1 // Copyright 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_media_stream_video_track.idl modified Thu Sep 18 11:36:39 2014.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_media_stream_video_track.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_stream_video_track_api.h"
20 PP_Resource
Create(PP_Instance instance
) {
21 VLOG(4) << "PPB_MediaStreamVideoTrack::Create()";
22 EnterResourceCreation
enter(instance
);
25 return enter
.functions()->CreateMediaStreamVideoTrack(instance
);
28 PP_Bool
IsMediaStreamVideoTrack(PP_Resource resource
) {
29 VLOG(4) << "PPB_MediaStreamVideoTrack::IsMediaStreamVideoTrack()";
30 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(resource
, false);
31 return PP_FromBool(enter
.succeeded());
34 int32_t Configure(PP_Resource video_track
,
35 const int32_t attrib_list
[],
36 struct PP_CompletionCallback callback
) {
37 VLOG(4) << "PPB_MediaStreamVideoTrack::Configure()";
38 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, callback
,
41 return enter
.retval();
42 return enter
.SetResult(
43 enter
.object()->Configure(attrib_list
, enter
.callback()));
46 int32_t GetAttrib(PP_Resource video_track
,
47 PP_MediaStreamVideoTrack_Attrib attrib
,
49 VLOG(4) << "PPB_MediaStreamVideoTrack::GetAttrib()";
50 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
52 return enter
.retval();
53 return enter
.object()->GetAttrib(attrib
, value
);
56 struct PP_Var
GetId(PP_Resource video_track
) {
57 VLOG(4) << "PPB_MediaStreamVideoTrack::GetId()";
58 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
60 return PP_MakeUndefined();
61 return enter
.object()->GetId();
64 PP_Bool
HasEnded(PP_Resource video_track
) {
65 VLOG(4) << "PPB_MediaStreamVideoTrack::HasEnded()";
66 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
69 return enter
.object()->HasEnded();
72 int32_t GetFrame(PP_Resource video_track
,
74 struct PP_CompletionCallback callback
) {
75 VLOG(4) << "PPB_MediaStreamVideoTrack::GetFrame()";
76 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, callback
,
79 return enter
.retval();
80 return enter
.SetResult(enter
.object()->GetFrame(frame
, enter
.callback()));
83 int32_t RecycleFrame(PP_Resource video_track
, PP_Resource frame
) {
84 VLOG(4) << "PPB_MediaStreamVideoTrack::RecycleFrame()";
85 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
87 return enter
.retval();
88 return enter
.object()->RecycleFrame(frame
);
91 void Close(PP_Resource video_track
) {
92 VLOG(4) << "PPB_MediaStreamVideoTrack::Close()";
93 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
96 enter
.object()->Close();
99 int32_t GetEmptyFrame(PP_Resource video_track
,
101 struct PP_CompletionCallback callback
) {
102 VLOG(4) << "PPB_MediaStreamVideoTrack::GetEmptyFrame()";
103 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, callback
,
106 return enter
.retval();
107 return enter
.SetResult(
108 enter
.object()->GetEmptyFrame(frame
, enter
.callback()));
111 int32_t PutFrame(PP_Resource video_track
, PP_Resource frame
) {
112 VLOG(4) << "PPB_MediaStreamVideoTrack::PutFrame()";
113 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
115 return enter
.retval();
116 return enter
.object()->PutFrame(frame
);
119 const PPB_MediaStreamVideoTrack_0_1 g_ppb_mediastreamvideotrack_thunk_0_1
= {
120 &IsMediaStreamVideoTrack
,
129 const PPB_MediaStreamVideoTrack_1_0 g_ppb_mediastreamvideotrack_thunk_1_0
= {
131 &IsMediaStreamVideoTrack
,
144 PPAPI_THUNK_EXPORT
const PPB_MediaStreamVideoTrack_0_1
*
145 GetPPB_MediaStreamVideoTrack_0_1_Thunk() {
146 return &g_ppb_mediastreamvideotrack_thunk_0_1
;
149 PPAPI_THUNK_EXPORT
const PPB_MediaStreamVideoTrack_1_0
*
150 GetPPB_MediaStreamVideoTrack_1_0_Thunk() {
151 return &g_ppb_mediastreamvideotrack_thunk_1_0
;