decoder/Client: new interface which wraps struct Decoder

Prepare for a Decoder API redesign based on an abstract class with
virtual methods.
This commit is contained in:
Max Kellermann
2016-11-18 07:13:35 +01:00
parent 595d1942cb
commit fd77acc217
46 changed files with 460 additions and 407 deletions

View File

@@ -27,7 +27,7 @@
#include <stddef.h>
#include <stdint.h>
struct Decoder;
class DecoderClient;
class InputStream;
/**
@@ -36,7 +36,7 @@ class InputStream;
* read it. It will automatically handle shifting the buffer.
*/
class DecoderBuffer {
Decoder *const decoder;
DecoderClient *const client;
InputStream &is;
DynamicFifoBuffer<uint8_t> buffer;
@@ -45,14 +45,14 @@ public:
/**
* Creates a new buffer.
*
* @param _decoder the decoder object, used for decoder_read(),
* @param _client the decoder client, used for decoder_read(),
* may be nullptr
* @param _is the input stream object where we should read from
* @param _size the maximum size of the buffer
*/
DecoderBuffer(Decoder *_decoder, InputStream &_is,
DecoderBuffer(DecoderClient *_client, InputStream &_is,
size_t _size)
:decoder(_decoder), is(_is), buffer(_size) {}
:client(_client), is(_is), buffer(_size) {}
const InputStream &GetStream() const {
return is;