blob: 2d84fc1e6903920f997df44b6df08863dbf057d8 [file] [log] [blame]
Henrik Kjellanderff761fb2015-11-04 08:31:52 +01001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020010#ifndef MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_PARSER_H_
11#define MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_PARSER_H_
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010012
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010014
15namespace webrtc {
16
17struct RTPHeader;
18
19class 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 Bonadei92ea95e2017-09-15 06:47:31 +020043#endif // MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_PARSER_H_