Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
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
15
#include "
roc_address/socket_addr.h
"
16
#include "
roc_core/attributes.h
"
17
#include "
roc_core/list.h
"
18
#include "
roc_core/list_node.h
"
19
#include "
roc_core/log.h
"
20
#include "
roc_core/ref_counted.h
"
21
#include "
roc_core/shared_ptr.h
"
22
#include "
roc_core/string_buffer.h
"
23
#include "
roc_core/string_builder.h
"
24
#include "
roc_core/string_list.h
"
25
#include "
roc_sdp/connection_data.h
"
26
#include "
roc_sdp/media_transport.h
"
27
#include "
roc_sdp/media_type.h
"
28
29
namespace
roc
{
30
namespace
sdp
{
31
32
//! SDP media description.
33
//! @code
34
//! m=<type> <port> <proto> <fmt>
35
//! @endcode
36
class
MediaDescription
:
public
core::RefCounted
<MediaDescription, core::ArenaAllocation>,
37
public
core::ListNode
<> {
38
public
:
39
//! Initialize empty media description
40
MediaDescription
(
core::IArena
&
arena
);
41
42
//! Clear all fields.
43
void
clear
();
44
45
//! Media type.
46
MediaType
type
()
const
;
47
48
//! Transport port.
49
int
port
()
const
;
50
51
//! Number of transport port(s).
52
int
nb_ports
()
const
;
53
54
//! Transport protocol.
55
MediaTransport
transport
()
const
;
56
57
//! Default media payload id.
58
unsigned
default_payload_id
()
const
;
59
60
//! Number of payload ids.
61
size_t
nb_payload_ids
()
const
;
62
63
//! Get the payload id that was listed at the i position in the media description.
64
unsigned
payload_id
(
size_t
i)
const
;
65
66
//! Number of connection data.
67
size_t
nb_connection_data
()
const
;
68
69
//! Get the reference of the i-th connection data that was listed just after the media
70
//! description.
71
const
ConnectionData
&
connection_data
(
size_t
i)
const
;
72
73
//! Set media type.
74
ROC_ATTR_NODISCARD
bool
set_type
(
MediaType
type
);
75
76
//! Set proto.
77
ROC_ATTR_NODISCARD
bool
set_transport
(
MediaTransport
transport
);
78
79
//! Set transport port.
80
ROC_ATTR_NODISCARD
bool
set_port
(
long
port
);
81
82
//! Set number of transport port(s).
83
ROC_ATTR_NODISCARD
bool
set_nb_ports
(
long
nb_ports
);
84
85
//! Add a media payload id.
86
ROC_ATTR_NODISCARD
bool
add_payload_id
(
unsigned
payload_id
);
87
88
//! Add a connection field from a string.
89
ROC_ATTR_NODISCARD
bool
90
add_connection_data
(
address::AddrFamily
addrtype,
const
char
* str,
size_t
str_len);
91
92
private
:
93
MediaType
type_;
94
int
port_;
95
int
nb_ports_;
96
MediaTransport
transport_;
97
core::Array<unsigned, 2>
payload_ids_;
98
99
core::Array<ConnectionData, 1>
connection_data_;
100
};
101
102
}
// namespace sdp
103
}
// namespace roc
104
105
#endif
// ROC_SDP_MEDIA_DESCRIPTION_H_
attributes.h
Compiler attributes.
ROC_ATTR_NODISCARD
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Definition
attributes.h:31
roc::core::ArenaAllocation::arena
IArena & arena() const
Get arena.
Definition
allocation_policy.h:37
roc::core::Array
Dynamic array.
Definition
array.h:40
roc::core::IArena
Memory arena interface.
Definition
iarena.h:23
roc::core::ListNode
Base class for List element.
Definition
list_node.h:48
roc::core::RefCounted
Base class for object with reference counter.
Definition
ref_counted.h:40
roc::sdp::ConnectionData
SDP connection data field.
Definition
connection_data.h:26
roc::sdp::MediaDescription::clear
void clear()
Clear all fields.
roc::sdp::MediaDescription::connection_data
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.
roc::sdp::MediaDescription::set_port
ROC_ATTR_NODISCARD bool set_port(long port)
Set transport port.
roc::sdp::MediaDescription::nb_connection_data
size_t nb_connection_data() const
Number of connection data.
roc::sdp::MediaDescription::nb_ports
int nb_ports() const
Number of transport port(s).
roc::sdp::MediaDescription::transport
MediaTransport transport() const
Transport protocol.
roc::sdp::MediaDescription::add_payload_id
ROC_ATTR_NODISCARD bool add_payload_id(unsigned payload_id)
Add a media payload id.
roc::sdp::MediaDescription::port
int port() const
Transport port.
roc::sdp::MediaDescription::default_payload_id
unsigned default_payload_id() const
Default media payload id.
roc::sdp::MediaDescription::nb_payload_ids
size_t nb_payload_ids() const
Number of payload ids.
roc::sdp::MediaDescription::payload_id
unsigned payload_id(size_t i) const
Get the payload id that was listed at the i position in the media description.
roc::sdp::MediaDescription::set_type
ROC_ATTR_NODISCARD bool set_type(MediaType type)
Set media type.
roc::sdp::MediaDescription::add_connection_data
ROC_ATTR_NODISCARD bool add_connection_data(address::AddrFamily addrtype, const char *str, size_t str_len)
Add a connection field from a string.
roc::sdp::MediaDescription::set_transport
ROC_ATTR_NODISCARD bool set_transport(MediaTransport transport)
Set proto.
roc::sdp::MediaDescription::type
MediaType type() const
Media type.
roc::sdp::MediaDescription::MediaDescription
MediaDescription(core::IArena &arena)
Initialize empty media description.
roc::sdp::MediaDescription::set_nb_ports
ROC_ATTR_NODISCARD bool set_nb_ports(long nb_ports)
Set number of transport port(s).
connection_data.h
Connection field in a SDP.
list.h
Intrusive doubly-linked list.
list_node.h
Linked list node.
log.h
Logging.
media_transport.h
SDP media transport protocol.
media_type.h
SDP media description type.
roc::address::AddrFamily
AddrFamily
Address family.
Definition
addr_family.h:19
roc::sdp
SDP protocol support.
roc::sdp::MediaType
MediaType
Media type.
Definition
media_type.h:19
roc::sdp::MediaTransport
MediaTransport
Media transport protocol.
Definition
media_transport.h:19
roc
Root namespace.
ref_counted.h
Base class for object with reference counter.
shared_ptr.h
Shared ownership intrusive pointer.
socket_addr.h
Socket address.
string_buffer.h
String buffer.
string_builder.h
String builder.
string_list.h
Dynamic list of strings.
roc_sdp
media_description.h
Generated by
1.17.0