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 */ 10 #ifndef WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_HEADER_PARSER_H_ 11 #define WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_HEADER_PARSER_H_ 12 13 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" 14 #include "webrtc/typedefs.h" 15 16 namespace webrtc { 17 18 struct RTPHeader; 19 20 class RtpHeaderParser { 21 public: 22 static RtpHeaderParser* Create(); 23 virtual ~RtpHeaderParser() {} 24 25 // Returns true if the packet is an RTCP packet, false otherwise. 26 static bool IsRtcp(const uint8_t* packet, int length); 27 28 // Parses the packet and stores the parsed packet in |header|. Returns true on 29 // success, false otherwise. 30 // This method is thread-safe in the sense that it can parse multiple packets 31 // at once. 32 virtual bool Parse(const uint8_t* packet, int 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 43 #endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_HEADER_PARSER_H_ 44