Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ppapi / thunk / ppb_video_source_private_thunk.cc
bloba2910a5ae5f2cf70aaaa9743b49b9449814f89d9
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"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
20 PP_Resource Create(PP_Instance instance) {
21 EnterResourceCreation enter(instance);
22 if (enter.failed())
23 return 0;
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,
33 PP_Var stream_url,
34 PP_CompletionCallback callback) {
35 EnterResource<PPB_VideoSource_Private_API> enter(source, callback, true);
36 if (enter.failed())
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);
45 if (enter.failed())
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 = {
57 &Create,
58 &IsVideoSource,
59 &Open,
60 &GetFrame,
61 &Close
64 } // namespace
66 const PPB_VideoSource_Private_0_1* GetPPB_VideoSource_Private_0_1_Thunk() {
67 return &g_ppb_video_source_private_thunk_0_1;
70 } // namespace thunk
71 } // namespace ppapi