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

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: Rename 'picture_id' to 'decode_id'. Address comments. 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
28 MediaCodecVideoDecoder::MediaCodecVideoDecoder(const InstanceHandle& instance) {
29 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
30 PassRefFromConstructor(
31 get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Create(
32 instance.pp_instance()));
33 }
34 }
35
36 MediaCodecVideoDecoder::MediaCodecVideoDecoder(
37 const MediaCodecVideoDecoder& other)
38 : Resource(other) {
39 }
40
41 int32_t MediaCodecVideoDecoder::Initialize(const Graphics3D& context,
42 PP_MediaCodec_VideoProfile profile,
43 const CompletionCallback& cc) {
44 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
45 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Initialize(
46 pp_resource(),
47 context.pp_resource(),
48 profile,
49 cc.pp_completion_callback());
50 }
51 return cc.MayForce(PP_ERROR_NOINTERFACE);
52 }
53
54 int32_t MediaCodecVideoDecoder::Decode(uint32_t decode_id,
55 uint32_t size,
56 const void* buffer,
57 const CompletionCallback& cc) {
58 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
59 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Decode(
60 pp_resource(), decode_id, size, buffer, cc.pp_completion_callback());
61 }
62 return cc.MayForce(PP_ERROR_NOINTERFACE);
63 }
64
65 int32_t MediaCodecVideoDecoder::GetPicture(
66 const CompletionCallbackWithOutput<PP_MediaCodec_Picture>& cc) {
67 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
68 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->GetPicture(
69 pp_resource(), cc.output(), cc.pp_completion_callback());
70 }
71 return cc.MayForce(PP_ERROR_NOINTERFACE);
72 }
73
74 void MediaCodecVideoDecoder::RecyclePicture(
75 const PP_MediaCodec_Picture& picture) {
76 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
77 get_interface<PPB_MediaCodecVideoDecoder_0_1>()->RecyclePicture(
78 pp_resource(), &picture);
79 }
80 }
81
82 int32_t MediaCodecVideoDecoder::Flush(const CompletionCallback& cc) {
83 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
84 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Flush(
85 pp_resource(), cc.pp_completion_callback());
86 }
87 return cc.MayForce(PP_ERROR_NOINTERFACE);
88 }
89
90 int32_t MediaCodecVideoDecoder::Reset(const CompletionCallback& cc) {
91 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
92 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Reset(
93 pp_resource(), cc.pp_completion_callback());
94 }
95 return cc.MayForce(PP_ERROR_NOINTERFACE);
96 }
97
98 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698