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_destination_private.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppb_instance_api.h"
12 #include "ppapi/thunk/ppb_video_destination_private_api.h"
13 #include "ppapi/thunk/resource_creation_api.h"
14 #include "ppapi/thunk/thunk.h"
21 PP_Resource
Create(PP_Instance instance
) {
22 EnterResourceCreation
enter(instance
);
25 return enter
.functions()->CreateVideoDestination(instance
);
28 PP_Bool
IsVideoDestination(PP_Resource resource
) {
29 EnterResource
<PPB_VideoDestination_Private_API
> enter(resource
, false);
30 return PP_FromBool(enter
.succeeded());
33 int32_t Open(PP_Resource destination
,
35 PP_CompletionCallback callback
) {
36 EnterResource
<PPB_VideoDestination_Private_API
> enter(destination
,
39 return enter
.retval();
40 return enter
.SetResult(enter
.object()->Open(stream_url
, enter
.callback()));
43 int32_t PutFrame(PP_Resource destination
,
44 const PP_VideoFrame_Private
* frame
) {
45 EnterResource
<PPB_VideoDestination_Private_API
> enter(destination
, true);
47 return enter
.retval();
48 return enter
.object()->PutFrame(*frame
);
51 void Close(PP_Resource destination
) {
52 EnterResource
<PPB_VideoDestination_Private_API
> enter(destination
, true);
53 if (enter
.succeeded())
54 enter
.object()->Close();
57 const PPB_VideoDestination_Private_0_1
58 g_ppb_video_destination_private_thunk_0_1
= {
68 const PPB_VideoDestination_Private_0_1
*
69 GetPPB_VideoDestination_Private_0_1_Thunk() {
70 return &g_ppb_video_destination_private_thunk_0_1
;