diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-30 00:48:33 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-30 00:48:33 +0000 |
commit | 1b2ec22ed8df1fb018e6ac402fc3b4f52e80a948 (patch) | |
tree | fbb93817da9d7315b45cf1288685cc860eef77e3 /ppapi/proxy | |
parent | 2854079e500f26d2b4c9b9b41ce1792e4a28091c (diff) | |
download | chromium_src-1b2ec22ed8df1fb018e6ac402fc3b4f52e80a948.zip chromium_src-1b2ec22ed8df1fb018e6ac402fc3b4f52e80a948.tar.gz chromium_src-1b2ec22ed8df1fb018e6ac402fc3b4f52e80a948.tar.bz2 |
Allow both Context3D and Graphics3D with the video decoder
BUG=none
TEST=Pepper Flash
Review URL: http://codereview.chromium.org/7765011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/ppb_video_decoder_proxy.cc | 39 | ||||
-rw-r--r-- | ppapi/proxy/ppb_video_decoder_proxy.h | 5 |
2 files changed, 29 insertions, 15 deletions
diff --git a/ppapi/proxy/ppb_video_decoder_proxy.cc b/ppapi/proxy/ppb_video_decoder_proxy.cc index 196d402..3763bbe 100644 --- a/ppapi/proxy/ppb_video_decoder_proxy.cc +++ b/ppapi/proxy/ppb_video_decoder_proxy.cc @@ -11,6 +11,7 @@ #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppb_buffer_proxy.h" #include "ppapi/proxy/ppb_context_3d_proxy.h" +#include "ppapi/proxy/ppb_graphics_3d_proxy.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/resource_creation_api.h" #include "ppapi/thunk/thunk.h" @@ -18,6 +19,7 @@ using ppapi::thunk::EnterResourceNoLock; using ppapi::thunk::PPB_Buffer_API; using ppapi::thunk::PPB_Context3D_API; +using ppapi::thunk::PPB_Graphics3D_API; using ppapi::thunk::PPB_VideoDecoder_API; namespace ppapi { @@ -30,7 +32,7 @@ class VideoDecoder : public Resource, public VideoDecoderImpl { virtual ~VideoDecoder(); static VideoDecoder* Create(const HostResource& resource, - PP_Resource context3d_id, + PP_Resource graphics_context, const PP_VideoConfigElement* config); // Resource overrides. @@ -206,7 +208,8 @@ bool PPB_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) { } PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( - PP_Instance instance, PP_Resource context3d_id, + PP_Instance instance, + PP_Resource graphics_context, const PP_VideoConfigElement* config) { PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); // Dispatcher is null if it cannot find the instance passed to it (i.e. if the @@ -218,12 +221,23 @@ PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( if (!VideoDecoderImpl::CopyConfigsToVector(config, &copied)) return 0; - EnterResourceNoLock<PPB_Context3D_API> enter_context(context3d_id, true); - if (enter_context.failed()) - return 0; - Context3D* ppb_context = - static_cast<Context3D*>(enter_context.object()); - HostResource host_context = ppb_context->host_resource(); + HostResource host_context; + gpu::gles2::GLES2Implementation* gles2_impl = NULL; + + EnterResourceNoLock<PPB_Context3D_API> enter_context(graphics_context, false); + if (enter_context.succeeded()) { + Context3D* context = static_cast<Context3D*>(enter_context.object()); + host_context = context->host_resource(); + gles2_impl = context->gles2_impl(); + } else { + EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, + true); + if (enter_context.failed()) + return 0; + Graphics3D* context = static_cast<Graphics3D*>(enter_context.object()); + host_context = context->host_resource(); + gles2_impl = context->gles2_impl(); + } HostResource result; dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( @@ -234,13 +248,12 @@ PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( // Need a scoped_refptr to keep the object alive during the Init call. scoped_refptr<VideoDecoder> decoder(new VideoDecoder(result)); - if (!decoder->Init(context3d_id, enter_context.object(), config)) - return 0; + decoder->InitCommon(graphics_context, gles2_impl); return decoder->GetReference(); } void PPB_VideoDecoder_Proxy::OnMsgCreate( - PP_Instance instance, const HostResource& context3d_id, + PP_Instance instance, const HostResource& graphics_context, const std::vector<PP_VideoConfigElement>& config, HostResource* result) { thunk::EnterFunction<thunk::ResourceCreationAPI> resource_creation(instance, @@ -254,7 +267,7 @@ void PPB_VideoDecoder_Proxy::OnMsgCreate( // Make the resource and get the API pointer to its interface. result->SetHostResource( instance, resource_creation.functions()->CreateVideoDecoder( - instance, context3d_id.host_resource(), &copied.front())); + instance, graphics_context.host_resource(), &copied.front())); } void PPB_VideoDecoder_Proxy::OnMsgDecode( @@ -275,7 +288,7 @@ void PPB_VideoDecoder_Proxy::OnMsgAssignPictureBuffers( const PP_PictureBuffer_Dev* buffer_array = &buffers.front(); ppb_video_decoder_target()->AssignPictureBuffers( - decoder.host_resource(), buffers.size(), buffer_array); + decoder.host_resource(), buffers.size(), buffer_array); } void PPB_VideoDecoder_Proxy::OnMsgReusePictureBuffer( diff --git a/ppapi/proxy/ppb_video_decoder_proxy.h b/ppapi/proxy/ppb_video_decoder_proxy.h index 2b51bc2..56c21c5 100644 --- a/ppapi/proxy/ppb_video_decoder_proxy.h +++ b/ppapi/proxy/ppb_video_decoder_proxy.h @@ -24,7 +24,8 @@ class PPB_VideoDecoder_Proxy : public InterfaceProxy { // Creates a VideoDecoder object in the plugin process. static PP_Resource CreateProxyResource(PP_Instance instance, - PP_Resource context3d_id, const PP_VideoConfigElement* config); + PP_Resource graphics_context, + const PP_VideoConfigElement* config); // InterfaceProxy implementation. virtual bool OnMessageReceived(const IPC::Message& msg); @@ -37,7 +38,7 @@ class PPB_VideoDecoder_Proxy : public InterfaceProxy { // Message handlers in the renderer process to receive messages from the // plugin process. void OnMsgCreate(PP_Instance instance, - const ppapi::HostResource& context3d_id, + const ppapi::HostResource& graphics_context, const std::vector<PP_VideoConfigElement>& config, ppapi::HostResource* result); void OnMsgDecode( |