| 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/private/video_source_private.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/private/ppb_video_source_private.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" |
| 11 #include "ppapi/cpp/module_impl.h" | 11 #include "ppapi/cpp/module_impl.h" |
| 12 #include "ppapi/cpp/private/video_frame_private.h" |
| 12 #include "ppapi/cpp/var.h" | 13 #include "ppapi/cpp/var.h" |
| 13 #include "ppapi/cpp/video_frame.h" | |
| 14 | 14 |
| 15 namespace pp { | 15 namespace pp { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 template <> const char* interface_name<PPB_VideoReader_0_1>() { | 19 template <> const char* interface_name<PPB_VideoSource_Private_0_1>() { |
| 20 return PPB_VIDEOREADER_INTERFACE_0_1; | 20 return PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1; |
| 21 } | 21 } |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 // VideoReader ----------------------------------------------------------------- | 25 VideoSource_Private::VideoSource_Private() { |
| 26 | |
| 27 VideoReader::VideoReader() { | |
| 28 } | 26 } |
| 29 | 27 |
| 30 VideoReader::VideoReader(const InstanceHandle& instance) { | 28 VideoSource_Private::VideoSource_Private(const InstanceHandle& instance) { |
| 31 if (!has_interface<PPB_VideoReader_0_1>()) | 29 if (!has_interface<PPB_VideoSource_Private_0_1>()) |
| 32 return; | 30 return; |
| 33 PassRefFromConstructor(get_interface<PPB_VideoReader_0_1>()->Create( | 31 PassRefFromConstructor(get_interface<PPB_VideoSource_Private_0_1>()->Create( |
| 34 instance.pp_instance())); | 32 instance.pp_instance())); |
| 35 } | 33 } |
| 36 | 34 |
| 37 VideoReader::VideoReader(const VideoReader& other) | 35 VideoSource_Private::VideoSource_Private(const VideoSource_Private& other) |
| 38 : Resource(other) { | 36 : Resource(other) { |
| 39 } | 37 } |
| 40 | 38 |
| 41 VideoReader::VideoReader(PassRef, PP_Resource resource) | 39 VideoSource_Private::VideoSource_Private(PassRef, PP_Resource resource) |
| 42 : Resource(PASS_REF, resource) { | 40 : Resource(PASS_REF, resource) { |
| 43 } | 41 } |
| 44 | 42 |
| 45 int32_t VideoReader::Open(const Var& stream_id, | 43 int32_t VideoSource_Private::Open(const Var& stream_url, |
| 46 const CompletionCallback& cc) { | 44 const CompletionCallback& cc) { |
| 47 if (has_interface<PPB_VideoReader_0_1>()) { | 45 if (has_interface<PPB_VideoSource_Private_0_1>()) { |
| 48 int32_t result = | 46 int32_t result = |
| 49 get_interface<PPB_VideoReader_0_1>()->Open( | 47 get_interface<PPB_VideoSource_Private_0_1>()->Open( |
| 50 pp_resource(), | 48 pp_resource(), |
| 51 stream_id.pp_var(), cc.pp_completion_callback()); | 49 stream_url.pp_var(), cc.pp_completion_callback()); |
| 52 return result; | 50 return result; |
| 53 } | 51 } |
| 54 return cc.MayForce(PP_ERROR_NOINTERFACE); | 52 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 55 } | 53 } |
| 56 | 54 |
| 57 int32_t VideoReader::GetFrame( | 55 int32_t VideoSource_Private::EmitFrame( |
| 58 const CompletionCallbackWithOutput<VideoFrame>& cc) { | 56 const CompletionCallbackWithOutput<VideoFrame_Private>& cc) { |
| 59 if (has_interface<PPB_VideoReader_0_1>()) { | 57 if (has_interface<PPB_VideoSource_Private_0_1>()) { |
| 60 return get_interface<PPB_VideoReader_0_1>()->GetFrame( | 58 return get_interface<PPB_VideoSource_Private_0_1>()->EmitFrame( |
| 61 pp_resource(), | 59 pp_resource(), |
| 62 cc.output(), cc.pp_completion_callback()); | 60 cc.output(), cc.pp_completion_callback()); |
| 63 } | 61 } |
| 64 return cc.MayForce(PP_ERROR_NOINTERFACE); | 62 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 65 } | 63 } |
| 66 | 64 |
| 67 void VideoReader::Close() { | 65 void VideoSource_Private::Close() { |
| 68 if (has_interface<PPB_VideoReader_0_1>()) { | 66 if (has_interface<PPB_VideoSource_Private_0_1>()) { |
| 69 get_interface<PPB_VideoReader_0_1>()->Close(pp_resource()); | 67 get_interface<PPB_VideoSource_Private_0_1>()->Close(pp_resource()); |
| 70 } | 68 } |
| 71 } | 69 } |
| 72 | 70 |
| 73 } // namespace pp | 71 } // namespace pp |
| OLD | NEW |