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

Side by Side Diff: ppapi/cpp/video_writer.cc

Issue 14192054: Rename PPAPI Video Stream APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Straighten out naming confusion, improve comments. 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
« no previous file with comments | « ppapi/cpp/video_writer.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('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) 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/cpp/video_writer.h"
6
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_video_writer.h"
9 #include "ppapi/cpp/instance_handle.h"
10 #include "ppapi/cpp/module.h"
11 #include "ppapi/cpp/module_impl.h"
12 #include "ppapi/cpp/var.h"
13 #include "ppapi/cpp/video_frame.h"
14
15 namespace pp {
16
17 namespace {
18
19 template <> const char* interface_name<PPB_VideoWriter_0_1>() {
20 return PPB_VIDEOWRITER_INTERFACE_0_1;
21 }
22
23 } // namespace
24
25 // VideoWriter -----------------------------------------------------------------
26
27 VideoWriter::VideoWriter() {
28 }
29
30 VideoWriter::VideoWriter(const InstanceHandle& instance) {
31 if (!has_interface<PPB_VideoWriter_0_1>())
32 return;
33 PassRefFromConstructor(get_interface<PPB_VideoWriter_0_1>()->Create(
34 instance.pp_instance()));
35 }
36
37 VideoWriter::VideoWriter(const VideoWriter& other)
38 : Resource(other) {
39 }
40
41 VideoWriter::VideoWriter(PassRef, PP_Resource resource)
42 : Resource(PASS_REF, resource) {
43 }
44
45 int32_t VideoWriter::Open(const CompletionCallbackWithOutput<Var>& cc) {
46 if (has_interface<PPB_VideoWriter_0_1>()) {
47 int32_t result =
48 get_interface<PPB_VideoWriter_0_1>()->Open(
49 pp_resource(),
50 cc.output(), cc.pp_completion_callback());
51 return result;
52 }
53 return cc.MayForce(PP_ERROR_NOINTERFACE);
54 }
55
56 int32_t VideoWriter::PutFrame(const VideoFrame& frame) {
57 if (has_interface<PPB_VideoWriter_0_1>()) {
58 return get_interface<PPB_VideoWriter_0_1>()->PutFrame(
59 pp_resource(),
60 &frame.pp_video_frame());
61 }
62 return PP_ERROR_NOINTERFACE;
63 }
64
65 void VideoWriter::Close() {
66 if (has_interface<PPB_VideoWriter_0_1>()) {
67 get_interface<PPB_VideoWriter_0_1>()->Close(pp_resource());
68 }
69 }
70
71 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/video_writer.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698