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.
5 // From ppb_video_decoder.idl modified Thu Jan 29 16:28:15 2015.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_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_video_decoder_api.h"
20 PP_Resource
Create(PP_Instance instance
) {
21 VLOG(4) << "PPB_VideoDecoder::Create()";
22 EnterResourceCreation
enter(instance
);
25 return enter
.functions()->CreateVideoDecoder(instance
);
28 PP_Bool
IsVideoDecoder(PP_Resource resource
) {
29 VLOG(4) << "PPB_VideoDecoder::IsVideoDecoder()";
30 EnterResource
<PPB_VideoDecoder_API
> enter(resource
, false);
31 return PP_FromBool(enter
.succeeded());
34 int32_t Initialize_0_1(PP_Resource video_decoder
,
35 PP_Resource graphics3d_context
,
36 PP_VideoProfile profile
,
37 PP_Bool allow_software_fallback
,
38 struct PP_CompletionCallback callback
) {
39 VLOG(4) << "PPB_VideoDecoder::Initialize_0_1()";
40 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
42 return enter
.retval();
43 return enter
.SetResult(enter
.object()->Initialize0_1(
44 graphics3d_context
, profile
, allow_software_fallback
, enter
.callback()));
47 int32_t Initialize(PP_Resource video_decoder
,
48 PP_Resource graphics3d_context
,
49 PP_VideoProfile profile
,
50 PP_HardwareAcceleration acceleration
,
51 struct PP_CompletionCallback callback
) {
52 VLOG(4) << "PPB_VideoDecoder::Initialize()";
53 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
55 return enter
.retval();
56 return enter
.SetResult(enter
.object()->Initialize(
57 graphics3d_context
, profile
, acceleration
, enter
.callback()));
60 int32_t Decode(PP_Resource video_decoder
,
64 struct PP_CompletionCallback callback
) {
65 VLOG(4) << "PPB_VideoDecoder::Decode()";
66 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
68 return enter
.retval();
69 return enter
.SetResult(
70 enter
.object()->Decode(decode_id
, size
, buffer
, enter
.callback()));
73 int32_t GetPicture_0_1(PP_Resource video_decoder
,
74 struct PP_VideoPicture_0_1
* picture
,
75 struct PP_CompletionCallback callback
) {
76 VLOG(4) << "PPB_VideoDecoder::GetPicture_0_1()";
77 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
79 return enter
.retval();
80 return enter
.SetResult(
81 enter
.object()->GetPicture0_1(picture
, enter
.callback()));
84 int32_t GetPicture(PP_Resource video_decoder
,
85 struct PP_VideoPicture
* picture
,
86 struct PP_CompletionCallback callback
) {
87 VLOG(4) << "PPB_VideoDecoder::GetPicture()";
88 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
90 return enter
.retval();
91 return enter
.SetResult(enter
.object()->GetPicture(picture
, enter
.callback()));
94 void RecyclePicture(PP_Resource video_decoder
,
95 const struct PP_VideoPicture
* picture
) {
96 VLOG(4) << "PPB_VideoDecoder::RecyclePicture()";
97 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, true);
100 enter
.object()->RecyclePicture(picture
);
103 int32_t Flush(PP_Resource video_decoder
,
104 struct PP_CompletionCallback callback
) {
105 VLOG(4) << "PPB_VideoDecoder::Flush()";
106 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
108 return enter
.retval();
109 return enter
.SetResult(enter
.object()->Flush(enter
.callback()));
112 int32_t Reset(PP_Resource video_decoder
,
113 struct PP_CompletionCallback callback
) {
114 VLOG(4) << "PPB_VideoDecoder::Reset()";
115 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
117 return enter
.retval();
118 return enter
.SetResult(enter
.object()->Reset(enter
.callback()));
121 const PPB_VideoDecoder_0_1 g_ppb_videodecoder_thunk_0_1
= {&Create
,
130 const PPB_VideoDecoder_0_2 g_ppb_videodecoder_thunk_0_2
= {&Create
,
139 const PPB_VideoDecoder_1_0 g_ppb_videodecoder_thunk_1_0
= {&Create
,
150 PPAPI_THUNK_EXPORT
const PPB_VideoDecoder_0_1
* GetPPB_VideoDecoder_0_1_Thunk() {
151 return &g_ppb_videodecoder_thunk_0_1
;
154 PPAPI_THUNK_EXPORT
const PPB_VideoDecoder_0_2
* GetPPB_VideoDecoder_0_2_Thunk() {
155 return &g_ppb_videodecoder_thunk_0_2
;
158 PPAPI_THUNK_EXPORT
const PPB_VideoDecoder_1_0
* GetPPB_VideoDecoder_1_0_Thunk() {
159 return &g_ppb_videodecoder_thunk_1_0
;