OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 virtual ~BackingStrategy() {} | 44 virtual ~BackingStrategy() {} |
45 | 45 |
46 // Called after the state provider is given, but before any other | 46 // Called after the state provider is given, but before any other |
47 // calls to the BackingStrategy. | 47 // calls to the BackingStrategy. |
48 virtual void Initialize(AVDAStateProvider* provider) = 0; | 48 virtual void Initialize(AVDAStateProvider* provider) = 0; |
49 | 49 |
50 // Called before the AVDA does any Destroy() work. This will be | 50 // Called before the AVDA does any Destroy() work. This will be |
51 // the last call that the BackingStrategy receives. | 51 // the last call that the BackingStrategy receives. |
52 virtual void Cleanup(const OutputBufferMap& buffer_map) = 0; | 52 virtual void Cleanup(const OutputBufferMap& buffer_map) = 0; |
53 | 53 |
54 // Return the number of picture buffers that we can support. | |
55 virtual uint32 GetNumPictureBuffers() const = 0; | |
56 | |
57 // Return the GL texture target that the PictureBuffer textures use. | 54 // Return the GL texture target that the PictureBuffer textures use. |
58 virtual uint32 GetTextureTarget() const = 0; | 55 virtual uint32 GetTextureTarget() const = 0; |
59 | 56 |
60 // Create and return a surface texture for the MediaCodec to use. | 57 // Create and return a surface texture for the MediaCodec to use. |
61 virtual scoped_refptr<gfx::SurfaceTexture> CreateSurfaceTexture() = 0; | 58 virtual scoped_refptr<gfx::SurfaceTexture> CreateSurfaceTexture() = 0; |
62 | 59 |
63 // Make the provided PictureBuffer draw the image that is represented by | 60 // Make the provided PictureBuffer draw the image that is represented by |
64 // the decoded output buffer at codec_buffer_index. | 61 // the decoded output buffer at codec_buffer_index. |
65 virtual void UseCodecBufferForPictureBuffer( | 62 virtual void UseCodecBufferForPictureBuffer( |
66 int32 codec_buffer_index, | 63 int32 codec_buffer_index, |
(...skipping 15 matching lines...) Expand all Loading... |
82 // happens when we're starting up or re-configuring mid-stream. Any | 79 // happens when we're starting up or re-configuring mid-stream. Any |
83 // previously provided codec should no longer be referenced. | 80 // previously provided codec should no longer be referenced. |
84 // For convenience, a container of PictureBuffers is provided in case | 81 // For convenience, a container of PictureBuffers is provided in case |
85 // per-image cleanup is needed. | 82 // per-image cleanup is needed. |
86 virtual void CodecChanged(media::VideoCodecBridge* codec, | 83 virtual void CodecChanged(media::VideoCodecBridge* codec, |
87 const OutputBufferMap& buffer_map) = 0; | 84 const OutputBufferMap& buffer_map) = 0; |
88 }; | 85 }; |
89 | 86 |
90 AndroidVideoDecodeAccelerator( | 87 AndroidVideoDecodeAccelerator( |
91 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, | 88 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, |
92 const base::Callback<bool(void)>& make_context_current, | 89 const base::Callback<bool(void)>& make_context_current); |
93 scoped_ptr<BackingStrategy> strategy); | |
94 | 90 |
95 ~AndroidVideoDecodeAccelerator() override; | 91 ~AndroidVideoDecodeAccelerator() override; |
96 | 92 |
97 // media::VideoDecodeAccelerator implementation: | 93 // media::VideoDecodeAccelerator implementation: |
98 bool Initialize(const Config& config, Client* client) override; | 94 bool Initialize(const Config& config, Client* client) override; |
99 void SetCdm(int cdm_id) override; | 95 void SetCdm(int cdm_id) override; |
100 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 96 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
101 void AssignPictureBuffers( | 97 void AssignPictureBuffers( |
102 const std::vector<media::PictureBuffer>& buffers) override; | 98 const std::vector<media::PictureBuffer>& buffers) override; |
103 void ReusePictureBuffer(int32 picture_buffer_id) override; | 99 void ReusePictureBuffer(int32 picture_buffer_id) override; |
104 void Flush() override; | 100 void Flush() override; |
105 void Reset() override; | 101 void Reset() override; |
106 void Destroy() override; | 102 void Destroy() override; |
107 bool CanDecodeOnIOThread() override; | 103 bool CanDecodeOnIOThread() override; |
108 | 104 |
109 // AVDAStateProvider implementation: | 105 // AVDAStateProvider implementation: |
110 const gfx::Size& GetSize() const override; | 106 const gfx::Size& GetSize() const override; |
111 const base::ThreadChecker& ThreadChecker() const override; | 107 const base::ThreadChecker& ThreadChecker() const override; |
112 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override; | 108 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override; |
113 void PostError(const ::tracked_objects::Location& from_here, | 109 void PostError(const ::tracked_objects::Location& from_here, |
114 media::VideoDecodeAccelerator::Error error) override; | 110 media::VideoDecodeAccelerator::Error error) override; |
115 | 111 |
116 static media::VideoDecodeAccelerator::SupportedProfiles | 112 static media::VideoDecodeAccelerator::Capabilities GetCapabilities(); |
117 GetSupportedProfiles(); | |
118 | 113 |
119 private: | 114 private: |
120 enum State { | 115 enum State { |
121 NO_ERROR, | 116 NO_ERROR, |
122 ERROR, | 117 ERROR, |
123 }; | 118 }; |
124 | 119 |
125 static const base::TimeDelta kDecodePollDelay; | 120 static const base::TimeDelta kDecodePollDelay; |
126 | 121 |
127 // Configures |media_codec_| with the given codec parameters from the client. | 122 // Configures |media_codec_| with the given codec parameters from the client. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 233 |
239 // WeakPtrFactory for posting tasks back to |this|. | 234 // WeakPtrFactory for posting tasks back to |this|. |
240 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 235 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
241 | 236 |
242 friend class AndroidVideoDecodeAcceleratorTest; | 237 friend class AndroidVideoDecodeAcceleratorTest; |
243 }; | 238 }; |
244 | 239 |
245 } // namespace content | 240 } // namespace content |
246 | 241 |
247 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 242 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |