Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
encoding.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/encoding.h
10
//! @brief RTP encoding.
11
12
#ifndef ROC_RTP_ENCODING_H_
13
#define ROC_RTP_ENCODING_H_
14
15
#include "
roc_audio/iframe_decoder.h
"
16
#include "
roc_audio/iframe_encoder.h
"
17
#include "
roc_audio/pcm_format.h
"
18
#include "
roc_audio/sample_spec.h
"
19
#include "
roc_core/attributes.h
"
20
#include "
roc_core/iarena.h
"
21
#include "
roc_rtp/headers.h
"
22
23
namespace
roc
{
24
namespace
rtp
{
25
26
//! RTP encoding.
27
struct
Encoding
{
28
//! Payload type.
29
unsigned
int
payload_type
;
30
31
//! Encoding specification.
32
audio::SampleSpec
sample_spec
;
33
34
//! Packet flags.
35
unsigned
packet_flags
;
36
37
//! Create frame encoder.
38
audio::IFrameEncoder
* (*new_encoder)(
core::IArena
& arena,
39
const
audio::SampleSpec
&
sample_spec
);
40
41
//! Create frame decoder.
42
audio::IFrameDecoder
* (*new_decoder)(
core::IArena
& arena,
43
const
audio::SampleSpec
&
sample_spec
);
44
45
//! Initialize.
46
Encoding
()
47
:
payload_type
(0)
48
,
sample_spec
()
49
,
packet_flags
(0)
50
,
new_encoder
(NULL)
51
,
new_decoder
(NULL) {
52
}
53
};
54
55
//! Parse RTP encoding from string.
56
//!
57
//! @remarks
58
//! The input string should have the form:
59
//! - "<id>:<spec>"
60
//!
61
//! Where:
62
//! - "<id>" is payload id, a positive integer
63
//! - "<spec>" is sample spec, in form "<format>/<rate>/<channel>"
64
//!
65
//! See audio::parse_sample_spec() for details on "<spec>" format.
66
//!
67
//! Examples:
68
//! - "55:s16/44100/stereo"
69
//! - "77:f32/96000/20-30"
70
//!
71
//! @returns
72
//! false if string can't be parsed.
73
ROC_ATTR_NODISCARD
bool
parse_encoding
(
const
char
* str,
Encoding
& result);
74
75
}
// namespace rtp
76
}
// namespace roc
77
78
#endif
// ROC_RTP_ENCODING_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::audio::IFrameDecoder
Audio frame decoder interface.
Definition
iframe_decoder.h:24
roc::audio::IFrameEncoder
Audio frame encoder interface.
Definition
iframe_encoder.h:24
roc::audio::SampleSpec
Sample specification. Describes sample rate and channels.
Definition
sample_spec.h:30
roc::core::IArena
Memory arena interface.
Definition
iarena.h:23
iarena.h
Memory arena interface.
iframe_decoder.h
Audio frame decoder interface.
iframe_encoder.h
Audio frame encoder interface.
roc::rtp
RTP protocol support.
roc::rtp::parse_encoding
ROC_ATTR_NODISCARD bool parse_encoding(const char *str, Encoding &result)
Parse RTP encoding from string.
roc
Root namespace.
pcm_format.h
PCM format.
headers.h
RTP headers.
sample_spec.h
Sample specifications.
roc::rtp::Encoding
RTP encoding.
Definition
encoding.h:27
roc::rtp::Encoding::new_encoder
audio::IFrameEncoder *(* new_encoder)(core::IArena &arena, const audio::SampleSpec &sample_spec)
Create frame encoder.
Definition
encoding.h:38
roc::rtp::Encoding::packet_flags
unsigned packet_flags
Packet flags.
Definition
encoding.h:35
roc::rtp::Encoding::sample_spec
audio::SampleSpec sample_spec
Encoding specification.
Definition
encoding.h:32
roc::rtp::Encoding::Encoding
Encoding()
Initialize.
Definition
encoding.h:46
roc::rtp::Encoding::new_decoder
audio::IFrameDecoder *(* new_decoder)(core::IArena &arena, const audio::SampleSpec &sample_spec)
Create frame decoder.
Definition
encoding.h:42
roc::rtp::Encoding::payload_type
unsigned int payload_type
Payload type.
Definition
encoding.h:29
roc_rtp
encoding.h
Generated by
1.17.0