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(media::VideoDecodeAccelerator::Client* client); | 41 OmxVideoDecodeAccelerator(EGLDisplay egl_display, EGLContext egl_context, |
| 42 media::VideoDecodeAccelerator::Client* client); |
42 virtual ~OmxVideoDecodeAccelerator(); | 43 virtual ~OmxVideoDecodeAccelerator(); |
43 | 44 |
44 // media::VideoDecodeAccelerator implementation. | 45 // media::VideoDecodeAccelerator implementation. |
45 bool Initialize(media::VideoCodecProfile profile) OVERRIDE; | 46 bool Initialize(media::VideoCodecProfile profile) OVERRIDE; |
46 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 47 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
47 virtual void AssignPictureBuffers( | 48 virtual void AssignPictureBuffers( |
48 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 49 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
49 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 50 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
50 void Flush() OVERRIDE; | 51 void Flush() OVERRIDE; |
51 void Reset() OVERRIDE; | 52 void Reset() OVERRIDE; |
52 void Destroy() OVERRIDE; | 53 void Destroy() OVERRIDE; |
53 | 54 |
54 void SetEglState(EGLDisplay egl_display, EGLContext egl_context); | |
55 | |
56 base::WeakPtr<OmxVideoDecodeAccelerator> weak_this() { return weak_this_; } | 55 base::WeakPtr<OmxVideoDecodeAccelerator> weak_this() { return weak_this_; } |
57 | 56 |
58 private: | 57 private: |
59 // Because OMX state-transitions are described solely by the "state reached" | 58 // Because OMX state-transitions are described solely by the "state reached" |
60 // (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 |
61 // 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 |
62 // |*this| is in any state other than NO_TRANSITION, unless requesting | 61 // |*this| is in any state other than NO_TRANSITION, unless requesting |
63 // DESTROYING or ERRORING. | 62 // DESTROYING or ERRORING. |
64 enum CurrentStateChange { | 63 enum CurrentStateChange { |
65 NO_TRANSITION, // Not in the middle of a transition. | 64 NO_TRANSITION, // Not in the middle of a transition. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 OMX_PTR event_data); | 232 OMX_PTR event_data); |
234 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, | 233 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, |
235 OMX_PTR priv_data, | 234 OMX_PTR priv_data, |
236 OMX_BUFFERHEADERTYPE* buffer); | 235 OMX_BUFFERHEADERTYPE* buffer); |
237 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, | 236 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, |
238 OMX_PTR priv_data, | 237 OMX_PTR priv_data, |
239 OMX_BUFFERHEADERTYPE* buffer); | 238 OMX_BUFFERHEADERTYPE* buffer); |
240 }; | 239 }; |
241 | 240 |
242 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 241 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |