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

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

Issue 10408003: Plumb extra_data() to VideoDecodeAccelerator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rev interface versino Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" 5 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return media::H264PROFILE_MULTIVIEWHIGH; 78 return media::H264PROFILE_MULTIVIEWHIGH;
79 default: 79 default:
80 return media::VIDEO_CODEC_PROFILE_UNKNOWN; 80 return media::VIDEO_CODEC_PROFILE_UNKNOWN;
81 } 81 }
82 } 82 }
83 83
84 // static 84 // static
85 PP_Resource PPB_VideoDecoder_Impl::Create( 85 PP_Resource PPB_VideoDecoder_Impl::Create(
86 PP_Instance instance, 86 PP_Instance instance,
87 PP_Resource graphics_context, 87 PP_Resource graphics_context,
88 PP_VideoDecoder_Profile profile) { 88 PP_VideoDecoder_Profile profile,
89 const gfx::Size& frame_size,
90 const std::vector<uint8_t>& extra_data) {
89 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, true); 91 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, true);
90 if (enter_context.failed()) 92 if (enter_context.failed())
91 return 0; 93 return 0;
92 PPB_Graphics3D_Impl* graphics3d_impl = 94 PPB_Graphics3D_Impl* graphics3d_impl =
93 static_cast<PPB_Graphics3D_Impl*>(enter_context.object()); 95 static_cast<PPB_Graphics3D_Impl*>(enter_context.object());
94 96
95 scoped_refptr<PPB_VideoDecoder_Impl> decoder( 97 scoped_refptr<PPB_VideoDecoder_Impl> decoder(
96 new PPB_VideoDecoder_Impl(instance)); 98 new PPB_VideoDecoder_Impl(instance));
97 if (decoder->Init(graphics_context, graphics3d_impl->platform_context(), 99 if (decoder->Init(graphics_context, graphics3d_impl->platform_context(),
98 graphics3d_impl->gles2_impl(), profile)) 100 graphics3d_impl->gles2_impl(), profile, frame_size,
101 extra_data))
99 return decoder->GetReference(); 102 return decoder->GetReference();
100 return 0; 103 return 0;
101 } 104 }
102 105
103 bool PPB_VideoDecoder_Impl::Init( 106 bool PPB_VideoDecoder_Impl::Init(
104 PP_Resource graphics_context, 107 PP_Resource graphics_context,
105 PluginDelegate::PlatformContext3D* context, 108 PluginDelegate::PlatformContext3D* context,
106 gpu::gles2::GLES2Implementation* gles2_impl, 109 gpu::gles2::GLES2Implementation* gles2_impl,
107 PP_VideoDecoder_Profile profile) { 110 PP_VideoDecoder_Profile profile,
111 const gfx::Size& frame_size,
112 const std::vector<uint8_t>& extra_data) {
108 InitCommon(graphics_context, gles2_impl); 113 InitCommon(graphics_context, gles2_impl);
109 114
110 int command_buffer_route_id = context->GetCommandBufferRouteId(); 115 int command_buffer_route_id = context->GetCommandBufferRouteId();
111 if (command_buffer_route_id == 0) 116 if (command_buffer_route_id == 0)
112 return false; 117 return false;
113 118
114 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); 119 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
115 if (!plugin_delegate) 120 if (!plugin_delegate)
116 return false; 121 return false;
117 122
118 platform_video_decoder_ = plugin_delegate->CreateVideoDecoder( 123 platform_video_decoder_ = plugin_delegate->CreateVideoDecoder(
119 this, command_buffer_route_id); 124 this, command_buffer_route_id);
120 if (!platform_video_decoder_) 125 if (!platform_video_decoder_)
121 return false; 126 return false;
122 127
123 FlushCommandBuffer(); 128 FlushCommandBuffer();
124 return platform_video_decoder_->Initialize(PPToMediaProfile(profile)); 129 return platform_video_decoder_->Initialize(
130 PPToMediaProfile(profile), frame_size, extra_data);
125 } 131 }
126 132
127 int32_t PPB_VideoDecoder_Impl::Decode( 133 int32_t PPB_VideoDecoder_Impl::Decode(
128 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, 134 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
129 PP_CompletionCallback callback) { 135 PP_CompletionCallback callback) {
130 if (!callback.func) 136 if (!callback.func)
131 return PP_ERROR_BLOCKS_MAIN_THREAD; 137 return PP_ERROR_BLOCKS_MAIN_THREAD;
132 138
133 if (!platform_video_decoder_) 139 if (!platform_video_decoder_)
134 return PP_ERROR_BADRESOURCE; 140 return PP_ERROR_BADRESOURCE;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 void PPB_VideoDecoder_Impl::NotifyFlushDone() { 277 void PPB_VideoDecoder_Impl::NotifyFlushDone() {
272 RunFlushCallback(PP_OK); 278 RunFlushCallback(PP_OK);
273 } 279 }
274 280
275 void PPB_VideoDecoder_Impl::NotifyInitializeDone() { 281 void PPB_VideoDecoder_Impl::NotifyInitializeDone() {
276 NOTREACHED() << "PlatformVideoDecoder::Initialize() is synchronous!"; 282 NOTREACHED() << "PlatformVideoDecoder::Initialize() is synchronous!";
277 } 283 }
278 284
279 } // namespace ppapi 285 } // namespace ppapi
280 } // namespace webkit 286 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_video_decoder_impl.h ('k') | webkit/plugins/ppapi/resource_creation_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698