changeset 522:2d3fad6a3842 trunk

[svn] - flac 112 plugin: do not try to pick tuple from file if file is not accessible via stdio (and stop crashing when such attempts are done); TODO: pick tags from flac via vfs
author giacomo
date Mon, 22 Jan 2007 12:32:00 -0800
parents 72515e5313cf
children 221086196f89
files ChangeLog src/flac112/fileinfo.c src/flac112/plugin.c src/flac112/tag.c
diffstat 4 files changed, 42 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 22 12:21:31 2007 -0800
+++ b/ChangeLog	Mon Jan 22 12:32:00 2007 -0800
@@ -1,3 +1,10 @@
+2007-01-22 20:21:31 +0000  Giacomo Lozito <james@develia.org>
+  revision [1128]
+  - refinements for getc/ungetc in curl
+  trunk/src/curl/curl.c |   15 +++++++--------
+  1 file changed, 7 insertions(+), 8 deletions(-)
+
+
 2007-01-22 18:36:50 +0000  Giacomo Lozito <james@develia.org>
   revision [1126]
   - add missing inclusion of audacious/strings.h where necessary
--- a/src/flac112/fileinfo.c	Mon Jan 22 12:21:31 2007 -0800
+++ b/src/flac112/fileinfo.c	Mon Jan 22 12:32:00 2007 -0800
@@ -240,6 +240,11 @@
 	gchar *title;
 	gchar *filename_utf8;
 
+	/* NOTE vfs is not used here, so only try
+	   to pick tags if you can do it with flac library stdio */
+	if ( strncmp(filename,"/",1) )
+		return;
+
 	if (!window)
 	{
 		GtkWidget *vbox, *hbox, *left_vbox, *table;
--- a/src/flac112/plugin.c	Mon Jan 22 12:21:31 2007 -0800
+++ b/src/flac112/plugin.c	Mon Jan 22 12:32:00 2007 -0800
@@ -403,32 +403,33 @@
 
 void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec)
 {
-	FLAC__StreamMetadata streaminfo;
+	/* NOTE vfs is not yet used here, so only try
+	   to pick tags if you can do it with flac library stdio */
+	if ( strncmp(filename,"/",1) )
+	{
+		FLAC__StreamMetadata streaminfo;
+		if(!FLAC__metadata_get_streaminfo(filename, &streaminfo)) {
+			/* @@@ how to report the error? */
+			if(title) {
+				if (source_to_decoder_type (filename) == DECODER_FILE) {
+					static const char *errtitle = "Invalid FLAC File: ";
+					*title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1);
+					sprintf(*title, "%s\"%s\"", errtitle, filename);
+				} else {
+					*title = NULL;
+				}
+			}
+			if(length_in_msec)
+				*length_in_msec = -1;
+			return;
+		}
 
-	if(0 == filename)
-		filename = "";
-
-	if(!FLAC__metadata_get_streaminfo(filename, &streaminfo)) {
-		/* @@@ how to report the error? */
 		if(title) {
-			if (source_to_decoder_type (filename) == DECODER_FILE) {
-				static const char *errtitle = "Invalid FLAC File: ";
-				*title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1);
-				sprintf(*title, "%s\"%s\"", errtitle, filename);
-			} else {
-				*title = NULL;
-			}
+			*title = flac_format_song_title(filename);
 		}
 		if(length_in_msec)
-			*length_in_msec = -1;
-		return;
+			*length_in_msec = (unsigned)((double)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5);
 	}
-
-	if(title) {
-		*title = flac_format_song_title(filename);
-	}
-	if(length_in_msec)
-		*length_in_msec = (unsigned)((double)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5);
 }
 
 /***********************************************************************
--- a/src/flac112/tag.c	Mon Jan 22 12:21:31 2007 -0800
+++ b/src/flac112/tag.c	Mon Jan 22 12:32:00 2007 -0800
@@ -91,7 +91,14 @@
 	FLAC__StreamMetadata *tags;
 	FLAC__StreamMetadata info;
 	char *title, *artist, *performer, *album, *date, *tracknumber, *genre, *description;
-	gchar *filename_proxy = g_strdup(filename);
+	gchar *filename_proxy;
+
+	/* NOTE vfs is not yet used here, so only try
+	   to pick tags if you can do it with flac library stdio */
+	if ( strncmp(filename,"/",1) )
+		return NULL;
+
+	filename_proxy = g_strdup(filename);
 
 	FLAC_plugin__tags_get(filename_proxy, &tags);