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