OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/cpp/video_writer.h" | 5 #include "ppapi/cpp/video_writer.h" |
6 | 6 |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/ppb_video_writer.h" | 8 #include "ppapi/c/ppb_video_writer.h" |
9 #include "ppapi/cpp/instance_handle.h" | 9 #include "ppapi/cpp/instance_handle.h" |
10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 VideoWriter::VideoWriter(const VideoWriter& other) | 37 VideoWriter::VideoWriter(const VideoWriter& other) |
38 : Resource(other) { | 38 : Resource(other) { |
39 } | 39 } |
40 | 40 |
41 VideoWriter::VideoWriter(PassRef, PP_Resource resource) | 41 VideoWriter::VideoWriter(PassRef, PP_Resource resource) |
42 : Resource(PASS_REF, resource) { | 42 : Resource(PASS_REF, resource) { |
43 } | 43 } |
44 | 44 |
45 int32_t VideoWriter::Open(const std::string& stream_id, | 45 int32_t VideoWriter::Open(const CompletionCallbackWithOutput<Var>& cc) { |
46 const CompletionCallback& cc) { | |
47 if (has_interface<PPB_VideoWriter_0_1>()) { | 46 if (has_interface<PPB_VideoWriter_0_1>()) { |
48 Var id(stream_id); | |
49 int32_t result = | 47 int32_t result = |
50 get_interface<PPB_VideoWriter_0_1>()->Open( | 48 get_interface<PPB_VideoWriter_0_1>()->Open( |
51 pp_resource(), | 49 pp_resource(), |
52 id.pp_var(), cc.pp_completion_callback()); | 50 cc.output(), cc.pp_completion_callback()); |
53 return result; | 51 return result; |
54 } | 52 } |
55 return cc.MayForce(PP_ERROR_NOINTERFACE); | 53 return cc.MayForce(PP_ERROR_NOINTERFACE); |
56 } | 54 } |
57 | 55 |
58 int32_t VideoWriter::PutFrame(const VideoFrame& frame) { | 56 int32_t VideoWriter::PutFrame(const VideoFrame& frame) { |
59 if (has_interface<PPB_VideoWriter_0_1>()) { | 57 if (has_interface<PPB_VideoWriter_0_1>()) { |
60 return get_interface<PPB_VideoWriter_0_1>()->PutFrame( | 58 return get_interface<PPB_VideoWriter_0_1>()->PutFrame( |
61 pp_resource(), | 59 pp_resource(), |
62 &frame.pp_video_frame()); | 60 &frame.pp_video_frame()); |
63 } | 61 } |
64 return PP_ERROR_NOINTERFACE; | 62 return PP_ERROR_NOINTERFACE; |
65 } | 63 } |
66 | 64 |
67 void VideoWriter::Close() { | 65 void VideoWriter::Close() { |
68 if (has_interface<PPB_VideoWriter_0_1>()) { | 66 if (has_interface<PPB_VideoWriter_0_1>()) { |
69 get_interface<PPB_VideoWriter_0_1>()->Close(pp_resource()); | 67 get_interface<PPB_VideoWriter_0_1>()->Close(pp_resource()); |
70 } | 68 } |
71 } | 69 } |
72 | 70 |
73 } // namespace pp | 71 } // namespace pp |
OLD | NEW |