MPD: Encoder Class Reference

MPD 0.20.18

Public Member Functions
Encoder Class Referenceabstract

`#include <EncoderInterface.hxx>`

Inheritance diagram for Encoder:
[legend]

## Public Member Functions
| Encoder (bool _implements_tag)
virtual | ~Encoder ()
bool | ImplementsTag () const
virtual void | End ()
| Ends the stream: flushes the encoder object, generate an end-of-stream marker (if applicable), make everything which might currently be buffered available by encoder_read(). More...
virtual void | Flush ()
| Flushes an encoder object, make everything which might currently be buffered available by Read(). More...
virtual void | PreTag ()
| Prepare for sending a tag to the encoder. More...
virtual void | SendTag (gcc_unused const Tag &tag)
| Sends a tag to the encoder. More...
virtual void | Write (const void *data, size_t length)=0
| Writes raw PCM data to the encoder. More...
virtual size_t | Read (void *dest, size_t length)=0
| Reads encoded data from the encoder. More...

## Detailed Description

Definition at line 32 of file EncoderInterface.hxx.

## Constructor & Destructor Documentation

## ◆ Encoder()

Encoder::Encoder | ( | bool | _implements_tag | ) |
| inlineexplicit

Definition at line 36 of file EncoderInterface.hxx.

## ◆ ~Encoder()

virtual Encoder::~Encoder | ( |  | ) |
| inlinevirtual

Definition at line 38 of file EncoderInterface.hxx.

## Member Function Documentation

## ◆ End()

virtual void Encoder::End | ( |  | ) |
| inlinevirtual

Ends the stream: flushes the encoder object, generate an end-of-stream marker (if applicable), make everything which might currently be buffered available by encoder_read().

After this function has been called, the encoder may not be usable for more data, and only Read() and Close() can be called.

Throws #std::runtime_error on error.

Definition at line 55 of file EncoderInterface.hxx.

## ◆ Flush()

virtual void Encoder::Flush | ( |  | ) |
| inlinevirtual

Flushes an encoder object, make everything which might currently be buffered available by Read().

Throws #std::runtime_error on error.

Reimplemented in OggEncoder.

Definition at line 64 of file EncoderInterface.hxx.

## ◆ ImplementsTag()

bool Encoder::ImplementsTag | ( |  | ) | const
| inline

Definition at line 40 of file EncoderInterface.hxx.

## ◆ PreTag()

virtual void Encoder::PreTag | ( |  | ) |
| inlinevirtual

Prepare for sending a tag to the encoder.

This is used by some encoders to flush the previous sub-stream, in preparation to begin a new one.

Throws #std::runtime_error on error.

Definition at line 74 of file EncoderInterface.hxx.

## ◆ Read()

virtual size_t Encoder::Read | ( | void * | dest,
|  | size_t | length
| ) |  |
| pure virtual

Reads encoded data from the encoder.

Call this repeatedly until no more data is returned.

Parameters

  dest | the destination buffer to copy to
  length | the maximum length of the destination buffer

Returns
  the number of bytes written to #dest

Implemented in OggEncoder.

## ◆ SendTag()

virtual void Encoder::SendTag | ( | gcc_unused const Tag & | tag | ) |
| inlinevirtual

Sends a tag to the encoder.

Instructions: call PreTag(); then obtain flushed data with Read(); finally call Tag().

Throws #std::runtime_error on error.

Parameters

  tag | the tag object

Definition at line 87 of file EncoderInterface.hxx.

## ◆ Write()

virtual void Encoder::Write | ( | const void * | data,
|  | size_t | length
| ) |  |
| pure virtual

Writes raw PCM data to the encoder.

Throws #std::runtime_error on error.

Parameters

  data | the buffer containing PCM samples
  length | the length of the buffer in bytes

The documentation for this class was generated from the following file:

- encoder/EncoderInterface.hxx