XmmsClient
Modules | Functions
XMMSClient

This functions are used to connect a client software to the XMMS2 daemon. More...

Modules

 Collections
 All modules related to collection handling.
 
 ConfigControl
 This controls configuration values on the XMMS server.
 
 MedialibControl
 This controls the medialib.
 
 PlaybackControl
 This controls the playback.
 
 PlaylistControl
 This controls the playlist.
 
 Result
 Result manipulation and error handlingEach command to the server will return a xmmsc_result_t to the programmer.
 
 StatsFunctions
 This module contains functions to access information and statistics of the XMMS server.
 
 Visualization
 This manages the visualization transfer.
 
 IOFunctions
 Functions for integrating the xmms client library with an existing mainloop.
 

Functions

xmmsc_connection_txmmsc_init (const char *clientname)
 Initializes a xmmsc_connection_t. More...
 
int xmmsc_connect (xmmsc_connection_t *c, const char *ipcpath)
 Connects to the XMMS server. More...
 
void xmmsc_disconnect_callback_set (xmmsc_connection_t *c, xmmsc_disconnect_func_t callback, void *userdata)
 Set the disconnect callback. More...
 
void xmmsc_disconnect_callback_set_full (xmmsc_connection_t *c, xmmsc_disconnect_func_t callback, void *userdata, xmmsc_user_data_free_func_t free_func)
 
char * xmmsc_get_last_error (xmmsc_connection_t *c)
 Returns a string that descibes the last error. More...
 
void xmmsc_unref (xmmsc_connection_t *c)
 Dereference the xmmsc_connection_t and free the memory when reference count reaches zero. More...
 
xmmsc_connection_txmmsc_ref (xmmsc_connection_t *c)
 References the xmmsc_connection_t. More...
 
void xmmsc_lock_set (xmmsc_connection_t *c, void *lock, void(*lockfunc)(void *), void(*unlockfunc)(void *))
 Set locking functions for a connection. More...
 
xmmsc_result_txmmsc_quit (xmmsc_connection_t *c)
 Tell the server to quit. More...
 
xmmsc_result_txmmsc_broadcast_quit (xmmsc_connection_t *c)
 Request the quit broadcast. More...
 
const char * xmmsc_userconfdir_get (char *buf, int len)
 Get the absolute path to the user config dir. More...
 

Detailed Description

This functions are used to connect a client software to the XMMS2 daemon.

For proper integration with a client you need to hook the XMMSIPC to your clients mainloop. XMMS2 ships with a couple of default mainloop integrations but can easily be extended to fit your own application.

There are three kinds of messages that will be involved in communication with the XMMS2 server.

Each client command will return a xmmsc_result_t which holds the command id that will be used to map the result back to the right caller. The xmmsc_result_t is used to get the result from the server.

Function Documentation

xmmsc_result_t* xmmsc_broadcast_quit ( xmmsc_connection_t c)

Request the quit broadcast.

Will be called when the server is terminating.

int xmmsc_connect ( xmmsc_connection_t c,
const char *  ipcpath 
)

Connects to the XMMS server.

If ipcpath is NULL, it will try to open the default path.

Parameters
cThe connection to the server. This must be initialized with xmmsc_init first.
ipcpathThe IPC path, it's broken down like this: <protocol>://<path>[:<port>]. If ipcpath is NULL it will default to "unix:///tmp/xmms-ipc-<username>"
  • Protocol could be "tcp" or "unix"
  • Path is either the UNIX socket, or the ipnumber of the server.
  • Port is only used when the protocol tcp.
Returns
TRUE on success and FALSE if some problem occured. call xmmsc_get_last_error to find out.
See Also
xmmsc_get_last_error
void xmmsc_disconnect_callback_set ( xmmsc_connection_t c,
xmmsc_disconnect_func_t  callback,
void *  userdata 
)

Set the disconnect callback.

It will be called when client will be disconnected.

void xmmsc_disconnect_callback_set_full ( xmmsc_connection_t c,
xmmsc_disconnect_func_t  callback,
void *  userdata,
xmmsc_user_data_free_func_t  free_func 
)
char* xmmsc_get_last_error ( xmmsc_connection_t c)

Returns a string that descibes the last error.

xmmsc_connection_t* xmmsc_init ( const char *  clientname)

Initializes a xmmsc_connection_t.

Returns NULL if you runned out of memory.

Returns
a xmmsc_connection_t that should be unreferenced with xmmsc_unref.
See Also
xmmsc_unref
void xmmsc_lock_set ( xmmsc_connection_t c,
void *  lock,
void(*)(void *)  lockfunc,
void(*)(void *)  unlockfunc 
)

Set locking functions for a connection.

Allows simultanous usage of a connection from several threads.

Parameters
cconnection
lockthe locking primitive passed to the lock and unlock functions
lockfuncfunction called when entering critical region, called with lock as argument.
unlockfuncfunciotn called when leaving critical region.
xmmsc_result_t* xmmsc_quit ( xmmsc_connection_t c)

Tell the server to quit.

This will terminate the server. If you only want to disconnect, use xmmsc_unref()

References the xmmsc_connection_t.

Parameters
cthe connection to reference.
Returns
c

Referenced by xmmsc_init().

void xmmsc_unref ( xmmsc_connection_t c)

Dereference the xmmsc_connection_t and free the memory when reference count reaches zero.

const char* xmmsc_userconfdir_get ( char *  buf,
int  len 
)

Get the absolute path to the user config dir.

Parameters
bufA char buffer
lenThe length of buf (XMMS_PATH_MAX is a good choice)
Returns
A pointer to buf, or NULL if an error occurred.