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/video_frame.h" |
| 6 |
| 7 #include "ppapi/cpp/module.h" |
| 8 #include "ppapi/cpp/module_impl.h" |
| 9 |
| 10 namespace pp { |
| 11 |
| 12 namespace { |
| 13 |
| 14 template <> const char* interface_name<PPB_VideoFrame_0_1>() { |
| 15 return PPB_VIDEOFRAME_INTERFACE_0_1; |
| 16 } |
| 17 |
| 18 } |
| 19 |
| 20 VideoFrame::VideoFrame() { |
| 21 } |
| 22 |
| 23 VideoFrame::VideoFrame(const VideoFrame& other) : Resource(other) { |
| 24 } |
| 25 |
| 26 VideoFrame::VideoFrame(const Resource& resource) : Resource(resource) { |
| 27 } |
| 28 |
| 29 VideoFrame::VideoFrame(PassRef, PP_Resource resource) |
| 30 : Resource(PASS_REF, resource) { |
| 31 } |
| 32 |
| 33 VideoFrame::~VideoFrame() { |
| 34 } |
| 35 |
| 36 PP_TimeDelta VideoFrame::GetTimestamp() const { |
| 37 PP_TimeDelta timestamp = .0; |
| 38 if (has_interface<PPB_VideoFrame_0_1>()) { |
| 39 timestamp = get_interface<PPB_VideoFrame_0_1>()->GetTimestamp( |
| 40 pp_resource()); |
| 41 } |
| 42 return timestamp; |
| 43 } |
| 44 |
| 45 void VideoFrame::SetTimestamp(PP_TimeDelta timestamp) { |
| 46 if (has_interface<PPB_VideoFrame_0_1>()) |
| 47 get_interface<PPB_VideoFrame_0_1>()->SetTimestamp(pp_resource(), timestamp); |
| 48 } |
| 49 |
| 50 PP_VideoFrame_Format VideoFrame::GetFormat() const { |
| 51 if (has_interface<PPB_VideoFrame_0_1>()) |
| 52 return get_interface<PPB_VideoFrame_0_1>()->GetFormat(pp_resource()); |
| 53 return PP_VIDEOFRAME_FORMAT_UNKNOWN; |
| 54 } |
| 55 |
| 56 bool VideoFrame::GetSize(Size* size) const { |
| 57 if (has_interface<PPB_VideoFrame_0_1>()) |
| 58 return get_interface<PPB_VideoFrame_0_1>()->GetSize(pp_resource(), |
| 59 &size->pp_size()); |
| 60 return false; |
| 61 } |
| 62 |
| 63 void* VideoFrame::GetDataBuffer() { |
| 64 if (has_interface<PPB_VideoFrame_0_1>()) |
| 65 return get_interface<PPB_VideoFrame_0_1>()->GetDataBuffer(pp_resource()); |
| 66 return NULL; |
| 67 } |
| 68 |
| 69 uint32_t VideoFrame::GetDataBufferSize() const { |
| 70 if (has_interface<PPB_VideoFrame_0_1>()) { |
| 71 return get_interface<PPB_VideoFrame_0_1>()->GetDataBufferSize( |
| 72 pp_resource()); |
| 73 } |
| 74 return 0; |
| 75 } |
| 76 |
| 77 } // namespace pp |
OLD | NEW |