1 // Copyright 2014 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/video_frame.h"
7 #include "ppapi/cpp/module.h"
8 #include "ppapi/cpp/module_impl.h"
14 template <> const char* interface_name
<PPB_VideoFrame_0_1
>() {
15 return PPB_VIDEOFRAME_INTERFACE_0_1
;
20 VideoFrame::VideoFrame() {
23 VideoFrame::VideoFrame(const VideoFrame
& other
) : Resource(other
) {
26 VideoFrame::VideoFrame(const Resource
& resource
) : Resource(resource
) {
29 VideoFrame::VideoFrame(PassRef
, PP_Resource resource
)
30 : Resource(PASS_REF
, resource
) {
33 VideoFrame::~VideoFrame() {
36 PP_TimeDelta
VideoFrame::GetTimestamp() const {
37 if (has_interface
<PPB_VideoFrame_0_1
>())
38 return get_interface
<PPB_VideoFrame_0_1
>()->GetTimestamp(pp_resource());
42 void VideoFrame::SetTimestamp(PP_TimeDelta timestamp
) {
43 if (has_interface
<PPB_VideoFrame_0_1
>())
44 get_interface
<PPB_VideoFrame_0_1
>()->SetTimestamp(pp_resource(), timestamp
);
47 PP_VideoFrame_Format
VideoFrame::GetFormat() const {
48 if (has_interface
<PPB_VideoFrame_0_1
>())
49 return get_interface
<PPB_VideoFrame_0_1
>()->GetFormat(pp_resource());
50 return PP_VIDEOFRAME_FORMAT_UNKNOWN
;
53 bool VideoFrame::GetSize(Size
* size
) const {
54 if (has_interface
<PPB_VideoFrame_0_1
>())
55 return PP_ToBool(get_interface
<PPB_VideoFrame_0_1
>()->GetSize(
56 pp_resource(), &size
->pp_size()));
60 void* VideoFrame::GetDataBuffer() {
61 if (has_interface
<PPB_VideoFrame_0_1
>())
62 return get_interface
<PPB_VideoFrame_0_1
>()->GetDataBuffer(pp_resource());
66 uint32_t VideoFrame::GetDataBufferSize() const {
67 if (has_interface
<PPB_VideoFrame_0_1
>()) {
68 return get_interface
<PPB_VideoFrame_0_1
>()->GetDataBufferSize(