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 Mon Sep 8 16:40:15 2014.
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()";
40 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
42 return enter
.retval();
43 return enter
.SetResult(enter
.object()->Initialize0_1(graphics3d_context
,
45 allow_software_fallback
,
49 int32_t Initialize(PP_Resource video_decoder
,
50 PP_Resource graphics3d_context
,
51 PP_VideoProfile profile
,
52 PP_HardwareAcceleration acceleration
,
53 struct PP_CompletionCallback callback
) {
54 VLOG(4) << "PPB_VideoDecoder::Initialize()";
55 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
57 return enter
.retval();
58 return enter
.SetResult(enter
.object()->Initialize(graphics3d_context
,
64 int32_t Decode(PP_Resource video_decoder
,
68 struct PP_CompletionCallback callback
) {
69 VLOG(4) << "PPB_VideoDecoder::Decode()";
70 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
72 return enter
.retval();
73 return enter
.SetResult(enter
.object()->Decode(decode_id
,
79 int32_t GetPicture(PP_Resource video_decoder
,
80 struct PP_VideoPicture
* picture
,
81 struct PP_CompletionCallback callback
) {
82 VLOG(4) << "PPB_VideoDecoder::GetPicture()";
83 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
85 return enter
.retval();
86 return enter
.SetResult(enter
.object()->GetPicture(picture
, enter
.callback()));
89 void RecyclePicture(PP_Resource video_decoder
,
90 const struct PP_VideoPicture
* picture
) {
91 VLOG(4) << "PPB_VideoDecoder::RecyclePicture()";
92 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, true);
95 enter
.object()->RecyclePicture(picture
);
98 int32_t Flush(PP_Resource video_decoder
,
99 struct PP_CompletionCallback callback
) {
100 VLOG(4) << "PPB_VideoDecoder::Flush()";
101 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
103 return enter
.retval();
104 return enter
.SetResult(enter
.object()->Flush(enter
.callback()));
107 int32_t Reset(PP_Resource video_decoder
,
108 struct PP_CompletionCallback callback
) {
109 VLOG(4) << "PPB_VideoDecoder::Reset()";
110 EnterResource
<PPB_VideoDecoder_API
> enter(video_decoder
, callback
, true);
112 return enter
.retval();
113 return enter
.SetResult(enter
.object()->Reset(enter
.callback()));
116 const PPB_VideoDecoder_0_1 g_ppb_videodecoder_thunk_0_1
= {
127 const PPB_VideoDecoder_0_2 g_ppb_videodecoder_thunk_0_2
= {
140 PPAPI_THUNK_EXPORT
const PPB_VideoDecoder_0_1
*
141 GetPPB_VideoDecoder_0_1_Thunk() {
142 return &g_ppb_videodecoder_thunk_0_1
;
145 PPAPI_THUNK_EXPORT
const PPB_VideoDecoder_0_2
*
146 GetPPB_VideoDecoder_0_2_Thunk() {
147 return &g_ppb_videodecoder_thunk_0_2
;