OLD | NEW |
---|---|
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; | 15 using std::vector; |
16 | 16 |
17 namespace pp { | 17 namespace pp { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 template <> const char* interface_name<PPB_VideoDecoder_Dev>() { | 21 template <> const char* interface_name<PPB_VideoDecoder_Dev>() { |
22 return PPB_VIDEODECODER_DEV_INTERFACE; | 22 return PPB_VIDEODECODER_DEV_INTERFACE; |
23 } | 23 } |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 VideoDecoder::VideoDecoder(const Instance* /* instance */, | 27 VideoDecoder::VideoDecoder(const Instance* /* instance */, Client* client) |
28 const std::vector<uint32_t>& /* config */, | |
29 CompletionCallback /* callback */, | |
30 Client* client) | |
31 : client_(client) { | 28 : client_(client) { |
32 if (!has_interface<PPB_VideoDecoder_Dev>()) | 29 if (!has_interface<PPB_VideoDecoder_Dev>()) |
33 return; | 30 return; |
34 // TODO(vmr): Implement. | 31 // TODO(vmr): Implement. |
35 } | 32 } |
36 | 33 |
37 VideoDecoder::~VideoDecoder() {} | 34 VideoDecoder::~VideoDecoder() {} |
38 | 35 |
36 int32_t VideoDecoder::Init(const std::vector<uint32_t>& /* config */, | |
37 CompletionCallback /* callback */) { | |
darin (slow to review)
2011/06/03 17:54:58
nit: indentation
int32_t VideoDecoder::Init(a,
polina
2011/06/03 19:35:04
Done.
| |
38 return PP_ERROR_FAILED; | |
39 // TODO(vmr): Implement. | |
40 } | |
41 | |
39 vector<uint32_t> VideoDecoder::GetConfigs( | 42 vector<uint32_t> VideoDecoder::GetConfigs( |
40 Instance* /* instance */, | 43 Instance* /* instance */, |
41 const vector<uint32_t>& /* prototype_config */) { | 44 const vector<uint32_t>& /* prototype_config */) { |
42 // TODO(vmr): Implement. | 45 // TODO(vmr): Implement. |
43 vector<uint32_t> matching_configs; | 46 vector<uint32_t> matching_configs; |
44 if (!has_interface<PPB_VideoDecoder_Dev>()) | 47 if (!has_interface<PPB_VideoDecoder_Dev>()) |
45 return matching_configs; | 48 return matching_configs; |
46 return matching_configs; | 49 return matching_configs; |
47 } | 50 } |
48 | 51 |
49 void VideoDecoder::AssignGLESBuffers(uint32_t /* no_of_buffers */, | 52 void VideoDecoder::AssignGLESBuffers(uint32_t /* no_of_buffers */, |
50 const PP_GLESBuffer_Dev& /* buffers */) { | 53 const PP_GLESBuffer_Dev& /* buffers */) { |
51 // TODO(vmr): Implement. | 54 // TODO(vmr): Implement. |
52 } | 55 } |
53 | 56 |
54 void VideoDecoder::AssignSysmemBuffers( | 57 void VideoDecoder::AssignSysmemBuffers( |
55 uint32_t /* no_of_buffers */, | 58 uint32_t /* no_of_buffers */, |
56 const PP_SysmemBuffer_Dev& /* buffers */) { | 59 const PP_SysmemBuffer_Dev& /* buffers */) { |
57 // TODO(vmr): Implement. | 60 // TODO(vmr): Implement. |
58 } | 61 } |
59 | 62 |
60 bool VideoDecoder::Decode( | 63 int32_t VideoDecoder::Decode( |
61 const PP_VideoBitstreamBuffer_Dev& /* bitstream_buffer */, | 64 const PP_VideoBitstreamBuffer_Dev& /* bitstream_buffer */, |
62 CompletionCallback /* callback */) { | 65 CompletionCallback /* callback */) { |
63 // TODO(vmr): Implement. | 66 // TODO(vmr): Implement. |
64 if (!has_interface<PPB_VideoDecoder_Dev>() || !pp_resource()) | 67 if (!has_interface<PPB_VideoDecoder_Dev>()) |
65 return false; | 68 return PP_ERROR_NOINTERFACE; |
66 return false; | 69 if (!pp_resource()) |
70 return PP_ERROR_BADRESOURCE; | |
71 return PP_ERROR_FAILED; | |
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 // TODO(vmr): Implement. |
71 } | 76 } |
72 | 77 |
73 bool VideoDecoder::Flush(CompletionCallback /* callback */) { | 78 int32_t VideoDecoder::Flush(CompletionCallback /* callback */) { |
74 // TODO(vmr): Implement. | 79 // TODO(vmr): Implement. |
75 if (!has_interface<PPB_VideoDecoder_Dev>()) | 80 if (!has_interface<PPB_VideoDecoder_Dev>()) |
76 return false; | 81 return PP_ERROR_NOINTERFACE; |
77 return true; | 82 return PP_ERROR_FAILED; |
78 } | 83 } |
79 | 84 |
80 bool VideoDecoder::Abort(CompletionCallback /* callback */) { | 85 int32_t VideoDecoder::Abort(CompletionCallback /* callback */) { |
81 // TODO(vmr): Implement. | 86 // TODO(vmr): Implement. |
82 if (!has_interface<PPB_VideoDecoder_Dev>()) | 87 if (!has_interface<PPB_VideoDecoder_Dev>()) |
83 return false; | 88 return PP_ERROR_NOINTERFACE; |
84 return true; | 89 return PP_ERROR_FAILED; |
85 } | 90 } |
86 | 91 |
87 } // namespace pp | 92 } // namespace pp |
OLD | NEW |