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 Streaming 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_
Base class for non-copyable objects.
Definition: noncopyable.h:23
Packet parser interface.
Definition: iparser.h:22
RTP payload format map. Thread-safe. Returned formats are immutable and can be safely used from any t...
Definition: format_map.h:33
RTP packet parser.
Definition: parser.h:23
Parser(const FormatMap &format_map, packet::IParser *inner_parser)
Initialization.
virtual bool parse(packet::Packet &packet, const core::Slice< uint8_t > &buffer)
Parse packet from buffer.
RTP payload format map.
Packet parser interface.
Root namespace.
Non-copyable object.