MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

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 | ( | bool | _implements_tag | ) |
| inline explicit

Definition at line 36 of file EncoderInterface.hxx.

virtual Encoder::~Encoder | ( |  | ) |
| inline virtual

Definition at line 38 of file EncoderInterface.hxx.

## Member Function Documentation

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

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.

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

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.

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

Definition at line 40 of file EncoderInterface.hxx.

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

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.

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.

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

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.

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