changeset 2389:46d3e970f0a5

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author William Pitcock <nenolod@atheme.org>
date Thu, 14 Feb 2008 15:44:10 -0600
parents 2fe51f6ddb36 (current diff) 74ab1fa87598 (diff)
children bd9673d8b7d5
files
diffstat 6 files changed, 47 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/src/alsa/audio.c	Thu Feb 14 15:43:46 2008 -0600
+++ b/src/alsa/audio.c	Thu Feb 14 15:44:10 2008 -0600
@@ -34,7 +34,6 @@
 #include "alsa.h"
 #include <ctype.h>
 #include <math.h>
-#include <audacious/xconvert.h>
 
 static snd_pcm_t *alsa_pcm;
 static snd_output_t *logs;
@@ -809,16 +808,6 @@
 	return f;
 }
 
-static int format_from_alsa(snd_pcm_format_t fmt)
-{
-	size_t i;
-	for (i = 0; i < sizeof(format_table) / sizeof(format_table[0]); i++)
-		if (format_table[i].alsa == fmt)
-			return format_table[i].xmms;
-	g_warning("Unsupported format: %s", snd_pcm_format_name(fmt));
-	return -1;
-}
-
 static int alsa_setup(struct snd_format *f)
 {
 	int err;
--- a/src/cdaudio-ng/cdaudio-ng.c	Thu Feb 14 15:43:46 2008 -0600
+++ b/src/cdaudio-ng/cdaudio-ng.c	Thu Feb 14 15:44:10 2008 -0600
@@ -48,15 +48,15 @@
 #include "configure.h"
 
 
-struct cdng_cfg_t			cdng_cfg;
-static gint					firsttrackno = -1;
-static gint					lasttrackno = -1;
+cdng_cfg_t				cdng_cfg;
+static gint				firsttrackno = -1;
+static gint				lasttrackno = -1;
 static CdIo_t				*pcdio = NULL;
 static trackinfo_t			*trackinfo = NULL;
 static gboolean				is_paused = FALSE;
-static gint					playing_track = -1;
+static gint				playing_track = -1;
 static dae_params_t			*pdae_params = NULL;
-static InputPlayback		*pglobalinputplayback = NULL;
+static InputPlayback			*pglobalinputplayback = NULL;
 static GtkWidget			*main_menu_item, *playlist_menu_item;
 static GThread				*scan_cd_thread = NULL;
 
@@ -73,11 +73,10 @@
 static gint			cdaudio_set_volume(gint l, gint r);
 static void			cdaudio_cleanup(void);
 static void			cdaudio_get_song_info(gchar *filename, gchar **title, gint *length);
-static Tuple		*cdaudio_get_song_tuple(gchar *filename);
+static Tuple			*cdaudio_get_song_tuple(gchar *filename);
 
 static void			menu_click(void);
-static Tuple		*create_tuple_from_trackinfo_and_filename(gchar *filename);
-static Tuple		*create_tuple_from_trackinfo(int trackno);
+static Tuple			*create_tuple_from_trackinfo_and_filename(gchar *filename);
 static void			dae_play_loop(dae_params_t *pdae_params);
 static void			*scan_cd(void *nothing);
 static void			scan_cd_threaded();
@@ -139,7 +138,20 @@
 
 	debug("cdaudio_init()\n");
 
-	memset(&cdng_cfg, 0, sizeof(cdng_cfg));
+	cdng_cfg.use_dae = TRUE;
+	cdng_cfg.use_cdtext = TRUE;
+	cdng_cfg.use_cddb = TRUE;
+	cdng_cfg.debug = FALSE;
+	cdng_cfg.device = g_strdup("");
+	cdng_cfg.cddb_server = g_strdup(CDDA_DEFAULT_CDDB_SERVER);
+	cdng_cfg.cddb_port = CDDA_DEFAULT_CDDB_PORT;
+	cdng_cfg.cddb_http = FALSE;
+	cdng_cfg.limitspeed = CDDA_DEFAULT_LIMIT_SPEED;
+	cdng_cfg.use_proxy = FALSE;
+	cdng_cfg.proxy_host = g_strdup("");
+	cdng_cfg.proxy_port = CDDA_DEFAULT_PROXY_PORT;
+	cdng_cfg.proxy_username = g_strdup("");
+	cdng_cfg.proxy_password = g_strdup("");
 
 	if ((db = aud_cfg_db_open()) == NULL) {
 		cdaudio_error("Failed to read configuration.\n");
@@ -150,42 +162,26 @@
 	if (!cdio_init()) {
 		cdaudio_error("Failed to initialize cdio subsystem.\n");
 		cleanup_on_error();
+		aud_cfg_db_close(db);
 		return;
 	}
 
 	libcddb_init();
 
-	/*
-	if (!aud_cfg_db_get_bool(db, "CDDA", "use_dae", &cdng_cfg.use_dae))
-	*/
-	cdng_cfg.use_dae = TRUE;
-
-	if (!aud_cfg_db_get_int(db, "CDDA", "limitspeed", &cdng_cfg.limitspeed))
-		cdng_cfg.limitspeed = 1;
-	if (!aud_cfg_db_get_bool(db, "CDDA", "use_cdtext", &cdng_cfg.use_cdtext))
-		cdng_cfg.use_cdtext = TRUE;
-	if (!aud_cfg_db_get_bool(db, "CDDA", "use_cddb", &cdng_cfg.use_cddb))
-		cdng_cfg.use_cddb = TRUE;
-	if (!aud_cfg_db_get_string(db, "CDDA", "cddbserver", &cdng_cfg.cddb_server))
-		cdng_cfg.cddb_server = g_strdup(CDDA_DEFAULT_CDDB_SERVER);
-	if (!aud_cfg_db_get_int(db, "CDDA", "cddbport", &cdng_cfg.cddb_port))
-		cdng_cfg.cddb_port = CDDA_DEFAULT_CDDB_PORT;
-	if (!aud_cfg_db_get_bool(db, "CDDA", "cddbhttp", &cdng_cfg.cddb_http))
-		cdng_cfg.cddb_port = FALSE;
-	if (!aud_cfg_db_get_string(db, "CDDA", "device", &cdng_cfg.device))
-		cdng_cfg.device = g_strdup("");
-	if (!aud_cfg_db_get_bool(db, "CDDA", "debug", &cdng_cfg.debug))
-		cdng_cfg.debug = FALSE;
-	if (!aud_cfg_db_get_bool(db, "audacious", "use_proxy", &cdng_cfg.use_proxy))
-		cdng_cfg.use_proxy = FALSE;
-	if (!aud_cfg_db_get_string(db, "audacious", "proxy_host", &cdng_cfg.proxy_host))
-		cdng_cfg.proxy_host = g_strdup("");
-	if (!aud_cfg_db_get_int(db, "audacious", "proxy_port", &cdng_cfg.proxy_port))
-		cdng_cfg.proxy_port = 8080;
-	if (!aud_cfg_db_get_string(db, "audacious", "proxy_user", &cdng_cfg.proxy_username))
-		cdng_cfg.proxy_username = g_strdup("");
-	if (!aud_cfg_db_get_string(db, "audacious", "proxy_pass", &cdng_cfg.proxy_password))
-		cdng_cfg.proxy_password = g_strdup("");
+	aud_cfg_db_get_bool(db, "CDDA", "use_dae", &cdng_cfg.use_dae);
+	aud_cfg_db_get_bool(db, "CDDA", "use_cdtext", &cdng_cfg.use_cdtext);
+	aud_cfg_db_get_bool(db, "CDDA", "use_cddb", &cdng_cfg.use_cddb);
+	aud_cfg_db_get_bool(db, "CDDA", "debug", &cdng_cfg.debug);
+	aud_cfg_db_get_string(db, "CDDA", "device", &cdng_cfg.device);
+	aud_cfg_db_get_string(db, "CDDA", "cddbserver", &cdng_cfg.cddb_server);
+	aud_cfg_db_get_int(db, "CDDA", "cddbport", &cdng_cfg.cddb_port);
+	aud_cfg_db_get_bool(db, "CDDA", "cddbhttp", &cdng_cfg.cddb_http);
+	aud_cfg_db_get_int(db, "CDDA", "limitspeed", &cdng_cfg.limitspeed);
+	aud_cfg_db_get_bool(db, "audacious", "use_proxy", &cdng_cfg.use_proxy);
+	aud_cfg_db_get_string(db, "audacious", "proxy_host", &cdng_cfg.proxy_host);
+	aud_cfg_db_get_int(db, "audacious", "proxy_port", &cdng_cfg.proxy_port);
+	aud_cfg_db_get_string(db, "audacious", "proxy_user", &cdng_cfg.proxy_username);
+	aud_cfg_db_get_string(db, "audacious", "proxy_pass", &cdng_cfg.proxy_password);
 
 	aud_cfg_db_close(db);
 
@@ -565,7 +561,7 @@
 	// todo: destroy the gui
 
 	ConfigDb *db = aud_cfg_db_open();
-	/*aud_cfg_db_set_bool(db, "CDDA", "use_dae", cdng_cfg.use_dae);*/
+	aud_cfg_db_set_bool(db, "CDDA", "use_dae", cdng_cfg.use_dae);
 	aud_cfg_db_set_int(db, "CDDA", "limitspeed", cdng_cfg.limitspeed);
 	aud_cfg_db_set_bool(db, "CDDA", "use_cdtext", cdng_cfg.use_cdtext);
 	aud_cfg_db_set_bool(db, "CDDA", "use_cddb", cdng_cfg.use_cddb);
@@ -646,40 +642,6 @@
 	}
 }
 
-static Tuple *create_tuple_from_trackinfo(int trackno)
-{
-	Tuple *tuple = aud_tuple_new();
-
-	if (trackinfo == NULL)
-		return tuple;
-
-	if (trackno < firsttrackno || trackno > lasttrackno)
-		return tuple;
-
-	if(strlen(trackinfo[trackno].performer)) {
-		aud_tuple_associate_string(tuple, FIELD_ARTIST, NULL, trackinfo[trackno].performer);
-	}
-	if(strlen(trackinfo[0].name)) {
-		aud_tuple_associate_string(tuple, FIELD_ALBUM, NULL, trackinfo[0].name);
-	}
-	if(strlen(trackinfo[trackno].name)) {
-		aud_tuple_associate_string(tuple, FIELD_TITLE, NULL, trackinfo[trackno].name);
-	}
-
-	aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, trackno);
-	aud_tuple_associate_string(tuple, -1, "ext", "cda"); //XXX should do? --yaz
-
-	aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL,
-		calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn));
-
-	if(strlen(trackinfo[trackno].genre)) {
-		aud_tuple_associate_string(tuple, FIELD_GENRE, NULL,  trackinfo[trackno].genre);
-	}
-	//tuple->year = 0; todo: set the year
-
-	return tuple;
-}
-
 static Tuple *create_tuple_from_trackinfo_and_filename(gchar *filename)
 {
 	Tuple *tuple = aud_tuple_new_from_filename(filename);
@@ -955,6 +917,9 @@
 			else {
 				debug("getting CDDB info\n");
 
+				cddb_cache_enable(pcddb_conn);
+				//cddb_cache_set_dir(pcddb_conn, "~/.cddbslave");
+
 				if (cdng_cfg.use_proxy) {
 					cddb_http_proxy_enable(pcddb_conn);
 					cddb_set_http_proxy_server_name(pcddb_conn, cdng_cfg.proxy_host);
@@ -988,7 +953,7 @@
 				cddb_disc_set_length(pcddb_disc, cdio_audio_get_msf_seconds(&endmsf) - cdio_audio_get_msf_seconds(&startmsf));
 
 				cddb_disc_calc_discid(pcddb_disc);
-				int discid = cddb_disc_get_discid(pcddb_disc);
+				unsigned int discid = cddb_disc_get_discid(pcddb_disc);
 				debug("CDDB disc id = %x\n", discid);
 
 				gint matches;
--- a/src/cdaudio-ng/cdaudio-ng.h	Thu Feb 14 15:43:46 2008 -0600
+++ b/src/cdaudio-ng/cdaudio-ng.h	Thu Feb 14 15:44:10 2008 -0600
@@ -24,8 +24,10 @@
 #define DEF_STRING_LEN				256
 #define CDDA_DEFAULT				"cdda://default"
 #define CDDA_DAE_FRAMES				8
+#define CDDA_DEFAULT_LIMIT_SPEED		1
 #define CDDA_DEFAULT_CDDB_SERVER	"freedb.org"
 #define CDDA_DEFAULT_CDDB_PORT		8880
+#define CDDA_DEFAULT_PROXY_PORT		8080
 
 
 typedef struct {
--- a/src/cdaudio-ng/configure.c	Thu Feb 14 15:43:46 2008 -0600
+++ b/src/cdaudio-ng/configure.c	Thu Feb 14 15:44:10 2008 -0600
@@ -7,6 +7,7 @@
 
 #include "configure.h"
 
+extern cdng_cfg_t cdng_cfg;
 
 static GtkWidget *configwindow,
 		*okbutton,
--- a/src/cdaudio-ng/configure.h	Thu Feb 14 15:43:46 2008 -0600
+++ b/src/cdaudio-ng/configure.h	Thu Feb 14 15:44:10 2008 -0600
@@ -2,7 +2,7 @@
 #define _CDNG_CONFIGURE_H
 #include <glib.h>
 
-extern struct cdng_cfg_t {
+typedef struct cdng_cfg_t {
 
 	gboolean	use_dae;
 	gboolean	use_cdtext;
@@ -19,7 +19,7 @@
 	gchar		*proxy_username;
 	gchar		*proxy_password;
 
-} cdng_cfg;
+} cdng_cfg_t;
 
 
 void	configure_create_gui(void);
--- a/src/gnomeshortcuts/gnomeshortcuts.c	Thu Feb 14 15:43:46 2008 -0600
+++ b/src/gnomeshortcuts/gnomeshortcuts.c	Thu Feb 14 15:44:10 2008 -0600
@@ -251,7 +251,7 @@
 		g_warning ("Error connecting to DBus: %s", error->message);
 	} else {
 		media_player_keys_proxy = dbus_g_proxy_new_for_name (bus,
-			"org.gnome.SettingsDaemon.MediaKeys", 
+			"org.gnome.SettingsDaemon", 
 			"/org/gnome/SettingsDaemon/MediaKeys",
 			"org.gnome.SettingsDaemon.MediaKeys");
 		if (media_player_keys_proxy == NULL) return;