libmpdclient 2.22
|
MPD client library. More...
Go to the source code of this file.
Functions | |
bool | mpd_send_current_song (struct mpd_connection *connection) |
struct mpd_song * | mpd_run_current_song (struct mpd_connection *connection) |
bool | mpd_send_play (struct mpd_connection *connection) |
bool | mpd_run_play (struct mpd_connection *connection) |
bool | mpd_send_play_pos (struct mpd_connection *connection, unsigned song_pos) |
bool | mpd_run_play_pos (struct mpd_connection *connection, unsigned song_pos) |
bool | mpd_send_play_id (struct mpd_connection *connection, unsigned song_id) |
bool | mpd_run_play_id (struct mpd_connection *connection, unsigned song_id) |
bool | mpd_send_stop (struct mpd_connection *connection) |
bool | mpd_run_stop (struct mpd_connection *connection) |
bool | mpd_send_toggle_pause (struct mpd_connection *connection) |
bool | mpd_run_toggle_pause (struct mpd_connection *connection) |
bool | mpd_send_pause (struct mpd_connection *connection, bool mode) |
bool | mpd_run_pause (struct mpd_connection *connection, bool mode) |
bool | mpd_send_next (struct mpd_connection *connection) |
bool | mpd_run_next (struct mpd_connection *connection) |
bool | mpd_send_previous (struct mpd_connection *connection) |
bool | mpd_run_previous (struct mpd_connection *connection) |
bool | mpd_send_seek_pos (struct mpd_connection *connection, unsigned song_pos, unsigned t) |
bool | mpd_run_seek_pos (struct mpd_connection *connection, unsigned song_pos, unsigned t) |
bool | mpd_send_seek_id (struct mpd_connection *connection, unsigned song_id, unsigned t) |
bool | mpd_run_seek_id (struct mpd_connection *connection, unsigned song_id, unsigned t) |
bool | mpd_send_seek_id_float (struct mpd_connection *connection, unsigned song_id, float t) |
bool | mpd_run_seek_id_float (struct mpd_connection *connection, unsigned song_id, float t) |
bool | mpd_send_seek_current (struct mpd_connection *connection, float t, bool relative) |
bool | mpd_run_seek_current (struct mpd_connection *connection, float t, bool relative) |
bool | mpd_send_repeat (struct mpd_connection *connection, bool mode) |
bool | mpd_run_repeat (struct mpd_connection *connection, bool mode) |
bool | mpd_send_random (struct mpd_connection *connection, bool mode) |
bool | mpd_run_random (struct mpd_connection *connection, bool mode) |
bool | mpd_send_single_state (struct mpd_connection *connection, enum mpd_single_state state) |
bool | mpd_run_single_state (struct mpd_connection *connection, enum mpd_single_state state) |
bool | mpd_send_single (struct mpd_connection *connection, bool mode) |
bool | mpd_run_single (struct mpd_connection *connection, bool mode) |
bool | mpd_send_consume (struct mpd_connection *connection, bool mode) |
bool | mpd_run_consume (struct mpd_connection *connection, bool mode) |
bool | mpd_send_consume_state (struct mpd_connection *connection, enum mpd_consume_state state) |
bool | mpd_run_consume_state (struct mpd_connection *connection, enum mpd_consume_state state) |
bool | mpd_send_crossfade (struct mpd_connection *connection, unsigned seconds) |
bool | mpd_run_crossfade (struct mpd_connection *connection, unsigned seconds) |
bool | mpd_send_mixrampdb (struct mpd_connection *connection, float db) |
bool | mpd_run_mixrampdb (struct mpd_connection *connection, float db) |
bool | mpd_send_mixrampdelay (struct mpd_connection *connection, float seconds) |
bool | mpd_run_mixrampdelay (struct mpd_connection *connection, float seconds) |
bool | mpd_send_clearerror (struct mpd_connection *connection) |
bool | mpd_run_clearerror (struct mpd_connection *connection) |
MPD client library.
Controlling playback.
Do not include this header directly. Use mpd/client.h instead.
Definition in file player.h.
bool mpd_send_current_song | ( | struct mpd_connection * | connection | ) |
There are two ways to address songs within the queue: by their position and by their id. The position is a 0-based index. It is unstable by design: if you move, delete or insert songs, all following indices will change, and a client can never be sure what song is behind a given index/position.
Song ids on the other hand are stable: an id is assigned to a song when it is added, and will stay the same, no matter how much it is moved around. Adding the same song twice will assign different ids to them, and a deleted-and-readded song will have a new id. This way, a client can always be sure the correct song is being used.
Many commands come in two flavors, one for each address type. Whenever possible, ids should be used. Fetches the currently selected song (the song referenced by mpd_status_get_song_id()). Call mpd_recv_song() to receive the response.
connection | the connection to MPD |
struct mpd_song * mpd_run_current_song | ( | struct mpd_connection * | connection | ) |
Shortcut for mpd_send_current_song() and mpd_recv_song().
connection | the connection to MPD |
bool mpd_send_play | ( | struct mpd_connection * | connection | ) |
Starts playing the current song from the beginning.
connection | the connection to MPD |
bool mpd_run_play | ( | struct mpd_connection * | connection | ) |
Shortcut for mpd_send_play() and mpd_response_finish().
connection | the connection to MPD |
bool mpd_send_play_pos | ( | struct mpd_connection * | connection, |
unsigned | song_pos | ||
) |
Starts playing the specified song from the beginning.
connection | the connection to MPD |
song_pos | the position of the song in the queue |
bool mpd_run_play_pos | ( | struct mpd_connection * | connection, |
unsigned | song_pos | ||
) |
Shortcut for mpd_send_play() and mpd_response_finish().
connection | the connection to MPD |
song_pos | the position of the song in the queue |
bool mpd_send_play_id | ( | struct mpd_connection * | connection, |
unsigned | song_id | ||
) |
Starts playing the specified song from the beginning.
connection | the connection to MPD |
song_id | the id of the song |
bool mpd_run_play_id | ( | struct mpd_connection * | connection, |
unsigned | song_id | ||
) |
Shortcut for mpd_send_play_id() and mpd_response_finish().
connection | the connection to MPD |
song_id | the id of the song |
bool mpd_send_stop | ( | struct mpd_connection * | connection | ) |
Stops playing the current song.
connection | the connection to MPD |
bool mpd_run_stop | ( | struct mpd_connection * | connection | ) |
Shortcut for mpd_send_stop() and mpd_response_finish().
connection | the connection to MPD |
bool mpd_send_toggle_pause | ( | struct mpd_connection * | connection | ) |
This function uses a deprecated feature of MPD, you should avoid it.
Toggles the pause mode by sending "pause" without arguments.
connection | the connection to MPD |
bool mpd_run_toggle_pause | ( | struct mpd_connection * | connection | ) |
This function uses a deprecated feature of MPD, you should avoid it. Shortcut for mpd_send_toggle_pause() and mpd_response_finish().
connection | the connection to MPD |
bool mpd_send_pause | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Pauses/Resumes playing the current song. If mode is true, MPD pauses the song; otherwise, MPD resumes the song.
connection | the connection to MPD |
mode | if true: pause, if false: resume |
bool mpd_run_pause | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Shortcut for mpd_send_pause() and mpd_response_finish().
connection | the connection to MPD |
mode | if true: pause, if false: resume |
bool mpd_send_next | ( | struct mpd_connection * | connection | ) |
Play the next song in the playlist.
connection | the connection to MPD |
bool mpd_run_next | ( | struct mpd_connection * | connection | ) |
Shortcut for mpd_send_next() and mpd_response_finish().
connection | the connection to MPD |
bool mpd_send_previous | ( | struct mpd_connection * | connection | ) |
Play the previous song in the playlist.
connection | the connection to MPD |
bool mpd_run_previous | ( | struct mpd_connection * | connection | ) |
Shortcut for mpd_send_previous() and mpd_response_finish().
connection | the connection to MPD |
bool mpd_send_seek_pos | ( | struct mpd_connection * | connection, |
unsigned | song_pos, | ||
unsigned | t | ||
) |
Seeks to the position t (in seconds) of position song_pos in the playlist.
connection | the connection to MPD |
song_pos | the position of the song in the queue |
t | the position within the song, in seconds |
bool mpd_run_seek_pos | ( | struct mpd_connection * | connection, |
unsigned | song_pos, | ||
unsigned | t | ||
) |
Shortcut for mpd_send_seek_pos() and mpd_response_finish().
connection | the connection to MPD |
song_pos | the position of the song in the queue |
t | the position within the song, in seconds |
bool mpd_send_seek_id | ( | struct mpd_connection * | connection, |
unsigned | song_id, | ||
unsigned | t | ||
) |
Seeks to the position t (in seconds) of song id song_id.
connection | the connection to MPD |
song_id | the id of the song |
t | the position within the song, in seconds |
bool mpd_run_seek_id | ( | struct mpd_connection * | connection, |
unsigned | song_id, | ||
unsigned | t | ||
) |
Shortcut for mpd_send_seek_id() and mpd_response_finish().
connection | the connection to MPD |
song_id | the id of the song |
t | the position within the song, in seconds |
bool mpd_send_seek_id_float | ( | struct mpd_connection * | connection, |
unsigned | song_id, | ||
float | t | ||
) |
Seeks to the position t (in seconds; fractions allowed) of song id song_id.
connection | the connection to MPD |
song_id | the id of the song |
t | the position within the song, in seconds (fractions allowed) |
bool mpd_run_seek_id_float | ( | struct mpd_connection * | connection, |
unsigned | song_id, | ||
float | t | ||
) |
Shortcut for mpd_send_seek_id_float() and mpd_response_finish().
connection | the connection to MPD |
song_id | the id of the song |
t | the position within the song, in seconds (fractions allowed) |
bool mpd_send_seek_current | ( | struct mpd_connection * | connection, |
float | t, | ||
bool | relative | ||
) |
Seeks the current song.
connection | the connection to MPD |
t | the position within the song, in seconds |
relative | true makes #t a relative to the current position |
bool mpd_run_seek_current | ( | struct mpd_connection * | connection, |
float | t, | ||
bool | relative | ||
) |
Shortcut for mpd_send_seek_current() and mpd_response_finish().
connection | the connection to MPD |
t | the new position (in seconds) |
relative | true to seek relative to the current position and false to seek to an absolute time stamp within the song |
bool mpd_send_repeat | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Sets repeat on/off for the current song. If mode is true, MPD repeats the song; otherwise, MPD does not repeat the song.
connection | the connection to MPD |
mode | if true: repeat, if false: do not repeat |
bool mpd_run_repeat | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Shortcut for mpd_send_repeat() and mpd_response_finish().
connection | the connection to MPD |
mode | if true: pause, if false: resume |
bool mpd_send_random | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Sets random mode on/off for the queue. If mode is true, MPD enables random mode; otherwise, MPD disables random mode.
connection | the connection to MPD |
mode | if true: enable random mode, if false: disable random mode |
bool mpd_run_random | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Shortcut for mpd_send_random() and mpd_response_finish().
connection | the connection to MPD |
mode | if true: enable random mode, if false: disable random mode |
bool mpd_send_single_state | ( | struct mpd_connection * | connection, |
enum mpd_single_state | state | ||
) |
Sets single state for the playlist. If state is MPD_SINGLE_ON, MPD enables single mode: playback is stopped after current song, or song is repeated if the repeat mode is enabled.
If state is MPD_SINGLE_OFF, MPD disables single mode: if random mode is enabled, the playlist order is shuffled after it is played completely.
If state is MPD_SINGLE_ONESHOT, MPD enables single mode temporarily: single mode is disabled (MPD_SINGLE_OFF) after a song has been played and there is another song in the current playlist.
connection | the connection to MPD |
state | the desired single mode state |
bool mpd_run_single_state | ( | struct mpd_connection * | connection, |
enum mpd_single_state | state | ||
) |
Shortcut for mpd_send_single_state() and mpd_response_finish().
connection | the connection to MPD |
state | the desired single mode state |
bool mpd_send_single | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Sets single mode on/off for the playlist. This function does not support the 'oneshot' state for single mode: use mpd_send_single_state() instead.
If mode is true, MPD enables single mode: playback is stopped after current song, or song is repeated if the repeat mode is enabled.
If mode is false, MPD disables single mode: if random mode is enabled, the playlist order is shuffled after it is played completely.
connection | the connection to MPD |
mode | if true: enable single mode, if false: disable single mode |
bool mpd_run_single | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Shortcut for mpd_send_single() and mpd_response_finish().
connection | the connection to MPD |
mode | if true: enable single mode, if false: disable single mode |
bool mpd_send_consume | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Sets consume mode on/off for the playlist. If mode is true, MPD enables consume mode: each song played is removed from the playlist.
This function does not support the 'oneshot' state for consume mode: use mpd_send_consume_state() instead.
If mode is false, MPD disables consume mode.
connection | the connection to MPD |
mode | if true: enable consume mode, if false: disable consume mode |
bool mpd_run_consume | ( | struct mpd_connection * | connection, |
bool | mode | ||
) |
Shortcut for mpd_send_consume() and mpd_response_finish().
connection | the connection to MPD |
mode | if true: enable consume mode, if false: disable consume mode |
bool mpd_send_consume_state | ( | struct mpd_connection * | connection, |
enum mpd_consume_state | state | ||
) |
Sets consume state for the playlist. If state is MPD_CONSUME_ON, MPD enables consume mode: each song played is removed from the playlist.
If state is MPD_CONSUME_OFF, MPD disables consume mode.
If state is MPD_CONSUME_ONESHOT, MPD enables consume mode temporarily: consume mode is disabled (MPD_CONSUME_OFF) after a song has been played.
connection | the connection to MPD |
state | the desired single mode state |
bool mpd_run_consume_state | ( | struct mpd_connection * | connection, |
enum mpd_consume_state | state | ||
) |
Shortcut for mpd_send_consume_state() and mpd_response_finish().
connection | the connection to MPD |
state | the desired single mode state |
bool mpd_send_crossfade | ( | struct mpd_connection * | connection, |
unsigned | seconds | ||
) |
Sets crossfading of seconds between songs on for the playlist. Crossfading only happens when the songs audio format are the same.
connection | the connection to MPD |
seconds | seconds of crossfading between songs |
bool mpd_run_crossfade | ( | struct mpd_connection * | connection, |
unsigned | seconds | ||
) |
Shortcut for mpd_send_crossfade() and mpd_response_finish().
connection | the connection to MPD |
seconds | seconds of crossfading between songs |
bool mpd_send_mixrampdb | ( | struct mpd_connection * | connection, |
float | db | ||
) |
Sets the threshold at which songs will be overlapped. Like crossfading but doesn't fade the track volume, just overlaps.
The songs need to have MixRamp tags added by an external tool. 0dB is the normalized maximum volume; so use negative values (I prefer -17dB). In the absence of MixRamp tags, crossfading will be used.
connection | the connection to MPD |
db | decibels of volume for overlapping songs |
bool mpd_run_mixrampdb | ( | struct mpd_connection * | connection, |
float | db | ||
) |
Shortcut for mpd_send_mixrampdb() and mpd_response_finish().
connection | the connection to MPD |
db | decibels of volume for overlapping songs |
bool mpd_send_mixrampdelay | ( | struct mpd_connection * | connection, |
float | seconds | ||
) |
Sets additional time subtracted from the overlap calculated by mixrampdb. A value of NaN disables MixRamp overlapping and falls back to crossfading.
connection | the connection to MPD |
seconds | seconds subtracted from the overlap calculated by mixrampdb |
bool mpd_run_mixrampdelay | ( | struct mpd_connection * | connection, |
float | seconds | ||
) |
Shortcut for mpd_send_mixrampdelay() and mpd_response_finish().
connection | the connection to MPD |
seconds | seconds subtracted from the overlap calculated by mixrampdb |
bool mpd_send_clearerror | ( | struct mpd_connection * | connection | ) |
Clears the current error message in MPD's status (this is also accomplished by any command that starts playback).
connection | the connection to MPD |
bool mpd_run_clearerror | ( | struct mpd_connection * | connection | ) |
Shortcut for mpd_send_clearerror() and mpd_response_finish().
connection | the connection to MPD |