Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ppapi / thunk / ppb_video_destination_private_thunk.cc
blob325f0bcae23adbfbba8abc31e8737413426603de
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"
16 namespace ppapi {
17 namespace thunk {
19 namespace {
21 PP_Resource Create(PP_Instance instance) {
22 EnterResourceCreation enter(instance);
23 if (enter.failed())
24 return 0;
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,
34 PP_Var stream_url,
35 PP_CompletionCallback callback) {
36 EnterResource<PPB_VideoDestination_Private_API> enter(destination,
37 callback, true);
38 if (enter.failed())
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);
46 if (enter.failed())
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 = {
59 &Create,
60 &IsVideoDestination,
61 &Open,
62 &PutFrame,
63 &Close
66 } // namespace
68 const PPB_VideoDestination_Private_0_1*
69 GetPPB_VideoDestination_Private_0_1_Thunk() {
70 return &g_ppb_video_destination_private_thunk_0_1;
73 } // namespace thunk
74 } // namespace ppapi