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/dev/pp_video_dev.h" |
15 #include "ppapi/c/pp_var.h" | 15 #include "ppapi/c/pp_var.h" |
| 16 #include "ppapi/shared_impl/resource.h" |
16 #include "ppapi/shared_impl/video_decoder_impl.h" | 17 #include "ppapi/shared_impl/video_decoder_impl.h" |
17 #include "ppapi/thunk/ppb_video_decoder_api.h" | 18 #include "ppapi/thunk/ppb_video_decoder_api.h" |
18 #include "webkit/plugins/ppapi/plugin_delegate.h" | 19 #include "webkit/plugins/ppapi/plugin_delegate.h" |
19 #include "webkit/plugins/ppapi/resource.h" | |
20 | 20 |
21 struct PP_PictureBuffer_Dev; | 21 struct PP_PictureBuffer_Dev; |
22 struct PP_VideoDecoderConfig_Dev; | 22 struct PP_VideoDecoderConfig_Dev; |
23 struct PP_VideoBitstreamBuffer_Dev; | 23 struct PP_VideoBitstreamBuffer_Dev; |
24 struct PPB_VideoDecoder_Dev; | 24 struct PPB_VideoDecoder_Dev; |
25 struct PPP_VideoDecoder_Dev; | 25 struct PPP_VideoDecoder_Dev; |
26 | 26 |
27 namespace gpu { | 27 namespace gpu { |
28 namespace gles2 { | 28 namespace gles2 { |
29 class GLES2Implementation; | 29 class GLES2Implementation; |
30 } // namespace gles2 | 30 } // namespace gles2 |
31 } // namespace gpu | 31 } // namespace gpu |
32 | 32 |
33 namespace ppapi { | 33 namespace ppapi { |
34 namespace thunk { | 34 namespace thunk { |
35 class PPB_Context3D_API; | 35 class PPB_Context3D_API; |
36 } // namespace thunk | 36 } // namespace thunk |
37 } // namespace ppapi | 37 } // namespace ppapi |
38 | 38 |
39 | 39 |
40 namespace webkit { | 40 namespace webkit { |
41 namespace ppapi { | 41 namespace ppapi { |
42 | 42 |
43 class PluginInstance; | 43 class PPB_VideoDecoder_Impl : public ::ppapi::Resource, |
44 | |
45 class PPB_VideoDecoder_Impl : public Resource, | |
46 public ::ppapi::VideoDecoderImpl, | 44 public ::ppapi::VideoDecoderImpl, |
47 public media::VideoDecodeAccelerator::Client { | 45 public media::VideoDecodeAccelerator::Client { |
48 public: | 46 public: |
49 virtual ~PPB_VideoDecoder_Impl(); | 47 virtual ~PPB_VideoDecoder_Impl(); |
50 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create & | 48 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create & |
51 // initialize. | 49 // initialize. |
52 static PP_Resource Create(PluginInstance* instance, | 50 static PP_Resource Create(PP_Instance instance, |
53 PP_Resource context3d_id, | 51 PP_Resource context3d_id, |
54 const PP_VideoConfigElement* config); | 52 const PP_VideoConfigElement* config); |
55 | 53 |
56 // Resource overrides. | 54 // Resource overrides. |
57 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE; | 55 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE; |
58 | 56 |
59 // PPB_VideoDecoder_API implementation. | 57 // PPB_VideoDecoder_API implementation. |
60 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, | 58 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, |
61 PP_CompletionCallback callback) OVERRIDE; | 59 PP_CompletionCallback callback) OVERRIDE; |
62 virtual void AssignPictureBuffers( | 60 virtual void AssignPictureBuffers( |
(...skipping 16 matching lines...) Expand all Loading... |
79 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE; | 77 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE; |
80 virtual void NotifyResetDone() OVERRIDE; | 78 virtual void NotifyResetDone() OVERRIDE; |
81 | 79 |
82 protected: | 80 protected: |
83 // VideoDecoderImpl implementation. | 81 // VideoDecoderImpl implementation. |
84 virtual bool Init(PP_Resource context3d_id, | 82 virtual bool Init(PP_Resource context3d_id, |
85 ::ppapi::thunk::PPB_Context3D_API* context, | 83 ::ppapi::thunk::PPB_Context3D_API* context, |
86 const PP_VideoConfigElement* dec_config) OVERRIDE; | 84 const PP_VideoConfigElement* dec_config) OVERRIDE; |
87 | 85 |
88 private: | 86 private: |
89 explicit PPB_VideoDecoder_Impl(PluginInstance* instance); | 87 explicit PPB_VideoDecoder_Impl(PP_Instance instance); |
90 | 88 |
91 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is | 89 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is |
92 // swapped with another. | 90 // swapped with another. |
93 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; | 91 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; |
94 | 92 |
95 // Reference to the plugin requesting this interface. | 93 // Reference to the plugin requesting this interface. |
96 const PPP_VideoDecoder_Dev* ppp_videodecoder_; | 94 const PPP_VideoDecoder_Dev* ppp_videodecoder_; |
97 | 95 |
98 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl); | 96 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl); |
99 }; | 97 }; |
100 | 98 |
101 } // namespace ppapi | 99 } // namespace ppapi |
102 } // namespace webkit | 100 } // namespace webkit |
103 | 101 |
104 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ | 102 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ |
OLD | NEW |