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

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: rebased 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..d869ef496019ce0e5832c925b1fb449a187db2b4 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
@@ -30,6 +30,7 @@ using ppapi::thunk::PPB_Buffer_API;
using ppapi::thunk::PPB_Context3D_API;
using ppapi::thunk::PPB_Graphics3D_API;
using ppapi::thunk::PPB_VideoDecoder_API;
+typedef media::VideoDecodeAccelerator::Config Config;
namespace webkit {
namespace ppapi {
@@ -51,10 +52,23 @@ PPB_VideoDecoder_API* PPB_VideoDecoder_Impl::AsPPB_VideoDecoder_API() {
return this;
}
+// Convert PP_VideoDecoderConfig_Dev to media::VideoDecodeAccelerator::Config.
+static media::VideoDecodeAccelerator::Config PPToMediaConfig(
+ const PP_VideoDecoderConfig_Dev& pp_config) {
+ Config media_config;
+ // TODO(fischman,vrk): this assumes the enums in the two Config objects match
+ // up, as do their fields. Add a COMPILE_ASSERT of these facts somewhere.
+ media_config.format = static_cast<Config::Format>(pp_config.format);
+ media_config.h264_profile =
+ static_cast<Config::H264Profile>(pp_config.h264_profile);
+ return media_config;
+}
+
// 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,
+ const PP_VideoDecoderConfig_Dev& config) {
PluginDelegate::PlatformContext3D* platform_context = NULL;
gpu::gles2::GLES2Implementation* gles2_impl = NULL;
EnterResourceNoLock<PPB_Context3D_API> enter_context(graphics_context, false);
@@ -85,17 +99,13 @@ bool PPB_VideoDecoder_Impl::Init(
PP_Resource graphics_context,
PluginDelegate::PlatformContext3D* context,
gpu::gles2::GLES2Implementation* gles2_impl,
- const PP_VideoConfigElement* config) {
+ const PP_VideoDecoderConfig_Dev& config) {
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 +116,7 @@ bool PPB_VideoDecoder_Impl::Init(
return false;
FlushCommandBuffer();
- return platform_video_decoder_->Initialize(copied);
+ return platform_video_decoder_->Initialize(PPToMediaConfig(config));
}
int32_t PPB_VideoDecoder_Impl::Decode(

Powered by Google App Engine
This is Rietveld 408576698