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

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: responding to brettw 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
« no previous file with comments | « ppapi/shared_impl/video_decoder_impl.cc ('k') | webkit/plugins/ppapi/ppb_video_decoder_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 } // namespace gles2
30 } 31 } // namespace gpu
32
33 namespace ppapi {
34 namespace thunk {
35 class PPB_Context3D_API;
36 } // namespace thunk
37 } // namespace ppapi
38
31 39
32 namespace webkit { 40 namespace webkit {
33 namespace ppapi { 41 namespace ppapi {
34 42
35 class PluginInstance; 43 class PluginInstance;
36 44
37 class PPB_VideoDecoder_Impl : public Resource, 45 class PPB_VideoDecoder_Impl : public Resource,
38 public ::ppapi::thunk::PPB_VideoDecoder_API, 46 public ::ppapi::VideoDecoderImpl,
39 public media::VideoDecodeAccelerator::Client { 47 public media::VideoDecodeAccelerator::Client {
40 public: 48 public:
41 virtual ~PPB_VideoDecoder_Impl(); 49 virtual ~PPB_VideoDecoder_Impl();
42 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create & 50 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create &
43 // initialize. 51 // initialize.
44 static PP_Resource Create(PluginInstance* instance, 52 static PP_Resource Create(PluginInstance* instance,
45 PP_Resource context3d_id, 53 PP_Resource context3d_id,
46 const PP_VideoConfigElement* config); 54 const PP_VideoConfigElement* config);
47 55
48 // ResourceObjectBase overrides. 56 // ResourceObjectBase overrides.
(...skipping 15 matching lines...) Expand all
64 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; 72 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
65 virtual void PictureReady(const media::Picture& picture) OVERRIDE; 73 virtual void PictureReady(const media::Picture& picture) OVERRIDE;
66 virtual void NotifyInitializeDone() OVERRIDE; 74 virtual void NotifyInitializeDone() OVERRIDE;
67 virtual void NotifyEndOfStream() OVERRIDE; 75 virtual void NotifyEndOfStream() OVERRIDE;
68 virtual void NotifyError( 76 virtual void NotifyError(
69 media::VideoDecodeAccelerator::Error error) OVERRIDE; 77 media::VideoDecodeAccelerator::Error error) OVERRIDE;
70 virtual void NotifyFlushDone() OVERRIDE; 78 virtual void NotifyFlushDone() OVERRIDE;
71 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE; 79 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE;
72 virtual void NotifyResetDone() OVERRIDE; 80 virtual void NotifyResetDone() OVERRIDE;
73 81
82 protected:
83 // VideoDecoderImpl implementation.
84 virtual bool Init(PP_Resource context3d_id,
85 ::ppapi::thunk::PPB_Context3D_API* context,
86 const PP_VideoConfigElement* dec_config) OVERRIDE;
87 virtual void AddRefResource(PP_Resource resource) OVERRIDE;
88 virtual void UnrefResource(PP_Resource resource) OVERRIDE;
89
74 private: 90 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); 91 explicit PPB_VideoDecoder_Impl(PluginInstance* instance);
80 92
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 93 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is
88 // swapped with another. 94 // swapped with another.
89 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; 95 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_;
90 96
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. 97 // Reference to the plugin requesting this interface.
103 const PPP_VideoDecoder_Dev* ppp_videodecoder_; 98 const PPP_VideoDecoder_Dev* ppp_videodecoder_;
104 99
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); 100 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl);
113 }; 101 };
114 102
115 } // namespace ppapi 103 } // namespace ppapi
116 } // namespace webkit 104 } // namespace webkit
117 105
118 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ 106 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/video_decoder_impl.cc ('k') | webkit/plugins/ppapi/ppb_video_decoder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698