OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2011 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_MODULES_VIDEO_CODING_ENCODED_FRAME_H_ | |
12 #define WEBRTC_MODULES_VIDEO_CODING_ENCODED_FRAME_H_ | |
13 | |
14 #pragma message("WARNING: video_coding/main/source is DEPRECATED; use video_codi
ng/ instead.") | |
15 | |
16 #include <vector> | |
17 | |
18 #include "webrtc/common_types.h" | |
19 #include "webrtc/common_video/include/video_image.h" | |
20 #include "webrtc/modules/include/module_common_types.h" | |
21 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | |
22 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | |
23 | |
24 namespace webrtc | |
25 { | |
26 | |
27 class VCMEncodedFrame : protected EncodedImage | |
28 { | |
29 public: | |
30 VCMEncodedFrame(); | |
31 VCMEncodedFrame(const webrtc::EncodedImage& rhs); | |
32 VCMEncodedFrame(const VCMEncodedFrame& rhs); | |
33 | |
34 ~VCMEncodedFrame(); | |
35 /** | |
36 * Delete VideoFrame and resets members to zero | |
37 */ | |
38 void Free(); | |
39 /** | |
40 * Set render time in milliseconds | |
41 */ | |
42 void SetRenderTime(const int64_t renderTimeMs) {_renderTimeMs = renderTimeMs
;} | |
43 | |
44 /** | |
45 * Set the encoded frame size | |
46 */ | |
47 void SetEncodedSize(uint32_t width, uint32_t height) | |
48 { _encodedWidth = width; _encodedHeight = height; } | |
49 /** | |
50 * Get the encoded image | |
51 */ | |
52 const webrtc::EncodedImage& EncodedImage() const | |
53 { return static_cast<const webrtc::EncodedImage&>(*this);
} | |
54 /** | |
55 * Get pointer to frame buffer | |
56 */ | |
57 const uint8_t* Buffer() const {return _buffer;} | |
58 /** | |
59 * Get frame length | |
60 */ | |
61 size_t Length() const {return _length;} | |
62 /** | |
63 * Get frame timestamp (90kHz) | |
64 */ | |
65 uint32_t TimeStamp() const {return _timeStamp;} | |
66 /** | |
67 * Get render time in milliseconds | |
68 */ | |
69 int64_t RenderTimeMs() const {return _renderTimeMs;} | |
70 /** | |
71 * Get frame type | |
72 */ | |
73 webrtc::FrameType FrameType() const { return _frameType; } | |
74 /** | |
75 * Get frame rotation | |
76 */ | |
77 VideoRotation rotation() const { return _rotation; } | |
78 /** | |
79 * True if this frame is complete, false otherwise | |
80 */ | |
81 bool Complete() const { return _completeFrame; } | |
82 /** | |
83 * True if there's a frame missing before this frame | |
84 */ | |
85 bool MissingFrame() const { return _missingFrame; } | |
86 /** | |
87 * Payload type of the encoded payload | |
88 */ | |
89 uint8_t PayloadType() const { return _payloadType; } | |
90 /** | |
91 * Get codec specific info. | |
92 * The returned pointer is only valid as long as the VCMEncodedFrame | |
93 * is valid. Also, VCMEncodedFrame owns the pointer and will delete | |
94 * the object. | |
95 */ | |
96 const CodecSpecificInfo* CodecSpecific() const {return &_codecSpecificInfo;} | |
97 | |
98 const RTPFragmentationHeader* FragmentationHeader() const; | |
99 | |
100 protected: | |
101 /** | |
102 * Verifies that current allocated buffer size is larger than or equal to the
input size. | |
103 * If the current buffer size is smaller, a new allocation is made and the ol
d buffer data | |
104 * is copied to the new buffer. | |
105 * Buffer size is updated to minimumSize. | |
106 */ | |
107 void VerifyAndAllocate(size_t minimumSize); | |
108 | |
109 void Reset(); | |
110 | |
111 void CopyCodecSpecific(const RTPVideoHeader* header); | |
112 | |
113 int64_t _renderTimeMs; | |
114 uint8_t _payloadType; | |
115 bool _missingFrame; | |
116 CodecSpecificInfo _codecSpecificInfo; | |
117 webrtc::VideoCodecType _codec; | |
118 RTPFragmentationHeader _fragmentation; | |
119 VideoRotation _rotation; | |
120 | |
121 // Video rotation is only set along with the last packet for each frame | |
122 // (same as marker bit). This |_rotation_set| is only for debugging purpose | |
123 // to ensure we don't set it twice for a frame. | |
124 bool _rotation_set; | |
125 }; | |
126 | |
127 } // namespace webrtc | |
128 | |
129 #endif // WEBRTC_MODULES_VIDEO_CODING_ENCODED_FRAME_H_ | |
OLD | NEW |