| 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_RENDERER_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "media/video/video_decode_accelerator.h" | 12 #include "media/video/video_decode_accelerator.h" |
| 13 #include "webkit/plugins/ppapi/plugin_delegate.h" | 13 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 14 | 14 |
| 15 class GpuChannelHost; | 15 class GpuChannelHost; |
| 16 namespace gpu { | 16 namespace gpu { |
| 17 class CommandBufferHelper; | 17 class CommandBufferHelper; |
| 18 } | 18 } |
| 19 | 19 |
| 20 class PlatformVideoDecoderImpl | 20 class PlatformVideoDecoderImpl |
| 21 : public webkit::ppapi::PluginDelegate::PlatformVideoDecoder, | 21 : public webkit::ppapi::PluginDelegate::PlatformVideoDecoder, |
| 22 public media::VideoDecodeAccelerator::Client { | 22 public media::VideoDecodeAccelerator::Client { |
| 23 public: | 23 public: |
| 24 PlatformVideoDecoderImpl( | 24 PlatformVideoDecoderImpl( |
| 25 media::VideoDecodeAccelerator::Client* client, | 25 media::VideoDecodeAccelerator::Client* client, |
| 26 int32 command_buffer_route_id, | 26 int32 command_buffer_route_id, |
| 27 gpu::CommandBufferHelper* cmd_buffer_helper); | 27 gpu::CommandBufferHelper* cmd_buffer_helper); |
| 28 virtual ~PlatformVideoDecoderImpl(); | |
| 29 | 28 |
| 30 // PlatformVideoDecoder implementation. | 29 // PlatformVideoDecoder (a.k.a. VideoDecodeAccelerator) implementation. |
| 31 virtual bool Initialize(const std::vector<uint32>& configs) OVERRIDE; | 30 virtual bool Initialize(const std::vector<uint32>& configs) OVERRIDE; |
| 32 virtual void Decode( | 31 virtual void Decode( |
| 33 const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 32 const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
| 34 virtual void AssignGLESBuffers( | 33 virtual void AssignGLESBuffers( |
| 35 const std::vector<media::GLESBuffer>& buffers) OVERRIDE; | 34 const std::vector<media::GLESBuffer>& buffers) OVERRIDE; |
| 36 virtual void ReusePictureBuffer(int32 picture_buffer_id); | 35 virtual void ReusePictureBuffer(int32 picture_buffer_id); |
| 37 virtual void Flush() OVERRIDE; | 36 virtual void Flush() OVERRIDE; |
| 38 virtual void Reset() OVERRIDE; | 37 virtual void Reset() OVERRIDE; |
| 39 virtual void Destroy() OVERRIDE; | 38 virtual void Destroy() OVERRIDE; |
| 40 | 39 |
| 41 // VideoDecodeAccelerator::Client implementation. | 40 // VideoDecodeAccelerator::Client implementation. |
| 42 virtual void ProvidePictureBuffers( | 41 virtual void ProvidePictureBuffers( |
| 43 uint32 requested_num_of_buffers, | 42 uint32 requested_num_of_buffers, |
| 44 const gfx::Size& dimensions, | 43 const gfx::Size& dimensions, |
| 45 media::VideoDecodeAccelerator::MemoryType type) OVERRIDE; | 44 media::VideoDecodeAccelerator::MemoryType type) OVERRIDE; |
| 46 virtual void PictureReady(const media::Picture& picture) OVERRIDE; | 45 virtual void PictureReady(const media::Picture& picture) OVERRIDE; |
| 47 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; | 46 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; |
| 48 virtual void NotifyInitializeDone() OVERRIDE; | 47 virtual void NotifyInitializeDone() OVERRIDE; |
| 49 virtual void NotifyEndOfStream() OVERRIDE; | 48 virtual void NotifyEndOfStream() OVERRIDE; |
| 50 virtual void NotifyError( | 49 virtual void NotifyError( |
| 51 media::VideoDecodeAccelerator::Error error) OVERRIDE; | 50 media::VideoDecodeAccelerator::Error error) OVERRIDE; |
| 52 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; | 51 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; |
| 53 virtual void NotifyFlushDone() OVERRIDE; | 52 virtual void NotifyFlushDone() OVERRIDE; |
| 54 virtual void NotifyResetDone() OVERRIDE; | 53 virtual void NotifyResetDone() OVERRIDE; |
| 55 virtual void NotifyDestroyDone() OVERRIDE; | |
| 56 | 54 |
| 57 private: | 55 private: |
| 56 virtual ~PlatformVideoDecoderImpl(); |
| 57 |
| 58 // Client lifetime must exceed lifetime of this class. | 58 // Client lifetime must exceed lifetime of this class. |
| 59 // TODO(vrk/fischman): We should take another look at the overall | 59 // TODO(vrk/fischman): We should take another look at the overall |
| 60 // arcitecture of PPAPI Video Decode to make sure lifetime/ownership makes | 60 // arcitecture of PPAPI Video Decode to make sure lifetime/ownership makes |
| 61 // sense, including lifetime of this client. | 61 // sense, including lifetime of this client. |
| 62 media::VideoDecodeAccelerator::Client* client_; | 62 media::VideoDecodeAccelerator::Client* client_; |
| 63 | 63 |
| 64 // Route ID for the command buffer associated with video decoder's context. | 64 // Route ID for the command buffer associated with video decoder's context. |
| 65 int32 command_buffer_route_id_; | 65 int32 command_buffer_route_id_; |
| 66 | 66 |
| 67 // Helper for the command buffer associated with video decoder's context. | 67 // Helper for the command buffer associated with video decoder's context. |
| 68 gpu::CommandBufferHelper* cmd_buffer_helper_; | 68 gpu::CommandBufferHelper* cmd_buffer_helper_; |
| 69 | 69 |
| 70 // Host for GpuVideoDecodeAccelerator. | 70 // Holds a GpuVideoDecodeAcceleratorHost. |
| 71 // This is owned by the CommandBufferProxy associated with | 71 scoped_refptr<media::VideoDecodeAccelerator> decoder_; |
| 72 // |command_buffer_route_id|. | |
| 73 media::VideoDecodeAccelerator* decoder_; | |
| 74 | 72 |
| 75 DISALLOW_COPY_AND_ASSIGN(PlatformVideoDecoderImpl); | 73 DISALLOW_COPY_AND_ASSIGN(PlatformVideoDecoderImpl); |
| 76 }; | 74 }; |
| 77 #endif // CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_ | 75 #endif // CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_ |
| OLD | NEW |