pbos@webrtc.org | ab990ae | 2014-09-17 09:02:25 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 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_VIDEO_FRAME_H_ |
| 12 | #define WEBRTC_VIDEO_FRAME_H_ |
| 13 | |
nisse | af91689 | 2017-01-10 15:44:26 | [diff] [blame] | 14 | // TODO(nisse): This header file should eventually be deleted. For |
| 15 | // declarations of classes related to unencoded video frame, use the |
| 16 | // headers under api/video instead. The EncodedImage class stays in |
| 17 | // this file until we have figured out how to refactor and clean up |
| 18 | // related interfaces. |
| 19 | |
| 20 | #include "webrtc/api/video/video_frame.h" |
| 21 | #include "webrtc/api/video/i420_buffer.h" |
pbos | 22993e1 | 2015-10-19 09:39:06 | [diff] [blame] | 22 | #include "webrtc/common_types.h" |
magjed@webrtc.org | 45cdcce | 2015-03-06 10:41:00 | [diff] [blame] | 23 | #include "webrtc/typedefs.h" |
pbos@webrtc.org | ab990ae | 2014-09-17 09:02:25 | [diff] [blame] | 24 | |
| 25 | namespace webrtc { |
| 26 | |
pbos@webrtc.org | ab990ae | 2014-09-17 09:02:25 | [diff] [blame] | 27 | // TODO(pbos): Rename EncodedFrame and reformat this class' members. |
| 28 | class EncodedImage { |
| 29 | public: |
hbos | d664836 | 2016-01-21 13:43:11 | [diff] [blame] | 30 | static const size_t kBufferPaddingBytesH264; |
| 31 | |
| 32 | // Some decoders require encoded image buffers to be padded with a small |
| 33 | // number of additional bytes (due to over-reading byte readers). |
| 34 | static size_t GetBufferPaddingBytes(VideoCodecType codec_type); |
| 35 | |
pbos@webrtc.org | 4c8b930 | 2015-03-10 12:55:17 | [diff] [blame] | 36 | EncodedImage() : EncodedImage(nullptr, 0, 0) {} |
Per | ba7dc72 | 2016-04-19 13:01:23 | [diff] [blame] | 37 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 | [diff] [blame] | 38 | EncodedImage(uint8_t* buffer, size_t length, size_t size) |
pbos@webrtc.org | 4c8b930 | 2015-03-10 12:55:17 | [diff] [blame] | 39 | : _buffer(buffer), _length(length), _size(size) {} |
pbos@webrtc.org | ab990ae | 2014-09-17 09:02:25 | [diff] [blame] | 40 | |
kthelgason | 0cd27ba | 2016-12-19 14:32:16 | [diff] [blame] | 41 | // TODO(kthelgason): get rid of this struct as it only has a single member |
| 42 | // remaining. |
asapersson | 4306fc7 | 2015-10-19 07:35:21 | [diff] [blame] | 43 | struct AdaptReason { |
kthelgason | 0cd27ba | 2016-12-19 14:32:16 | [diff] [blame] | 44 | AdaptReason() : bw_resolutions_disabled(-1) {} |
asapersson | da535c4 | 2015-10-20 06:32:41 | [diff] [blame] | 45 | int bw_resolutions_disabled; // Number of resolutions that are not sent |
| 46 | // due to bandwidth for this frame. |
| 47 | // Or -1 if information is not provided. |
asapersson | 4306fc7 | 2015-10-19 07:35:21 | [diff] [blame] | 48 | }; |
pbos@webrtc.org | 4c8b930 | 2015-03-10 12:55:17 | [diff] [blame] | 49 | uint32_t _encodedWidth = 0; |
| 50 | uint32_t _encodedHeight = 0; |
| 51 | uint32_t _timeStamp = 0; |
pbos@webrtc.org | ab990ae | 2014-09-17 09:02:25 | [diff] [blame] | 52 | // NTP time of the capture time in local timebase in milliseconds. |
pbos@webrtc.org | 4c8b930 | 2015-03-10 12:55:17 | [diff] [blame] | 53 | int64_t ntp_time_ms_ = 0; |
| 54 | int64_t capture_time_ms_ = 0; |
Peter Boström | 49e196a | 2015-10-23 13:58:18 | [diff] [blame] | 55 | FrameType _frameType = kVideoFrameDelta; |
pbos@webrtc.org | ab990ae | 2014-09-17 09:02:25 | [diff] [blame] | 56 | uint8_t* _buffer; |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 | [diff] [blame] | 57 | size_t _length; |
| 58 | size_t _size; |
Per | ba7dc72 | 2016-04-19 13:01:23 | [diff] [blame] | 59 | VideoRotation rotation_ = kVideoRotation_0; |
pbos@webrtc.org | 4c8b930 | 2015-03-10 12:55:17 | [diff] [blame] | 60 | bool _completeFrame = false; |
asapersson | 4306fc7 | 2015-10-19 07:35:21 | [diff] [blame] | 61 | AdaptReason adapt_reason_; |
asapersson | 86b0160 | 2015-10-21 06:55:26 | [diff] [blame] | 62 | int qp_ = -1; // Quantizer value. |
isheriff | 6b4b5f3 | 2016-06-08 07:24:21 | [diff] [blame] | 63 | |
| 64 | // When an application indicates non-zero values here, it is taken as an |
| 65 | // indication that all future frames will be constrained with those limits |
| 66 | // until the application indicates a change again. |
| 67 | PlayoutDelay playout_delay_ = {-1, -1}; |
pbos@webrtc.org | ab990ae | 2014-09-17 09:02:25 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | } // namespace webrtc |
| 71 | #endif // WEBRTC_VIDEO_FRAME_H_ |