Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
parser.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Roc authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_rtp/parser.h
10 //! @brief RTP packet parser.
11 
12 #ifndef ROC_RTP_PARSER_H_
13 #define ROC_RTP_PARSER_H_
14 
15 #include "roc_core/noncopyable.h"
16 #include "roc_packet/iparser.h"
17 #include "roc_rtp/format_map.h"
18 
19 namespace roc {
20 namespace rtp {
21 
22 //! RTP packet parser.
23 class Parser : public packet::IParser, public core::NonCopyable<> {
24 public:
25  //! Initialization.
26  //!
27  //! @b Parameters
28  //! - @p format_map is used to get packet parameters by its
29  //! payload type
30  //! - if @p inner_parser is not NULL, it is used to parse the
31  //! packet payload
32  Parser(const FormatMap& format_map, packet::IParser* inner_parser);
33 
34  //! Parse packet from buffer.
35  virtual bool parse(packet::Packet& packet, const core::Slice<uint8_t>& buffer);
36 
37 private:
38  const FormatMap& format_map_;
39  packet::IParser* inner_parser_;
40 };
41 
42 } // namespace rtp
43 } // namespace roc
44 
45 #endif // ROC_RTP_PARSER_H_
RTP payload format map.
Root namespace.
virtual bool parse(packet::Packet &packet, const core::Slice< uint8_t > &buffer)
Parse packet from buffer.
Packet parser interface.
Definition: iparser.h:22
RTP packet parser.
Definition: parser.h:23
Packet parser interface.
Base class for non-copyable objects.
Definition: noncopyable.h:23
Packet.
Definition: packet.h:35
RTP payload format map.
Definition: format_map.h:22
Non-copyable object.
Parser(const FormatMap &format_map, packet::IParser *inner_parser)
Initialization.