blob: 2c625ab57d73073fd329471e18ea1e8598bccc6c [file] [log] [blame]
wu@webrtc.org9dba5252013-08-05 20:36:57 +00001/*
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
23namespace webrtc {
24
25class 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;
wu@webrtc.org9dba5252013-08-05 20:36:57 +000051 virtual int CopyFrame(const I420VideoFrame& videoFrame) OVERRIDE;
wuchengli@chromium.org637c55f2014-05-28 07:00:51 +000052 virtual I420VideoFrame* CloneFrame() const OVERRIDE;
wu@webrtc.org9dba5252013-08-05 20:36:57 +000053 virtual void SwapFrame(I420VideoFrame* videoFrame) OVERRIDE;
54 virtual uint8_t* buffer(PlaneType type) OVERRIDE;
55 virtual const uint8_t* buffer(PlaneType type) const OVERRIDE;
56 virtual int allocated_size(PlaneType type) const OVERRIDE;
57 virtual int stride(PlaneType type) const OVERRIDE;
58 virtual bool IsZeroSize() const OVERRIDE;
59 virtual void ResetSize() OVERRIDE;
60 virtual void* native_handle() const OVERRIDE;
61
62 protected:
63 virtual int CheckDimensions(
64 int width, int height, int stride_y, int stride_u, int stride_v) OVERRIDE;
65
66 private:
67 // An opaque handle that stores the underlying video frame.
68 scoped_refptr<NativeHandle> handle_;
69};
70
71} // namespace webrtc
72
73#endif // COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H