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

Side by Side Diff: ppapi/thunk/ppb_media_codec_video_decoder_thunk.cc

Issue 210373003: Pepper VideoDecoder API definition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add 'allow_software_fallback' param to Initialize. 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 // From ppb_media_codec_video_decoder.idl modified Wed Apr 23 11:18:26 2014.
6
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_media_codec_video_decoder.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_media_codec_video_decoder_api.h"
14
15 namespace ppapi {
16 namespace thunk {
17
18 namespace {
19
20 PP_Resource Create(PP_Instance instance) {
21 VLOG(4) << "PPB_MediaCodecVideoDecoder::Create()";
22 EnterResourceCreation enter(instance);
23 if (enter.failed())
24 return 0;
25 return enter.functions()->CreateMediaCodecVideoDecoder(instance);
26 }
27
28 PP_Bool IsMediaCodecVideoDecoder(PP_Resource resource) {
29 VLOG(4) << "PPB_MediaCodecVideoDecoder::IsMediaCodecVideoDecoder()";
30 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(resource, false);
31 return PP_FromBool(enter.succeeded());
32 }
33
34 int32_t Initialize(PP_Resource video_decoder,
35 PP_Resource graphics3d_context,
36 PP_MediaCodec_VideoProfile profile,
37 PP_Bool allow_software_fallback,
38 struct PP_CompletionCallback callback) {
39 VLOG(4) << "PPB_MediaCodecVideoDecoder::Initialize()";
40 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder,
41 callback,
42 true);
43 if (enter.failed())
44 return enter.retval();
45 return enter.SetResult(enter.object()->Initialize(graphics3d_context,
46 profile,
47 allow_software_fallback,
48 enter.callback()));
49 }
50
51 int32_t Decode(PP_Resource video_decoder,
52 uint32_t decode_id,
53 uint32_t size,
54 const void* buffer,
55 struct PP_CompletionCallback callback) {
56 VLOG(4) << "PPB_MediaCodecVideoDecoder::Decode()";
57 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder,
58 callback,
59 true);
60 if (enter.failed())
61 return enter.retval();
62 return enter.SetResult(enter.object()->Decode(decode_id,
63 size,
64 buffer,
65 enter.callback()));
66 }
67
68 int32_t GetPicture(PP_Resource video_decoder,
69 struct PP_MediaCodec_Picture* picture,
70 struct PP_CompletionCallback callback) {
71 VLOG(4) << "PPB_MediaCodecVideoDecoder::GetPicture()";
72 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder,
73 callback,
74 true);
75 if (enter.failed())
76 return enter.retval();
77 return enter.SetResult(enter.object()->GetPicture(picture, enter.callback()));
78 }
79
80 void RecyclePicture(PP_Resource video_decoder,
81 const struct PP_MediaCodec_Picture* picture) {
82 VLOG(4) << "PPB_MediaCodecVideoDecoder::RecyclePicture()";
83 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder, true);
84 if (enter.failed())
85 return;
86 enter.object()->RecyclePicture(picture);
87 }
88
89 int32_t Flush(PP_Resource video_decoder,
90 struct PP_CompletionCallback callback) {
91 VLOG(4) << "PPB_MediaCodecVideoDecoder::Flush()";
92 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder,
93 callback,
94 true);
95 if (enter.failed())
96 return enter.retval();
97 return enter.SetResult(enter.object()->Flush(enter.callback()));
98 }
99
100 int32_t Reset(PP_Resource video_decoder,
101 struct PP_CompletionCallback callback) {
102 VLOG(4) << "PPB_MediaCodecVideoDecoder::Reset()";
103 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder,
104 callback,
105 true);
106 if (enter.failed())
107 return enter.retval();
108 return enter.SetResult(enter.object()->Reset(enter.callback()));
109 }
110
111 const PPB_MediaCodecVideoDecoder_0_1 g_ppb_mediacodecvideodecoder_thunk_0_1 = {
112 &Create,
113 &IsMediaCodecVideoDecoder,
114 &Initialize,
115 &Decode,
116 &GetPicture,
117 &RecyclePicture,
118 &Flush,
119 &Reset
120 };
121
122 } // namespace
123
124 PPAPI_THUNK_EXPORT const PPB_MediaCodecVideoDecoder_0_1*
125 GetPPB_MediaCodecVideoDecoder_0_1_Thunk() {
126 return &g_ppb_mediacodecvideodecoder_thunk_0_1;
127 }
128
129 } // namespace thunk
130 } // namespace ppapi
OLDNEW
« ppapi/api/pp_media_codec.idl ('K') | « ppapi/thunk/ppb_media_codec_video_decoder_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698