OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2016 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_RTP_RTCP_SOURCE_H264_SPS_PARSER_H_ | |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_H264_SPS_PARSER_H_ | |
13 | |
14 #include "webrtc/base/common.h" | |
15 #include "webrtc/base/optional.h" | |
16 | |
17 namespace rtc { | |
18 class BitBuffer; | |
19 } | |
20 | |
21 namespace webrtc { | |
22 | |
23 // A class for parsing out sequence parameter set (SPS) data from an H264 NALU. | |
24 class SpsParser { | |
25 public: | |
26 SpsParser(); | |
noahric
2016/05/18 01:35:07
Yeah, this is really weird now; you use this const
sprang_webrtc
2016/05/20 16:11:00
Acknowledged.
| |
27 SpsParser(const uint8_t* buffer, size_t buffer_length); | |
28 | |
29 // Parses the SPS to completion. Returns true if the SPS was parsed correctly. | |
30 bool Parse(); | |
31 | |
32 // Alternative parsing method, using a supplied BitBuffer where the RBSP | |
33 // decoding has already been performed. Useful if further parsing of the NAL | |
34 // shall follow. | |
35 bool ParseFromRbspDecodedBitBuffer(rtc::BitBuffer* buffer); | |
noahric
2016/05/18 01:35:07
I still think you want to get rid of this. It's st
sprang_webrtc
2016/05/20 16:11:00
Acknowledged.
| |
36 | |
37 // The parsed state of the SPS. Only some select values are stored. | |
38 // Add more as they are actually needed. | |
39 struct SpsState { | |
40 SpsState() = default; | |
41 | |
42 uint32_t width = 0; | |
43 uint32_t height = 0; | |
44 uint32_t delta_pic_order_always_zero_flag = 0; | |
45 uint32_t separate_colour_plane_flag = 0; | |
46 uint32_t frame_mbs_only_flag = 0; | |
47 uint32_t log2_max_frame_num_minus4 = 0; | |
48 uint32_t log2_max_pic_order_cnt_lsb_minus4 = 0; | |
49 uint32_t pic_order_cnt_type = 0; | |
50 uint32_t max_num_ref_frames = 0; | |
51 uint32_t vui_params_present = 0; | |
52 }; | |
53 | |
54 // Get the parsed SPS state. | |
55 const rtc::Optional<SpsState>& GetState() const; | |
56 | |
57 private: | |
58 const uint8_t* const buffer_; | |
59 const size_t buffer_length_; | |
60 rtc::Optional<SpsState> state_; | |
61 }; | |
62 | |
63 } // namespace webrtc | |
64 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_H264_SPS_PARSER_H_ | |
OLD | NEW |