| 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 WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_callback_factory.h" | 12 #include "base/memory/scoped_callback_factory.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "ppapi/c/dev/pp_video_dev.h" |
| 14 #include "ppapi/c/pp_var.h" | 15 #include "ppapi/c/pp_var.h" |
| 15 #include "webkit/plugins/ppapi/plugin_delegate.h" | 16 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 16 #include "webkit/plugins/ppapi/resource.h" | 17 #include "webkit/plugins/ppapi/resource.h" |
| 17 | 18 |
| 18 union PP_PictureData_Dev; | |
| 19 struct PP_VideoDecoderConfig_Dev; | |
| 20 struct PP_VideoBitstreamBuffer_Dev; | |
| 21 struct PPB_VideoDecoder_Dev; | 19 struct PPB_VideoDecoder_Dev; |
| 20 struct PPP_VideoDecoder_Dev; |
| 22 | 21 |
| 23 namespace webkit { | 22 namespace webkit { |
| 24 namespace ppapi { | 23 namespace ppapi { |
| 25 | 24 |
| 26 class PluginInstance; | 25 class PluginInstance; |
| 27 | 26 |
| 28 class PPB_VideoDecoder_Impl : public Resource, | 27 class PPB_VideoDecoder_Impl : public Resource, |
| 29 public media::VideoDecodeAccelerator::Client { | 28 public media::VideoDecodeAccelerator::Client { |
| 30 public: | 29 public: |
| 31 explicit PPB_VideoDecoder_Impl(PluginInstance* instance); | 30 explicit PPB_VideoDecoder_Impl(PluginInstance* instance); |
| 32 virtual ~PPB_VideoDecoder_Impl(); | 31 virtual ~PPB_VideoDecoder_Impl(); |
| 33 | 32 |
| 34 // Returns a pointer to the interface implementing PPB_VideoDecoder that is | 33 // Returns a pointer to the interface implementing PPB_VideoDecoder that is |
| 35 // exposed to the plugin. | 34 // exposed to the plugin. |
| 36 static const PPB_VideoDecoder_Dev* GetInterface(); | 35 static const PPB_VideoDecoder_Dev* GetInterface(); |
| 37 | 36 |
| 38 // Resource overrides. | 37 // Resource overrides. |
| 39 virtual PPB_VideoDecoder_Impl* AsPPB_VideoDecoder_Impl(); | 38 virtual PPB_VideoDecoder_Impl* AsPPB_VideoDecoder_Impl(); |
| 40 | 39 |
| 41 // PPB_VideoDecoder implementation. | 40 // PPB_VideoDecoder implementation. |
| 42 bool GetConfigs(PP_VideoDecoderConfig_Dev* proto_config, | 41 bool GetConfigs(PP_VideoConfigElement* requested_configs, |
| 43 PP_VideoDecoderConfig_Dev* matching_configs, | 42 PP_VideoConfigElement* matching_configs, |
| 44 int32_t matching_configs_size, | 43 uint32_t matching_configs_size, |
| 45 int32_t* num_of_matching_configs); | 44 uint32_t* num_of_matching_configs); |
| 46 bool Init(PP_VideoDecoderConfig_Dev* dec_config); | 45 bool Init(PP_VideoConfigElement* dec_config); |
| 47 bool Decode(PP_VideoBitstreamBuffer_Dev* bitstream_buffer, | 46 bool Decode(PP_VideoBitstreamBuffer_Dev* bitstream_buffer, |
| 48 PP_CompletionCallback callback); | 47 PP_CompletionCallback callback); |
| 49 void AssignPictureBuffer(uint32_t no_of_picture_buffers, | 48 void AssignGLESBuffers(uint32_t no_of_buffers, |
| 50 PP_PictureData_Dev* picture_buffers); | 49 PP_GLESBuffer_Dev* buffers); |
| 51 void ReusePictureBuffer(PP_PictureData_Dev* picture_buffer); | 50 void AssignSysmemBuffers(uint32_t no_of_buffers, |
| 51 PP_SysmemBuffer_Dev* buffers); |
| 52 void ReusePictureBuffer(int32_t picture_buffer_id); |
| 52 bool Flush(PP_CompletionCallback callback); | 53 bool Flush(PP_CompletionCallback callback); |
| 53 bool Abort(PP_CompletionCallback callback); | 54 bool Abort(PP_CompletionCallback callback); |
| 54 | 55 |
| 55 // media::VideoDecodeAccelerator::Client implementation. | 56 // media::VideoDecodeAccelerator::Client implementation. |
| 56 virtual void ProvidePictureBuffers( | 57 virtual void ProvidePictureBuffers( |
| 57 uint32_t requested_num_of_buffers, | 58 uint32 requested_num_of_buffers, |
| 58 const std::vector<uint32_t>& buffer_properties) OVERRIDE; | 59 gfx::Size dimensions, |
| 59 virtual void DismissPictureBuffer( | 60 media::VideoDecodeAccelerator::MemoryType type) OVERRIDE; |
| 60 media::VideoDecodeAccelerator::PictureBuffer* picture_buffer) OVERRIDE; | 61 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; |
| 61 virtual void PictureReady( | 62 virtual void PictureReady( |
| 62 media::VideoDecodeAccelerator::Picture* picture) OVERRIDE; | 63 const media::Picture& picture) OVERRIDE; |
| 63 virtual void NotifyEndOfStream() OVERRIDE; | 64 virtual void NotifyEndOfStream() OVERRIDE; |
| 64 virtual void NotifyError( | 65 virtual void NotifyError( |
| 65 media::VideoDecodeAccelerator::Error error) OVERRIDE; | 66 media::VideoDecodeAccelerator::Error error) OVERRIDE; |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 void OnAbortComplete(); | 69 void OnAbortComplete(); |
| 69 void OnBitstreamBufferProcessed(); | 70 void OnBitstreamBufferProcessed(); |
| 70 void OnFlushComplete(); | 71 void OnFlushComplete(); |
| 71 | 72 |
| 72 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is | 73 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is |
| 73 // swapped with another. | 74 // swapped with another. |
| 74 scoped_ptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; | 75 scoped_ptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; |
| 75 | 76 |
| 76 // Factory to produce our callbacks. | 77 // Factory to produce our callbacks. |
| 77 base::ScopedCallbackFactory<PPB_VideoDecoder_Impl> callback_factory_; | 78 base::ScopedCallbackFactory<PPB_VideoDecoder_Impl> callback_factory_; |
| 78 | 79 |
| 79 PP_CompletionCallback abort_callback_; | 80 PP_CompletionCallback abort_callback_; |
| 80 PP_CompletionCallback flush_callback_; | 81 PP_CompletionCallback flush_callback_; |
| 81 PP_CompletionCallback bitstream_buffer_callback_; | 82 PP_CompletionCallback bitstream_buffer_callback_; |
| 82 | 83 |
| 84 // Reference to the plugin requesting this interface. |
| 85 const PPP_VideoDecoder_Dev* ppp_videodecoder_; |
| 86 |
| 83 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl); | 87 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl); |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace ppapi | 90 } // namespace ppapi |
| 87 } // namespace webkit | 91 } // namespace webkit |
| 88 | 92 |
| 89 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ | 93 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ |
| OLD | NEW |