OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // Interface of a simple frame buffer containing pixel data. This interface does | 32 // Interface of a simple frame buffer containing pixel data. This interface does |
33 // not contain any frame metadata such as rotation, timestamp, pixel_width, etc. | 33 // not contain any frame metadata such as rotation, timestamp, pixel_width, etc. |
34 class VideoFrameBuffer : public rtc::RefCountInterface { | 34 class VideoFrameBuffer : public rtc::RefCountInterface { |
35 public: | 35 public: |
36 // The resolution of the frame in pixels. For formats where some planes are | 36 // The resolution of the frame in pixels. For formats where some planes are |
37 // subsampled, this is the highest-resolution plane. | 37 // subsampled, this is the highest-resolution plane. |
38 virtual int width() const = 0; | 38 virtual int width() const = 0; |
39 virtual int height() const = 0; | 39 virtual int height() const = 0; |
40 | 40 |
41 // TODO(nisse): For the transition, we use default implementations | |
42 // of the stride and data methods where the new methods calls the | |
43 // old method, and the old method calls the new methods. Subclasses | |
44 // must override either the new methods or the old method, to break | |
45 // infinite recursion. And similarly for the strides. When | |
46 // applications, in particular Chrome, are updated, delete the old | |
47 // method and delete the default implementation of the new methods. | |
48 | |
49 // Returns pointer to the pixel data for a given plane. The memory is owned by | 41 // Returns pointer to the pixel data for a given plane. The memory is owned by |
50 // the VideoFrameBuffer object and must not be freed by the caller. | 42 // the VideoFrameBuffer object and must not be freed by the caller. |
51 virtual const uint8_t* DataY() const; | 43 virtual const uint8_t* DataY() const = 0; |
52 virtual const uint8_t* DataU() const; | 44 virtual const uint8_t* DataU() const = 0; |
53 virtual const uint8_t* DataV() const; | 45 virtual const uint8_t* DataV() const = 0; |
54 // Deprecated method. | |
55 // TODO(nisse): Delete after all users are updated. | |
56 virtual const uint8_t* data(PlaneType type) const; | |
57 | 46 |
58 // TODO(nisse): Move MutableData methods to the I420Buffer subclass. | 47 // TODO(nisse): Move MutableData methods to the I420Buffer subclass. |
59 // Non-const data access. | 48 // Non-const data access. |
60 virtual uint8_t* MutableDataY(); | 49 virtual uint8_t* MutableDataY(); |
61 virtual uint8_t* MutableDataU(); | 50 virtual uint8_t* MutableDataU(); |
62 virtual uint8_t* MutableDataV(); | 51 virtual uint8_t* MutableDataV(); |
63 // Deprecated method. TODO(nisse): Delete after all users are updated. | |
64 virtual uint8_t* MutableData(PlaneType type); | |
65 | 52 |
66 // Returns the number of bytes between successive rows for a given plane. | 53 // Returns the number of bytes between successive rows for a given plane. |
67 virtual int StrideY() const; | 54 virtual int StrideY() const = 0; |
68 virtual int StrideU() const; | 55 virtual int StrideU() const = 0; |
69 virtual int StrideV() const; | 56 virtual int StrideV() const = 0; |
70 // Deprecated method. TODO(nisse): Delete after all users are updated. | |
71 virtual int stride(PlaneType type) const; | |
72 | 57 |
73 // Return the handle of the underlying video frame. This is used when the | 58 // Return the handle of the underlying video frame. This is used when the |
74 // frame is backed by a texture. | 59 // frame is backed by a texture. |
75 virtual void* native_handle() const = 0; | 60 virtual void* native_handle() const = 0; |
76 | 61 |
77 // Returns a new memory-backed frame buffer converted from this buffer's | 62 // Returns a new memory-backed frame buffer converted from this buffer's |
78 // native handle. | 63 // native handle. |
79 virtual rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() = 0; | 64 virtual rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() = 0; |
80 | 65 |
81 protected: | 66 protected: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 const uint8_t* const v_plane_; | 203 const uint8_t* const v_plane_; |
219 const int y_stride_; | 204 const int y_stride_; |
220 const int u_stride_; | 205 const int u_stride_; |
221 const int v_stride_; | 206 const int v_stride_; |
222 rtc::Callback0<void> no_longer_used_cb_; | 207 rtc::Callback0<void> no_longer_used_cb_; |
223 }; | 208 }; |
224 | 209 |
225 } // namespace webrtc | 210 } // namespace webrtc |
226 | 211 |
227 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 212 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
OLD | NEW |