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

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

Issue 7474006: PPB_VideoDecoder_Dev::Initialize is now synchronous! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: vrk CR update. 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/thunk/resource_creation_api.h ('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"
(...skipping 20 matching lines...) Expand all
31 31
32 namespace webkit { 32 namespace webkit {
33 namespace ppapi { 33 namespace ppapi {
34 34
35 class PluginInstance; 35 class PluginInstance;
36 36
37 class PPB_VideoDecoder_Impl : public Resource, 37 class PPB_VideoDecoder_Impl : public Resource,
38 public ::ppapi::thunk::PPB_VideoDecoder_API, 38 public ::ppapi::thunk::PPB_VideoDecoder_API,
39 public media::VideoDecodeAccelerator::Client { 39 public media::VideoDecodeAccelerator::Client {
40 public: 40 public:
41 explicit PPB_VideoDecoder_Impl(PluginInstance* instance);
42 virtual ~PPB_VideoDecoder_Impl(); 41 virtual ~PPB_VideoDecoder_Impl();
42 // See PPB_VideoDecoder_Dev::Create. Returns 0 on failure to create &
43 // initialize.
44 static PP_Resource Create(PluginInstance* instance,
45 PP_Resource context3d_id,
46 const PP_VideoConfigElement* config);
43 47
44 // ResourceObjectBase overrides. 48 // ResourceObjectBase overrides.
45 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE; 49 virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE;
46 50
47 // PPB_VideoDecoder_API implementation. 51 // PPB_VideoDecoder_API implementation.
48 virtual int32_t Initialize(PP_Resource context_id,
49 const PP_VideoConfigElement* dec_config,
50 PP_CompletionCallback callback) OVERRIDE;
51 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, 52 virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
52 PP_CompletionCallback callback) OVERRIDE; 53 PP_CompletionCallback callback) OVERRIDE;
53 virtual void AssignPictureBuffers( 54 virtual void AssignPictureBuffers(
54 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE; 55 uint32_t no_of_buffers, const PP_PictureBuffer_Dev* buffers) OVERRIDE;
55 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE; 56 virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE;
56 virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE; 57 virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE;
57 virtual int32_t Reset(PP_CompletionCallback callback) OVERRIDE; 58 virtual int32_t Reset(PP_CompletionCallback callback) OVERRIDE;
58 virtual void Destroy() OVERRIDE; 59 virtual void Destroy() OVERRIDE;
59 60
60 // media::VideoDecodeAccelerator::Client implementation. 61 // media::VideoDecodeAccelerator::Client implementation.
61 virtual void ProvidePictureBuffers( 62 virtual void ProvidePictureBuffers(
62 uint32 requested_num_of_buffers, const gfx::Size& dimensions) OVERRIDE; 63 uint32 requested_num_of_buffers, const gfx::Size& dimensions) OVERRIDE;
63 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; 64 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
64 virtual void PictureReady(const media::Picture& picture) OVERRIDE; 65 virtual void PictureReady(const media::Picture& picture) OVERRIDE;
65 virtual void NotifyInitializeDone() OVERRIDE; 66 virtual void NotifyInitializeDone() OVERRIDE;
66 virtual void NotifyEndOfStream() OVERRIDE; 67 virtual void NotifyEndOfStream() OVERRIDE;
67 virtual void NotifyError( 68 virtual void NotifyError(
68 media::VideoDecodeAccelerator::Error error) OVERRIDE; 69 media::VideoDecodeAccelerator::Error error) OVERRIDE;
69 virtual void NotifyFlushDone() OVERRIDE; 70 virtual void NotifyFlushDone() OVERRIDE;
70 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE; 71 virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE;
71 virtual void NotifyResetDone() OVERRIDE; 72 virtual void NotifyResetDone() OVERRIDE;
72 73
73 private: 74 private:
74 // Key: bitstream_buffer_id, value: callback to run when bitstream decode is 75 // Key: bitstream_buffer_id, value: callback to run when bitstream decode is
75 // done. 76 // done.
76 typedef std::map<int32, PP_CompletionCallback> CallbackById; 77 typedef std::map<int32, PP_CompletionCallback> CallbackById;
77 78
79 explicit PPB_VideoDecoder_Impl(PluginInstance* instance);
80
81 // Initialize the underlying decoder and return success status.
82 bool Init(PP_Resource context_id, const PP_VideoConfigElement* dec_config);
83
78 // Tell command buffer to process all commands it has received so far. 84 // Tell command buffer to process all commands it has received so far.
79 void FlushCommandBuffer(); 85 void FlushCommandBuffer();
80 86
81 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is 87 // This is NULL before initialization, and if this PPB_VideoDecoder_Impl is
82 // swapped with another. 88 // swapped with another.
83 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_; 89 scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_;
84 90
85 // Factory to produce our callbacks. 91 // Factory to produce our callbacks.
86 base::ScopedCallbackFactory<PPB_VideoDecoder_Impl> callback_factory_; 92 base::ScopedCallbackFactory<PPB_VideoDecoder_Impl> callback_factory_;
87 93
88 // The resource ID of the underlying Context3d object being used. Used only 94 // The resource ID of the underlying Context3d object being used. Used only
89 // for reference counting to keep it alive for the lifetime of |*this|. 95 // for reference counting to keep it alive for the lifetime of |*this|.
90 PP_Resource context3d_id_; 96 PP_Resource context3d_id_;
91 97
92 PP_CompletionCallback initialization_callback_;
93 PP_CompletionCallback flush_callback_; 98 PP_CompletionCallback flush_callback_;
94 PP_CompletionCallback reset_callback_; 99 PP_CompletionCallback reset_callback_;
95 CallbackById bitstream_buffer_callbacks_; 100 CallbackById bitstream_buffer_callbacks_;
96 101
97 // Reference to the plugin requesting this interface. 102 // Reference to the plugin requesting this interface.
98 const PPP_VideoDecoder_Dev* ppp_videodecoder_; 103 const PPP_VideoDecoder_Dev* ppp_videodecoder_;
99 104
100 // Reference to the GLES2Implementation owned by PPB_Context3D_Impl. 105 // Reference to the GLES2Implementation owned by PPB_Context3D_Impl.
101 // PPB_Context3D_Impl is guaranteed to be alive for the lifetime of this 106 // PPB_Context3D_Impl is guaranteed to be alive for the lifetime of this
102 // class. 107 // class.
103 // In the out-of-process case, Context3D's gles2_impl() exists in the plugin 108 // In the out-of-process case, Context3D's gles2_impl() exists in the plugin
104 // process only, so gles2_impl_ is NULL in that case. 109 // process only, so gles2_impl_ is NULL in that case.
105 gpu::gles2::GLES2Implementation* gles2_impl_; 110 gpu::gles2::GLES2Implementation* gles2_impl_;
106 111
107 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl); 112 DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl);
108 }; 113 };
109 114
110 } // namespace ppapi 115 } // namespace ppapi
111 } // namespace webkit 116 } // namespace webkit
112 117
113 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ 118 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_
OLDNEW
« no previous file with comments | « ppapi/thunk/resource_creation_api.h ('k') | webkit/plugins/ppapi/ppb_video_decoder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698