wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include "webrtc/common_video/interface/texture_video_frame.h" |
| 12 | |
| 13 | #include <assert.h> |
| 14 | |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 15 | namespace webrtc { |
| 16 | |
| 17 | TextureVideoFrame::TextureVideoFrame(NativeHandle* handle, |
| 18 | int width, |
| 19 | int height, |
| 20 | uint32_t timestamp, |
| 21 | int64_t render_time_ms) |
| 22 | : handle_(handle) { |
| 23 | set_width(width); |
| 24 | set_height(height); |
| 25 | set_timestamp(timestamp); |
| 26 | set_render_time_ms(render_time_ms); |
| 27 | } |
| 28 | |
| 29 | TextureVideoFrame::~TextureVideoFrame() {} |
| 30 | |
| 31 | int TextureVideoFrame::CreateEmptyFrame(int width, |
| 32 | int height, |
| 33 | int stride_y, |
| 34 | int stride_u, |
| 35 | int stride_v) { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 36 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 37 | return -1; |
| 38 | } |
| 39 | |
| 40 | int TextureVideoFrame::CreateFrame(int size_y, |
| 41 | const uint8_t* buffer_y, |
| 42 | int size_u, |
| 43 | const uint8_t* buffer_u, |
| 44 | int size_v, |
| 45 | const uint8_t* buffer_v, |
| 46 | int width, |
| 47 | int height, |
| 48 | int stride_y, |
| 49 | int stride_u, |
| 50 | int stride_v) { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 51 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 52 | return -1; |
| 53 | } |
| 54 | |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 55 | int TextureVideoFrame::CopyFrame(const I420VideoFrame& videoFrame) { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 56 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 57 | return -1; |
| 58 | } |
| 59 | |
wuchengli@chromium.org | 637c55f | 2014-05-28 07:00:51 +0000 | [diff] [blame] | 60 | I420VideoFrame* TextureVideoFrame::CloneFrame() const { |
| 61 | return new TextureVideoFrame( |
| 62 | handle_, width(), height(), timestamp(), render_time_ms()); |
| 63 | } |
| 64 | |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 65 | void TextureVideoFrame::SwapFrame(I420VideoFrame* videoFrame) { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 66 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | uint8_t* TextureVideoFrame::buffer(PlaneType type) { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 70 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 71 | return NULL; |
| 72 | } |
| 73 | |
| 74 | const uint8_t* TextureVideoFrame::buffer(PlaneType type) const { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 75 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 76 | return NULL; |
| 77 | } |
| 78 | |
| 79 | int TextureVideoFrame::allocated_size(PlaneType type) const { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 80 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 81 | return -1; |
| 82 | } |
| 83 | |
| 84 | int TextureVideoFrame::stride(PlaneType type) const { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 85 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 86 | return -1; |
| 87 | } |
| 88 | |
| 89 | bool TextureVideoFrame::IsZeroSize() const { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 90 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 91 | return true; |
| 92 | } |
| 93 | |
| 94 | void TextureVideoFrame::ResetSize() { |
pbos@webrtc.org | 0fefb10 | 2014-04-07 07:29:18 +0000 | [diff] [blame] | 95 | assert(false); // Should not be called. |
wu@webrtc.org | 9dba525 | 2013-08-05 20:36:57 +0000 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | void* TextureVideoFrame::native_handle() const { return handle_.get(); } |
| 99 | |
| 100 | int TextureVideoFrame::CheckDimensions( |
| 101 | int width, int height, int stride_y, int stride_u, int stride_v) { |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | } // namespace webrtc |