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 24 matching lines...) Expand all Loading... |
35 // 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 |
36 // 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 |
37 // 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 |
38 // OMX thread). | 38 // OMX thread). |
39 class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator { | 39 class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator { |
40 public: | 40 public: |
41 // Does not take ownership of |client| which must outlive |*this|. | 41 // Does not take ownership of |client| which must outlive |*this|. |
42 OmxVideoDecodeAccelerator(media::VideoDecodeAccelerator::Client* client); | 42 OmxVideoDecodeAccelerator(media::VideoDecodeAccelerator::Client* client); |
43 | 43 |
44 // media::VideoDecodeAccelerator implementation. | 44 // media::VideoDecodeAccelerator implementation. |
45 bool Initialize(const std::vector<uint32>& config) OVERRIDE; | 45 bool Initialize(const std::vector<int32>& config) OVERRIDE; |
46 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 46 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
47 virtual void AssignPictureBuffers( | 47 virtual void AssignPictureBuffers( |
48 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 48 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
49 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 49 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
50 void Flush() OVERRIDE; | 50 void Flush() OVERRIDE; |
51 void Reset() OVERRIDE; | 51 void Reset() OVERRIDE; |
52 void Destroy() OVERRIDE; | 52 void Destroy() OVERRIDE; |
53 | 53 |
54 void SetEglState(EGLDisplay egl_display, EGLContext egl_context); | 54 void SetEglState(EGLDisplay egl_display, EGLContext egl_context); |
55 | 55 |
(...skipping 19 matching lines...) Expand all Loading... |
75 OutputPicture(media::PictureBuffer p_b, OMX_BUFFERHEADERTYPE* o_b_h, | 75 OutputPicture(media::PictureBuffer p_b, OMX_BUFFERHEADERTYPE* o_b_h, |
76 EGLImageKHR e_i) | 76 EGLImageKHR e_i) |
77 : picture_buffer(p_b), omx_buffer_header(o_b_h), egl_image(e_i) {} | 77 : picture_buffer(p_b), omx_buffer_header(o_b_h), egl_image(e_i) {} |
78 media::PictureBuffer picture_buffer; | 78 media::PictureBuffer picture_buffer; |
79 OMX_BUFFERHEADERTYPE* omx_buffer_header; | 79 OMX_BUFFERHEADERTYPE* omx_buffer_header; |
80 EGLImageKHR egl_image; | 80 EGLImageKHR egl_image; |
81 }; | 81 }; |
82 typedef std::map<int32, OutputPicture> OutputPictureById; | 82 typedef std::map<int32, OutputPicture> OutputPictureById; |
83 | 83 |
84 // Verify that |config| is compatible with this class and hardware. | 84 // Verify that |config| is compatible with this class and hardware. |
85 bool VerifyConfigs(const std::vector<uint32>& configs); | 85 bool VerifyConfigs(const std::vector<int32>& configs); |
86 | 86 |
87 MessageLoop* message_loop_; | 87 MessageLoop* message_loop_; |
88 OMX_HANDLETYPE component_handle_; | 88 OMX_HANDLETYPE component_handle_; |
89 | 89 |
90 // Create the Component for OMX. Handles all OMX initialization. | 90 // Create the Component for OMX. Handles all OMX initialization. |
91 bool CreateComponent(); | 91 bool CreateComponent(); |
92 // Buffer allocation/free methods for input and output buffers. | 92 // Buffer allocation/free methods for input and output buffers. |
93 bool AllocateInputBuffers(); | 93 bool AllocateInputBuffers(); |
94 bool AllocateOutputBuffers(); | 94 bool AllocateOutputBuffers(); |
95 void FreeInputBuffers(); | 95 void FreeInputBuffers(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 OMX_PTR event_data); | 214 OMX_PTR event_data); |
215 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, | 215 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, |
216 OMX_PTR priv_data, | 216 OMX_PTR priv_data, |
217 OMX_BUFFERHEADERTYPE* buffer); | 217 OMX_BUFFERHEADERTYPE* buffer); |
218 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, | 218 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, |
219 OMX_PTR priv_data, | 219 OMX_PTR priv_data, |
220 OMX_BUFFERHEADERTYPE* buffer); | 220 OMX_BUFFERHEADERTYPE* buffer); |
221 }; | 221 }; |
222 | 222 |
223 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 223 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |