| OLD | NEW | 
|    1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #ifndef CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |    5 #ifndef CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 
|    6 #define CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |    6 #define CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 
|    7  |    7  | 
|    8 #include <dlfcn.h> |    8 #include <dlfcn.h> | 
|    9 #include <map> |    9 #include <map> | 
|   10 #include <queue> |   10 #include <queue> | 
|   11 #include <set> |   11 #include <set> | 
|   12 #include <string> |   12 #include <string> | 
|   13 #include <utility> |   13 #include <utility> | 
|   14 #include <vector> |   14 #include <vector> | 
|   15  |   15  | 
|   16 #include "base/compiler_specific.h" |   16 #include "base/compiler_specific.h" | 
|   17 #include "base/logging.h" |   17 #include "base/logging.h" | 
|   18 #include "base/memory/ref_counted.h" |   18 #include "base/memory/ref_counted.h" | 
|   19 #include "base/message_loop.h" |   19 #include "base/message_loop.h" | 
|   20 #include "base/shared_memory.h" |   20 #include "base/shared_memory.h" | 
|   21 #include "media/video/video_decode_accelerator.h" |   21 #include "media/video/video_decode_accelerator.h" | 
|   22 #include "third_party/angle/include/EGL/egl.h" |   22 #include "third_party/angle/include/EGL/egl.h" | 
|   23 #include "third_party/angle/include/EGL/eglext.h" |   23 #include "third_party/angle/include/EGL/eglext.h" | 
|   24 #include "third_party/openmax/il/OMX_Component.h" |   24 #include "third_party/openmax/il/OMX_Component.h" | 
|   25 #include "third_party/openmax/il/OMX_Core.h" |   25 #include "third_party/openmax/il/OMX_Core.h" | 
|   26 #include "third_party/openmax/il/OMX_Video.h" |   26 #include "third_party/openmax/il/OMX_Video.h" | 
|   27  |   27  | 
 |   28 class Gles2TextureToEglImageTranslator; | 
 |   29  | 
|   28 // Class to wrap OpenMAX IL accelerator behind VideoDecodeAccelerator interface. |   30 // Class to wrap OpenMAX IL accelerator behind VideoDecodeAccelerator interface. | 
|   29 // The implementation assumes an OpenMAX IL 1.1.2 implementation conforming to |   31 // The implementation assumes an OpenMAX IL 1.1.2 implementation conforming to | 
|   30 // http://www.khronos.org/registry/omxil/specs/OpenMAX_IL_1_1_2_Specification.pd
     f |   32 // http://www.khronos.org/registry/omxil/specs/OpenMAX_IL_1_1_2_Specification.pd
     f | 
|   31 // |   33 // | 
|   32 // This class lives on a single thread and DCHECKs that it is never accessed |   34 // This class lives on a single thread and DCHECKs that it is never accessed | 
|   33 // from any other.  OMX callbacks are trampolined from the OMX component's |   35 // from any other.  OMX callbacks are trampolined from the OMX component's | 
|   34 // thread to maintain this invariant.  The only exception to thread-unsafety is |   36 // thread to maintain this invariant.  The only exception to thread-unsafety is | 
|   35 // that references can be added from any thread (practically used only by the |   37 // that references can be added from any thread (practically used only by the | 
|   36 // OMX thread). |   38 // OMX thread). | 
|   37 class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator { |   39 class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator { | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  141   // Following are input port related variables. |  143   // Following are input port related variables. | 
|  142   int input_buffer_count_; |  144   int input_buffer_count_; | 
|  143   int input_buffer_size_; |  145   int input_buffer_size_; | 
|  144   OMX_U32 input_port_; |  146   OMX_U32 input_port_; | 
|  145   int input_buffers_at_component_; |  147   int input_buffers_at_component_; | 
|  146  |  148  | 
|  147   // Following are output port related variables. |  149   // Following are output port related variables. | 
|  148   OMX_U32 output_port_; |  150   OMX_U32 output_port_; | 
|  149   int output_buffers_at_component_; |  151   int output_buffers_at_component_; | 
|  150  |  152  | 
 |  153   gfx::Size last_requested_picture_buffer_dimensions_; | 
 |  154  | 
|  151   // NOTE: someday there may be multiple contexts for a single decoder.  But not |  155   // NOTE: someday there may be multiple contexts for a single decoder.  But not | 
|  152   // today. |  156   // today. | 
|  153   // TODO(fischman,vrk): handle lost contexts? |  157   // TODO(fischman,vrk): handle lost contexts? | 
|  154   EGLDisplay egl_display_; |  158   EGLDisplay egl_display_; | 
|  155   EGLContext egl_context_; |  159   EGLContext egl_context_; | 
|  156  |  160  | 
|  157   // Free input OpenMAX buffers that can be used to take bitstream from demuxer. |  161   // Free input OpenMAX buffers that can be used to take bitstream from demuxer. | 
|  158   std::queue<OMX_BUFFERHEADERTYPE*> free_input_buffers_; |  162   std::queue<OMX_BUFFERHEADERTYPE*> free_input_buffers_; | 
|  159  |  163  | 
|  160   // For output buffer recycling cases. |  164   // For output buffer recycling cases. | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|  172   BitstreamBufferList queued_bitstream_buffers_; |  176   BitstreamBufferList queued_bitstream_buffers_; | 
|  173   // Available output picture buffers released during Reset() and awaiting |  177   // Available output picture buffers released during Reset() and awaiting | 
|  174   // re-use once Reset is done.  Is empty most of the time and drained right |  178   // re-use once Reset is done.  Is empty most of the time and drained right | 
|  175   // before NotifyResetDone is sent. |  179   // before NotifyResetDone is sent. | 
|  176   std::vector<int> queued_picture_buffer_ids_; |  180   std::vector<int> queued_picture_buffer_ids_; | 
|  177  |  181  | 
|  178   // To expose client callbacks from VideoDecodeAccelerator. |  182   // To expose client callbacks from VideoDecodeAccelerator. | 
|  179   // NOTE: all calls to this object *MUST* be executed in message_loop_. |  183   // NOTE: all calls to this object *MUST* be executed in message_loop_. | 
|  180   Client* client_; |  184   Client* client_; | 
|  181  |  185  | 
|  182   // These two members are only used during Initialization. |  186   scoped_ptr<Gles2TextureToEglImageTranslator> texture_to_egl_image_translator_; | 
 |  187  | 
 |  188   // These members are only used during Initialization. | 
|  183   // OMX_AVCProfile requested during Initialization. |  189   // OMX_AVCProfile requested during Initialization. | 
|  184   uint32 profile_; |  190   uint32 profile_; | 
|  185   bool component_name_is_nvidia_h264ext_; |  191   bool component_name_is_nvidia_h264ext_; | 
|  186  |  192  | 
|  187   // Method to handle events |  193   // Method to handle events | 
|  188   void EventHandlerCompleteTask(OMX_EVENTTYPE event, |  194   void EventHandlerCompleteTask(OMX_EVENTTYPE event, | 
|  189                                 OMX_U32 data1, |  195                                 OMX_U32 data1, | 
|  190                                 OMX_U32 data2); |  196                                 OMX_U32 data2); | 
|  191  |  197  | 
|  192   // Method to receive buffers from component's input port |  198   // Method to receive buffers from component's input port | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
|  209                                     OMX_PTR event_data); |  215                                     OMX_PTR event_data); | 
|  210   static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, |  216   static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, | 
|  211                                            OMX_PTR priv_data, |  217                                            OMX_PTR priv_data, | 
|  212                                            OMX_BUFFERHEADERTYPE* buffer); |  218                                            OMX_BUFFERHEADERTYPE* buffer); | 
|  213   static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, |  219   static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, | 
|  214                                           OMX_PTR priv_data, |  220                                           OMX_PTR priv_data, | 
|  215                                           OMX_BUFFERHEADERTYPE* buffer); |  221                                           OMX_BUFFERHEADERTYPE* buffer); | 
|  216 }; |  222 }; | 
|  217  |  223  | 
|  218 #endif  // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |  224 #endif  // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 
| OLD | NEW |