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

Side by Side Diff: ppapi/cpp/media_codec_video_decoder.cc

Issue 210373003: Pepper VideoDecoder API definition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: David's comments, run clang format. Created 6 years, 8 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
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/cpp/media_codec_video_decoder.h"
6
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_media_codec_video_decoder.h"
9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/instance_handle.h"
11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/module_impl.h"
13
14 namespace pp {
15
16 namespace {
17
18 template <>
19 const char* interface_name<PPB_MediaCodecVideoDecoder_0_1>() {
20 return PPB_MEDIACODECVIDEODECODER_INTERFACE_0_1;
21 }
22
23 } // namespace
24
25 MediaCodecVideoDecoder::MediaCodecVideoDecoder() {}
26
27 MediaCodecVideoDecoder::MediaCodecVideoDecoder(const InstanceHandle& instance) {
28 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
29 PassRefFromConstructor(
30 get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Create(
31 instance.pp_instance()));
32 }
33 }
34
35 MediaCodecVideoDecoder::MediaCodecVideoDecoder(
36 const MediaCodecVideoDecoder& other)
37 : Resource(other) {}
38
39 int32_t MediaCodecVideoDecoder::Initialize(const Graphics3D& context,
40 PP_MediaCodec_VideoProfile profile,
41 const CompletionCallback& cc) {
42 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
43 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Initialize(
44 pp_resource(),
45 context.pp_resource(),
46 profile,
47 cc.pp_completion_callback());
48 }
49 return cc.MayForce(PP_ERROR_NOINTERFACE);
50 }
51
52 int32_t MediaCodecVideoDecoder::Decode(uint32_t picture_id,
53 uint32_t size,
54 const void* buffer,
55 const CompletionCallback& cc) {
56 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
57 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Decode(
58 pp_resource(), picture_id, size, buffer, cc.pp_completion_callback());
59 }
60 return PP_ERROR_NOINTERFACE;
61 }
62
63 int32_t MediaCodecVideoDecoder::GetPicture(
64 const CompletionCallbackWithOutput<PP_MediaCodec_Picture>& cc) {
65 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
66 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->GetPicture(
67 pp_resource(), cc.output(), cc.pp_completion_callback());
68 }
69 return cc.MayForce(PP_ERROR_NOINTERFACE);
70 }
71
72 void MediaCodecVideoDecoder::RecyclePicture(
73 const PP_MediaCodec_Picture& picture) {
74 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
75 get_interface<PPB_MediaCodecVideoDecoder_0_1>()->RecyclePicture(
76 pp_resource(), &picture);
77 }
78 }
79
80 int32_t MediaCodecVideoDecoder::Flush(const CompletionCallback& cc) {
81 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
82 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Flush(
83 pp_resource(), cc.pp_completion_callback());
84 }
85 return cc.MayForce(PP_ERROR_NOINTERFACE);
86 }
87
88 int32_t MediaCodecVideoDecoder::Reset(const CompletionCallback& cc) {
89 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
90 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Reset(
91 pp_resource(), cc.pp_completion_callback());
92 }
93 return cc.MayForce(PP_ERROR_NOINTERFACE);
94 }
95
96 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698