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

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

Issue 7058061: Revert 87905 (broke PPAPITest.Scrollbar on win) - PPAPI: Fix interface functions that take PP_Com... (Closed) Base URL: svn://svn.chromium.org/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, Client* client) 25 VideoDecoder::VideoDecoder(const Instance* instance,
26 const PP_VideoConfigElement* config,
27 CompletionCallback callback,
28 Client* client)
26 : client_(client) { 29 : client_(client) {
27 if (!has_interface<PPB_VideoDecoder_Dev>()) 30 if (!has_interface<PPB_VideoDecoder_Dev>())
28 return; 31 return;
29 PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create( 32 PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create(
30 instance->pp_instance())); 33 instance->pp_instance(), config, callback.pp_completion_callback()));
31 } 34 }
32 35
33 VideoDecoder::~VideoDecoder() {} 36 VideoDecoder::~VideoDecoder() {}
34 37
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
43 bool VideoDecoder::GetConfigs(Instance* instance, 38 bool VideoDecoder::GetConfigs(Instance* instance,
44 const PP_VideoConfigElement* prototype_config, 39 const PP_VideoConfigElement* prototype_config,
45 PP_VideoConfigElement* matching_configs, 40 PP_VideoConfigElement* matching_configs,
46 uint32_t matching_configs_size, 41 uint32_t matching_configs_size,
47 uint32_t* num_of_matching_configs) { 42 uint32_t* num_of_matching_configs) {
48 if (!has_interface<PPB_VideoDecoder_Dev>()) 43 if (!has_interface<PPB_VideoDecoder_Dev>())
49 return false; 44 return false;
50 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->GetConfigs( 45 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->GetConfigs(
51 instance->pp_instance(), prototype_config, matching_configs, 46 instance->pp_instance(), prototype_config, matching_configs,
52 matching_configs_size, num_of_matching_configs)); 47 matching_configs_size, num_of_matching_configs));
53 } 48 }
54 49
55 void VideoDecoder::AssignGLESBuffers( 50 void VideoDecoder::AssignGLESBuffers(
56 const std::vector<PP_GLESBuffer_Dev>& buffers) { 51 const std::vector<PP_GLESBuffer_Dev>& buffers) {
57 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 52 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
58 return; 53 return;
59 get_interface<PPB_VideoDecoder_Dev>()->AssignGLESBuffers( 54 get_interface<PPB_VideoDecoder_Dev>()->AssignGLESBuffers(
60 pp_resource(), buffers.size(), &buffers[0]); 55 pp_resource(), buffers.size(), &buffers[0]);
61 } 56 }
62 57
63 void VideoDecoder::AssignSysmemBuffers( 58 void VideoDecoder::AssignSysmemBuffers(
64 const std::vector<PP_SysmemBuffer_Dev>& buffers) { 59 const std::vector<PP_SysmemBuffer_Dev>& buffers) {
65 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 60 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
66 return; 61 return;
67 get_interface<PPB_VideoDecoder_Dev>()->AssignSysmemBuffers( 62 get_interface<PPB_VideoDecoder_Dev>()->AssignSysmemBuffers(
68 pp_resource(), buffers.size(), &buffers[0]); 63 pp_resource(), buffers.size(), &buffers[0]);
69 } 64 }
70 65
71 int32_t VideoDecoder::Decode( 66 bool VideoDecoder::Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
72 const PP_VideoBitstreamBuffer_Dev& bitstream_buffer, 67 CompletionCallback callback) {
73 CompletionCallback callback) { 68 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
74 if (!has_interface<PPB_VideoDecoder_Dev>()) 69 return false;
75 return PP_ERROR_NOINTERFACE; 70 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Decode(
76 if (!pp_resource()) 71 pp_resource(), &bitstream_buffer, callback.pp_completion_callback()));
77 return PP_ERROR_BADRESOURCE;
78 return get_interface<PPB_VideoDecoder_Dev>()->Decode(
79 pp_resource(), &bitstream_buffer, callback.pp_completion_callback());
80 } 72 }
81 73
82 void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) { 74 void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) {
83 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 75 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
84 return; 76 return;
85 get_interface<PPB_VideoDecoder_Dev>()->ReusePictureBuffer( 77 get_interface<PPB_VideoDecoder_Dev>()->ReusePictureBuffer(
86 pp_resource(), picture_buffer_id); 78 pp_resource(), picture_buffer_id);
87 } 79 }
88 80
89 int32_t VideoDecoder::Flush(CompletionCallback callback) { 81 bool VideoDecoder::Flush(CompletionCallback callback) {
90 if (!has_interface<PPB_VideoDecoder_Dev>()) 82 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
91 return PP_ERROR_NOINTERFACE; 83 return false;
92 if (!pp_resource()) 84 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Flush(
93 return PP_ERROR_BADRESOURCE; 85 pp_resource(), callback.pp_completion_callback()));
94 return get_interface<PPB_VideoDecoder_Dev>()->Flush(
95 pp_resource(), callback.pp_completion_callback());
96 } 86 }
97 87
98 int32_t VideoDecoder::Abort(CompletionCallback callback) { 88 bool VideoDecoder::Abort(CompletionCallback callback) {
99 if (!has_interface<PPB_VideoDecoder_Dev>()) 89 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
100 return PP_ERROR_NOINTERFACE; 90 return false;
101 if (!pp_resource()) 91 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Abort(
102 return PP_ERROR_BADRESOURCE; 92 pp_resource(), callback.pp_completion_callback()));
103 return get_interface<PPB_VideoDecoder_Dev>()->Abort(
104 pp_resource(), callback.pp_completion_callback());
105 } 93 }
106 94
107 } // namespace pp 95 } // 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