Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 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 | */ |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 10 | #ifndef MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_PARSER_H_ |
| 11 | #define MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_PARSER_H_ |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 14 | |
| 15 | namespace webrtc { |
| 16 | |
| 17 | struct RTPHeader; |
| 18 | |
| 19 | class RtpHeaderParser { |
| 20 | public: |
| 21 | static RtpHeaderParser* Create(); |
| 22 | virtual ~RtpHeaderParser() {} |
| 23 | |
| 24 | // Returns true if the packet is an RTCP packet, false otherwise. |
| 25 | static bool IsRtcp(const uint8_t* packet, size_t length); |
| 26 | |
| 27 | // Parses the packet and stores the parsed packet in |header|. Returns true on |
| 28 | // success, false otherwise. |
| 29 | // This method is thread-safe in the sense that it can parse multiple packets |
| 30 | // at once. |
| 31 | virtual bool Parse(const uint8_t* packet, |
| 32 | size_t length, |
| 33 | RTPHeader* header) const = 0; |
| 34 | |
| 35 | // Registers an RTP header extension and binds it to |id|. |
| 36 | virtual bool RegisterRtpHeaderExtension(RTPExtensionType type, |
| 37 | uint8_t id) = 0; |
| 38 | |
| 39 | // De-registers an RTP header extension. |
| 40 | virtual bool DeregisterRtpHeaderExtension(RTPExtensionType type) = 0; |
| 41 | }; |
| 42 | } // namespace webrtc |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 43 | #endif // MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_PARSER_H_ |