Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
media_description.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 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_sdp/media_description.h
10//! @brief SDP Media Description.
11
12#ifndef ROC_SDP_MEDIA_DESCRIPTION_H_
13#define ROC_SDP_MEDIA_DESCRIPTION_H_
14
16#include "roc_core/list.h"
17#include "roc_core/list_node.h"
18#include "roc_core/log.h"
20#include "roc_core/shared_ptr.h"
26#include "roc_sdp/media_type.h"
27
28namespace roc {
29namespace sdp {
30
31//! SDP media description.
32//! @code
33//! m=<type> <port> <proto> <fmt>
34//! @endcode
36 : public core::RefCounted<MediaDescription, core::StandardAllocation>,
37 public core::ListNode {
39
40public:
41 //! Initialize empty media description
43
44 //! Clear all fields.
45 void clear();
46
47 //! Media type.
48 MediaType type() const;
49
50 //! Transport port.
51 int port() const;
52
53 //! Number of transport port(s).
54 int nb_ports() const;
55
56 //! Transport protocol.
58
59 //! Default media payload id.
60 unsigned default_payload_id() const;
61
62 //! Number of payload ids.
63 size_t nb_payload_ids() const;
64
65 //! Get the payload id that was listed at the i position in the media description.
66 unsigned payload_id(size_t i) const;
67
68 //! Number of connection data.
69 size_t nb_connection_data() const;
70
71 //! Get the reference of the i-th connection data that was listed just after the media
72 //! description.
73 const ConnectionData& connection_data(size_t i) const;
74
75 //! Set media type.
77
78 //! Set proto.
80
81 //! Set transport port.
82 bool set_port(long port);
83
84 //! Set number of transport port(s).
86
87 //! Add a media payload id.
88 bool add_payload_id(unsigned payload_id);
89
90 //! Add a connection field from a string.
91 bool
92 add_connection_data(address::AddrFamily addrtype, const char* str, size_t str_len);
93
94private:
95 MediaType type_;
96 int port_;
97 int nb_ports_;
98 MediaTransport transport_;
99 core::Array<unsigned, 2> payload_ids_;
100
101 core::Array<ConnectionData, 1> connection_data_;
102};
103
104} // namespace sdp
105} // namespace roc
106
107#endif // ROC_SDP_MEDIA_DESCRIPTION_H_
Dynamic array.
Definition array.h:38
Memory allocator interface.
Definition iallocator.h:23
Base class for list element.
Definition list_node.h:26
Base class for reference counted object.
Definition ref_counted.h:39
IAllocator & allocator() const
Get allocator.
SDP connection data field.
SDP media description.
void clear()
Clear all fields.
const ConnectionData & connection_data(size_t i) const
Get the reference of the i-th connection data that was listed just after the media description.
size_t nb_connection_data() const
Number of connection data.
int nb_ports() const
Number of transport port(s).
MediaTransport transport() const
Transport protocol.
bool set_port(long port)
Set transport port.
int port() const
Transport port.
unsigned default_payload_id() const
Default media payload id.
bool add_connection_data(address::AddrFamily addrtype, const char *str, size_t str_len)
Add a connection field from a string.
bool set_type(MediaType type)
Set media type.
size_t nb_payload_ids() const
Number of payload ids.
unsigned payload_id(size_t i) const
Get the payload id that was listed at the i position in the media description.
bool add_payload_id(unsigned payload_id)
Add a media payload id.
bool set_transport(MediaTransport transport)
Set proto.
MediaType type() const
Media type.
MediaDescription(core::IAllocator &allocator)
Initialize empty media description.
bool set_nb_ports(long nb_ports)
Set number of transport port(s).
Connection field in a SDP.
Intrusive doubly-linked list.
Linked list node.
Logging.
SDP media transport protocol.
SDP media description type.
AddrFamily
Address family.
Definition addr_family.h:19
MediaType
Media type.
Definition media_type.h:19
MediaTransport
Media transport protocol.
Root namespace.
Base class for reference counted object.
Shared ownership intrusive pointer.
Socket address.
String buffer.
String builder.
Dynamic list of strings.