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

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: Plugin should call RecyclePicture during Flush. 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(
40 const Graphics3D& context,
41 PP_MediaCodec_VideoProfile profile,
42 const CompletionCallback& cc) {
43 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
44 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Initialize(
45 pp_resource(),
46 context.pp_resource(),
47 profile,
48 cc.pp_completion_callback());
49 }
50 return cc.MayForce(PP_ERROR_NOINTERFACE);
51 }
52
53 int32_t MediaCodecVideoDecoder::Decode(
54 uint32_t user_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(),
61 user_id,
62 size,
63 buffer,
64 cc.pp_completion_callback());
65 }
66 return PP_ERROR_NOINTERFACE;
dmichael (off chromium) 2014/04/17 20:23:26 cc.MayForce?
bbudge 2014/04/21 18:14:58 Missed this one. Done.
67 }
68
69 int32_t MediaCodecVideoDecoder::GetPicture(
70 const CompletionCallbackWithOutput<PP_MediaCodec_Picture>& cc) {
71 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
72 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->GetPicture(
73 pp_resource(),
74 cc.output(),
75 cc.pp_completion_callback());
76 }
77 return cc.MayForce(PP_ERROR_NOINTERFACE);
78 }
79
80 void MediaCodecVideoDecoder::RecyclePicture(
81 const PP_MediaCodec_Picture& picture) {
82 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
83 get_interface<PPB_MediaCodecVideoDecoder_0_1>()->RecyclePicture(
84 pp_resource(), &picture);
85 }
86 }
87
88 int32_t MediaCodecVideoDecoder::Flush(const CompletionCallback& cc) {
89 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
90 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Flush(
91 pp_resource(), cc.pp_completion_callback());
92 }
93 return cc.MayForce(PP_ERROR_NOINTERFACE);
94 }
95
96 int32_t MediaCodecVideoDecoder::Reset(const CompletionCallback& cc) {
97 if (has_interface<PPB_MediaCodecVideoDecoder_0_1>()) {
98 return get_interface<PPB_MediaCodecVideoDecoder_0_1>()->Reset(
99 pp_resource(), cc.pp_completion_callback());
100 }
101 return cc.MayForce(PP_ERROR_NOINTERFACE);
102 }
103
104 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698