Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
composer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 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_rtcp/composer.h
10 //! @brief RTCP packet composer.
11 
12 #ifndef ROC_RTCP_COMPOSER_H_
13 #define ROC_RTCP_COMPOSER_H_
14 
15 #include "roc_core/noncopyable.h"
16 #include "roc_packet/icomposer.h"
17 
18 namespace roc {
19 namespace rtcp {
20 
21 //! RTCP packet composer.
22 //!
23 //! @remarks
24 //! Unlike other composers, this one expects that the buffer already contains valid
25 //! RTCP compound packet. The actual composing is done earlier in rtcp::Communicator
26 //! using rtcp::Builder.
27 class Composer : public packet::IComposer, public core::NonCopyable<> {
28 public:
29  //! Initialization.
31 
32  //! Adjust buffer to align payload.
33  virtual bool
34  align(core::Slice<uint8_t>& buffer, size_t header_size, size_t payload_alignment);
35 
36  //! Prepare buffer for composing a packet.
37  virtual bool
38  prepare(packet::Packet& packet, core::Slice<uint8_t>& buffer, size_t payload_size);
39 
40  //! Pad packet.
41  virtual bool pad(packet::Packet& packet, size_t padding_size);
42 
43  //! Compose packet to buffer.
44  virtual bool compose(packet::Packet& packet);
45 };
46 
47 } // namespace rtcp
48 } // namespace roc
49 
50 #endif // ROC_RTCP_COMPOSER_H_
Base class for non-copyable objects.
Definition: noncopyable.h:23
Packet composer interface.
Definition: icomposer.h:22
RTCP packet composer.
Definition: composer.h:27
virtual bool align(core::Slice< uint8_t > &buffer, size_t header_size, size_t payload_alignment)
Adjust buffer to align payload.
virtual bool compose(packet::Packet &packet)
Compose packet to buffer.
Composer()
Initialization.
virtual bool prepare(packet::Packet &packet, core::Slice< uint8_t > &buffer, size_t payload_size)
Prepare buffer for composing a packet.
virtual bool pad(packet::Packet &packet, size_t padding_size)
Pad packet.
Packet composer interface.
Root namespace.
Non-copyable object.