Example #1
0
/**
 * Request the current id broadcast. This will be called then the
 * current playing id is changed. New song for example.
 */
xmmsc_result_t *
xmmsc_broadcast_playback_current_id (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_broadcast_msg (c, XMMS_IPC_SIGNAL_PLAYBACK_CURRENTID);
}
Example #2
0
xmmsc_result_t *
xmmsc_visualization_init (xmmsc_connection_t *c)
{
	xmmsc_result_t *res = NULL;

	x_check_conn (c, 0);

	c->visc++;
	c->visv = realloc (c->visv, sizeof (xmmsc_visualization_t*) * c->visc);
	if (!c->visv) {
		x_oom ();
		c->visc = 0;
	}
	if (c->visc > 0) {
		int vv = c->visc-1;
		if (!(c->visv[vv] = x_new0 (xmmsc_visualization_t, 1))) {
			x_oom ();
		} else {
			c->visv[vv]->idx = vv;
			c->visv[vv]->state = VIS_NEW;
			res = xmmsc_send_msg_no_arg (c, XMMS_IPC_OBJECT_VISUALIZATION, XMMS_IPC_CMD_VISUALIZATION_REGISTER);
			if (res) {
				xmmsc_result_visc_set (res, c->visv[vv]);
			}
		}
	}
	return res;
}
Example #3
0
/**
 * Requests the playback status broadcast. This will be called when
 * events like play, stop and pause is triggered.
 */
xmmsc_result_t *
xmmsc_broadcast_playback_status (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_broadcast_msg (c, XMMS_IPC_SIGNAL_PLAYBACK_STATUS);
}
Example #4
0
xmmsc_result_t *
xmmsc_visualization_start (xmmsc_connection_t *c, int vv)
{
	xmmsc_result_t *res;
	xmmsc_visualization_t *v;

	x_check_conn (c, 0);
	v = get_dataset (c, vv);
	x_api_error_if (!v, "with unregistered/unconnected visualization dataset", 0);

	switch (v->state) {
	case VIS_WORKING:
	case VIS_ERRORED:
		break;
	case VIS_NEW:
#ifdef HAVE_SEMTIMEDOP
		/* first try unixshm */
		v->type = VIS_UNIXSHM;
		res = setup_shm_prepare (c, vv);
		v->state = VIS_TRYING_UNIXSHM;
		break;
#endif
	case VIS_TO_TRY_UDP:
		v->type = VIS_UDP;
		res = setup_udp_prepare (c, vv);
		v->state = VIS_TRYING_UDP;
		break;
	default:
		v->state = VIS_ERRORED;
		x_api_warning ("out of sequence");
		break;
	}

	return res;
}
Example #5
0
/**
 * Request the playlist current pos broadcast. When the position
 * in the playlist is changed this will be called.
 */
xmmsc_result_t *
xmmsc_broadcast_playlist_current_pos (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_broadcast_msg (c, XMMS_IPC_SIGNAL_PLAYLIST_CURRENT_POS);
}
Example #6
0
xmmsc_result_t *
xmmsc_playback_pause (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_msg_no_arg (c, XMMS_IPC_OBJECT_PLAYBACK, XMMS_IPC_CMD_PAUSE);
}
Example #7
0
/**
 * Stop decoding of current song. This will start decoding of the song
 * set with xmmsc_playlist_set_next, or the current song again if no
 * xmmsc_playlist_set_next was executed.
 */
xmmsc_result_t *
xmmsc_playback_tickle (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_msg_no_arg (c, XMMS_IPC_OBJECT_PLAYBACK, XMMS_IPC_CMD_DECODER_KILL);
}
Example #8
0
/**
 * Request the playlist_loaded broadcast. This will be called
 * if a playlist is loaded server-side. The argument will be a string
 * with the playlist name.
 */
xmmsc_result_t *
xmmsc_broadcast_playlist_loaded (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_broadcast_msg (c, XMMS_IPC_SIGNAL_PLAYLIST_LOADED);
}
Example #9
0
/**
 * Queries the medialib for media and inserts the matching ones to
 * the current playlist at the given position.
 *
 * @param c The connection structure.
 * @param playlist The playlist in which to insert the media.
 * @param pos A position in the playlist
 * @param coll The collection to find media in the medialib.
 * @param order The list of properties by which to order the matching
 *              media, passed as an #xmmsv_t list of strings.
 */
xmmsc_result_t *
xmmsc_playlist_insert_collection (xmmsc_connection_t *c, const char *playlist,
                                  int pos, xmmsv_coll_t *coll,
                                  xmmsv_t *order)
{
	xmms_ipc_msg_t *msg;

	x_check_conn (c, NULL);

	/* default to the active playlist */
	if (playlist == NULL) {
		playlist = XMMS_ACTIVE_PLAYLIST;
	}

	/* default to empty ordering */

	msg = xmms_ipc_msg_new (XMMS_IPC_OBJECT_PLAYLIST, XMMS_IPC_CMD_INSERT_COLL);
	xmms_ipc_msg_put_string (msg, playlist);
	xmms_ipc_msg_put_int32 (msg, pos);
	xmms_ipc_msg_put_collection (msg, coll);
	xmms_ipc_msg_put_value_list (msg, order); /* purposedly skip typing */

	return xmmsc_send_msg (c, msg);

}
Example #10
0
/**
 * Request the collection changed broadcast from the server. Everytime someone
 * manipulates a collection this will be emitted.
 */
xmmsc_result_t*
xmmsc_broadcast_collection_changed (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_broadcast_msg (c, XMMS_IPC_SIGNAL_COLLECTION_CHANGED);
}
Example #11
0
/**
 * Search for a entry (URL) in the medialib db and return its ID number
 *
 * Same as #xmmsc_medialib_get_id but expects a encoded URL instead
 *
 * @param conn The #xmmsc_connection_t
 * @param url The URL to search for
 */
xmmsc_result_t *
xmmsc_medialib_get_id_encoded (xmmsc_connection_t *conn, const char *url)
{
	x_check_conn (conn, NULL);

	return do_methodcall (conn, XMMS_IPC_CMD_GET_ID, url);
}
Example #12
0
/**
 * List the ids of all media matched by the given collection.
 * A list of ordering properties can be specified, as well as offsets
 * to only retrieve part of the result set.
 *
 * @param conn  The connection to the server.
 * @param coll  The collection used to query.
 * @param order  The list of properties to order by, passed as an #xmmsv_t list of strings.
 * @param limit_start  The offset at which to start retrieving results (0 to disable).
 * @param limit_len  The maximum number of entries to retrieve (0 to disable).
 */
xmmsc_result_t*
xmmsc_coll_query_ids (xmmsc_connection_t *conn, xmmsv_coll_t *coll,
                      xmmsv_t *order, int limit_start,
                      int limit_len)
{
	xmms_ipc_msg_t *msg;

	x_check_conn (conn, NULL);
	x_api_error_if (!coll, "with a NULL collection", NULL);

	/* default to empty ordering */
	if (!order) {
		order = xmmsv_new_list ();
	} else {
		xmmsv_ref (order);
	}

	msg = xmms_ipc_msg_new (XMMS_IPC_OBJECT_COLLECTION, XMMS_IPC_CMD_QUERY_IDS);
	xmms_ipc_msg_put_collection (msg, coll);
	xmms_ipc_msg_put_int32 (msg, limit_start);
	xmms_ipc_msg_put_int32 (msg, limit_len);
	xmms_ipc_msg_put_value_list (msg, order); /* purposedly skip typing */

	xmmsv_unref (order);

	return xmmsc_send_msg (conn, msg);
}
Example #13
0
/**
 * Request the playback_playtime signal. Will update the
 * time we have played the current entry.
 */
xmmsc_result_t *
xmmsc_signal_playback_playtime (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_signal_msg (c, XMMS_IPC_SIGNAL_PLAYBACK_PLAYTIME);
}
Example #14
0
/**
 * Request the medialib_entry_changed broadcast. This will be called
 * if a entry changes on the serverside. The argument will be an medialib
 * id.
 */
xmmsc_result_t *
xmmsc_broadcast_medialib_entry_changed (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_broadcast_msg (c, XMMS_IPC_SIGNAL_MEDIALIB_ENTRY_UPDATE);
}
Example #15
0
/**
 * Retrive the name of the active playlist
 */
xmmsc_result_t *
xmmsc_playlist_current_active (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_msg_no_arg (c, XMMS_IPC_OBJECT_PLAYLIST, XMMS_IPC_CMD_CURRENT_ACTIVE);
}
Example #16
0
xmmsc_result_t *
xmmsc_broadcast_playback_volume_changed (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_broadcast_msg (c, XMMS_IPC_SIGNAL_PLAYBACK_VOLUME_CHANGED);
}
Example #17
0
xmmsc_result_t *
xmmsc_visualization_version (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_msg_no_arg (c, XMMS_IPC_OBJECT_VISUALIZATION, XMMS_IPC_CMD_VISUALIZATION_QUERY_VERSION);
}
Example #18
0
/**
 * Request number of unindexed entries in medialib.
 */
xmmsc_result_t *
xmmsc_signal_mediainfo_reader_unindexed (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_signal_msg (c, XMMS_IPC_SIGNAL_MEDIAINFO_READER_UNINDEXED);
}
Example #19
0
/**
 * Request status for the mediainfo reader. It can be idle or working
 */
xmmsc_result_t *
xmmsc_broadcast_mediainfo_reader_status (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_broadcast_msg (c, XMMS_IPC_SIGNAL_MEDIAINFO_READER_STATUS);
}
Example #20
0
/**
 * Get a list of statistics from the server
 */
xmmsc_result_t *
xmmsc_main_stats (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_msg_no_arg (c, XMMS_IPC_OBJECT_MAIN, XMMS_IPC_CMD_STATS);
}
Example #21
0
/**
 * Make server emit the playback status.
 */
xmmsc_result_t *
xmmsc_playback_status (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_msg_no_arg (c, XMMS_IPC_OBJECT_PLAYBACK,
	                              XMMS_IPC_CMD_PLAYBACK_STATUS);
}
Example #22
0
/**
 * List all bindata hashes stored on the server
 */
xmmsc_result_t *
xmmsc_bindata_list (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_BINDATA, XMMS_IPC_CMD_LIST_DATA,
	                       XMMSV_LIST_END);
}
Example #23
0
/**
 * Remove a file with associated with the hash from the server
 */
xmmsc_result_t *
xmmsc_bindata_remove (xmmsc_connection_t *c, const char *hash)
{
	x_check_conn (c, NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_BINDATA, XMMS_IPC_CMD_REMOVE_DATA,
	                       XMMSV_LIST_ENTRY_STR (hash), XMMSV_LIST_END);
}
Example #24
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);
}
Example #25
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);
}
Example #26
0
xmmsc_result_t *
xmmsc_playback_volume_get (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_msg_no_arg (c, XMMS_IPC_OBJECT_PLAYBACK,
	                              XMMS_IPC_CMD_VOLUME_GET);
}
Example #27
0
/**
 * Make server emit the current id.
 */
xmmsc_result_t *
xmmsc_playback_current_id (xmmsc_connection_t *c)
{
	x_check_conn (c, NULL);

	return xmmsc_send_msg_no_arg (c, XMMS_IPC_OBJECT_PLAYBACK,
	                              XMMS_IPC_CMD_CURRENTID);
}
Example #28
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);
}
Example #29
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);
}
Example #30
0
/**
 * Add a URL to the medialib. If you want to add mutiple files
 * you should call #xmmsc_medialib_import_path
 *
 * same as #xmmsc_medialib_add_entry but expects a encoded URL
 * instead
 *
 * @param conn The #xmmsc_connection_t
 * @param url URL to add to the medialib.
 */
xmmsc_result_t *
xmmsc_medialib_add_entry_encoded (xmmsc_connection_t *conn, const char *url)
{
	x_check_conn (conn, NULL);

	if (!_xmmsc_medialib_verify_url (url))
		x_api_error ("with a non encoded url", NULL);

	return do_methodcall (conn, XMMS_IPC_CMD_MLIB_ADD_URL, url);
}