Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
iblock_encoder.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_fec/iblock_encoder.h
10 //! @brief FEC block encoder interface.
11 
12 #ifndef ROC_FEC_IBLOCK_ENCODER_H_
13 #define ROC_FEC_IBLOCK_ENCODER_H_
14 
15 #include "roc_core/slice.h"
16 #include "roc_core/stddefs.h"
17 
18 namespace roc {
19 namespace fec {
20 
21 //! FEC block encoder interface.
23 public:
24  virtual ~IBlockEncoder();
25 
26  //! Get buffer alignment requirement.
27  virtual size_t alignment() const = 0;
28 
29  //! Get the maximum number of encoding symbols for the scheme being used.
30  virtual size_t max_block_length() const = 0;
31 
32  //! Start block.
33  //!
34  //! @remarks
35  //! Performs an initial setup for a block. Should be called before
36  //! any operations for the block.
37  virtual bool begin(size_t sblen, size_t rblen, size_t payload_size) = 0;
38 
39  //! Store source or repair packet buffer for current block.
40  //!
41  //! @pre
42  //! This method may be called only between begin() and end() calls.
43  virtual void set(size_t index, const core::Slice<uint8_t>& buffer) = 0;
44 
45  //! Fill all repair packets in current block.
46  //!
47  //! @pre
48  //! This method may be called only between begin() and end() calls.
49  virtual void fill() = 0;
50 
51  //! Finish block.
52  //!
53  //! @remarks
54  //! Cleanups the resources allocated for the block. Should be called after
55  //! all operations for the block.
56  virtual void end() = 0;
57 };
58 
59 } // namespace fec
60 } // namespace roc
61 
62 #endif // ROC_FEC_IBLOCK_ENCODER_H_
FEC block encoder interface.
virtual size_t alignment() const =0
Get buffer alignment requirement.
virtual void end()=0
Finish block.
virtual bool begin(size_t sblen, size_t rblen, size_t payload_size)=0
Start block.
virtual void fill()=0
Fill all repair packets in current block.
virtual size_t max_block_length() const =0
Get the maximum number of encoding symbols for the scheme being used.
virtual void set(size_t index, const core::Slice< uint8_t > &buffer)=0
Store source or repair packet buffer for current block.
Root namespace.
Slice.
Commonly used types and functions.