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

Unified Diff: webkit/plugins/ppapi/ppb_video_decoder_impl.cc

Issue 7779001: Replace the use of an int32* with a proper struct for decoder configuration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replaced struct with explicit profile parameter. 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 side-by-side diff with in-line comments
Download patch
Index: webkit/plugins/ppapi/ppb_video_decoder_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
index e8cd2ac95ea275d01e5a084e56ce27038da8068e..7dc63a1a416722dc9f79f7b87b5fcbcd555953a3 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(

Powered by Google App Engine
This is Rietveld 408576698