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.
5 #include "ppapi/cpp/private/video_destination_private.h"
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"
19 template <> const char* interface_name
<PPB_VideoDestination_Private_0_1
>() {
20 return PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1
;
25 VideoDestination_Private::VideoDestination_Private() {
28 VideoDestination_Private::VideoDestination_Private(
29 const InstanceHandle
& instance
) {
30 if (!has_interface
<PPB_VideoDestination_Private_0_1
>())
32 PassRefFromConstructor(
33 get_interface
<PPB_VideoDestination_Private_0_1
>()->Create(
34 instance
.pp_instance()));
37 VideoDestination_Private::VideoDestination_Private(
38 const VideoDestination_Private
& other
)
42 VideoDestination_Private::VideoDestination_Private(PassRef
,
44 : Resource(PASS_REF
, resource
) {
47 int32_t VideoDestination_Private::Open(const Var
& stream_url
,
48 const CompletionCallback
& cc
) {
49 if (has_interface
<PPB_VideoDestination_Private_0_1
>()) {
51 get_interface
<PPB_VideoDestination_Private_0_1
>()->Open(
54 cc
.pp_completion_callback());
57 return cc
.MayForce(PP_ERROR_NOINTERFACE
);
60 int32_t VideoDestination_Private::PutFrame(
61 const VideoFrame_Private
& frame
) {
62 if (has_interface
<PPB_VideoDestination_Private_0_1
>()) {
63 return get_interface
<PPB_VideoDestination_Private_0_1
>()->PutFrame(
65 &frame
.pp_video_frame());
67 return PP_ERROR_NOINTERFACE
;
70 void VideoDestination_Private::Close() {
71 if (has_interface
<PPB_VideoDestination_Private_0_1
>()) {
72 get_interface
<PPB_VideoDestination_Private_0_1
>()->Close(pp_resource());