| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // Called before the AVDA does any Destroy() work. This will be | 48 // Called before the AVDA does any Destroy() work. This will be |
| 49 // the last call that the BackingStrategy receives. | 49 // the last call that the BackingStrategy receives. |
| 50 virtual void Cleanup() = 0; | 50 virtual void Cleanup() = 0; |
| 51 | 51 |
| 52 // Return the number of picture buffers that we can support. | 52 // Return the number of picture buffers that we can support. |
| 53 virtual uint32 GetNumPictureBuffers() const = 0; | 53 virtual uint32 GetNumPictureBuffers() const = 0; |
| 54 | 54 |
| 55 // Return the GL texture target that the PictureBuffer textures use. | 55 // Return the GL texture target that the PictureBuffer textures use. |
| 56 virtual uint32 GetTextureTarget() const = 0; | 56 virtual uint32 GetTextureTarget() const = 0; |
| 57 | 57 |
| 58 // Use the provided PictureBuffer to hold the current surface. | 58 // Create and return a surface texture for the MediaCodec to use. |
| 59 virtual void AssignCurrentSurfaceToPictureBuffer( | 59 virtual scoped_refptr<gfx::SurfaceTexture> CreateSurfaceTexture() = 0; |
| 60 |
| 61 // Make the provided PictureBuffer draw the image that is represented by |
| 62 // the decoded output buffer at codec_buffer_index. |
| 63 virtual void UseCodecBufferForPictureBuffer( |
| 60 int32 codec_buffer_index, | 64 int32 codec_buffer_index, |
| 61 const media::PictureBuffer&) = 0; | 65 const media::PictureBuffer&) = 0; |
| 62 }; | 66 }; |
| 63 | 67 |
| 64 AndroidVideoDecodeAccelerator( | 68 AndroidVideoDecodeAccelerator( |
| 65 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, | 69 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, |
| 66 const base::Callback<bool(void)>& make_context_current, | 70 const base::Callback<bool(void)>& make_context_current, |
| 67 scoped_ptr<BackingStrategy> strategy); | 71 scoped_ptr<BackingStrategy> strategy); |
| 68 | 72 |
| 69 ~AndroidVideoDecodeAccelerator() override; | 73 ~AndroidVideoDecodeAccelerator() override; |
| 70 | 74 |
| 71 // Does not take ownership of |client| which must outlive |*this|. | 75 // Does not take ownership of |client| which must outlive |*this|. |
| 72 bool Initialize(media::VideoCodecProfile profile, Client* client) override; | 76 bool Initialize(media::VideoCodecProfile profile, Client* client) override; |
| 73 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 77 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
| 74 void AssignPictureBuffers( | 78 void AssignPictureBuffers( |
| 75 const std::vector<media::PictureBuffer>& buffers) override; | 79 const std::vector<media::PictureBuffer>& buffers) override; |
| 76 void ReusePictureBuffer(int32 picture_buffer_id) override; | 80 void ReusePictureBuffer(int32 picture_buffer_id) override; |
| 77 void Flush() override; | 81 void Flush() override; |
| 78 void Reset() override; | 82 void Reset() override; |
| 79 void Destroy() override; | 83 void Destroy() override; |
| 80 bool CanDecodeOnIOThread() override; | 84 bool CanDecodeOnIOThread() override; |
| 81 | 85 |
| 82 // AndroidVideoDecodeStateProvider | 86 // AndroidVideoDecodeStateProvider |
| 83 const gfx::Size& GetSize() const override; | 87 const gfx::Size& GetSize() const override; |
| 84 const base::ThreadChecker& ThreadChecker() const override; | 88 const base::ThreadChecker& ThreadChecker() const override; |
| 85 gfx::SurfaceTexture* GetSurfaceTexture() const override; | |
| 86 uint32 GetSurfaceTextureId() const override; | |
| 87 gpu::gles2::GLES2Decoder* GetGlDecoder() const override; | 89 gpu::gles2::GLES2Decoder* GetGlDecoder() const override; |
| 88 media::VideoCodecBridge* GetMediaCodec() override; | 90 media::VideoCodecBridge* GetMediaCodec() override; |
| 89 void PostError(const ::tracked_objects::Location& from_here, | 91 void PostError(const ::tracked_objects::Location& from_here, |
| 90 media::VideoDecodeAccelerator::Error error) override; | 92 media::VideoDecodeAccelerator::Error error) override; |
| 91 | 93 |
| 92 static media::VideoDecodeAccelerator::SupportedProfiles | 94 static media::VideoDecodeAccelerator::SupportedProfiles |
| 93 GetSupportedProfiles(); | 95 GetSupportedProfiles(); |
| 94 | 96 |
| 95 private: | 97 private: |
| 96 enum State { | 98 enum State { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // to ignore ReusePictureBuffer calls that were in flight when the | 169 // to ignore ReusePictureBuffer calls that were in flight when the |
| 168 // DismissPictureBuffer call was made. | 170 // DismissPictureBuffer call was made. |
| 169 std::set<int32> dismissed_picture_ids_; | 171 std::set<int32> dismissed_picture_ids_; |
| 170 | 172 |
| 171 // The low-level decoder which Android SDK provides. | 173 // The low-level decoder which Android SDK provides. |
| 172 scoped_ptr<media::VideoCodecBridge> media_codec_; | 174 scoped_ptr<media::VideoCodecBridge> media_codec_; |
| 173 | 175 |
| 174 // A container of texture. Used to set a texture to |media_codec_|. | 176 // A container of texture. Used to set a texture to |media_codec_|. |
| 175 scoped_refptr<gfx::SurfaceTexture> surface_texture_; | 177 scoped_refptr<gfx::SurfaceTexture> surface_texture_; |
| 176 | 178 |
| 177 // The texture id which is set to |surface_texture_|. | |
| 178 uint32 surface_texture_id_; | |
| 179 | |
| 180 // Set to true after requesting picture buffers to the client. | 179 // Set to true after requesting picture buffers to the client. |
| 181 bool picturebuffers_requested_; | 180 bool picturebuffers_requested_; |
| 182 | 181 |
| 183 // The resolution of the stream. | 182 // The resolution of the stream. |
| 184 gfx::Size size_; | 183 gfx::Size size_; |
| 185 | 184 |
| 186 // Encoded bitstream buffers to be passed to media codec, queued until an | 185 // Encoded bitstream buffers to be passed to media codec, queued until an |
| 187 // input buffer is available, along with the time when they were first | 186 // input buffer is available, along with the time when they were first |
| 188 // enqueued. | 187 // enqueued. |
| 189 typedef std::queue<std::pair<media::BitstreamBuffer, base::Time> > | 188 typedef std::queue<std::pair<media::BitstreamBuffer, base::Time> > |
| (...skipping 21 matching lines...) Expand all Loading... |
| 211 | 210 |
| 212 // WeakPtrFactory for posting tasks back to |this|. | 211 // WeakPtrFactory for posting tasks back to |this|. |
| 213 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 212 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| 214 | 213 |
| 215 friend class AndroidVideoDecodeAcceleratorTest; | 214 friend class AndroidVideoDecodeAcceleratorTest; |
| 216 }; | 215 }; |
| 217 | 216 |
| 218 } // namespace content | 217 } // namespace content |
| 219 | 218 |
| 220 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 219 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |