Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: webkit/plugins/ppapi/ppb_video_decoder_impl.h

Issue 7545014: Implement PPAPI VideoDecode out-of-process support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: responses to ddorwin and piman Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/video_decoder_impl.h"
16 #include "ppapi/thunk/ppb_video_decoder_api.h" 17 #include "ppapi/thunk/ppb_video_decoder_api.h"
17 #include "webkit/plugins/ppapi/plugin_delegate.h" 18 #include "webkit/plugins/ppapi/plugin_delegate.h"
18 #include "webkit/plugins/ppapi/resource.h" 19 #include "webkit/plugins/ppapi/resource.h"
19 20
20 struct PP_PictureBuffer_Dev; 21 struct PP_PictureBuffer_Dev;
21 struct PP_VideoDecoderConfig_Dev; 22 struct PP_VideoDecoderConfig_Dev;
22 struct PP_VideoBitstreamBuffer_Dev; 23 struct PP_VideoBitstreamBuffer_Dev;
23 struct PPB_VideoDecoder_Dev; 24 struct PPB_VideoDecoder_Dev;
24 struct PPP_VideoDecoder_Dev; 25 struct PPP_VideoDecoder_Dev;
25 26
26 namespace gpu { 27 namespace gpu {
27 namespace gles2 { 28 namespace gles2 {
28 class GLES2Implementation; 29 class GLES2Implementation;
29 } 30 }
30 } 31 }
31 32
32 namespace webkit { 33 namespace webkit {
33 namespace ppapi { 34 namespace ppapi {
34 35
35 class PluginInstance; 36 class PluginInstance;
36 37
37 class PPB_VideoDecoder_Impl : public Resource, 38 class PPB_VideoDecoder_Impl : public Resource,
38 public ::ppapi::thunk::PPB_VideoDecoder_API, 39 public ::ppapi::VideoDecoderImpl,
39 public media::VideoDecodeAccelerator::Client { 40 public media::VideoDecodeAccelerator::Client {
40 public: 41 public:
41 virtual ~PPB_VideoDecoder_Impl(); 42 virtual ~PPB_VideoDecoder_Impl();
42 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create & 43 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create &
43 // initialize. 44 // initialize.
44 static PP_Resource Create(PluginInstance* instance, 45 static PP_Resource Create(PluginInstance* instance,
45 PP_Resource context3d_id, 46 PP_Resource context3d_id,
46 const PP_VideoConfigElement* config); 47 const PP_VideoConfigElement* config);
47 48
48 // ResourceObjectBase overrides. 49 // ResourceObjectBase overrides.
49 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE; 50 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE;
50 51
51 // PPB_VideoDecoder_API implementation. 52 // PPB_VideoDecoder_API implementation.
52 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, 53 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
53 PP_CompletionCallback callback) OVERRIDE; 54 PP_CompletionCallback callback) OVERRIDE;
54 virtual void AssignPictureBuffers( 55 virtual void AssignPictureBuffers(
55 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE; 56 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE;
56 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE; 57 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE;
57 virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE; 58 virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE;
58 virtual int32_t Reset(PP_CompletionCallback callback) OVERRIDE; 59 virtual int32_t Reset(PP_CompletionCallback callback) OVERRIDE;
59 virtual void Destroy() OVERRIDE; 60 virtual void Destroy() OVERRIDE;
Ami GONE FROM CHROMIUM 2011/08/02 00:49:08 The section-heading comment is now out of date, si
vrk (LEFT CHROMIUM) 2011/08/03 19:04:30 Kept it the same for now because I think a referen
60 61
61 // media::VideoDecodeAccelerator::Client implementation. 62 // media::VideoDecodeAccelerator::Client implementation.
62 virtual void ProvidePictureBuffers( 63 virtual void ProvidePictureBuffers(
63 uint32 requested_num_of_buffers, const gfx::Size& dimensions) OVERRIDE; 64 uint32 requested_num_of_buffers, const gfx::Size& dimensions) OVERRIDE;
64 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; 65 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
65 virtual void PictureReady(const media::Picture& picture) OVERRIDE; 66 virtual void PictureReady(const media::Picture& picture) OVERRIDE;
66 virtual void NotifyInitializeDone() OVERRIDE; 67 virtual void NotifyInitializeDone() OVERRIDE;
67 virtual void NotifyEndOfStream() OVERRIDE; 68 virtual void NotifyEndOfStream() OVERRIDE;
68 virtual void NotifyError( 69 virtual void NotifyError(
69 media::VideoDecodeAccelerator::Error error) OVERRIDE; 70 media::VideoDecodeAccelerator::Error error) OVERRIDE;
70 virtual void NotifyFlushDone() OVERRIDE; 71 virtual void NotifyFlushDone() OVERRIDE;
71 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE; 72 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE;
72 virtual void NotifyResetDone() OVERRIDE; 73 virtual void NotifyResetDone() OVERRIDE;
73 74
75 // Initialize the underlying decoder and return success status.
Ami GONE FROM CHROMIUM 2011/08/02 00:49:08 s/public/protected/?
vrk (LEFT CHROMIUM) 2011/08/03 19:04:30 Done.
76 virtual bool Init(PP_Resource context_id,
77 const PP_VideoConfigElement* dec_config);
Ami GONE FROM CHROMIUM 2011/08/02 00:49:08 OVERRIDE
vrk (LEFT CHROMIUM) 2011/08/03 19:04:30 Done.
78
74 private: 79 private:
75 // Key: bitstream_buffer_id, value: callback to run when bitstream decode is
76 // done.
77 typedef std::map<int32, PP_CompletionCallback> CallbackById;
78
79 explicit PPB_VideoDecoder_Impl(PluginInstance* instance); 80 explicit PPB_VideoDecoder_Impl(PluginInstance* instance);
80 81
81 // Initialize the underlying decoder and return success status.
82 bool Init(PP_Resource context_id, const PP_VideoConfigElement* dec_config);
83
84 // Tell command buffer to process all commands it has received so far.
85 void FlushCommandBuffer();
86
87 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is 82 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is
88 // swapped with another. 83 // swapped with another.
89 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; 84 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_;
90 85
91 // Factory to produce our callbacks.
92 base::ScopedCallbackFactory<PPB_VideoDecoder_Impl> callback_factory_;
93
94 // The resource ID of the underlying Context3d object being used. Used only
95 // for reference counting to keep it alive for the lifetime of |*this|.
96 PP_Resource context3d_id_;
97
98 PP_CompletionCallback flush_callback_;
99 PP_CompletionCallback reset_callback_;
100 CallbackById bitstream_buffer_callbacks_;
101
102 // Reference to the plugin requesting this interface. 86 // Reference to the plugin requesting this interface.
103 const PPP_VideoDecoder_Dev* ppp_videodecoder_; 87 const PPP_VideoDecoder_Dev* ppp_videodecoder_;
104 88
105 // Reference to the GLES2Implementation owned by PPB_Context3D_Impl.
106 // PPB_Context3D_Impl is guaranteed to be alive for the lifetime of this
107 // class.
108 // In the out-of-process case, Context3D's gles2_impl() exists in the plugin
109 // process only, so gles2_impl_ is NULL in that case.
110 gpu::gles2::GLES2Implementation* gles2_impl_;
111
112 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl); 89 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl);
113 }; 90 };
114 91
115 } // namespace ppapi 92 } // namespace ppapi
116 } // namespace webkit 93 } // namespace webkit
117 94
118 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ 95 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698