OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 |
11 // TODO(nisse): Deprecated, replace cricket::VideoFrame with | |
12 // webrtc::VideoFrame everywhere, then delete this file. See | |
13 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5682. | |
14 | |
15 #ifndef WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
16 #define WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 12 #define WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
17 | 13 |
18 #include "webrtc/video_frame.h" | 14 #include "webrtc/base/basictypes.h" |
| 15 #include "webrtc/base/stream.h" |
| 16 #include "webrtc/common_video/include/video_frame_buffer.h" |
| 17 #include "webrtc/common_video/rotation.h" |
19 | 18 |
20 namespace cricket { | 19 namespace cricket { |
21 | 20 |
22 class VideoFrame : public webrtc::VideoFrame { | 21 // Represents a YUV420 (a.k.a. I420) video frame. |
23 protected: | 22 |
24 VideoFrame() : webrtc::VideoFrame() {} | 23 // TODO(nisse): This class duplicates webrtc::VideoFrame. There's |
25 VideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | 24 // ongoing work to merge the classes. See |
26 webrtc::VideoRotation rotation, | 25 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5682. |
27 int64_t timestamp_us) | 26 class VideoFrame { |
28 : webrtc::VideoFrame(buffer, rotation, timestamp_us) {} | 27 public: |
| 28 VideoFrame() {} |
| 29 virtual ~VideoFrame() {} |
| 30 |
| 31 // Basic accessors. |
| 32 // Note this is the width and height without rotation applied. |
| 33 virtual int width() const = 0; |
| 34 virtual int height() const = 0; |
| 35 |
| 36 // Returns the underlying video frame buffer. This function is ok to call |
| 37 // multiple times, but the returned object will refer to the same memory. |
| 38 virtual const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& |
| 39 video_frame_buffer() const = 0; |
| 40 |
| 41 // Frame ID. Normally RTP timestamp when the frame was received using RTP. |
| 42 virtual uint32_t transport_frame_id() const = 0; |
| 43 |
| 44 // System monotonic clock, same timebase as rtc::TimeMicros(). |
| 45 virtual int64_t timestamp_us() const = 0; |
| 46 virtual void set_timestamp_us(int64_t time_us) = 0; |
| 47 |
| 48 // Indicates the rotation angle in degrees. |
| 49 virtual webrtc::VideoRotation rotation() const = 0; |
| 50 |
| 51 // Tests if sample is valid. Returns true if valid. |
| 52 |
| 53 // TODO(nisse): Deprecated. Should be deleted in the cricket::VideoFrame and |
| 54 // webrtc::VideoFrame merge. Validation of sample_size possibly moved to |
| 55 // libyuv::ConvertToI420. As an initial step, demote this method to protected |
| 56 // status. Used only by WebRtcVideoFrame::Reset. |
| 57 static bool Validate(uint32_t fourcc, |
| 58 int w, |
| 59 int h, |
| 60 const uint8_t* sample, |
| 61 size_t sample_size); |
29 }; | 62 }; |
30 | 63 |
31 } // namespace cricket | 64 } // namespace cricket |
32 | 65 |
33 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 66 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
OLD | NEW |