| 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_reader.h" | 5 #include "ppapi/cpp/video_reader.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/ppb_video_reader.h" | 8 #include "ppapi/c/ppb_video_reader.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 VideoReader::VideoReader(const VideoReader& other) | 37 VideoReader::VideoReader(const VideoReader& other) |
| 38 : Resource(other) { | 38 : Resource(other) { |
| 39 } | 39 } |
| 40 | 40 |
| 41 VideoReader::VideoReader(PassRef, PP_Resource resource) | 41 VideoReader::VideoReader(PassRef, PP_Resource resource) |
| 42 : Resource(PASS_REF, resource) { | 42 : Resource(PASS_REF, resource) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 int32_t VideoReader::Open(const std::string& stream_id, | 45 int32_t VideoReader::Open(const Var& stream_id, |
| 46 const CompletionCallback& cc) { | 46 const CompletionCallback& cc) { |
| 47 if (has_interface<PPB_VideoReader_0_1>()) { | 47 if (has_interface<PPB_VideoReader_0_1>()) { |
| 48 Var id(stream_id); | |
| 49 int32_t result = | 48 int32_t result = |
| 50 get_interface<PPB_VideoReader_0_1>()->Open( | 49 get_interface<PPB_VideoReader_0_1>()->Open( |
| 51 pp_resource(), | 50 pp_resource(), |
| 52 id.pp_var(), cc.pp_completion_callback()); | 51 stream_id.pp_var(), cc.pp_completion_callback()); |
| 53 return result; | 52 return result; |
| 54 } | 53 } |
| 55 return cc.MayForce(PP_ERROR_NOINTERFACE); | 54 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 56 } | 55 } |
| 57 | 56 |
| 58 int32_t VideoReader::GetFrame( | 57 int32_t VideoReader::GetFrame( |
| 59 const CompletionCallbackWithOutput<VideoFrame>& cc) { | 58 const CompletionCallbackWithOutput<VideoFrame>& cc) { |
| 60 if (has_interface<PPB_VideoReader_0_1>()) { | 59 if (has_interface<PPB_VideoReader_0_1>()) { |
| 61 return get_interface<PPB_VideoReader_0_1>()->GetFrame( | 60 return get_interface<PPB_VideoReader_0_1>()->GetFrame( |
| 62 pp_resource(), | 61 pp_resource(), |
| 63 cc.output(), cc.pp_completion_callback()); | 62 cc.output(), cc.pp_completion_callback()); |
| 64 } | 63 } |
| 65 return cc.MayForce(PP_ERROR_NOINTERFACE); | 64 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 66 } | 65 } |
| 67 | 66 |
| 68 void VideoReader::Close() { | 67 void VideoReader::Close() { |
| 69 if (has_interface<PPB_VideoReader_0_1>()) { | 68 if (has_interface<PPB_VideoReader_0_1>()) { |
| 70 get_interface<PPB_VideoReader_0_1>()->Close(pp_resource()); | 69 get_interface<PPB_VideoReader_0_1>()->Close(pp_resource()); |
| 71 } | 70 } |
| 72 } | 71 } |
| 73 | 72 |
| 74 } // namespace pp | 73 } // namespace pp |
| OLD | NEW |