Mercurial > audlegacy
changeset 2739:953001c668ae trunk
[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
author | giacomo |
---|---|
date | Fri, 11 May 2007 16:27:54 -0700 |
parents | 1eb06f902923 |
children | a67712c75069 |
files | ChangeLog src/audacious/Makefile src/audacious/auddrct.c src/audacious/auddrct.h src/audacious/build_stamp.c |
diffstat | 5 files changed, 162 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri May 11 13:02:49 2007 -0700 +++ b/ChangeLog Fri May 11 16:27:54 2007 -0700 @@ -1,3 +1,11 @@ +2007-05-11 20:02:49 +0000 William Pitcock <nenolod@sacredspiral.co.uk> + revision [4502] + - call SongFrames not SongLength + + trunk/src/libaudclient/audctrl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2007-05-11 19:49:05 +0000 William Pitcock <nenolod@sacredspiral.co.uk> revision [4500] - split handlers out to handlers.c
--- a/src/audacious/Makefile Fri May 11 13:02:49 2007 -0700 +++ b/src/audacious/Makefile Fri May 11 16:27:54 2007 -0700 @@ -37,6 +37,7 @@ -I../intl HEADERS = \ + auddrct.h \ configdb.h \ dbus.h \ formatter.h \ @@ -60,6 +61,7 @@ xconvert.h SOURCES = \ + auddrct.c \ build_stamp.c \ configdb.c \ $(DBUS_C) \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/auddrct.c Fri May 11 16:27:54 2007 -0700 @@ -0,0 +1,115 @@ +/* + * Audacious: A cross-platform multimedia player + * Copyright (c) 2007 Giacomo Lozito + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +/* audacious_drct_* provides a handy interface for player + plugins, originally intended for migration from xmms_remote_* calls */ + + +#include "input.h" +#include "playback.h" +#include "ui_main.h" + + +/* playback */ + +void +audacious_drct_play ( void ) +{ + if (playback_get_paused()) + playback_pause(); + else if (playlist_get_length(playlist_get_active())) + playback_initiate(); + else + mainwin_eject_pushed(); + return; +} + +void +audacious_drct_pause ( void ) +{ + playback_pause(); + return; +} + +void +audacious_drct_stop ( void ) +{ + ip_data.stop = TRUE; + playback_stop(); + ip_data.stop = FALSE; + mainwin_clear_song_info(); + return; +} + +gboolean +audacious_drct_get_playing ( void ) +{ + return playback_get_playing(); +} + +gboolean +audacious_drct_get_paused ( void ) +{ + return playback_get_paused(); +} + +gboolean +audacious_drct_get_stopped ( void ) +{ + return !playback_get_playing(); +} + +gint +audacious_drct_get_time ( void ) +{ + gint time; + if (playback_get_playing()) + time = playback_get_time(); + else + time = 0; + return time; +} + +void +audacious_drct_seek ( guint pos ) +{ + if (playlist_get_current_length(playlist_get_active()) > 0 && + pos < (guint)playlist_get_current_length(playlist_get_active())) + playback_seek(pos / 1000); + return; +} + +void +audacious_drct_get_volume( gint *vl, gint *vr ) +{ + input_get_volume(vl, vr); + return; +} + +void +audacious_drct_set_volume( gint vl, gint vr ) +{ + if (vl > 100) + vl = 100; + if (vr > 100) + vr = 100; + input_set_volume(vl, vr); + return; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/auddrct.h Fri May 11 16:27:54 2007 -0700 @@ -0,0 +1,36 @@ +/* + * Audacious: A cross-platform multimedia player + * Copyright (c) 2007 Giacomo Lozito + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +/* audacious_drct_* provides a handy interface for player + plugins, originally intended for migration from xmms_remote_* calls */ + +#include <glib.h> + + +/* playback */ +void audacious_drct_play ( void ); +void audacious_drct_pause ( void ); +void audacious_drct_stop ( void ); +gboolean audacious_drct_get_playing ( void ); +gboolean audacious_drct_get_paused ( void ); +gboolean audacious_drct_get_stopped ( void ); +gint audacious_drct_get_time ( void ); +void audacious_drct_seek ( guint pos ); +void audacious_drct_get_volume( gint *vl, gint *vr ); +void audacious_drct_set_volume( gint vl, gint vr );