Go to the source code of this file.
|
enum | MpdError {
MPD_OK = 0
, MPD_ARGS_ERROR = -5
, MPD_NOT_CONNECTED = -10
, MPD_STATUS_FAILED = -20
,
MPD_LOCK_FAILED = -30
, MPD_STATS_FAILED = -40
, MPD_SERVER_ERROR = -50
, MPD_SERVER_NOT_SUPPORTED = -51
,
MPD_DATABASE_PLAYLIST_EXIST = -60
, MPD_PLAYLIST_EMPTY = -70
, MPD_PLAYLIST_QUEUE_EMPTY = -75
, MPD_PLAYER_NOT_PLAYING = -80
,
MPD_TAG_NOT_FOUND = -90
, MPD_PLAYLIST_LOAD_FAILED = -100
, MPD_FATAL_ERROR = -1000
} |
|
enum | MpdServerCommand { MPD_SERVER_COMMAND_ALLOWED = TRUE
, MPD_SERVER_COMMAND_NOT_ALLOWED = FALSE
, MPD_SERVER_COMMAND_NOT_SUPPORTED = -1
, MPD_SERVER_COMMAND_ERROR = -2
} |
|
enum | MpdDataType {
MPD_DATA_TYPE_NONE
, MPD_DATA_TYPE_TAG
, MPD_DATA_TYPE_DIRECTORY
, MPD_DATA_TYPE_SONG
,
MPD_DATA_TYPE_PLAYLIST
, MPD_DATA_TYPE_OUTPUT_DEV
} |
|
enum | ChangedStatusType {
MPD_CST_PLAYLIST = 0x0001
, MPD_CST_SONGPOS = 0x0002
, MPD_CST_SONGID = 0x0004
, MPD_CST_DATABASE = 0x0008
,
MPD_CST_UPDATING = 0x0010
, MPD_CST_VOLUME = 0x0020
, MPD_CST_TOTAL_TIME = 0x0040
, MPD_CST_ELAPSED_TIME = 0x0080
,
MPD_CST_CROSSFADE = 0x0100
, MPD_CST_RANDOM = 0x0200
, MPD_CST_REPEAT = 0x0400
, MPD_CST_AUDIO = 0x0800
,
MPD_CST_STATE = 0x1000
, MPD_CST_PERMISSION = 0x2000
, MPD_CST_BITRATE = 0x4000
, MPD_CST_AUDIOFORMAT = 0x8000
,
MPD_CST_STORED_PLAYLIST = 0x20000
, MPD_CST_SERVER_ERROR = 0x40000
, MPD_CST_OUTPUT = 0x80000
, MPD_CST_STICKER = 0x100000
,
MPD_CST_NEXTSONG = 0x200000
, MPD_CST_SINGLE_MODE = 0x400000
, MPD_CST_CONSUME_MODE = 0x800000
, MPD_CST_REPLAYGAIN = 0x1000000
} |
|
enum | MpdServerReplaygainMode { MPD_SERVER_REPLAYGAIN_MODE_OFF = 0
, MPD_SERVER_REPLAYGAIN_MODE_TRACK = 1
, MPD_SERVER_REPLAYGAIN_MODE_ALBUM = 2
, MPD_SERVER_REPLAYGAIN_MODE_AUTO = 3
} |
|
|
MpdObj * | mpd_new_default () |
|
MpdObj * | mpd_new (char *hostname, int port, char *password) |
|
int | mpd_set_hostname (MpdObj *mi, char *hostname) |
|
const char * | mpd_get_hostname (MpdObj *mi) |
|
int | mpd_set_password (MpdObj *mi, const char *password) |
|
int | mpd_set_port (MpdObj *mi, int port) |
|
int | mpd_set_connection_timeout (MpdObj *mi, float timeout) |
|
int | mpd_connect_real (MpdObj *mi, mpd_Connection *connection) |
|
int | mpd_connect (MpdObj *mi) |
|
int | mpd_disconnect (MpdObj *mi) |
|
int | mpd_check_connected (MpdObj *mi) |
|
int | mpd_check_error (MpdObj *mi) |
|
void | mpd_free (MpdObj *mi) |
|
int | mpd_send_password (MpdObj *mi) |
|
void | mpd_signal_connect_status_changed (MpdObj *mi, StatusChangedCallback status_changed, void *userdata) |
|
void | mpd_signal_connect_error (MpdObj *mi, ErrorCallback error, void *userdata) |
|
void | mpd_signal_connect_connection_changed (MpdObj *mi, ConnectionChangedCallback connection_changed, void *userdata) |
|
int | mpd_data_is_last (MpdData const *data) |
|
void | mpd_data_free (MpdData *data) |
|
MpdData * | mpd_data_get_next (MpdData *data) |
|
MpdData * | mpd_data_get_first (MpdData const *data) |
|
MpdData * | mpd_data_delete_item (MpdData *data) |
|
MpdData * | mpd_server_get_output_devices (MpdObj *mi) |
|
int | mpd_server_set_output_device (MpdObj *mi, int device_id, int state) |
|
long unsigned | mpd_server_get_database_update_time (MpdObj *mi) |
|
int | mpd_server_check_version (MpdObj *mi, int major, int minor, int micro) |
|
char * | mpd_server_get_version (MpdObj *mi) |
|
int | mpd_server_check_command_allowed (MpdObj *mi, const char *command) |
|
char ** | mpd_server_get_url_handlers (MpdObj *mi) |
|
char ** | mpd_server_get_tag_types (MpdObj *mi) |
|
int | mpd_misc_get_tag_by_name (char *name) |
|
int | mpd_server_has_idle (MpdObj *mi) |
|
int | mpd_server_tag_supported (MpdObj *mi, int tag) |
|
MpdServerReplaygainMode | mpd_server_get_replaygain_mode (MpdObj *mi) |
|
int | mpd_server_set_replaygain_mode (MpdObj *mi, MpdServerReplaygainMode mode) |
|
◆ __MPD_LIB__
◆ FALSE
Defined for readability: False is 0.
Definition at line 49 of file libmpd.h.
◆ TRUE
Defined for readability: True is 1.
Definition at line 44 of file libmpd.h.
◆ ConnectionChangedCallback
typedef void(* ConnectionChangedCallback) (MpdObj *mi, int connect, void *userdata) |
- Parameters
-
mi | a MpdObj |
connect | 1 if you are now connected, 0 if you are disconnected. |
userdata | user data set when the signal handler was connected. Signal is triggered when the connection state changes. |
Definition at line 434 of file libmpd.h.
◆ ErrorCallback
typedef int(* ErrorCallback) (MpdObj *mi, int id, char *msg, void *userdata) |
- Parameters
-
mi | a MpdObj |
id | The error Code. |
msg | human-readable informative error message. |
userdata | user data set when the signal handler was connected. This signal is called when an error has occurred in the communication with mpd. |
return: TRUE if libmpd should disconnect.
- Examples
- testcase.c.
Definition at line 423 of file libmpd.h.
◆ MpdObj
The Main Mpd Object. Don't access any of the internal values directly, but use the provided functions.
Definition at line 100 of file libmpd.h.
◆ StatusChangedCallback
- Parameters
-
mi | a MpdObj |
what | a ChangedStatusType that determines what changed triggered the signal. This is a bitmask. |
userdata | user data set when the signal handler was connected. |
Signal that gets called when the state of mpd has changed. Look ChangedStatusType to see the possible events.
- Examples
- testcase.c.
Definition at line 409 of file libmpd.h.
◆ ChangedStatusType
Bitwise enumeration to determine what triggered the status_changed signals This is used in combination with the StatusChangedCallback
Enumerator |
---|
MPD_CST_PLAYLIST | The playlist has changed
|
MPD_CST_SONGPOS | The song position of the playing song has changed
|
MPD_CST_SONGID | The songid of the playing song has changed
|
MPD_CST_DATABASE | The database has changed.
|
MPD_CST_UPDATING | the state of updating the database has changed.
|
MPD_CST_VOLUME | the volume has changed
|
MPD_CST_TOTAL_TIME | The total time of the currently playing song has changed
|
MPD_CST_ELAPSED_TIME | The elapsed time of the current song has changed.
|
MPD_CST_CROSSFADE | The crossfade time has changed.
|
MPD_CST_RANDOM | The random state is changed.
|
MPD_CST_REPEAT | repeat state is changed.
|
MPD_CST_AUDIO | Not implemented
|
MPD_CST_STATE | The state of the player has changed.
|
MPD_CST_PERMISSION | The permissions the client has, has changed.
|
MPD_CST_BITRATE | The bitrate of the playing song has changed.
|
MPD_CST_AUDIOFORMAT | the audio format of the playing song changed.
|
MPD_CST_STORED_PLAYLIST | the queue has changed
|
MPD_CST_SERVER_ERROR | server error
|
MPD_CST_OUTPUT | output changed
|
MPD_CST_STICKER | Sticker changed
|
MPD_CST_NEXTSONG | Next song changed
|
MPD_CST_SINGLE_MODE | Single mode changed
|
MPD_CST_CONSUME_MODE | Consume mode changed
|
MPD_CST_REPLAYGAIN | Replaygain mode changed
|
Definition at line 349 of file libmpd.h.
◆ MpdError
Enum that represent the errors libmpd functions can return
Enumerator |
---|
MPD_OK | Command/function completed succesfull
|
MPD_ARGS_ERROR | Error in the function's arguments
|
MPD_NOT_CONNECTED | Action failed because there is no connection to an mpd daemon
|
MPD_STATUS_FAILED | Failed to grab status
|
MPD_LOCK_FAILED | Connection is still locked
|
MPD_STATS_FAILED | Failed to grab status
|
MPD_SERVER_ERROR | Mpd server returned an error
|
MPD_SERVER_NOT_SUPPORTED | Mpd doesn't support this feature
|
MPD_DATABASE_PLAYLIST_EXIST | The playlist already exists
|
MPD_PLAYLIST_EMPTY | Playlist is empty
|
MPD_PLAYLIST_QUEUE_EMPTY | Playlist queue is empty
|
MPD_PLAYER_NOT_PLAYING | Player isn't Playing
|
MPD_TAG_NOT_FOUND | Tag Item not found
|
MPD_PLAYLIST_LOAD_FAILED | |
MPD_FATAL_ERROR | Fatal error, something I am not sure what todo with
|
Definition at line 58 of file libmpd.h.
◆ MpdServerCommand
enum that represents the state of a command.
Enumerator |
---|
MPD_SERVER_COMMAND_ALLOWED | |
MPD_SERVER_COMMAND_NOT_ALLOWED | |
MPD_SERVER_COMMAND_NOT_SUPPORTED | |
MPD_SERVER_COMMAND_ERROR | |
Definition at line 106 of file libmpd.h.
◆ MpdServerReplaygainMode
Enumerator |
---|
MPD_SERVER_REPLAYGAIN_MODE_OFF | |
MPD_SERVER_REPLAYGAIN_MODE_TRACK | |
MPD_SERVER_REPLAYGAIN_MODE_ALBUM | |
MPD_SERVER_REPLAYGAIN_MODE_AUTO | |
Definition at line 664 of file libmpd.h.
◆ mpd_check_connected()
int mpd_check_connected |
( |
MpdObj * | mi | ) |
|
- Parameters
-
Checks if MpdObj is connected
- Returns
- True when connected
◆ mpd_check_error()
int mpd_check_error |
( |
MpdObj * | mi | ) |
|
- Parameters
-
Checks if there was an error
- Returns
- True when there is an error
◆ mpd_connect()
int mpd_connect |
( |
MpdObj * | mi | ) |
|
- Parameters
-
Connect to the mpd daemon. Warning: mpd_connect connects anonymous, to authenticate use mpd_send_password
- Returns
- returns a MpdError, MPD_OK when successful
- Examples
- testcase.c.
◆ mpd_connect_real()
◆ mpd_data_delete_item()
- Parameters
-
removes the passed MpdData from the underlying list, and returns the element before data
- Returns
- a MpdData list
◆ mpd_data_free()
void mpd_data_free |
( |
MpdData * | data | ) |
|
◆ mpd_data_get_first()
- Parameters
-
Returns the first MpdData in the list.
- Returns
- The first MpdData or NULL
◆ mpd_data_get_next()
- Parameters
-
Returns the next MpdData in the list. If it's the last item in the list, it will free the list.
You can iterate through a list like this and have it freed afterwards.
{
}
MpdData * mpd_database_get_albums(MpdObj *mi, const char *artist)
MpdData * mpd_data_get_next(MpdData *data)
- Returns
- The next MpdData or NULL
- Examples
- testcase.c.
◆ mpd_data_is_last()
int mpd_data_is_last |
( |
MpdData const * | data | ) |
|
- Parameters
-
Checks if the passed MpdData is the last in a list
- Returns
- TRUE when data is the last in the list.
◆ mpd_disconnect()
int mpd_disconnect |
( |
MpdObj * | mi | ) |
|
- Parameters
-
Disconnect the current connection
- Returns
- MPD_OK (always)
◆ mpd_free()
- Parameters
-
Free the MpdObj, when still connected the connection will be disconnected first
- Examples
- testcase.c.
◆ mpd_get_hostname()
const char * mpd_get_hostname |
( |
MpdObj * | mi | ) |
|
- Parameters
-
gets the set hostname
- Returns
- a const char representing the hostname
◆ mpd_misc_get_tag_by_name()
int mpd_misc_get_tag_by_name |
( |
char * | name | ) |
|
- Parameters
-
name | a NULL terminated string |
gets the Matching MpdDataType matching at the string
- Returns
- a MpdDataType
◆ mpd_new()
MpdObj * mpd_new |
( |
char * | hostname, |
|
|
int | port, |
|
|
char * | password ) |
- Parameters
-
hostname | The hostname to connect to |
port | The port to connect to |
password | The password to use for the connection, or NULL for no password |
Create a new MpdObj with provided settings:
- Returns
- the new MpdObj
- Examples
- testcase.c.
◆ mpd_new_default()
mpd_new_default
Create a new MpdObj with default settings. Hostname will be set to "localhost". Port will be 6600.
same as calling:
MpdObj * mpd_new(char *hostname, int port, char *password)
- Returns
- the new MpdObj
◆ mpd_send_password()
int mpd_send_password |
( |
MpdObj * | mi | ) |
|
- Parameters
-
Forces libmpd to re-authenticate itself.
When successful it will trigger the "permission" changed signal.
- Returns
- : a MpdError
- Examples
- testcase.c.
◆ mpd_server_check_command_allowed()
int mpd_server_check_command_allowed |
( |
MpdObj * | mi, |
|
|
const char * | command ) |
- Parameters
-
mi | a MpdObj |
command | the command to check |
Checks if the user is allowed to execute the command and if the server supports it
- Returns
- Returns MpdServerCommand
- Examples
- testcase.c.
◆ mpd_server_check_version()
int mpd_server_check_version |
( |
MpdObj * | mi, |
|
|
int | major, |
|
|
int | minor, |
|
|
int | micro ) |
- Parameters
-
mi | a MpdObj |
major | the major version number |
minor | the minor version number |
micro | the micro version number |
Checks if the connected mpd server version is equal or higher.
- Returns
- TRUE when version of mpd equals or is higher, else FALSE
◆ mpd_server_get_database_update_time()
long unsigned mpd_server_get_database_update_time |
( |
MpdObj * | mi | ) |
|
- Parameters
-
Gets a unix timestamp of the last time the database was updated.
- Returns
- unix Timestamp
◆ mpd_server_get_output_devices()
- Parameters
-
Returns a list of audio output devices stored in a MpdData list
- Returns
- a MpdData
◆ mpd_server_get_replaygain_mode()
◆ mpd_server_get_tag_types()
char ** mpd_server_get_tag_types |
( |
MpdObj * | mi | ) |
|
- Parameters
-
- Returns
- an array with supported tag types. (NULL Terminated). Result must be freed.
◆ mpd_server_get_url_handlers()
char ** mpd_server_get_url_handlers |
( |
MpdObj * | mi | ) |
|
- Parameters
-
- Returns
- an array with urlhandlers (NULL terminated). Result must be freed.
◆ mpd_server_get_version()
char * mpd_server_get_version |
( |
MpdObj * | mi | ) |
|
- Parameters
-
- Returns
- a string with version or NULL when not connected
◆ mpd_server_has_idle()
int mpd_server_has_idle |
( |
MpdObj * | mi | ) |
|
- Parameters
-
Reports if the connected mpd supports the idle command.
- Returns
- a boolean, TRUE if it has idle support
◆ mpd_server_set_output_device()
int mpd_server_set_output_device |
( |
MpdObj * | mi, |
|
|
int | device_id, |
|
|
int | state ) |
- Parameters
-
mi | a MpdObj |
device_id | The id of the output device |
state | The state to change the output device to, 1 is enable, 0 is disable. |
Enable or Disable an audio output device
- Returns
- 0 if successful
◆ mpd_server_set_replaygain_mode()
◆ mpd_server_tag_supported()
int mpd_server_tag_supported |
( |
MpdObj * | mi, |
|
|
int | tag ) |
- Parameters
-
Returns if mpd supports this tag.
return 1 if support 0 if not
◆ mpd_set_connection_timeout()
int mpd_set_connection_timeout |
( |
MpdObj * | mi, |
|
|
float | timeout ) |
- Parameters
-
mi | a MpdObj |
timeout | A timeout (in seconds) |
Set the timeout of the connection. If already connected the timeout of the running connection
- Returns
- a MpdError. (MPD_OK if everything went ok)
- Examples
- testcase.c.
◆ mpd_set_hostname()
int mpd_set_hostname |
( |
MpdObj * | mi, |
|
|
char * | hostname ) |
- Parameters
-
mi | a MpdObj |
hostname | The new hostname to use |
set the hostname
- Returns
- a MpdError. (MPD_OK if everything went ok)
◆ mpd_set_password()
int mpd_set_password |
( |
MpdObj * | mi, |
|
|
const char * | password ) |
◆ mpd_set_port()
int mpd_set_port |
( |
MpdObj * | mi, |
|
|
int | port ) |
- Parameters
-
mi | a MpdObj |
port | The port to use. (Default: 6600) |
Set the Port number
- Returns
- a MpdError. (MPD_OK if everything went ok)
◆ mpd_signal_connect_connection_changed()
◆ mpd_signal_connect_error()
◆ mpd_signal_connect_status_changed()
◆ libmpd_version