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

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: Eliminate GetBitstreamBuffer function. Add 'picture_id' parameter. 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 Thu Apr 10 18:06:08 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 context,
36 PP_MediaCodec_Profile profile,
37 struct PP_CompletionCallback callback) {
38 VLOG(4) << "PPB_MediaCodecVideoDecoder::Initialize()";
39 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder,
40 callback,
41 true);
42 if (enter.failed())
43 return enter.retval();
44 return enter.SetResult(enter.object()->Initialize(context,
45 profile,
46 enter.callback()));
47 }
48
49 int32_t Decode(PP_Resource video_decoder,
50 uint32_t picture_id,
51 uint32_t size,
52 const void* buffer,
53 struct PP_CompletionCallback callback) {
54 VLOG(4) << "PPB_MediaCodecVideoDecoder::Decode()";
55 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder,
56 callback,
57 true);
58 if (enter.failed())
59 return enter.retval();
60 return enter.SetResult(enter.object()->Decode(picture_id,
61 size,
62 buffer,
63 enter.callback()));
64 }
65
66 int32_t GetPictureBuffer(PP_Resource video_decoder,
67 struct PP_MediaCodec_PictureBuffer* picture_buffer,
68 struct PP_CompletionCallback callback) {
69 VLOG(4) << "PPB_MediaCodecVideoDecoder::GetPictureBuffer()";
70 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder,
71 callback,
72 true);
73 if (enter.failed())
74 return enter.retval();
75 return enter.SetResult(enter.object()->GetPictureBuffer(picture_buffer,
76 enter.callback()));
77 }
78
79 void RecyclePictureBuffer(
80 PP_Resource video_decoder,
81 const struct PP_MediaCodec_PictureBuffer* picture_buffer) {
82 VLOG(4) << "PPB_MediaCodecVideoDecoder::RecyclePictureBuffer()";
83 EnterResource<PPB_MediaCodecVideoDecoder_API> enter(video_decoder, true);
84 if (enter.failed())
85 return;
86 enter.object()->RecyclePictureBuffer(picture_buffer);
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 &GetPictureBuffer,
117 &RecyclePictureBuffer,
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/cpp/media_codec_video_decoder.h ('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