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 | #ifndef COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H |
| 12 | #define COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H |
| 13 | |
| 14 | // TextureVideoFrame class |
| 15 | // |
| 16 | // Storing and handling of video frames backed by textures. |
| 17 | |
| 18 | #include "webrtc/common_video/interface/i420_video_frame.h" |
| 19 | #include "webrtc/common_video/interface/native_handle.h" |
| 20 | #include "webrtc/system_wrappers/interface/scoped_refptr.h" |
| 21 | #include "webrtc/typedefs.h" |
| 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | class TextureVideoFrame : public I420VideoFrame { |
| 26 | public: |
| 27 | TextureVideoFrame(NativeHandle* handle, |
| 28 | int width, |
| 29 | int height, |
| 30 | uint32_t timestamp, |
| 31 | int64_t render_time_ms); |
| 32 | virtual ~TextureVideoFrame(); |
| 33 | |
| 34 | // I420VideoFrame implementation |
| 35 | virtual int CreateEmptyFrame(int width, |
| 36 | int height, |
| 37 | int stride_y, |
| 38 | int stride_u, |
| 39 | int stride_v) OVERRIDE; |
| 40 | virtual int 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) OVERRIDE; |
| 51 | virtual int CopyFrame(const I420VideoFrame& videoFrame) OVERRIDE; |
| 52 | virtual void SwapFrame(I420VideoFrame* videoFrame) OVERRIDE; |
| 53 | virtual uint8_t* buffer(PlaneType type) OVERRIDE; |
| 54 | virtual const uint8_t* buffer(PlaneType type) const OVERRIDE; |
| 55 | virtual int allocated_size(PlaneType type) const OVERRIDE; |
| 56 | virtual int stride(PlaneType type) const OVERRIDE; |
| 57 | virtual bool IsZeroSize() const OVERRIDE; |
| 58 | virtual void ResetSize() OVERRIDE; |
| 59 | virtual void* native_handle() const OVERRIDE; |
| 60 | |
| 61 | protected: |
| 62 | virtual int CheckDimensions( |
| 63 | int width, int height, int stride_y, int stride_u, int stride_v) OVERRIDE; |
| 64 | |
| 65 | private: |
| 66 | // An opaque handle that stores the underlying video frame. |
| 67 | scoped_refptr<NativeHandle> handle_; |
| 68 | }; |
| 69 | |
| 70 | } // namespace webrtc |
| 71 | |
| 72 | #endif // COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H |