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

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

Issue 7085030: Implementation for Pepper C++ Video Decoder API (wrapper on top of C API). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed the CPP video decoder client to match the changes in PPP_VideoDecoder_Dev 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') | webkit/plugins/ppapi/ppb_video_decoder_impl.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 using std::vector;
16
17 namespace pp { 15 namespace pp {
18 16
19 namespace { 17 namespace {
20 18
21 template <> const char* interface_name<PPB_VideoDecoder_Dev>() { 19 template <> const char* interface_name<PPB_VideoDecoder_Dev>() {
22 return PPB_VIDEODECODER_DEV_INTERFACE; 20 return PPB_VIDEODECODER_DEV_INTERFACE;
23 } 21 }
24 22
25 } // namespace 23 } // namespace
26 24
27 VideoDecoder::VideoDecoder(const Instance* /* instance */, 25 VideoDecoder::VideoDecoder(const Instance* instance,
28 const std::vector<uint32_t>& /* config */, 26 const PP_VideoConfigElement* config,
29 CompletionCallback /* callback */, 27 CompletionCallback callback,
30 Client* client) 28 Client* client)
31 : client_(client) { 29 : client_(client) {
32 if (!has_interface<PPB_VideoDecoder_Dev>()) 30 if (!has_interface<PPB_VideoDecoder_Dev>())
33 return; 31 return;
34 // TODO(vmr): Implement. 32 PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create(
33 instance->pp_instance(), config, callback.pp_completion_callback()));
35 } 34 }
36 35
37 VideoDecoder::~VideoDecoder() {} 36 VideoDecoder::~VideoDecoder() {}
38 37
39 vector<uint32_t> VideoDecoder::GetConfigs( 38 bool VideoDecoder::GetConfigs(Instance* instance,
40 Instance* /* instance */, 39 const PP_VideoConfigElement* prototype_config,
41 const vector<uint32_t>& /* prototype_config */) { 40 PP_VideoConfigElement* matching_configs,
42 // TODO(vmr): Implement. 41 uint32_t matching_configs_size,
43 vector<uint32_t> matching_configs; 42 uint32_t* num_of_matching_configs) {
44 if (!has_interface<PPB_VideoDecoder_Dev>()) 43 if (!has_interface<PPB_VideoDecoder_Dev>())
45 return matching_configs; 44 return false;
46 return matching_configs; 45 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->GetConfigs(
46 instance->pp_instance(), prototype_config, matching_configs,
47 matching_configs_size, num_of_matching_configs));
47 } 48 }
48 49
49 void VideoDecoder::AssignGLESBuffers(uint32_t /* no_of_buffers */, 50 void VideoDecoder::AssignGLESBuffers(
50 const PP_GLESBuffer_Dev& /* buffers */) { 51 const std::vector<PP_GLESBuffer_Dev>& buffers) {
51 // TODO(vmr): Implement. 52 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
53 return;
54 get_interface<PPB_VideoDecoder_Dev>()->AssignGLESBuffers(
55 pp_resource(), buffers.size(), &buffers[0]);
52 } 56 }
53 57
54 void VideoDecoder::AssignSysmemBuffers( 58 void VideoDecoder::AssignSysmemBuffers(
55 uint32_t /* no_of_buffers */, 59 const std::vector<PP_SysmemBuffer_Dev>& buffers) {
56 const PP_SysmemBuffer_Dev& /* buffers */) { 60 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
57 // TODO(vmr): Implement. 61 return;
62 get_interface<PPB_VideoDecoder_Dev>()->AssignSysmemBuffers(
63 pp_resource(), buffers.size(), &buffers[0]);
58 } 64 }
59 65
60 bool VideoDecoder::Decode( 66 bool VideoDecoder::Decode(const PP_VideoBitstreamBuffer_Dev& bitstream_buffer,
61 const PP_VideoBitstreamBuffer_Dev& /* bitstream_buffer */, 67 CompletionCallback callback) {
62 CompletionCallback /* callback */) {
63 // TODO(vmr): Implement.
64 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) 68 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
65 return false; 69 return false;
66 return false; 70 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Decode(
71 pp_resource(), &bitstream_buffer, callback.pp_completion_callback()));
67 } 72 }
68 73
69 void VideoDecoder::ReusePictureBuffer(int32_t /* picture_buffer_id */) { 74 void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) {
70 // TODO(vmr): Implement. 75 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
76 return;
77 get_interface<PPB_VideoDecoder_Dev>()->ReusePictureBuffer(
78 pp_resource(), picture_buffer_id);
71 } 79 }
72 80
73 bool VideoDecoder::Flush(CompletionCallback /* callback */) { 81 bool VideoDecoder::Flush(CompletionCallback callback) {
74 // TODO(vmr): Implement. 82 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
75 if (!has_interface<PPB_VideoDecoder_Dev>())
76 return false; 83 return false;
77 return true; 84 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Flush(
85 pp_resource(), callback.pp_completion_callback()));
78 } 86 }
79 87
80 bool VideoDecoder::Abort(CompletionCallback /* callback */) { 88 bool VideoDecoder::Abort(CompletionCallback callback) {
81 // TODO(vmr): Implement. 89 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource())
82 if (!has_interface<PPB_VideoDecoder_Dev>())
83 return false; 90 return false;
84 return true; 91 return PPBoolToBool(get_interface<PPB_VideoDecoder_Dev>()->Abort(
92 pp_resource(), callback.pp_completion_callback()));
85 } 93 }
86 94
87 } // namespace pp 95 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/video_decoder_dev.h ('k') | webkit/plugins/ppapi/ppb_video_decoder_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698