Mercurial > audlegacy
changeset 984:bcd1ebd0a7c1 trunk
[svn] - jumptofile and queue support fun
author | nhjm449 |
---|---|
date | Fri, 28 Apr 2006 22:46:00 -0700 |
parents | 6cc5538851d6 |
children | a68257a298a1 |
files | audacious/controlsocket.c audacious/controlsocket.h audacious/playlist.c audacious/playlist.h libaudacious/beepctrl.c libaudacious/beepctrl.h |
diffstat | 6 files changed, 149 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/audacious/controlsocket.c Fri Apr 28 22:44:06 2006 -0700 +++ b/audacious/controlsocket.c Fri Apr 28 22:46:00 2006 -0700 @@ -354,6 +354,33 @@ ctrl_write_gint(pkt->fd, playlist_queue_get_length()); ctrl_ack_packet(pkt); break; + case CMD_PLAYQUEUE_IS_QUEUED: + ctrl_write_gboolean(pkt->fd, + playlist_is_position_queued(*((guint32 *) pkt->data))); + ctrl_ack_packet(pkt); + break; + case CMD_PLAYQUEUE_GET_POS: + if (pkt->data) + ctrl_write_gint(pkt->fd, + playlist_get_queue_position_number(* + ((guint32 *) pkt-> + data))); + else + ctrl_write_gint(pkt->fd, 0); + + ctrl_ack_packet(pkt); + break; + case CMD_PLAYQUEUE_GET_QPOS: + if (pkt->data) + ctrl_write_gint(pkt->fd, + playlist_get_queue_qposition_number(* + ((guint32 *) pkt-> + data))); + else + ctrl_write_gint(pkt->fd, 0); + + ctrl_ack_packet(pkt); + break; case CMD_GET_OUTPUT_TIME: if (bmp_playback_get_playing()) ctrl_write_gint(pkt->fd, bmp_playback_get_time()); @@ -584,6 +611,9 @@ if (num < (guint)playlist_get_length()) playlist_queue_remove(num); break; + case CMD_PLAYQUEUE_CLEAR: + playlist_clear_queue(); + break; case CMD_SET_PLAYLIST_POS: num = *((guint32 *) data); if (num < (guint)playlist_get_length()) @@ -628,6 +658,11 @@ break; show_prefs_window(); break; + case CMD_SHOW_JTF_BOX: + if (has_x11_connection != TRUE) + break; + mainwin_jump_to_file(); + break; case CMD_TOGGLE_AOT: if (has_x11_connection != TRUE) break;
--- a/audacious/controlsocket.h Fri Apr 28 22:44:06 2006 -0700 +++ b/audacious/controlsocket.h Fri Apr 28 22:46:00 2006 -0700 @@ -48,7 +48,9 @@ CMD_QUIT, CMD_PLAYLIST_INS_URL_STRING, CMD_PLAYLIST_INS, CMD_PLAY_PAUSE, CMD_PLAYQUEUE_ADD, CMD_GET_PLAYQUEUE_LENGTH, CMD_PLAYQUEUE_REMOVE, CMD_TOGGLE_ADVANCE, CMD_IS_ADVANCE, - CMD_ACTIVATE + CMD_ACTIVATE, CMD_SHOW_JTF_BOX, + CMD_PLAYQUEUE_CLEAR, CMD_PLAYQUEUE_IS_QUEUED, + CMD_PLAYQUEUE_GET_POS, CMD_PLAYQUEUE_GET_QPOS };
--- a/audacious/playlist.c Fri Apr 28 22:44:06 2006 -0700 +++ b/audacious/playlist.c Fri Apr 28 22:46:00 2006 -0700 @@ -1010,6 +1010,34 @@ return tmp != NULL; } +gint +playlist_get_queue_position_number(guint pos) +{ + PlaylistEntry *entry; + gint tmp; + + PLAYLIST_LOCK(); + entry = g_list_nth_data(playlist, pos); + tmp = g_list_index(queued_list, entry); + PLAYLIST_UNLOCK(); + + return tmp; +} + +gint +playlist_get_queue_qposition_number(guint pos) +{ + PlaylistEntry *entry; + gint tmp; + + PLAYLIST_LOCK(); + entry = g_list_nth_data(queued_list, pos); + tmp = g_list_index(playlist, entry); + PLAYLIST_UNLOCK(); + + return tmp; +} + void playlist_clear_queue(void) {
--- a/audacious/playlist.h Fri Apr 28 22:44:06 2006 -0700 +++ b/audacious/playlist.h Fri Apr 28 22:46:00 2006 -0700 @@ -83,6 +83,8 @@ gboolean playlist_is_position_queued(guint pos); void playlist_clear_queue(void); gint playlist_get_queue_position(PlaylistEntry * entry); +gint playlist_get_queue_position_number(guint pos); +gint playlist_get_queue_qposition_number(guint pos); void playlist_eof_reached(void); void playlist_set_position(guint pos); gint playlist_get_length(void);
--- a/libaudacious/beepctrl.c Fri Apr 28 22:44:06 2006 -0700 +++ b/libaudacious/beepctrl.c Fri Apr 28 22:46:00 2006 -0700 @@ -693,6 +693,12 @@ } void +xmms_remote_show_jtf_box(gint session) +{ + remote_cmd(session, CMD_SHOW_JTF_BOX); +} + +void xmms_remote_toggle_aot(gint session, gboolean ontop) { remote_send_boolean(session, CMD_TOGGLE_AOT, ontop); @@ -805,12 +811,81 @@ remote_send_guint32(session, CMD_PLAYQUEUE_REMOVE, pos); } +void +xmms_remote_playqueue_clear(gint session) +{ + remote_cmd(session, CMD_PLAYQUEUE_CLEAR); +} + gint xmms_remote_get_playqueue_length(gint session) { return remote_get_gint(session, CMD_GET_PLAYQUEUE_LENGTH); } +gboolean +xmms_remote_playqueue_is_queued(gint session, gint pos) +{ + ServerPktHeader pkt_hdr; + gpointer data; + gint fd, ret = 0; + guint32 p = pos; + + if ((fd = xmms_connect_to_session(session)) == -1) + return ret; + remote_send_packet(fd, CMD_PLAYQUEUE_IS_QUEUED, &p, sizeof(guint32)); + data = remote_read_packet(fd, &pkt_hdr); + if (data) { + ret = *((gint *) data); + g_free(data); + } + remote_read_ack(fd); + close(fd); + return ret; +} + +gint +xmms_remote_get_playqueue_position(gint session, gint pos) +{ + ServerPktHeader pkt_hdr; + gpointer data; + gint fd, ret = 0; + guint32 p = pos; + + if ((fd = xmms_connect_to_session(session)) == -1) + return ret; + remote_send_packet(fd, CMD_PLAYQUEUE_GET_POS, &p, sizeof(guint32)); + data = remote_read_packet(fd, &pkt_hdr); + if (data) { + ret = *((gint *) data); + g_free(data); + } + remote_read_ack(fd); + close(fd); + return ret; +} + +gint +xmms_remote_get_playqueue_queue_position(gint session, gint pos) +{ + ServerPktHeader pkt_hdr; + gpointer data; + gint fd, ret = 0; + guint32 p = pos; + + if ((fd = xmms_connect_to_session(session)) == -1) + return ret; + remote_send_packet(fd, CMD_PLAYQUEUE_GET_QPOS, &p, sizeof(guint32)); + data = remote_read_packet(fd, &pkt_hdr); + if (data) { + ret = *((gint *) data); + g_free(data); + } + remote_read_ack(fd); + close(fd); + return ret; +} + void xmms_remote_get_eq(gint session, gfloat * preamp, gfloat ** bands) {
--- a/libaudacious/beepctrl.h Fri Apr 28 22:44:06 2006 -0700 +++ b/libaudacious/beepctrl.h Fri Apr 28 22:46:00 2006 -0700 @@ -101,6 +101,12 @@ /* Added in BMP 0.9.7 */ void xmms_remote_activate(gint session); +/* Added in Audacious 1.1 */ + void xmms_remote_show_jtf_box(gint session); + void xmms_remote_playqueue_clear(gint session); + gboolean xmms_remote_playqueue_is_queued(gint session, gint pos); + gint xmms_remote_get_playqueue_position(gint session, gint pos); + gint xmms_remote_get_playqueue_queue_position(gint session, gint pos); #ifdef __cplusplus };