src/decoder_api.h File Reference
The MPD Decoder API.
More...
#include "check.h"
#include "decoder_command.h"
#include "decoder_plugin.h"
#include "input_stream.h"
#include "replay_gain_info.h"
#include "tag.h"
#include "audio_format.h"
#include "conf.h"
#include <stdbool.h>
Go to the source code of this file.
Functions |
void | decoder_initialized (struct decoder *decoder, const struct audio_format *audio_format, bool seekable, float total_time) |
| Notify the player thread that it has finished initialization and that it has read the song's meta data.
|
enum decoder_command | decoder_get_command (struct decoder *decoder) |
| Determines the pending decoder command.
|
void | decoder_command_finished (struct decoder *decoder) |
| Called by the decoder when it has performed the requested command (dc->command).
|
double | decoder_seek_where (struct decoder *decoder) |
| Call this when you have received the DECODE_COMMAND_SEEK command.
|
void | decoder_seek_error (struct decoder *decoder) |
| Call this instead of decoder_command_finished() when seeking has failed.
|
size_t | decoder_read (struct decoder *decoder, struct input_stream *is, void *buffer, size_t length) |
| Blocking read from the input stream.
|
void | decoder_timestamp (struct decoder *decoder, double t) |
| Sets the time stamp for the next data chunk [seconds].
|
enum decoder_command | decoder_data (struct decoder *decoder, struct input_stream *is, const void *data, size_t length, uint16_t kbit_rate) |
| This function is called by the decoder plugin when it has successfully decoded block of input data.
|
enum decoder_command | decoder_tag (struct decoder *decoder, struct input_stream *is, const struct tag *tag) |
| This function is called by the decoder plugin when it has successfully decoded a tag.
|
float | decoder_replay_gain (struct decoder *decoder, const struct replay_gain_info *replay_gain_info) |
| Set replay gain values for the following chunks.
|
void | decoder_mixramp (struct decoder *decoder, float replay_gain_db, char *mixramp_start, char *mixramp_end) |
| Store MixRamp tags.
|
Detailed Description
The MPD Decoder API.
This is the public API which is used by decoder plugins to communicate with the mpd core.
Definition in file decoder_api.h.
Function Documentation
void decoder_command_finished |
( |
struct decoder * |
decoder |
) |
|
Called by the decoder when it has performed the requested command (dc->command).
This function resets dc->command and wakes up the player thread.
- Parameters:
-
This function is called by the decoder plugin when it has successfully decoded block of input data.
- Parameters:
-
| decoder | the decoder object |
| is | an input stream which is buffering while we are waiting for the player |
| data | the source buffer |
| length | the number of bytes in the buffer |
- Returns:
- the current command, or DECODE_COMMAND_NONE if there is no command pending
Determines the pending decoder command.
- Parameters:
-
- Returns:
- the current command, or DECODE_COMMAND_NONE if there is no command pending
void decoder_initialized |
( |
struct decoder * |
decoder, |
|
|
const struct audio_format * |
audio_format, |
|
|
bool |
seekable, |
|
|
float |
total_time | |
|
) |
| | |
Notify the player thread that it has finished initialization and that it has read the song's meta data.
- Parameters:
-
void decoder_mixramp |
( |
struct decoder * |
decoder, |
|
|
float |
replay_gain_db, |
|
|
char * |
mixramp_start, |
|
|
char * |
mixramp_end | |
|
) |
| | |
Store MixRamp tags.
- Parameters:
-
| decoder | the decoder object |
| replay_gain_db | the ReplayGain adjustment used for this song |
| mixramp_start | the mixramp_start tag; may be NULL to invalidate |
| mixramp_end | the mixramp_end tag; may be NULL to invalidate |
size_t decoder_read |
( |
struct decoder * |
decoder, |
|
|
struct input_stream * |
is, |
|
|
void * |
buffer, |
|
|
size_t |
length | |
|
) |
| | |
Blocking read from the input stream.
- Parameters:
-
| decoder | the decoder object |
| is | the input stream to read from |
| buffer | the destination buffer |
| length | the maximum number of bytes to read |
- Returns:
- the number of bytes read, or 0 if one of the following occurs: end of file; error; command (like SEEK or STOP).
Set replay gain values for the following chunks.
- Parameters:
-
- Returns:
- the replay gain adjustment used
void decoder_seek_error |
( |
struct decoder * |
decoder |
) |
|
double decoder_seek_where |
( |
struct decoder * |
decoder |
) |
|
Call this when you have received the DECODE_COMMAND_SEEK command.
- Parameters:
-
- Returns:
- the destination position for the week
This function is called by the decoder plugin when it has successfully decoded a tag.
- Parameters:
-
| decoder | the decoder object |
| is | an input stream which is buffering while we are waiting for the player |
| tag | the tag to send |
- Returns:
- the current command, or DECODE_COMMAND_NONE if there is no command pending
void decoder_timestamp |
( |
struct decoder * |
decoder, |
|
|
double |
t | |
|
) |
| | |
Sets the time stamp for the next data chunk [seconds].
The MPD core automatically counts it up, and a decoder plugin only needs to use this function if it thinks that adding to the time stamp based on the buffer size won't work.