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