OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 20 matching lines...) Expand all Loading... |
31 // 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 |
32 // 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 |
33 // | 33 // |
34 // This class lives on a single thread (the GPU process ChildThread) and DCHECKs | 34 // This class lives on a single thread (the GPU process ChildThread) and DCHECKs |
35 // that it is never accessed from any other. OMX callbacks are trampolined from | 35 // that it is never accessed from any other. OMX callbacks are trampolined from |
36 // the OMX component's thread to maintain this invariant, using |weak_this()|. | 36 // the OMX component's thread to maintain this invariant, using |weak_this()|. |
37 class CONTENT_EXPORT OmxVideoDecodeAccelerator : | 37 class CONTENT_EXPORT OmxVideoDecodeAccelerator : |
38 public media::VideoDecodeAccelerator { | 38 public media::VideoDecodeAccelerator { |
39 public: | 39 public: |
40 // Does not take ownership of |client| which must outlive |*this|. | 40 // Does not take ownership of |client| which must outlive |*this|. |
41 OmxVideoDecodeAccelerator(EGLDisplay egl_display, EGLContext egl_context, | 41 OmxVideoDecodeAccelerator( |
42 media::VideoDecodeAccelerator::Client* client); | 42 EGLDisplay egl_display, EGLContext egl_context, |
| 43 media::VideoDecodeAccelerator::Client* client, |
| 44 const base::Callback<bool(void)>& make_context_current); |
43 virtual ~OmxVideoDecodeAccelerator(); | 45 virtual ~OmxVideoDecodeAccelerator(); |
44 | 46 |
45 // media::VideoDecodeAccelerator implementation. | 47 // media::VideoDecodeAccelerator implementation. |
46 bool Initialize(media::VideoCodecProfile profile) OVERRIDE; | 48 bool Initialize(media::VideoCodecProfile profile) OVERRIDE; |
47 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 49 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
48 virtual void AssignPictureBuffers( | 50 virtual void AssignPictureBuffers( |
49 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 51 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
50 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 52 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
51 void Flush() OVERRIDE; | 53 void Flush() OVERRIDE; |
52 void Reset() OVERRIDE; | 54 void Reset() OVERRIDE; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 OMX_U32 output_port_; | 176 OMX_U32 output_port_; |
175 int output_buffers_at_component_; | 177 int output_buffers_at_component_; |
176 | 178 |
177 gfx::Size last_requested_picture_buffer_dimensions_; | 179 gfx::Size last_requested_picture_buffer_dimensions_; |
178 | 180 |
179 // NOTE: someday there may be multiple contexts for a single decoder. But not | 181 // NOTE: someday there may be multiple contexts for a single decoder. But not |
180 // today. | 182 // today. |
181 // TODO(fischman,vrk): handle lost contexts? | 183 // TODO(fischman,vrk): handle lost contexts? |
182 EGLDisplay egl_display_; | 184 EGLDisplay egl_display_; |
183 EGLContext egl_context_; | 185 EGLContext egl_context_; |
| 186 base::Callback<bool(void)> make_context_current_; |
184 | 187 |
185 // Free input OpenMAX buffers that can be used to take bitstream from demuxer. | 188 // Free input OpenMAX buffers that can be used to take bitstream from demuxer. |
186 std::queue<OMX_BUFFERHEADERTYPE*> free_input_buffers_; | 189 std::queue<OMX_BUFFERHEADERTYPE*> free_input_buffers_; |
187 | 190 |
188 // For output buffer recycling cases. | 191 // For output buffer recycling cases. |
189 OutputPictureById pictures_; | 192 OutputPictureById pictures_; |
190 | 193 |
191 // To kick the component from Loaded to Idle before we know the real size of | 194 // To kick the component from Loaded to Idle before we know the real size of |
192 // the video (so can't yet ask for textures) we populate it with fake output | 195 // the video (so can't yet ask for textures) we populate it with fake output |
193 // buffers. Keep track of them here. | 196 // buffers. Keep track of them here. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 OMX_PTR event_data); | 245 OMX_PTR event_data); |
243 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, | 246 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, |
244 OMX_PTR priv_data, | 247 OMX_PTR priv_data, |
245 OMX_BUFFERHEADERTYPE* buffer); | 248 OMX_BUFFERHEADERTYPE* buffer); |
246 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, | 249 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, |
247 OMX_PTR priv_data, | 250 OMX_PTR priv_data, |
248 OMX_BUFFERHEADERTYPE* buffer); | 251 OMX_BUFFERHEADERTYPE* buffer); |
249 }; | 252 }; |
250 | 253 |
251 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 254 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |