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 Mon Mar 31 14:40:45 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
,
42 return enter
.retval();
43 return enter
.SetResult(enter
.object()->Configure(attrib_list
,
47 int32_t GetAttrib(PP_Resource video_track
,
48 PP_MediaStreamVideoTrack_Attrib attrib
,
50 VLOG(4) << "PPB_MediaStreamVideoTrack::GetAttrib()";
51 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
53 return enter
.retval();
54 return enter
.object()->GetAttrib(attrib
, value
);
57 struct PP_Var
GetId(PP_Resource video_track
) {
58 VLOG(4) << "PPB_MediaStreamVideoTrack::GetId()";
59 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
61 return PP_MakeUndefined();
62 return enter
.object()->GetId();
65 PP_Bool
HasEnded(PP_Resource video_track
) {
66 VLOG(4) << "PPB_MediaStreamVideoTrack::HasEnded()";
67 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
70 return enter
.object()->HasEnded();
73 int32_t GetFrame(PP_Resource video_track
,
75 struct PP_CompletionCallback callback
) {
76 VLOG(4) << "PPB_MediaStreamVideoTrack::GetFrame()";
77 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
,
81 return enter
.retval();
82 return enter
.SetResult(enter
.object()->GetFrame(frame
, enter
.callback()));
85 int32_t RecycleFrame(PP_Resource video_track
, PP_Resource frame
) {
86 VLOG(4) << "PPB_MediaStreamVideoTrack::RecycleFrame()";
87 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
89 return enter
.retval();
90 return enter
.object()->RecycleFrame(frame
);
93 void Close(PP_Resource video_track
) {
94 VLOG(4) << "PPB_MediaStreamVideoTrack::Close()";
95 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
98 enter
.object()->Close();
101 int32_t GetEmptyFrame(PP_Resource video_track
,
103 struct PP_CompletionCallback callback
) {
104 VLOG(4) << "PPB_MediaStreamVideoTrack::GetEmptyFrame()";
105 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
,
109 return enter
.retval();
110 return enter
.SetResult(enter
.object()->GetEmptyFrame(frame
,
114 int32_t PutFrame(PP_Resource video_track
, PP_Resource frame
) {
115 VLOG(4) << "PPB_MediaStreamVideoTrack::PutFrame()";
116 EnterResource
<PPB_MediaStreamVideoTrack_API
> enter(video_track
, true);
118 return enter
.retval();
119 return enter
.object()->PutFrame(frame
);
122 const PPB_MediaStreamVideoTrack_0_1 g_ppb_mediastreamvideotrack_thunk_0_1
= {
123 &IsMediaStreamVideoTrack
,
133 const PPB_MediaStreamVideoTrack_1_0 g_ppb_mediastreamvideotrack_thunk_1_0
= {
135 &IsMediaStreamVideoTrack
,
149 PPAPI_THUNK_EXPORT
const PPB_MediaStreamVideoTrack_0_1
*
150 GetPPB_MediaStreamVideoTrack_0_1_Thunk() {
151 return &g_ppb_mediastreamvideotrack_thunk_0_1
;
154 PPAPI_THUNK_EXPORT
const PPB_MediaStreamVideoTrack_1_0
*
155 GetPPB_MediaStreamVideoTrack_1_0_Thunk() {
156 return &g_ppb_mediastreamvideotrack_thunk_1_0
;