Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
format.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 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_rtp/format.h
10 //! @brief RTP payload format.
11 
12 #ifndef ROC_RTP_FORMAT_H_
13 #define ROC_RTP_FORMAT_H_
14 
17 #include "roc_core/iallocator.h"
18 #include "roc_core/time.h"
19 #include "roc_packet/rtp.h"
20 #include "roc_packet/units.h"
21 #include "roc_rtp/headers.h"
22 
23 namespace roc {
24 namespace rtp {
25 
26 //! RTP payload format.
27 struct Format {
28  //! Payload type.
30 
31  //! Packet flags.
32  unsigned flags;
33 
34  //! Sample rate.
35  size_t sample_rate;
36 
37  //! Channel mask.
39 
40  //! Get number of samples for given payload size.
41  size_t (*get_num_samples)(size_t payload_size);
42 
43  //! Create encoder.
44  audio::IFrameEncoder* (*new_encoder)(core::IAllocator& allocator);
45 
46  //! Create decoder.
47  audio::IFrameDecoder* (*new_decoder)(core::IAllocator& allocator);
48 };
49 
50 } // namespace rtp
51 } // namespace roc
52 
53 #endif // ROC_RTP_FORMAT_H_
Audio frame encoder interface.
packet::channel_mask_t channel_mask
Channel mask.
Definition: format.h:38
Memory allocator interface.
Definition: iallocator.h:23
PayloadType payload_type
Payload type.
Definition: format.h:29
Time definitions.
Root namespace.
Audio frame decoder interface.
RTP payload format.
Definition: format.h:27
uint32_t channel_mask_t
Bitmask of channels present in audio packet.
Definition: units.h:77
RTP headers.
size_t sample_rate
Sample rate.
Definition: format.h:35
Audio frame encoder interface.
Various units used in packets.
size_t(* get_num_samples)(size_t payload_size)
Get number of samples for given payload size.
Definition: format.h:41
PayloadType
RTP payload type.
Definition: headers.h:29
unsigned flags
Packet flags.
Definition: format.h:32
RTP packet.
Audio frame decoder interface.
Memory allocator interface.