Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
receiver_port.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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_pipeline/receiver_port.h
10 //! @brief Receiver port pipeline.
11 
12 #ifndef ROC_PIPELINE_RECEIVER_PORT_H_
13 #define ROC_PIPELINE_RECEIVER_PORT_H_
14 
15 #include "roc_core/iallocator.h"
16 #include "roc_core/list_node.h"
17 #include "roc_core/refcnt.h"
18 #include "roc_core/unique_ptr.h"
19 #include "roc_packet/iparser.h"
20 #include "roc_pipeline/config.h"
21 #include "roc_rtp/format_map.h"
22 #include "roc_rtp/parser.h"
23 
24 namespace roc {
25 namespace pipeline {
26 
27 //! Receiver port pipeline.
28 //! @remarks
29 //! Created at the receiver side for every listened port.
30 class ReceiverPort : public core::RefCnt<ReceiverPort>, public core::ListNode {
31 public:
32  //! Initialize.
34  const rtp::FormatMap& format_map,
35  core::IAllocator& allocator);
36 
37  //! Check if the port pipeline was succefully constructed.
38  bool valid() const;
39 
40  //! Get port config.
41  const PortConfig& config() const;
42 
43  //! Try to handle packet on this port.
44  //! @returns
45  //! true if the packet is dedicated for this port
46  bool handle(packet::Packet& packet);
47 
48 private:
49  friend class core::RefCnt<ReceiverPort>;
50 
51  void destroy();
52 
53  core::IAllocator& allocator_;
54 
55  const PortConfig config_;
56 
57  packet::IParser* parser_;
58 
59  core::UniquePtr<rtp::Parser> rtp_parser_;
61 };
62 
63 } // namespace pipeline
64 } // namespace roc
65 
66 #endif // ROC_PIPELINE_RECEIVER_PORT_H_
bool valid() const
Check if the port pipeline was succefully constructed.
Port parameters.
Definition: config.h:56
Memory allocator interface.
Definition: iallocator.h:23
Receiver port pipeline.
Definition: receiver_port.h:30
Pipeline config.
RTP payload format map.
const PortConfig & config() const
Get port config.
Base class for list element.
Definition: list_node.h:26
Root namespace.
Linked list node.
ReceiverPort(const PortConfig &config, const rtp::FormatMap &format_map, core::IAllocator &allocator)
Initialize.
RTP packet parser.
Packet parser interface.
Definition: iparser.h:22
Packet parser interface.
Packet.
Definition: packet.h:35
RTP payload format map.
Definition: format_map.h:22
bool handle(packet::Packet &packet)
Try to handle packet on this port.
Base class for reference countable objects.
Definition: refcnt.h:25
Base class for reference countable objects.
Unique ownrship pointer.
Memory allocator interface.