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

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

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/transport_dev.cc ('k') | ppapi/cpp/file_io.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/common.h" 10 #include "ppapi/cpp/common.h"
11 #include "ppapi/cpp/dev/context_3d_dev.h" 11 #include "ppapi/cpp/dev/context_3d_dev.h"
12 #include "ppapi/cpp/instance.h" 12 #include "ppapi/cpp/instance.h"
13 #include "ppapi/cpp/module.h" 13 #include "ppapi/cpp/module.h"
14 #include "ppapi/cpp/module_impl.h" 14 #include "ppapi/cpp/module_impl.h"
15 #include "ppapi/thunk/common.h"
15 16
16 namespace pp { 17 namespace pp {
17 18
18 namespace { 19 namespace {
19 20
20 template <> const char* interface_name<PPB_VideoDecoder_Dev>() { 21 template <> const char* interface_name<PPB_VideoDecoder_Dev>() {
21 return PPB_VIDEODECODER_DEV_INTERFACE; 22 return PPB_VIDEODECODER_DEV_INTERFACE;
22 } 23 }
23 24
24 } // namespace 25 } // namespace
25 26
26 VideoDecoder_Dev::VideoDecoder_Dev(const Instance& instance) { 27 VideoDecoder_Dev::VideoDecoder_Dev(const Instance& instance) {
27 if (!has_interface<PPB_VideoDecoder_Dev>()) 28 if (!has_interface<PPB_VideoDecoder_Dev>())
28 return; 29 return;
29 PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create( 30 PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create(
30 instance.pp_instance())); 31 instance.pp_instance()));
31 } 32 }
32 33
33 VideoDecoder_Dev::VideoDecoder_Dev(PP_Resource resource) : Resource(resource) { 34 VideoDecoder_Dev::VideoDecoder_Dev(PP_Resource resource) : Resource(resource) {
34 } 35 }
35 36
36 VideoDecoder_Dev::~VideoDecoder_Dev() {} 37 VideoDecoder_Dev::~VideoDecoder_Dev() {}
37 38
38 int32_t VideoDecoder_Dev::Initialize(const PP_VideoConfigElement* config, 39 int32_t VideoDecoder_Dev::Initialize(const PP_VideoConfigElement* config,
39 const Context3D_Dev& context, 40 const Context3D_Dev& context,
40 CompletionCallback callback) { 41 CompletionCallback callback) {
41 if (!has_interface<PPB_VideoDecoder_Dev>()) 42 if (!has_interface<PPB_VideoDecoder_Dev>())
42 return PP_ERROR_NOINTERFACE; 43 return callback.MayForce(PP_ERROR_NOINTERFACE);
43 return get_interface<PPB_VideoDecoder_Dev>()->Initialize( 44 return get_interface<PPB_VideoDecoder_Dev>()->Initialize(
44 pp_resource(), context.pp_resource(), config, 45 pp_resource(), context.pp_resource(), config,
45 callback.pp_completion_callback()); 46 callback.pp_completion_callback());
46 } 47 }
47 48
48 bool VideoDecoder_Dev::GetConfigs(Instance* instance, 49 bool VideoDecoder_Dev::GetConfigs(Instance* instance,
49 const PP_VideoConfigElement* prototype_config, 50 const PP_VideoConfigElement* prototype_config,
50 PP_VideoConfigElement* matching_configs, 51 PP_VideoConfigElement* matching_configs,
51 uint32_t matching_configs_size, 52 uint32_t matching_configs_size,
52 uint32_t* num_of_matching_configs) { 53 uint32_t* num_of_matching_configs) {
(...skipping 17 matching lines...) Expand all
70 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 71 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
71 return; 72 return;
72 get_interface<PPB_VideoDecoder_Dev>()->AssignSysmemBuffers( 73 get_interface<PPB_VideoDecoder_Dev>()->AssignSysmemBuffers(
73 pp_resource(), buffers.size(), &buffers[0]); 74 pp_resource(), buffers.size(), &buffers[0]);
74 } 75 }
75 76
76 int32_t VideoDecoder_Dev::Decode( 77 int32_t VideoDecoder_Dev::Decode(
77 const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, 78 const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
78 CompletionCallback callback) { 79 CompletionCallback callback) {
79 if (!has_interface<PPB_VideoDecoder_Dev>()) 80 if (!has_interface<PPB_VideoDecoder_Dev>())
80 return PP_ERROR_NOINTERFACE; 81 return callback.MayForce(PP_ERROR_NOINTERFACE);
81 if (!pp_resource())
82 return PP_ERROR_BADRESOURCE;
83 return get_interface<PPB_VideoDecoder_Dev>()->Decode( 82 return get_interface<PPB_VideoDecoder_Dev>()->Decode(
84 pp_resource(), &bitstream_buffer, callback.pp_completion_callback()); 83 pp_resource(), &bitstream_buffer, callback.pp_completion_callback());
85 } 84 }
86 85
87 void VideoDecoder_Dev::ReusePictureBuffer(int32_t picture_buffer_id) { 86 void VideoDecoder_Dev::ReusePictureBuffer(int32_t picture_buffer_id) {
88 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 87 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
89 return; 88 return;
90 get_interface<PPB_VideoDecoder_Dev>()->ReusePictureBuffer( 89 get_interface<PPB_VideoDecoder_Dev>()->ReusePictureBuffer(
91 pp_resource(), picture_buffer_id); 90 pp_resource(), picture_buffer_id);
92 } 91 }
93 92
94 int32_t VideoDecoder_Dev::Flush(CompletionCallback callback) { 93 int32_t VideoDecoder_Dev::Flush(CompletionCallback callback) {
95 if (!has_interface<PPB_VideoDecoder_Dev>()) 94 if (!has_interface<PPB_VideoDecoder_Dev>())
96 return PP_ERROR_NOINTERFACE; 95 return callback.MayForce(PP_ERROR_NOINTERFACE);
97 if (!pp_resource())
98 return PP_ERROR_BADRESOURCE;
99 return get_interface<PPB_VideoDecoder_Dev>()->Flush( 96 return get_interface<PPB_VideoDecoder_Dev>()->Flush(
100 pp_resource(), callback.pp_completion_callback()); 97 pp_resource(), callback.pp_completion_callback());
101 } 98 }
102 99
103 int32_t VideoDecoder_Dev::Abort(CompletionCallback callback) { 100 int32_t VideoDecoder_Dev::Abort(CompletionCallback callback) {
104 if (!has_interface<PPB_VideoDecoder_Dev>()) 101 if (!has_interface<PPB_VideoDecoder_Dev>())
105 return PP_ERROR_NOINTERFACE; 102 return callback.MayForce(PP_ERROR_NOINTERFACE);
106 if (!pp_resource())
107 return PP_ERROR_BADRESOURCE;
108 return get_interface<PPB_VideoDecoder_Dev>()->Abort( 103 return get_interface<PPB_VideoDecoder_Dev>()->Abort(
109 pp_resource(), callback.pp_completion_callback()); 104 pp_resource(), callback.pp_completion_callback());
110 } 105 }
111 106
112 } // namespace pp 107 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/transport_dev.cc ('k') | ppapi/cpp/file_io.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698