Пример #1
0
xmmsc_result_t *
xmmsc_playback_seek_ms (xmmsc_connection_t *c, int milliseconds,
                        xmms_playback_seek_mode_t whence)
{
	x_check_conn (c, NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_PLAYBACK, XMMS_IPC_CMD_SEEKMS,
	                       XMMSV_LIST_ENTRY_INT (milliseconds),
	                       XMMSV_LIST_ENTRY_INT (whence),
	                       XMMSV_LIST_END);
}
Пример #2
0
xmmsc_result_t *
xmmsc_playback_seek_samples (xmmsc_connection_t *c, int samples,
                             xmms_playback_seek_mode_t whence)
{
	x_check_conn (c, NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_PLAYBACK,
	                       XMMS_IPC_CMD_SEEKSAMPLES,
	                       XMMSV_LIST_ENTRY_INT (samples),
	                       XMMSV_LIST_ENTRY_INT (whence),
	                       XMMSV_LIST_END);
}
Пример #3
0
/**
 * Set a custom int field in the medialib associated with a entry,
 * the same as #xmmsc_medialib_entry_property_set_int but with specifing
 * your own source.
 */
xmmsc_result_t *
xmmsc_medialib_entry_property_set_int_with_source (xmmsc_connection_t *c,
                                                   int id,
                                                   const char *source,
                                                   const char *key,
                                                   int32_t value)
{
	x_check_conn (c, NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_MEDIALIB,
	                       XMMS_IPC_CMD_PROPERTY_SET_INT,
	                       XMMSV_LIST_ENTRY_INT (id),
	                       XMMSV_LIST_ENTRY_STR (source),
	                       XMMSV_LIST_ENTRY_STR (key),
	                       XMMSV_LIST_ENTRY_INT (value),
	                       XMMSV_LIST_END);
}
Пример #4
0
/**
 * Retrieve information about a entry from the medialib.
 */
xmmsc_result_t *
xmmsc_medialib_get_info (xmmsc_connection_t *c, int id)
{
	x_check_conn (c, NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_MEDIALIB, XMMS_IPC_CMD_INFO,
	                       XMMSV_LIST_ENTRY_INT (id), XMMSV_LIST_END);
}
Пример #5
0
/**
 * Get a list of loaded plugins from the server
 */
xmmsc_result_t *
xmmsc_main_list_plugins (xmmsc_connection_t *c, xmms_plugin_type_t type)
{
	x_check_conn (c, NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_MAIN, XMMS_IPC_CMD_PLUGIN_LIST,
	                       XMMSV_LIST_ENTRY_INT (type), XMMSV_LIST_END);
}
Пример #6
0
static xmmsc_result_t *
xmmsc_send_hello (xmmsc_connection_t *c)
{
	const int protocol_version = XMMS_IPC_PROTOCOL_VERSION;

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_MAIN, XMMS_IPC_CMD_HELLO,
	                       XMMSV_LIST_ENTRY_INT (protocol_version),
	                       XMMSV_LIST_ENTRY_STR (c->clientname),
	                       XMMSV_LIST_END);
}
Пример #7
0
/**
 * Rehash the medialib, this will check data in the medialib
 * still is the same as the data in files.
 *
 * @param conn #xmmsc_connection_t
 * @param id The id to rehash. Set it to 0 if you want to rehash
 * the whole medialib.
 */
xmmsc_result_t *
xmmsc_medialib_rehash (xmmsc_connection_t *conn, int id)
{
	x_check_conn (conn, NULL);

	return xmmsc_send_cmd (conn, XMMS_IPC_OBJECT_MEDIALIB,
	                       XMMS_IPC_CMD_REHASH,
	                       XMMSV_LIST_ENTRY_INT (id),
	                       XMMSV_LIST_END);
}
Пример #8
0
/**
 * Remove a entry from the medialib
 * @param conn The #xmmsc_connection_t
 * @param entry The entry id you want to remove
 */
xmmsc_result_t *
xmmsc_medialib_remove_entry (xmmsc_connection_t *conn, int entry)
{
	x_check_conn (conn, NULL);

	return xmmsc_send_cmd (conn, XMMS_IPC_OBJECT_MEDIALIB,
	                       XMMS_IPC_CMD_REMOVE_ID,
	                       XMMSV_LIST_ENTRY_INT (entry),
	                       XMMSV_LIST_END);
}
Пример #9
0
/**
 * Change the url property of an entry in the media library.  Note
 * that you need to handle the actual file move yourself.
 *
 * @param conn The #xmmsc_connection_t
 * @param entry The entry id you want to move
 * @param url The url to move it to
 */
xmmsc_result_t *
xmmsc_medialib_move_entry (xmmsc_connection_t *conn, int entry, const char *url)
{
	x_check_conn (conn, NULL);

	return xmmsc_send_cmd (conn, XMMS_IPC_OBJECT_MEDIALIB,
	                       XMMS_IPC_CMD_MOVE_URL,
	                       XMMSV_LIST_ENTRY_INT (entry),
	                       XMMSV_LIST_ENTRY_STR (url),
	                       XMMSV_LIST_END);
}
Пример #10
0
xmmsc_result_t *
xmmsc_playback_volume_set (xmmsc_connection_t *c,
                           const char *channel, int volume)
{
	x_check_conn (c, NULL);
	x_api_error_if (!channel, "with a NULL channel", NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_PLAYBACK,
	                       XMMS_IPC_CMD_VOLUME_SET,
	                       XMMSV_LIST_ENTRY_STR (channel),
	                       XMMSV_LIST_ENTRY_INT (volume),
	                       XMMSV_LIST_END);
}
Пример #11
0
xmmsc_result_t *
setup_udp_prepare (xmmsc_connection_t *c, int32_t vv)
{
	xmmsc_result_t *res;
	xmmsc_visualization_t *v;

	x_check_conn (c, 0);
	v = get_dataset (c, vv);

	res = xmmsc_send_cmd (c, XMMS_IPC_OBJECT_VISUALIZATION,
	                      XMMS_IPC_CMD_VISUALIZATION_INIT_UDP,
	                      XMMSV_LIST_ENTRY_INT (v->id),
	                      XMMSV_LIST_END);

	if (res) {
		xmmsc_result_visc_set (res, v);
	}
	return res;
}
Пример #12
0
xmmsc_result_t *
setup_shm_prepare (xmmsc_connection_t *c, int32_t vv)
{
	xmmsc_result_t *res;
	xmmsc_vischunk_t *buffer;
	xmmsc_vis_unixshm_t *t;
	xmmsc_visualization_t *v;
	char shmidstr[32];

	x_check_conn (c, 0);
	v = get_dataset (c, vv);

	t = &v->transport.shm;

	/* prepare unixshm + semaphores */
	/* following access modifiers imply everyone on the system could inject wrong vis data ;) */
	t->shmid = shmget (IPC_PRIVATE, sizeof (xmmsc_vischunk_t) * XMMS_VISPACKET_SHMCOUNT, S_IRWXU + S_IRWXG + S_IRWXO);
	if (t->shmid == -1) {
		c->error = strdup ("Couldn't create the shared memory!");
		return false;
	}
	/* attach early, so that the server doesn't think we aren't there */
	buffer = shmat(t->shmid, NULL, SHM_RDONLY);
	t->buffer = buffer;

	/* we send it as string to make it work on 64bit systems.
	   Ugly? Yes, but works. */
	snprintf (shmidstr, sizeof (shmidstr), "%d", t->shmid);

	/* send packet */
	res = xmmsc_send_cmd (c, XMMS_IPC_OBJECT_VISUALIZATION,
	                      XMMS_IPC_COMMAND_VISUALIZATION_INIT_SHM,
	                      XMMSV_LIST_ENTRY_INT (v->id),
	                      XMMSV_LIST_ENTRY_STR (shmidstr),
	                      XMMSV_LIST_END);

	if (res) {
		xmmsc_result_visc_set (res, v);
	}

	return res;
}