Line data Source code
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 :
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"
22 : #include "webrtc/common_types.h"
23 : #include "webrtc/typedefs.h"
24 :
25 : namespace webrtc {
26 :
27 : // TODO(pbos): Rename EncodedFrame and reformat this class' members.
28 : class EncodedImage {
29 : public:
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 :
36 0 : EncodedImage() : EncodedImage(nullptr, 0, 0) {}
37 :
38 0 : EncodedImage(uint8_t* buffer, size_t length, size_t size)
39 0 : : _buffer(buffer), _length(length), _size(size) {}
40 :
41 : // TODO(kthelgason): get rid of this struct as it only has a single member
42 : // remaining.
43 : struct AdaptReason {
44 0 : AdaptReason() : bw_resolutions_disabled(-1) {}
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.
48 : };
49 : uint32_t _encodedWidth = 0;
50 : uint32_t _encodedHeight = 0;
51 : uint32_t _timeStamp = 0;
52 : // NTP time of the capture time in local timebase in milliseconds.
53 : int64_t ntp_time_ms_ = 0;
54 : int64_t capture_time_ms_ = 0;
55 : FrameType _frameType = kVideoFrameDelta;
56 : uint8_t* _buffer;
57 : size_t _length;
58 : size_t _size;
59 : VideoRotation rotation_ = kVideoRotation_0;
60 : bool _completeFrame = false;
61 : AdaptReason adapt_reason_;
62 : int qp_ = -1; // Quantizer value.
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};
68 : };
69 :
70 : } // namespace webrtc
71 : #endif // WEBRTC_VIDEO_FRAME_H_
|