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

Side by Side Diff: ppapi/cpp/dev/video_decoder_dev.cc

Issue 7474006: PPB_VideoDecoder_Dev::Initialize is now synchronous! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: vrk CR update. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/dev/video_decoder_dev.h ('k') | ppapi/examples/gles2/gles2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ppapi/cpp/dev/video_decoder_dev.h" 5 #include "ppapi/cpp/dev/video_decoder_dev.h"
6 6
7 #include "ppapi/c/dev/ppb_video_decoder_dev.h" 7 #include "ppapi/c/dev/ppb_video_decoder_dev.h"
8 #include "ppapi/c/dev/ppp_video_decoder_dev.h" 8 #include "ppapi/c/dev/ppp_video_decoder_dev.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/cpp/dev/context_3d_dev.h" 10 #include "ppapi/cpp/dev/context_3d_dev.h"
11 #include "ppapi/cpp/instance.h" 11 #include "ppapi/cpp/instance.h"
12 #include "ppapi/cpp/module.h" 12 #include "ppapi/cpp/module.h"
13 #include "ppapi/cpp/module_impl.h" 13 #include "ppapi/cpp/module_impl.h"
14 14
15 namespace pp { 15 namespace pp {
16 16
17 namespace { 17 namespace {
18 18
19 template <> const char* interface_name<PPB_VideoDecoder_Dev>() { 19 template <> const char* interface_name<PPB_VideoDecoder_Dev>() {
20 return PPB_VIDEODECODER_DEV_INTERFACE; 20 return PPB_VIDEODECODER_DEV_INTERFACE;
21 } 21 }
22 22
23 } // namespace 23 } // namespace
24 24
25 VideoDecoder_Dev::VideoDecoder_Dev(const Instance& instance) { 25 VideoDecoder_Dev::VideoDecoder_Dev(const Instance& instance,
26 const Context3D_Dev& context,
27 const PP_VideoConfigElement* config) {
26 if (!has_interface<PPB_VideoDecoder_Dev>()) 28 if (!has_interface<PPB_VideoDecoder_Dev>())
27 return; 29 return;
28 PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create( 30 PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create(
29 instance.pp_instance())); 31 instance.pp_instance(), context.pp_resource(), config));
30 } 32 }
31 33
32 VideoDecoder_Dev::VideoDecoder_Dev(PP_Resource resource) : Resource(resource) { 34 VideoDecoder_Dev::VideoDecoder_Dev(PP_Resource resource) : Resource(resource) {
33 } 35 }
34 36
35 VideoDecoder_Dev::~VideoDecoder_Dev() { 37 VideoDecoder_Dev::~VideoDecoder_Dev() {
36 get_interface<PPB_VideoDecoder_Dev>()->Destroy(pp_resource()); 38 get_interface<PPB_VideoDecoder_Dev>()->Destroy(pp_resource());
37 } 39 }
38 40
39
40 int32_t VideoDecoder_Dev::Initialize(const PP_VideoConfigElement* config,
41 const Context3D_Dev& context,
42 CompletionCallback callback) {
43 if (!has_interface<PPB_VideoDecoder_Dev>())
44 return callback.MayForce(PP_ERROR_NOINTERFACE);
45 return get_interface<PPB_VideoDecoder_Dev>()->Initialize(
46 pp_resource(), context.pp_resource(), config,
47 callback.pp_completion_callback());
48 }
49
50 void VideoDecoder_Dev::AssignPictureBuffers( 41 void VideoDecoder_Dev::AssignPictureBuffers(
51 const std::vector<PP_PictureBuffer_Dev>& buffers) { 42 const std::vector<PP_PictureBuffer_Dev>& buffers) {
52 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 43 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
53 return; 44 return;
54 get_interface<PPB_VideoDecoder_Dev>()->AssignPictureBuffers( 45 get_interface<PPB_VideoDecoder_Dev>()->AssignPictureBuffers(
55 pp_resource(), buffers.size(), &buffers[0]); 46 pp_resource(), buffers.size(), &buffers[0]);
56 } 47 }
57 48
58 int32_t VideoDecoder_Dev::Decode( 49 int32_t VideoDecoder_Dev::Decode(
59 const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, 50 const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
(...skipping 19 matching lines...) Expand all
79 } 70 }
80 71
81 int32_t VideoDecoder_Dev::Reset(CompletionCallback callback) { 72 int32_t VideoDecoder_Dev::Reset(CompletionCallback callback) {
82 if (!has_interface<PPB_VideoDecoder_Dev>()) 73 if (!has_interface<PPB_VideoDecoder_Dev>())
83 return callback.MayForce(PP_ERROR_NOINTERFACE); 74 return callback.MayForce(PP_ERROR_NOINTERFACE);
84 return get_interface<PPB_VideoDecoder_Dev>()->Reset( 75 return get_interface<PPB_VideoDecoder_Dev>()->Reset(
85 pp_resource(), callback.pp_completion_callback()); 76 pp_resource(), callback.pp_completion_callback());
86 } 77 }
87 78
88 } // namespace pp 79 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/video_decoder_dev.h ('k') | ppapi/examples/gles2/gles2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698