/* This code is automatically generated by genipc_server.py. Do not edit. */

#include <xmmsc/xmmsv.h>
static void
__int_xmms_cmd_start (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to start (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to start");
		return;
	}


	xmms_playback_client_start ((xmms_output_t *) object, &arg->error);
	arg->retval = xmmsv_new_none ();
}


static void
__int_xmms_cmd_stop (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to stop (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to stop");
		return;
	}


	xmms_playback_client_stop ((xmms_output_t *) object, &arg->error);
	arg->retval = xmmsv_new_none ();
}


static void
__int_xmms_cmd_pause (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to pause (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to pause");
		return;
	}


	xmms_playback_client_pause ((xmms_output_t *) object, &arg->error);
	arg->retval = xmmsv_new_none ();
}


static void
__int_xmms_cmd_tickle (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to tickle (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to tickle");
		return;
	}


	xmms_playback_client_tickle ((xmms_output_t *) object, &arg->error);
	arg->retval = xmmsv_new_none ();
}


static void
__int_xmms_cmd_playtime (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to playtime (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to playtime");
		return;
	}


	arg->retval = xmmsv_new_int (xmms_playback_client_playtime ((xmms_output_t *) object, &arg->error));
}


static void
__int_xmms_cmd_seek_ms (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	xmmsv_t *t;
	if (xmmsv_list_get_size (arg->args) != 2) {
		XMMS_DBG ("Wrong number of arguments to seek_ms (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to seek_ms");
		return;
	}
	gint32 argval0;
	gint32 argval1;

	if (!xmmsv_list_get (arg->args, 0, &t)) {
		XMMS_DBG ("Missing arg 0 in seek_ms");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 0 in seek_ms");
		return;
	}
	if (!xmmsv_get_int (t, &argval0)) {
		XMMS_DBG ("Error parsing arg 0 in seek_ms");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 0 in seek_ms");
		return;
	}
	if (!xmmsv_list_get (arg->args, 1, &t)) {
		XMMS_DBG ("Missing arg 1 in seek_ms");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 1 in seek_ms");
		return;
	}
	if (!xmmsv_get_int (t, &argval1)) {
		XMMS_DBG ("Error parsing arg 1 in seek_ms");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 1 in seek_ms");
		return;
	}

	xmms_playback_client_seek_ms ((xmms_output_t *) object, argval0, argval1, &arg->error);
	arg->retval = xmmsv_new_none ();
}


static void
__int_xmms_cmd_seek_samples (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	xmmsv_t *t;
	if (xmmsv_list_get_size (arg->args) != 2) {
		XMMS_DBG ("Wrong number of arguments to seek_samples (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to seek_samples");
		return;
	}
	gint32 argval0;
	gint32 argval1;

	if (!xmmsv_list_get (arg->args, 0, &t)) {
		XMMS_DBG ("Missing arg 0 in seek_samples");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 0 in seek_samples");
		return;
	}
	if (!xmmsv_get_int (t, &argval0)) {
		XMMS_DBG ("Error parsing arg 0 in seek_samples");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 0 in seek_samples");
		return;
	}
	if (!xmmsv_list_get (arg->args, 1, &t)) {
		XMMS_DBG ("Missing arg 1 in seek_samples");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 1 in seek_samples");
		return;
	}
	if (!xmmsv_get_int (t, &argval1)) {
		XMMS_DBG ("Error parsing arg 1 in seek_samples");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 1 in seek_samples");
		return;
	}

	xmms_playback_client_seek_samples ((xmms_output_t *) object, argval0, argval1, &arg->error);
	arg->retval = xmmsv_new_none ();
}


static void
__int_xmms_cmd_status (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to status (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to status");
		return;
	}


	arg->retval = xmmsv_new_int (xmms_playback_client_status ((xmms_output_t *) object, &arg->error));
}


static void
__int_xmms_cmd_current_id (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to current_id (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to current_id");
		return;
	}


	arg->retval = xmmsv_new_int (xmms_playback_client_current_id ((xmms_output_t *) object, &arg->error));
}


static void
__int_xmms_cmd_volume_set (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	xmmsv_t *t;
	if (xmmsv_list_get_size (arg->args) != 2) {
		XMMS_DBG ("Wrong number of arguments to volume_set (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to volume_set");
		return;
	}
	const char * argval0;
	gint32 argval1;

	if (!xmmsv_list_get (arg->args, 0, &t)) {
		XMMS_DBG ("Missing arg 0 in volume_set");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 0 in volume_set");
		return;
	}
	if (!xmmsv_get_string (t, &argval0)) {
		XMMS_DBG ("Error parsing arg 0 in volume_set");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 0 in volume_set");
		return;
	}
	if (!xmmsv_list_get (arg->args, 1, &t)) {
		XMMS_DBG ("Missing arg 1 in volume_set");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 1 in volume_set");
		return;
	}
	if (!xmmsv_get_int (t, &argval1)) {
		XMMS_DBG ("Error parsing arg 1 in volume_set");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 1 in volume_set");
		return;
	}

	xmms_playback_client_volume_set ((xmms_output_t *) object, argval0, argval1, &arg->error);
	arg->retval = xmmsv_new_none ();
}


static void
__int_xmms_cmd_volume_get (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to volume_get (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to volume_get");
		return;
	}


	arg->retval = xmms_playback_client_volume_get ((xmms_output_t *) object, &arg->error);
}



static void
xmms_playback_register_ipc_commands (xmms_object_t *playback_object)
{
	xmms_ipc_object_register (XMMS_IPC_OBJECT_PLAYBACK, playback_object);

	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_START, __int_xmms_cmd_start);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_STOP, __int_xmms_cmd_stop);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_PAUSE, __int_xmms_cmd_pause);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_TICKLE, __int_xmms_cmd_tickle);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_PLAYTIME, __int_xmms_cmd_playtime);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_SEEK_MS, __int_xmms_cmd_seek_ms);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_SEEK_SAMPLES, __int_xmms_cmd_seek_samples);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_STATUS, __int_xmms_cmd_status);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_CURRENT_ID, __int_xmms_cmd_current_id);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_VOLUME_SET, __int_xmms_cmd_volume_set);
	xmms_object_cmd_add (playback_object, XMMS_IPC_COMMAND_PLAYBACK_VOLUME_GET, __int_xmms_cmd_volume_get);

	xmms_ipc_broadcast_register (playback_object, XMMS_IPC_SIGNAL_PLAYBACK_STATUS);
	xmms_ipc_broadcast_register (playback_object, XMMS_IPC_SIGNAL_PLAYBACK_VOLUME_CHANGED);
	xmms_ipc_broadcast_register (playback_object, XMMS_IPC_SIGNAL_PLAYBACK_CURRENT_ID);

	xmms_ipc_signal_register (playback_object, XMMS_IPC_SIGNAL_PLAYBACK_PLAYTIME);
}

static void
xmms_playback_unregister_ipc_commands (void)
{
	xmms_ipc_broadcast_unregister (XMMS_IPC_SIGNAL_PLAYBACK_STATUS);
	xmms_ipc_broadcast_unregister (XMMS_IPC_SIGNAL_PLAYBACK_VOLUME_CHANGED);
	xmms_ipc_broadcast_unregister (XMMS_IPC_SIGNAL_PLAYBACK_CURRENT_ID);

	xmms_ipc_signal_unregister (XMMS_IPC_SIGNAL_PLAYBACK_PLAYTIME);

	xmms_ipc_object_unregister (XMMS_IPC_OBJECT_PLAYBACK);
}
