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

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

Issue 6975053: PPAPI: Fix interface functions that take PP_CompletionCallbacks, but don't (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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/tests/arch_dependent_sizes_32.h » ('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/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::VideoDecoder(const Instance* instance, 25 VideoDecoder::VideoDecoder(const Instance* instance, Client* client)
26 const PP_VideoConfigElement* config,
27 CompletionCallback callback,
28 Client* client)
29 : client_(client) { 26 : client_(client) {
30 if (!has_interface<PPB_VideoDecoder_Dev>()) 27 if (!has_interface<PPB_VideoDecoder_Dev>())
31 return; 28 return;
32 PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create( 29 PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create(
33 instance->pp_instance(), config, callback.pp_completion_callback())); 30 instance->pp_instance()));
34 } 31 }
35 32
36 VideoDecoder::~VideoDecoder() {} 33 VideoDecoder::~VideoDecoder() {}
37 34
35 int32_t VideoDecoder::Initialize(const PP_VideoConfigElement* config,
36 CompletionCallback callback) {
37 if (!has_interface<PPB_VideoDecoder_Dev>())
38 return PP_ERROR_NOINTERFACE;
39 return get_interface<PPB_VideoDecoder_Dev>()->Initialize(
40 pp_resource(), config, callback.pp_completion_callback());
41 }
42
38 bool VideoDecoder::GetConfigs(Instance* instance, 43 bool VideoDecoder::GetConfigs(Instance* instance,
39 const PP_VideoConfigElement* prototype_config, 44 const PP_VideoConfigElement* prototype_config,
40 PP_VideoConfigElement* matching_configs, 45 PP_VideoConfigElement* matching_configs,
41 uint32_t matching_configs_size, 46 uint32_t matching_configs_size,
42 uint32_t* num_of_matching_configs) { 47 uint32_t* num_of_matching_configs) {
43 if (!has_interface<PPB_VideoDecoder_Dev>()) 48 if (!has_interface<PPB_VideoDecoder_Dev>())
44 return false; 49 return false;
45 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->GetConfigs( 50 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->GetConfigs(
46 instance->pp_instance(), prototype_config, matching_configs, 51 instance->pp_instance(), prototype_config, matching_configs,
47 matching_configs_size, num_of_matching_configs)); 52 matching_configs_size, num_of_matching_configs));
48 } 53 }
49 54
50 void VideoDecoder::AssignGLESBuffers( 55 void VideoDecoder::AssignGLESBuffers(
51 const std::vector<PP_GLESBuffer_Dev>& buffers) { 56 const std::vector<PP_GLESBuffer_Dev>& buffers) {
52 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 57 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
53 return; 58 return;
54 get_interface<PPB_VideoDecoder_Dev>()->AssignGLESBuffers( 59 get_interface<PPB_VideoDecoder_Dev>()->AssignGLESBuffers(
55 pp_resource(), buffers.size(), &buffers[0]); 60 pp_resource(), buffers.size(), &buffers[0]);
56 } 61 }
57 62
58 void VideoDecoder::AssignSysmemBuffers( 63 void VideoDecoder::AssignSysmemBuffers(
59 const std::vector<PP_SysmemBuffer_Dev>& buffers) { 64 const std::vector<PP_SysmemBuffer_Dev>& buffers) {
60 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 65 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
61 return; 66 return;
62 get_interface<PPB_VideoDecoder_Dev>()->AssignSysmemBuffers( 67 get_interface<PPB_VideoDecoder_Dev>()->AssignSysmemBuffers(
63 pp_resource(), buffers.size(), &buffers[0]); 68 pp_resource(), buffers.size(), &buffers[0]);
64 } 69 }
65 70
66 bool VideoDecoder::Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, 71 int32_t VideoDecoder::Decode(
67 CompletionCallback callback) { 72 const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
68 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 73 CompletionCallback callback) {
69 return false; 74 if (!has_interface<PPB_VideoDecoder_Dev>())
70 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Decode( 75 return PP_ERROR_NOINTERFACE;
71 pp_resource(), &bitstream_buffer, callback.pp_completion_callback())); 76 if (!pp_resource())
77 return PP_ERROR_BADRESOURCE;
78 return get_interface<PPB_VideoDecoder_Dev>()->Decode(
79 pp_resource(), &bitstream_buffer, callback.pp_completion_callback());
72 } 80 }
73 81
74 void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) { 82 void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) {
75 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 83 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
76 return; 84 return;
77 get_interface<PPB_VideoDecoder_Dev>()->ReusePictureBuffer( 85 get_interface<PPB_VideoDecoder_Dev>()->ReusePictureBuffer(
78 pp_resource(), picture_buffer_id); 86 pp_resource(), picture_buffer_id);
79 } 87 }
80 88
81 bool VideoDecoder::Flush(CompletionCallback callback) { 89 int32_t VideoDecoder::Flush(CompletionCallback callback) {
82 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 90 if (!has_interface<PPB_VideoDecoder_Dev>())
83 return false; 91 return PP_ERROR_NOINTERFACE;
84 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Flush( 92 if (!pp_resource())
85 pp_resource(), callback.pp_completion_callback())); 93 return PP_ERROR_BADRESOURCE;
94 return get_interface<PPB_VideoDecoder_Dev>()->Flush(
95 pp_resource(), callback.pp_completion_callback());
86 } 96 }
87 97
88 bool VideoDecoder::Abort(CompletionCallback callback) { 98 int32_t VideoDecoder::Abort(CompletionCallback callback) {
89 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 99 if (!has_interface<PPB_VideoDecoder_Dev>())
90 return false; 100 return PP_ERROR_NOINTERFACE;
91 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Abort( 101 if (!pp_resource())
92 pp_resource(), callback.pp_completion_callback())); 102 return PP_ERROR_BADRESOURCE;
103 return get_interface<PPB_VideoDecoder_Dev>()->Abort(
104 pp_resource(), callback.pp_completion_callback());
93 } 105 }
94 106
95 } // namespace pp 107 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/video_decoder_dev.h ('k') | ppapi/tests/arch_dependent_sizes_32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698