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