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> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // media::VideoDecodeAccelerator implementation. | 42 // media::VideoDecodeAccelerator implementation. |
43 bool Initialize(Profile profile) OVERRIDE; | 43 bool Initialize(Profile profile) OVERRIDE; |
44 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 44 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
45 virtual void AssignPictureBuffers( | 45 virtual void AssignPictureBuffers( |
46 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 46 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
47 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 47 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
48 void Flush() OVERRIDE; | 48 void Flush() OVERRIDE; |
49 void Reset() OVERRIDE; | 49 void Reset() OVERRIDE; |
50 void Destroy() OVERRIDE; | 50 void Destroy() OVERRIDE; |
51 | 51 |
52 void SetEglState(EGLDisplay egl_display, EGLContext egl_context); | 52 void SetEglState(Display* x_display, EGLDisplay egl_display, |
| 53 EGLContext egl_context, EGLSurface egl_surface); |
53 | 54 |
54 private: | 55 private: |
55 virtual ~OmxVideoDecodeAccelerator(); | 56 virtual ~OmxVideoDecodeAccelerator(); |
56 | 57 |
57 // Because OMX state-transitions are described solely by the "state reached" | 58 // Because OMX state-transitions are described solely by the "state reached" |
58 // (3.1.2.9.1, table 3-7 of the spec), we track what transition was requested | 59 // (3.1.2.9.1, table 3-7 of the spec), we track what transition was requested |
59 // using this enum. Note that it is an error to request a transition while | 60 // using this enum. Note that it is an error to request a transition while |
60 // |*this| is in any state other than NO_TRANSITION, unless requesting | 61 // |*this| is in any state other than NO_TRANSITION, unless requesting |
61 // DESTROYING or ERRORING. | 62 // DESTROYING or ERRORING. |
62 enum CurrentStateChange { | 63 enum CurrentStateChange { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 OMX_U32 input_port_; | 145 OMX_U32 input_port_; |
145 int input_buffers_at_component_; | 146 int input_buffers_at_component_; |
146 | 147 |
147 // Following are output port related variables. | 148 // Following are output port related variables. |
148 OMX_U32 output_port_; | 149 OMX_U32 output_port_; |
149 int output_buffers_at_component_; | 150 int output_buffers_at_component_; |
150 | 151 |
151 // NOTE: someday there may be multiple contexts for a single decoder. But not | 152 // NOTE: someday there may be multiple contexts for a single decoder. But not |
152 // today. | 153 // today. |
153 // TODO(fischman,vrk): handle lost contexts? | 154 // TODO(fischman,vrk): handle lost contexts? |
| 155 Display* x_display_; |
154 EGLDisplay egl_display_; | 156 EGLDisplay egl_display_; |
155 EGLContext egl_context_; | 157 EGLContext egl_context_; |
| 158 EGLSurface egl_surface_; |
156 | 159 |
157 // Free input OpenMAX buffers that can be used to take bitstream from demuxer. | 160 // Free input OpenMAX buffers that can be used to take bitstream from demuxer. |
158 std::queue<OMX_BUFFERHEADERTYPE*> free_input_buffers_; | 161 std::queue<OMX_BUFFERHEADERTYPE*> free_input_buffers_; |
159 | 162 |
160 // For output buffer recycling cases. | 163 // For output buffer recycling cases. |
161 OutputPictureById pictures_; | 164 OutputPictureById pictures_; |
162 | 165 |
163 // To kick the component from Loaded to Idle before we know the real size of | 166 // To kick the component from Loaded to Idle before we know the real size of |
164 // the video (so can't yet ask for textures) we populate it with fake output | 167 // the video (so can't yet ask for textures) we populate it with fake output |
165 // buffers. Keep track of them here. | 168 // buffers. Keep track of them here. |
(...skipping 10 matching lines...) Expand all Loading... |
176 std::vector<int> queued_picture_buffer_ids_; | 179 std::vector<int> queued_picture_buffer_ids_; |
177 | 180 |
178 // To expose client callbacks from VideoDecodeAccelerator. | 181 // To expose client callbacks from VideoDecodeAccelerator. |
179 // NOTE: all calls to this object *MUST* be executed in message_loop_. | 182 // NOTE: all calls to this object *MUST* be executed in message_loop_. |
180 Client* client_; | 183 Client* client_; |
181 | 184 |
182 // These two members are only used during Initialization. | 185 // These two members are only used during Initialization. |
183 // OMX_AVCProfile requested during Initialization. | 186 // OMX_AVCProfile requested during Initialization. |
184 uint32 profile_; | 187 uint32 profile_; |
185 bool component_name_is_nvidia_h264ext_; | 188 bool component_name_is_nvidia_h264ext_; |
| 189 bool component_name_is_sec_h264ext_; |
186 | 190 |
187 // Method to handle events | 191 // Method to handle events |
188 void EventHandlerCompleteTask(OMX_EVENTTYPE event, | 192 void EventHandlerCompleteTask(OMX_EVENTTYPE event, |
189 OMX_U32 data1, | 193 OMX_U32 data1, |
190 OMX_U32 data2); | 194 OMX_U32 data2); |
191 | 195 |
192 // Method to receive buffers from component's input port | 196 // Method to receive buffers from component's input port |
193 void EmptyBufferDoneTask(OMX_BUFFERHEADERTYPE* buffer); | 197 void EmptyBufferDoneTask(OMX_BUFFERHEADERTYPE* buffer); |
194 | 198 |
195 // Method to receive buffers from component's output port | 199 // Method to receive buffers from component's output port |
(...skipping 13 matching lines...) Expand all Loading... |
209 OMX_PTR event_data); | 213 OMX_PTR event_data); |
210 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, | 214 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, |
211 OMX_PTR priv_data, | 215 OMX_PTR priv_data, |
212 OMX_BUFFERHEADERTYPE* buffer); | 216 OMX_BUFFERHEADERTYPE* buffer); |
213 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, | 217 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, |
214 OMX_PTR priv_data, | 218 OMX_PTR priv_data, |
215 OMX_BUFFERHEADERTYPE* buffer); | 219 OMX_BUFFERHEADERTYPE* buffer); |
216 }; | 220 }; |
217 | 221 |
218 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 222 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |