#include <glib.h>
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | encoder |
struct | encoder_plugin |
Functions | |
static void | encoder_struct_init (struct encoder *encoder, const struct encoder_plugin *plugin) |
Initializes an encoder object. | |
static struct encoder * | encoder_init (const struct encoder_plugin *plugin, const struct config_param *param, GError **error) |
Creates a new encoder object. | |
static void | encoder_finish (struct encoder *encoder) |
Frees an encoder object. | |
static bool | encoder_open (struct encoder *encoder, struct audio_format *audio_format, GError **error) |
Opens an encoder object. | |
static void | encoder_close (struct encoder *encoder) |
Closes an encoder object. | |
static bool | encoder_end (struct encoder *encoder, GError **error) |
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(). | |
static bool | encoder_flush (struct encoder *encoder, GError **error) |
Flushes an encoder object, make everything which might currently be buffered available by encoder_read(). | |
static bool | encoder_pre_tag (struct encoder *encoder, GError **error) |
Prepare for sending a tag to the encoder. | |
static bool | encoder_tag (struct encoder *encoder, const struct tag *tag, GError **error) |
Sends a tag to the encoder. | |
static bool | encoder_write (struct encoder *encoder, const void *data, size_t length, GError **error) |
Writes raw PCM data to the encoder. | |
static size_t | encoder_read (struct encoder *encoder, void *dest, size_t length) |
Reads encoded data from the encoder. | |
static const char * | encoder_get_mime_type (struct encoder *encoder) |
Get mime type of encoded content. |
static void encoder_close | ( | struct encoder * | encoder | ) | [inline, static] |
Closes an encoder object.
This disables the encoder, and readies it for reusal by calling encoder_open() again.
Definition at line 153 of file encoder_plugin.h.
static bool encoder_end | ( | struct encoder * | encoder, | |
GError ** | error | |||
) | [inline, static] |
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 encoder_read() and encoder_close() can be called.
encoder | the encoder | |
error | location to store the error occuring, or NULL to ignore errors. |
Definition at line 179 of file encoder_plugin.h.
static void encoder_finish | ( | struct encoder * | encoder | ) | [inline, static] |
Frees an encoder object.
Definition at line 110 of file encoder_plugin.h.
static bool encoder_flush | ( | struct encoder * | encoder, | |
GError ** | error | |||
) | [inline, static] |
Flushes an encoder object, make everything which might currently be buffered available by encoder_read().
encoder | the encoder | |
error | location to store the error occurring, or NULL to ignore errors. |
Definition at line 203 of file encoder_plugin.h.
static const char* encoder_get_mime_type | ( | struct encoder * | encoder | ) | [inline, static] |
Get mime type of encoded content.
plugin | the encoder plugin |
Definition at line 328 of file encoder_plugin.h.
static struct encoder* encoder_init | ( | const struct encoder_plugin * | plugin, | |
const struct config_param * | param, | |||
GError ** | error | |||
) | [static, read] |
Creates a new encoder object.
plugin | the encoder plugin | |
param | optional configuration | |
error | location to store the error occurring, or NULL to ignore errors. |
Definition at line 98 of file encoder_plugin.h.
static bool encoder_open | ( | struct encoder * | encoder, | |
struct audio_format * | audio_format, | |||
GError ** | error | |||
) | [inline, static] |
Opens an encoder object.
You must call this prior to using it. Before you free it, you must call encoder_close(). You may open and close (reuse) one encoder any number of times.
After this function returns successfully and before the first encoder_write() call, you should invoke encoder_read() to obtain the file header.
encoder | the encoder | |
audio_format | the encoder's input audio format; the plugin may modify the struct to adapt it to its abilities | |
error | location to store the error occurring, or NULL to ignore errors. |
Definition at line 133 of file encoder_plugin.h.
static bool encoder_pre_tag | ( | struct encoder * | encoder, | |
GError ** | error | |||
) | [inline, static] |
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.
encoder | the encoder | |
tag | the tag object | |
error | location to store the error occuring, or NULL to ignore errors. |
Definition at line 227 of file encoder_plugin.h.
static size_t encoder_read | ( | struct encoder * | encoder, | |
void * | dest, | |||
size_t | length | |||
) | [inline, static] |
Reads encoded data from the encoder.
Call this repeatedly until no more data is returned.
encoder | the encoder | |
dest | the destination buffer to copy to | |
length | the maximum length of the destination buffer |
Definition at line 306 of file encoder_plugin.h.
static void encoder_struct_init | ( | struct encoder * | encoder, | |
const struct encoder_plugin * | plugin | |||
) | [inline, static] |
Initializes an encoder object.
This should be used by encoder plugins to initialize their base class.
Definition at line 79 of file encoder_plugin.h.
static bool encoder_tag | ( | struct encoder * | encoder, | |
const struct tag * | tag, | |||
GError ** | error | |||
) | [inline, static] |
Instructions: call encoder_pre_tag(); then obtain flushed data with encoder_read(); finally call encoder_tag().
encoder | the encoder | |
tag | the tag object | |
error | location to store the error occurring, or NULL to ignore errors. |
Definition at line 257 of file encoder_plugin.h.
static bool encoder_write | ( | struct encoder * | encoder, | |
const void * | data, | |||
size_t | length, | |||
GError ** | error | |||
) | [inline, static] |
Writes raw PCM data to the encoder.
encoder | the encoder | |
data | the buffer containing PCM samples | |
length | the length of the buffer in bytes | |
error | location to store the error occurring, or NULL to ignore errors. |
Definition at line 284 of file encoder_plugin.h.