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 20 matching lines...) Expand all Loading... |
76 OutputPicture(media::PictureBuffer p_b, OMX_BUFFERHEADERTYPE* o_b_h, | 76 OutputPicture(media::PictureBuffer p_b, OMX_BUFFERHEADERTYPE* o_b_h, |
77 EGLImageKHR e_i) | 77 EGLImageKHR e_i) |
78 : picture_buffer(p_b), omx_buffer_header(o_b_h), egl_image(e_i) {} | 78 : picture_buffer(p_b), omx_buffer_header(o_b_h), egl_image(e_i) {} |
79 media::PictureBuffer picture_buffer; | 79 media::PictureBuffer picture_buffer; |
80 OMX_BUFFERHEADERTYPE* omx_buffer_header; | 80 OMX_BUFFERHEADERTYPE* omx_buffer_header; |
81 EGLImageKHR egl_image; | 81 EGLImageKHR egl_image; |
82 }; | 82 }; |
83 typedef std::map<int32, OutputPicture> OutputPictureById; | 83 typedef std::map<int32, OutputPicture> OutputPictureById; |
84 | 84 |
85 // Verify that |config| is compatible with this class and hardware. | 85 // Verify that |config| is compatible with this class and hardware. |
86 bool VerifyConfigs(const std::vector<uint32>& configs); | 86 bool VerifyConfigs(const std::vector<int32>& configs); |
87 | 87 |
88 MessageLoop* message_loop_; | 88 MessageLoop* message_loop_; |
89 OMX_HANDLETYPE component_handle_; | 89 OMX_HANDLETYPE component_handle_; |
90 | 90 |
91 // Create the Component for OMX. Handles all OMX initialization. | 91 // Create the Component for OMX. Handles all OMX initialization. |
92 bool CreateComponent(); | 92 bool CreateComponent(); |
93 // Buffer allocation/free methods for input and output buffers. | 93 // Buffer allocation/free methods for input and output buffers. |
94 bool AllocateInputBuffers(); | 94 bool AllocateInputBuffers(); |
95 bool AllocateOutputBuffers(); | 95 bool AllocateOutputBuffers(); |
96 void FreeInputBuffers(); | 96 void FreeInputBuffers(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 OMX_PTR event_data); | 215 OMX_PTR event_data); |
216 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, | 216 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, |
217 OMX_PTR priv_data, | 217 OMX_PTR priv_data, |
218 OMX_BUFFERHEADERTYPE* buffer); | 218 OMX_BUFFERHEADERTYPE* buffer); |
219 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, | 219 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, |
220 OMX_PTR priv_data, | 220 OMX_PTR priv_data, |
221 OMX_BUFFERHEADERTYPE* buffer); | 221 OMX_BUFFERHEADERTYPE* buffer); |
222 }; | 222 }; |
223 | 223 |
224 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 224 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |