Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
format_map.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_rtp/format_map.h
10 //! @brief RTP payload format map.
11 
12 #ifndef ROC_RTP_FORMAT_MAP_H_
13 #define ROC_RTP_FORMAT_MAP_H_
14 
15 #include "roc_core/noncopyable.h"
16 #include "roc_rtp/format.h"
17 
18 namespace roc {
19 namespace rtp {
20 
21 //! RTP payload format map.
22 class FormatMap : public core::NonCopyable<> {
23 public:
24  FormatMap();
25 
26  //! Get format by payload type.
27  //! @returns
28  //! pointer to the format structure or null if there is no format
29  //! registered for this payload type.
30  const Format* format(unsigned int pt) const;
31 
32 private:
33  enum { MaxFormats = 2 };
34 
35  Format formats_[MaxFormats];
36  size_t n_formats_;
37 
38  void add_(const Format& fmt);
39 };
40 
41 } // namespace rtp
42 } // namespace roc
43 
44 #endif // ROC_RTP_FORMAT_MAP_H_
Root namespace.
RTP payload format.
Definition: format.h:27
RTP payload format.
Base class for non-copyable objects.
Definition: noncopyable.h:23
RTP payload format map.
Definition: format_map.h:22
Non-copyable object.
const Format * format(unsigned int pt) const
Get format by payload type.