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

Side by Side Diff: ppapi/cpp/video_encoder.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/cpp/video_encoder.h ('k') | ppapi/cpp/video_encoder_client.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 #include "ppapi/cpp/video_encoder.h"
6
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_console.h"
9 #include "ppapi/c/ppb_video_encoder.h"
10 #include "ppapi/cpp/completion_callback.h"
11 #include "ppapi/cpp/instance_handle.h"
12 #include "ppapi/cpp/logging.h"
13 #include "ppapi/cpp/module.h"
14 #include "ppapi/cpp/module_impl.h"
15
16
17 namespace pp {
18
19 namespace {
20
21 template <>
22 const char* interface_name<PPB_VideoEncoder_0_1>() {
23 return PPB_VIDEOENCODER_INTERFACE_0_1;
24 }
25
26 } // namespace
27
28 VideoEncoder::VideoEncoder() {
29 }
30
31 VideoEncoder::VideoEncoder(const InstanceHandle& instance) {
32 if (has_interface<PPB_VideoEncoder_0_1>()) {
33 PassRefFromConstructor(
34 get_interface<PPB_VideoEncoder_0_1>()->Create(instance.pp_instance()));
35 }
36 }
37
38 VideoEncoder::VideoEncoder(PP_Resource resource)
39 : Resource(resource) {
40 }
41
42 VideoEncoder::VideoEncoder(const VideoEncoder& other)
43 : Resource(other) {
44 }
45
46 int32_t VideoEncoder::Initialize(
47 const Graphics3D& context,
48 const PP_VideoEncoderParams& params,
49 void* user_data,
50 PPB_VideoEncoder_Ready_Func callback) {
51 if (has_interface<PPB_VideoEncoder_0_1>()) {
52 return get_interface<PPB_VideoEncoder_0_1>()->Initialize(
53 pp_resource(), context.pp_resource(), &params, user_data, callback);
54 }
55 return PP_ERROR_NOINTERFACE;
56 }
57
58 int32_t VideoEncoder::Encode(uint32_t encode_id,
59 const PP_VideoEncoderPicture& picture,
60 const PP_Bool force_keyframe,
61 const CompletionCallback& callback) {
62 if (has_interface<PPB_VideoEncoder_0_1>()) {
63 return get_interface<PPB_VideoEncoder_0_1>()->Encode(
64 pp_resource(), encode_id, &picture, force_keyframe,
65 callback.pp_completion_callback());
66 }
67 return callback.MayForce(PP_ERROR_NOINTERFACE);
68 }
69
70 int32_t VideoEncoder::Reset(const CompletionCallback& callback) {
71 if (has_interface<PPB_VideoEncoder_0_1>()) {
72 return get_interface<PPB_VideoEncoder_0_1>()->Reset(
73 pp_resource(), callback.pp_completion_callback());
74 }
75 return callback.MayForce(PP_ERROR_NOINTERFACE);
76 }
77
78 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/video_encoder.h ('k') | ppapi/cpp/video_encoder_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698