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

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

Issue 365153003: Pepper: add PPB_VideoEncoder interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update API to prevent the user from dealing with buffer management Created 6 years, 5 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
« no previous file with comments | « ppapi/thunk/ppb_video_encoder_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 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 // From ppb_video_encoder.idl modified Thu Jul 10 15:27:41 2014.
6
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_video_encoder.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_video_encoder_api.h"
14
15 namespace ppapi {
16 namespace thunk {
17
18 namespace {
19
20 PP_Resource Create(PP_Instance instance) {
21 VLOG(4) << "PPB_VideoEncoder::Create()";
22 EnterResourceCreation enter(instance);
23 if (enter.failed())
24 return 0;
25 return enter.functions()->CreateVideoEncoder(instance);
26 }
27
28 PP_Bool IsVideoEncoder(PP_Resource resource) {
29 VLOG(4) << "PPB_VideoEncoder::IsVideoEncoder()";
30 EnterResource<PPB_VideoEncoder_API> enter(resource, false);
31 return PP_FromBool(enter.succeeded());
32 }
33
34 int32_t Initialize(PP_Resource video_encoder,
35 PP_Resource graphics3d_context,
36 const struct PP_VideoEncoderParams* params,
37 void* user_data,
38 PPB_VideoEncoder_Ready_Func callback) {
39 VLOG(4) << "PPB_VideoEncoder::Initialize()";
40 EnterResource<PPB_VideoEncoder_API> enter(video_encoder, true);
41 if (enter.failed())
42 return enter.retval();
43 return enter.object()->Initialize(graphics3d_context,
44 params,
45 user_data,
46 callback);
47 }
48
49 int32_t Encode(PP_Resource video_encoder,
50 uint32_t encode_id,
51 const struct PP_VideoEncoderPicture* picture,
52 PP_Bool force_keyframe,
53 struct PP_CompletionCallback callback) {
54 VLOG(4) << "PPB_VideoEncoder::Encode()";
55 EnterResource<PPB_VideoEncoder_API> enter(video_encoder, callback, true);
56 if (enter.failed())
57 return enter.retval();
58 return enter.SetResult(enter.object()->Encode(encode_id,
59 picture,
60 force_keyframe,
61 enter.callback()));
62 }
63
64 int32_t Reset(PP_Resource video_encoder,
65 struct PP_CompletionCallback callback) {
66 VLOG(4) << "PPB_VideoEncoder::Reset()";
67 EnterResource<PPB_VideoEncoder_API> enter(video_encoder, callback, true);
68 if (enter.failed())
69 return enter.retval();
70 return enter.SetResult(enter.object()->Reset(enter.callback()));
71 }
72
73 const PPB_VideoEncoder_0_1 g_ppb_videoencoder_thunk_0_1 = {
74 &Create,
75 &IsVideoEncoder,
76 &Initialize,
77 &Encode,
78 &Reset
79 };
80
81 } // namespace
82
83 PPAPI_THUNK_EXPORT const PPB_VideoEncoder_0_1*
84 GetPPB_VideoEncoder_0_1_Thunk() {
85 return &g_ppb_videoencoder_thunk_0_1;
86 }
87
88 } // namespace thunk
89 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_video_encoder_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698