1 // Copyright (c) 2013 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 #include "ppapi/c/pp_completion_callback.h"
6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/c/private/pp_video_frame_private.h"
8 #include "ppapi/c/private/ppb_video_source_private.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppb_video_source_private_api.h"
12 #include "ppapi/thunk/resource_creation_api.h"
13 #include "ppapi/thunk/thunk.h"
20 PP_Resource
Create(PP_Instance instance
) {
21 EnterResourceCreation
enter(instance
);
24 return enter
.functions()->CreateVideoSource(instance
);
27 PP_Bool
IsVideoSource(PP_Resource resource
) {
28 EnterResource
<PPB_VideoSource_Private_API
> enter(resource
, false);
29 return PP_FromBool(enter
.succeeded());
32 int32_t Open(PP_Resource source
,
34 PP_CompletionCallback callback
) {
35 EnterResource
<PPB_VideoSource_Private_API
> enter(source
, callback
, true);
37 return enter
.retval();
38 return enter
.SetResult(enter
.object()->Open(stream_url
, enter
.callback()));
41 int32_t GetFrame(PP_Resource source
,
42 PP_VideoFrame_Private
* frame
,
43 PP_CompletionCallback callback
) {
44 EnterResource
<PPB_VideoSource_Private_API
> enter(source
, callback
, true);
46 return enter
.retval();
47 return enter
.SetResult(enter
.object()->GetFrame(frame
, enter
.callback()));
50 void Close(PP_Resource source
) {
51 EnterResource
<PPB_VideoSource_Private_API
> enter(source
, true);
52 if (enter
.succeeded())
53 enter
.object()->Close();
56 const PPB_VideoSource_Private_0_1 g_ppb_video_source_private_thunk_0_1
= {
66 const PPB_VideoSource_Private_0_1
* GetPPB_VideoSource_Private_0_1_Thunk() {
67 return &g_ppb_video_source_private_thunk_0_1
;