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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 namespace ppapi { | 41 namespace ppapi { |
42 | 42 |
43 class PPB_VideoDecoder_Impl : public ::ppapi::Resource, | 43 class PPB_VideoDecoder_Impl : public ::ppapi::Resource, |
44 public ::ppapi::VideoDecoderImpl, | 44 public ::ppapi::VideoDecoderImpl, |
45 public media::VideoDecodeAccelerator::Client { | 45 public media::VideoDecodeAccelerator::Client { |
46 public: | 46 public: |
47 virtual ~PPB_VideoDecoder_Impl(); | 47 virtual ~PPB_VideoDecoder_Impl(); |
48 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create & | 48 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create & |
49 // initialize. | 49 // initialize. |
50 static PP_Resource Create(PP_Instance instance, | 50 static PP_Resource Create(PP_Instance instance, |
51 PP_Resource context3d_id, | 51 PP_Resource graphics_context, |
52 const PP_VideoConfigElement* config); | 52 const PP_VideoConfigElement* config); |
53 | 53 |
54 // Resource overrides. | 54 // Resource overrides. |
55 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE; | 55 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE; |
56 | 56 |
57 // PPB_VideoDecoder_API implementation. | 57 // PPB_VideoDecoder_API implementation. |
58 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, | 58 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, |
59 PP_CompletionCallback callback) OVERRIDE; | 59 PP_CompletionCallback callback) OVERRIDE; |
60 virtual void AssignPictureBuffers( | 60 virtual void AssignPictureBuffers( |
61 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE; | 61 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE; |
62 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE; | 62 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE; |
63 virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE; | 63 virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE; |
64 virtual int32_t Reset(PP_CompletionCallback callback) OVERRIDE; | 64 virtual int32_t Reset(PP_CompletionCallback callback) OVERRIDE; |
65 virtual void Destroy() OVERRIDE; | 65 virtual void Destroy() OVERRIDE; |
66 | 66 |
67 // media::VideoDecodeAccelerator::Client implementation. | 67 // media::VideoDecodeAccelerator::Client implementation. |
68 virtual void ProvidePictureBuffers( | 68 virtual void ProvidePictureBuffers( |
69 uint32 requested_num_of_buffers, const gfx::Size& dimensions) OVERRIDE; | 69 uint32 requested_num_of_buffers, const gfx::Size& dimensions) OVERRIDE; |
70 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; | 70 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; |
71 virtual void PictureReady(const media::Picture& picture) OVERRIDE; | 71 virtual void PictureReady(const media::Picture& picture) OVERRIDE; |
72 virtual void NotifyInitializeDone() OVERRIDE; | 72 virtual void NotifyInitializeDone() OVERRIDE; |
73 virtual void NotifyEndOfStream() OVERRIDE; | 73 virtual void NotifyEndOfStream() OVERRIDE; |
74 virtual void NotifyError( | 74 virtual void NotifyError( |
75 media::VideoDecodeAccelerator::Error error) OVERRIDE; | 75 media::VideoDecodeAccelerator::Error error) OVERRIDE; |
76 virtual void NotifyFlushDone() OVERRIDE; | 76 virtual void NotifyFlushDone() OVERRIDE; |
77 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE; | 77 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE; |
78 virtual void NotifyResetDone() OVERRIDE; | 78 virtual void NotifyResetDone() OVERRIDE; |
79 | 79 |
80 protected: | |
81 // VideoDecoderImpl implementation. | |
82 virtual bool Init(PP_Resource context3d_id, | |
83 ::ppapi::thunk::PPB_Context3D_API* context, | |
84 const PP_VideoConfigElement* dec_config) OVERRIDE; | |
85 | |
86 private: | 80 private: |
87 explicit PPB_VideoDecoder_Impl(PP_Instance instance); | 81 explicit PPB_VideoDecoder_Impl(PP_Instance instance); |
| 82 bool Init(PP_Resource graphics_context, |
| 83 PluginDelegate::PlatformContext3D* context, |
| 84 gpu::gles2::GLES2Implementation* gles2_impl, |
| 85 const PP_VideoConfigElement* config); |
88 | 86 |
89 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is | 87 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is |
90 // swapped with another. | 88 // swapped with another. |
91 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; | 89 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; |
92 | 90 |
93 // Reference to the plugin requesting this interface. | 91 // Reference to the plugin requesting this interface. |
94 const PPP_VideoDecoder_Dev* ppp_videodecoder_; | 92 const PPP_VideoDecoder_Dev* ppp_videodecoder_; |
95 | 93 |
96 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl); | 94 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl); |
97 }; | 95 }; |
98 | 96 |
99 } // namespace ppapi | 97 } // namespace ppapi |
100 } // namespace webkit | 98 } // namespace webkit |
101 | 99 |
102 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ | 100 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ |
OLD | NEW |