blob: 3b0c16c12e8c2681547db0c4815773e54a08ea7a [file] [log] [blame]
pbos@webrtc.orgab990ae2014-09-17 09:02:251/*
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
nisseaf916892017-01-10 15:44:2614// 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"
pbos22993e12015-10-19 09:39:0622#include "webrtc/common_types.h"
magjed@webrtc.org45cdcce2015-03-06 10:41:0023#include "webrtc/typedefs.h"
pbos@webrtc.orgab990ae2014-09-17 09:02:2524
25namespace webrtc {
26
pbos@webrtc.orgab990ae2014-09-17 09:02:2527// TODO(pbos): Rename EncodedFrame and reformat this class' members.
28class EncodedImage {
29 public:
hbosd6648362016-01-21 13:43:1130 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.org4c8b9302015-03-10 12:55:1736 EncodedImage() : EncodedImage(nullptr, 0, 0) {}
Perba7dc722016-04-19 13:01:2337
pkasting@chromium.org4591fbd2014-11-20 22:28:1438 EncodedImage(uint8_t* buffer, size_t length, size_t size)
pbos@webrtc.org4c8b9302015-03-10 12:55:1739 : _buffer(buffer), _length(length), _size(size) {}
pbos@webrtc.orgab990ae2014-09-17 09:02:2540
kthelgason0cd27ba2016-12-19 14:32:1641 // TODO(kthelgason): get rid of this struct as it only has a single member
42 // remaining.
asapersson4306fc72015-10-19 07:35:2143 struct AdaptReason {
kthelgason0cd27ba2016-12-19 14:32:1644 AdaptReason() : bw_resolutions_disabled(-1) {}
asaperssonda535c42015-10-20 06:32:4145 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.
asapersson4306fc72015-10-19 07:35:2148 };
pbos@webrtc.org4c8b9302015-03-10 12:55:1749 uint32_t _encodedWidth = 0;
50 uint32_t _encodedHeight = 0;
51 uint32_t _timeStamp = 0;
pbos@webrtc.orgab990ae2014-09-17 09:02:2552 // NTP time of the capture time in local timebase in milliseconds.
pbos@webrtc.org4c8b9302015-03-10 12:55:1753 int64_t ntp_time_ms_ = 0;
54 int64_t capture_time_ms_ = 0;
Peter Boström49e196a2015-10-23 13:58:1855 FrameType _frameType = kVideoFrameDelta;
pbos@webrtc.orgab990ae2014-09-17 09:02:2556 uint8_t* _buffer;
pkasting@chromium.org4591fbd2014-11-20 22:28:1457 size_t _length;
58 size_t _size;
Perba7dc722016-04-19 13:01:2359 VideoRotation rotation_ = kVideoRotation_0;
pbos@webrtc.org4c8b9302015-03-10 12:55:1760 bool _completeFrame = false;
asapersson4306fc72015-10-19 07:35:2161 AdaptReason adapt_reason_;
asapersson86b01602015-10-21 06:55:2662 int qp_ = -1; // Quantizer value.
isheriff6b4b5f32016-06-08 07:24:2163
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.orgab990ae2014-09-17 09:02:2568};
69
70} // namespace webrtc
71#endif // WEBRTC_VIDEO_FRAME_H_