OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2015 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 WEBRTC_API_VIDEO_VIDEO_FRAME_BUFFER_H_ |
| 12 #define WEBRTC_API_VIDEO_VIDEO_FRAME_BUFFER_H_ |
| 13 |
| 14 #include <stdint.h> |
| 15 |
| 16 #include "webrtc/base/refcount.h" |
| 17 #include "webrtc/base/scoped_ref_ptr.h" |
| 18 |
| 19 namespace webrtc { |
| 20 |
| 21 // Interface of a simple frame buffer containing pixel data. This interface does |
| 22 // not contain any frame metadata such as rotation, timestamp, pixel_width, etc. |
| 23 class VideoFrameBuffer : public rtc::RefCountInterface { |
| 24 public: |
| 25 // The resolution of the frame in pixels. For formats where some planes are |
| 26 // subsampled, this is the highest-resolution plane. |
| 27 virtual int width() const = 0; |
| 28 virtual int height() const = 0; |
| 29 |
| 30 // Returns pointer to the pixel data for a given plane. The memory is owned by |
| 31 // the VideoFrameBuffer object and must not be freed by the caller. |
| 32 virtual const uint8_t* DataY() const = 0; |
| 33 virtual const uint8_t* DataU() const = 0; |
| 34 virtual const uint8_t* DataV() const = 0; |
| 35 |
| 36 // Returns the number of bytes between successive rows for a given plane. |
| 37 virtual int StrideY() const = 0; |
| 38 virtual int StrideU() const = 0; |
| 39 virtual int StrideV() const = 0; |
| 40 |
| 41 // Return the handle of the underlying video frame. This is used when the |
| 42 // frame is backed by a texture. |
| 43 virtual void* native_handle() const = 0; |
| 44 |
| 45 // Returns a new memory-backed frame buffer converted from this buffer's |
| 46 // native handle. |
| 47 virtual rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() = 0; |
| 48 |
| 49 protected: |
| 50 ~VideoFrameBuffer() override {} |
| 51 }; |
| 52 |
| 53 } // namespace webrtc |
| 54 |
| 55 #endif // WEBRTC_API_VIDEO_VIDEO_FRAME_BUFFER_H_ |
OLD | NEW |