Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2019)

Side by Side Diff: ppapi/thunk/ppb_video_writer_thunk.cc

Issue 13771020: Add Pepper VideoReader and VideoWriter plumbing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "ppapi/c/pp_completion_callback.h"
6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/c/pp_video_frame.h"
8 #include "ppapi/c/ppb_video_writer.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_writer_api.h"
13 #include "ppapi/thunk/resource_creation_api.h"
14 #include "ppapi/thunk/thunk.h"
15
16 namespace ppapi {
17 namespace thunk {
18
19 namespace {
20
21 PP_Resource Create(PP_Instance instance) {
22 EnterResourceCreation enter(instance);
23 if (enter.failed())
24 return 0;
25 return enter.functions()->CreateVideoWriter(instance);
26 }
27
28 PP_Bool IsVideoWriter(PP_Resource resource) {
29 EnterResource<PPB_VideoWriter_API> enter(resource, false);
30 return PP_FromBool(enter.succeeded());
31 }
32
33 int32_t Open(PP_Resource writer,
34 PP_Var* stream_id,
35 PP_CompletionCallback callback) {
36 EnterResource<PPB_VideoWriter_API> enter(writer, callback, true);
37 if (enter.failed())
38 return enter.retval();
39 return enter.SetResult(enter.object()->Open(stream_id, enter.callback()));
40 }
41
42 int32_t PutFrame(PP_Resource writer,
43 const PP_VideoFrame* frame) {
44 EnterResource<PPB_VideoWriter_API> enter(writer, true);
45 if (enter.failed())
46 return enter.retval();
47 return enter.SetResult(enter.object()->PutFrame(*frame));
48 }
49
50 void Close(PP_Resource writer) {
51 EnterResource<PPB_VideoWriter_API> enter(writer, true);
52 if (enter.succeeded())
53 enter.object()->Close();
54 }
55
56 const PPB_VideoWriter_0_1 g_ppb_video_writer_thunk_0_1 = {
57 &Create,
58 &IsVideoWriter,
59 &Open,
60 &PutFrame,
61 &Close
62 };
63
64 } // namespace
65
66 const PPB_VideoWriter_0_1* GetPPB_VideoWriter_0_1_Thunk() {
67 return &g_ppb_video_writer_thunk_0_1;
68 }
69
70 } // namespace thunk
71 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698