summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 03:18:28 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 03:18:28 +0000
commit2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589 (patch)
tree34122669bf4397a7c59156d6af5f47f49af08933 /webkit/plugins
parent1695f071610fc582b0bd9342cb13a4eae291707f (diff)
downloadchromium_src-2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589.zip
chromium_src-2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589.tar.gz
chromium_src-2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589.tar.bz2
Replace the use of an int32* with an explicit profile for decoder configuration.
Replaces the error-prone, overly-general, error-containing, and brittle manually-terminated array-of-ints holding name/value pairs (except for names that don't take values) with a simple profile parameter (specifying only information we actually use today). BUG=none TEST=trybots, ovdatest, gles2 Review URL: http://codereview.chromium.org/7779001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.cc25
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.h5
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.cc4
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.h2
4 files changed, 20 insertions, 16 deletions
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
index e8cd2ac..7dc63a1 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
@@ -51,10 +51,19 @@ PPB_VideoDecoder_API* PPB_VideoDecoder_Impl::AsPPB_VideoDecoder_API() {
return this;
}
+// Convert PP_VideoDecoder_Profile to media::VideoDecodeAccelerator::Profile.
+static media::VideoDecodeAccelerator::Profile PPToMediaProfile(
+ const PP_VideoDecoder_Profile pp_profile) {
+ // TODO(fischman,vrk): this assumes the enum values in the two Profile types
+ // match up exactly. Add a COMPILE_ASSERT for this somewhere.
+ return static_cast<media::VideoDecodeAccelerator::Profile>(pp_profile);
+}
+
// static
-PP_Resource PPB_VideoDecoder_Impl::Create(PP_Instance instance,
- PP_Resource graphics_context,
- const PP_VideoConfigElement* config) {
+PP_Resource PPB_VideoDecoder_Impl::Create(
+ PP_Instance instance,
+ PP_Resource graphics_context,
+ PP_VideoDecoder_Profile profile) {
PluginDelegate::PlatformContext3D* platform_context = NULL;
gpu::gles2::GLES2Implementation* gles2_impl = NULL;
EnterResourceNoLock<PPB_Context3D_API> enter_context(graphics_context, false);
@@ -76,7 +85,7 @@ PP_Resource PPB_VideoDecoder_Impl::Create(PP_Instance instance,
scoped_refptr<PPB_VideoDecoder_Impl> decoder(
new PPB_VideoDecoder_Impl(instance));
- if (decoder->Init(graphics_context, platform_context, gles2_impl, config))
+ if (decoder->Init(graphics_context, platform_context, gles2_impl, profile))
return decoder->GetReference();
return 0;
}
@@ -85,17 +94,13 @@ bool PPB_VideoDecoder_Impl::Init(
PP_Resource graphics_context,
PluginDelegate::PlatformContext3D* context,
gpu::gles2::GLES2Implementation* gles2_impl,
- const PP_VideoConfigElement* config) {
+ PP_VideoDecoder_Profile profile) {
InitCommon(graphics_context, gles2_impl);
int command_buffer_route_id = context->GetCommandBufferRouteId();
if (command_buffer_route_id == 0)
return false;
- std::vector<int32> copied;
- if (!CopyConfigsToVector(config, &copied))
- return false;
-
PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
if (!plugin_delegate)
return false;
@@ -106,7 +111,7 @@ bool PPB_VideoDecoder_Impl::Init(
return false;
FlushCommandBuffer();
- return platform_video_decoder_->Initialize(copied);
+ return platform_video_decoder_->Initialize(PPToMediaProfile(profile));
}
int32_t PPB_VideoDecoder_Impl::Decode(
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.h b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
index a76d0ec..48b7b15 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.h
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
@@ -19,7 +19,6 @@
#include "webkit/plugins/ppapi/plugin_delegate.h"
struct PP_PictureBuffer_Dev;
-struct PP_VideoDecoderConfig_Dev;
struct PP_VideoBitstreamBuffer_Dev;
struct PPB_VideoDecoder_Dev;
struct PPP_VideoDecoder_Dev;
@@ -49,7 +48,7 @@ class PPB_VideoDecoder_Impl : public ::ppapi::Resource,
// initialize.
static PP_Resource Create(PP_Instance instance,
PP_Resource graphics_context,
- const PP_VideoConfigElement* config);
+ PP_VideoDecoder_Profile profile);
// Resource overrides.
virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE;
@@ -82,7 +81,7 @@ class PPB_VideoDecoder_Impl : public ::ppapi::Resource,
bool Init(PP_Resource graphics_context,
PluginDelegate::PlatformContext3D* context,
gpu::gles2::GLES2Implementation* gles2_impl,
- const PP_VideoConfigElement* config);
+ PP_VideoDecoder_Profile profile);
// This is NULL before initialization, and if this PPB_VideoDecoder_Impl is
// swapped with another.
diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc
index 23b725b..eeffefb 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.cc
+++ b/webkit/plugins/ppapi/resource_creation_impl.cc
@@ -276,8 +276,8 @@ PP_Resource ResourceCreationImpl::CreateVideoCapture(PP_Instance instance) {
PP_Resource ResourceCreationImpl::CreateVideoDecoder(
PP_Instance instance,
PP_Resource context3d_id,
- const PP_VideoConfigElement* config) {
- return PPB_VideoDecoder_Impl::Create(instance, context3d_id, config);
+ PP_VideoDecoder_Profile profile) {
+ return PPB_VideoDecoder_Impl::Create(instance, context3d_id, profile);
}
PP_Resource ResourceCreationImpl::CreateVideoLayer(PP_Instance instance,
diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h
index 6e0129f..4a7a2a9 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.h
+++ b/webkit/plugins/ppapi/resource_creation_impl.h
@@ -106,7 +106,7 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase,
virtual PP_Resource CreateVideoDecoder(
PP_Instance instance,
PP_Resource context3d_id,
- const PP_VideoConfigElement* config) OVERRIDE;
+ PP_VideoDecoder_Profile profile) OVERRIDE;
virtual PP_Resource CreateVideoLayer(PP_Instance instance,
PP_VideoLayerMode_Dev mode) OVERRIDE;
virtual PP_Resource CreateWheelInputEvent(