changeset 96:8dbd2d31c1f7 trunk

[svn] More work
author nenolod
date Tue, 01 Nov 2005 21:23:24 -0800
parents 8247bbf454a8
children 6b7d49bd0292
files Plugins/Input/console/Audacious_Driver.cpp Plugins/Input/console/Makefile.am
diffstat 2 files changed, 74 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/console/Audacious_Driver.cpp	Tue Nov 01 21:09:52 2005 -0800
+++ b/Plugins/Input/console/Audacious_Driver.cpp	Tue Nov 01 21:23:24 2005 -0800
@@ -8,6 +8,7 @@
 
 #include "Audacious_Driver.h"
 
+#include <glib/gi18n.h>
 #include "libaudacious/configfile.h"
 #include "libaudacious/util.h"
 #include "libaudacious/titlestring.h"
@@ -18,9 +19,11 @@
 
 static Spc_Emu *spc = NULL;
 static GThread *decode_thread;
-static InputPlugin console_ip;
 
 static void *play_loop(gpointer arg);
+static void console_stop(void);
+static void console_pause(gshort p);
+static int get_time(void);
 
 static int is_our_file(gchar *filename)
 {
@@ -73,22 +76,80 @@
 	decode_thread = g_thread_create(play_loop, NULL, FALSE, NULL);
 }
 
+static void seek(gint time)
+{
+	// XXX: Not yet implemented
+}
+
+static void console_init(void)
+{
+	// nothing to do here
+}
+
+InputPlugin console_ip = {
+	NULL,
+	NULL,
+	NULL,
+	console_init,
+	NULL,
+	NULL,
+	is_our_file,
+	NULL,
+	play_file,
+	console_stop,
+	console_pause,
+	seek,
+	NULL,
+	get_time,
+	NULL,
+	NULL,
+	NULL,	
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL
+};
+
+static void console_stop(void)
+{
+        g_thread_join(decode_thread);
+        console_ip.output->close_audio();
+}
+
+InputPlugin *get_iplugin_info(void)
+{
+        console_ip.description = g_strdup_printf(_("Console music plugin"));
+        return &console_ip;
+}
+
+static void console_pause(gshort p)
+{
+        console_ip.output->pause(p);
+}
+
 static void *play_loop(gpointer arg)
 {
-	Music_Emu::sample_t buf[1024];
+        Music_Emu::sample_t buf[1024];
 
-	while (spc->play(1024, buf))
-	{
-		produce_audio(console_ip.output->written_time(),
-				FMT_S16_LE, 2, 1024, (char *) buf,
-				NULL);
-		xmms_usleep(100000);
-	}
+        while (spc->play(1024, buf))
+        {
+                produce_audio(console_ip.output->written_time(),
+                                FMT_S16_LE, 2, 1024, (char *) buf,
+                                NULL);
+                xmms_usleep(100000);
+        }
 
-	delete spc;
-	g_thread_exit(NULL);
+        delete spc;
+        g_thread_exit(NULL);
 
-	return NULL;
+        return NULL;
 }
 
+static int get_time(void)
+{
+        return console_ip.output->output_time();
+}
 
--- a/Plugins/Input/console/Makefile.am	Tue Nov 01 21:09:52 2005 -0800
+++ b/Plugins/Input/console/Makefile.am	Tue Nov 01 21:23:24 2005 -0800
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libconsole.la
+lib_LTLIBRARIES = libconsole.la
 
 libdir = $(plugin_dir)/$(INPUT_PLUGIN_DIR)