| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ | 6 #define CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 namespace content { | 40 namespace content { |
| 41 | 41 |
| 42 class PepperVideoDecoderHost; | 42 class PepperVideoDecoderHost; |
| 43 | 43 |
| 44 // This class is a shim to wrap a media::VideoDecoder so that it can be used | 44 // This class is a shim to wrap a media::VideoDecoder so that it can be used |
| 45 // by PepperVideoDecoderHost in place of a media::VideoDecodeAccelerator. | 45 // by PepperVideoDecoderHost in place of a media::VideoDecodeAccelerator. |
| 46 // This class should be constructed, used, and destructed on the main (render) | 46 // This class should be constructed, used, and destructed on the main (render) |
| 47 // thread. | 47 // thread. |
| 48 class VideoDecoderShim : public media::VideoDecodeAccelerator { | 48 class VideoDecoderShim : public media::VideoDecodeAccelerator { |
| 49 public: | 49 public: |
| 50 explicit VideoDecoderShim(PepperVideoDecoderHost* host); | 50 VideoDecoderShim(PepperVideoDecoderHost* host, uint32_t texture_pool_size); |
| 51 ~VideoDecoderShim() override; | 51 ~VideoDecoderShim() override; |
| 52 | 52 |
| 53 // media::VideoDecodeAccelerator implementation. | 53 // media::VideoDecodeAccelerator implementation. |
| 54 bool Initialize(media::VideoCodecProfile profile, | 54 bool Initialize(media::VideoCodecProfile profile, |
| 55 media::VideoDecodeAccelerator::Client* client) override; | 55 media::VideoDecodeAccelerator::Client* client) override; |
| 56 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 56 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
| 57 void AssignPictureBuffers( | 57 void AssignPictureBuffers( |
| 58 const std::vector<media::PictureBuffer>& buffers) override; | 58 const std::vector<media::PictureBuffer>& buffers) override; |
| 59 void ReusePictureBuffer(int32 picture_buffer_id) override; | 59 void ReusePictureBuffer(int32 picture_buffer_id) override; |
| 60 void Flush() override; | 60 void Flush() override; |
| 61 void Reset() override; | 61 void Reset() override; |
| 62 void Destroy() override; | 62 void Destroy() override; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 enum State { | 65 enum State { |
| 66 UNINITIALIZED, | 66 UNINITIALIZED, |
| 67 DECODING, | 67 DECODING, |
| 68 FLUSHING, | 68 FLUSHING, |
| 69 RESETTING, | 69 RESETTING, |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 struct PendingDecode; | 72 struct PendingDecode; |
| 73 struct PendingFrame; | 73 struct PendingFrame; |
| 74 class DecoderImpl; | 74 class DecoderImpl; |
| 75 class YUVConverter; | 75 class YUVConverter; |
| 76 | 76 |
| 77 void OnInitializeComplete(int32_t result, uint32_t texture_pool_size); | 77 void OnInitializeComplete(int32_t result); |
| 78 void OnDecodeComplete(int32_t result, uint32_t decode_id); | 78 void OnDecodeComplete(int32_t result, uint32_t decode_id); |
| 79 void OnOutputComplete(scoped_ptr<PendingFrame> frame); | 79 void OnOutputComplete(scoped_ptr<PendingFrame> frame); |
| 80 void SendPictures(); | 80 void SendPictures(); |
| 81 void OnResetComplete(); | 81 void OnResetComplete(); |
| 82 void NotifyCompletedDecodes(); | 82 void NotifyCompletedDecodes(); |
| 83 void DismissTexture(uint32_t texture_id); | 83 void DismissTexture(uint32_t texture_id); |
| 84 void DeleteTexture(uint32_t texture_id); | 84 void DeleteTexture(uint32_t texture_id); |
| 85 // Call this whenever we change GL state that the plugin relies on, such as | 85 // Call this whenever we change GL state that the plugin relies on, such as |
| 86 // creating picture textures. | 86 // creating picture textures. |
| 87 void FlushCommandBuffer(); | 87 void FlushCommandBuffer(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 scoped_ptr<YUVConverter> yuv_converter_; | 122 scoped_ptr<YUVConverter> yuv_converter_; |
| 123 | 123 |
| 124 base::WeakPtrFactory<VideoDecoderShim> weak_ptr_factory_; | 124 base::WeakPtrFactory<VideoDecoderShim> weak_ptr_factory_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(VideoDecoderShim); | 126 DISALLOW_COPY_AND_ASSIGN(VideoDecoderShim); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace content | 129 } // namespace content |
| 130 | 130 |
| 131 #endif // CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ | 131 #endif // CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ |
| OLD | NEW |