OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ | |
6 #define WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "ppapi/c/dev/pp_video_dev.h" | |
12 #include "ppapi/c/dev/ppp_video_decoder_dev.h" | |
13 #include "ppapi/c/pp_var.h" | |
14 #include "ppapi/shared_impl/ppb_video_decoder_shared.h" | |
15 #include "ppapi/shared_impl/resource.h" | |
16 #include "ppapi/thunk/ppb_video_decoder_api.h" | |
17 #include "webkit/plugins/ppapi/plugin_delegate.h" | |
18 | |
19 struct PP_PictureBuffer_Dev; | |
20 struct PP_VideoBitstreamBuffer_Dev; | |
21 | |
22 namespace gpu { | |
23 namespace gles2 { | |
24 class GLES2Implementation; | |
25 } // namespace gles2 | |
26 } // namespace gpu | |
27 | |
28 namespace webkit { | |
29 namespace ppapi { | |
30 | |
31 class PPB_VideoDecoder_Impl : public ::ppapi::PPB_VideoDecoder_Shared, | |
32 public media::VideoDecodeAccelerator::Client { | |
33 public: | |
34 virtual ~PPB_VideoDecoder_Impl(); | |
35 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create & | |
36 // initialize. | |
37 static PP_Resource Create(PP_Instance instance, | |
38 PP_Resource graphics_context, | |
39 PP_VideoDecoder_Profile profile); | |
40 | |
41 // PPB_VideoDecoder_API implementation. | |
42 virtual int32_t Decode( | |
43 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, | |
44 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; | |
45 virtual void AssignPictureBuffers( | |
46 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE; | |
47 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE; | |
48 virtual int32_t Flush( | |
49 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; | |
50 virtual int32_t Reset( | |
51 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; | |
52 virtual void Destroy() OVERRIDE; | |
53 | |
54 // media::VideoDecodeAccelerator::Client implementation. | |
55 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | |
56 const gfx::Size& dimensions, | |
57 uint32 texture_target) OVERRIDE; | |
58 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; | |
59 virtual void PictureReady(const media::Picture& picture) OVERRIDE; | |
60 virtual void NotifyInitializeDone() OVERRIDE; | |
61 virtual void NotifyError( | |
62 media::VideoDecodeAccelerator::Error error) OVERRIDE; | |
63 virtual void NotifyFlushDone() OVERRIDE; | |
64 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE; | |
65 virtual void NotifyResetDone() OVERRIDE; | |
66 | |
67 private: | |
68 explicit PPB_VideoDecoder_Impl(PP_Instance instance); | |
69 bool Init(PP_Resource graphics_context, | |
70 PluginDelegate::PlatformContext3D* context, | |
71 gpu::gles2::GLES2Implementation* gles2_impl, | |
72 PP_VideoDecoder_Profile profile); | |
73 | |
74 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is | |
75 // swapped with another. | |
76 scoped_ptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; | |
77 | |
78 // Reference to the plugin requesting this interface. | |
79 const PPP_VideoDecoder_Dev* ppp_videodecoder_; | |
80 | |
81 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl); | |
82 }; | |
83 | |
84 } // namespace ppapi | |
85 } // namespace webkit | |
86 | |
87 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ | |
OLD | NEW |