[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Request for Review: bmp-flac



On Tue, 2005-04-19 at 22:23 +0200, Michael Schwendt wrote:

>  * Doesn't work for me. Steps to reproduce:
> 
>    1. take an arbitrary .WAV file
>    2. encode it with "flac filename.wav"
>    3. load "filename.flac" into BMP
>    
>    Result: Invalid FLAC File: "file:///..."
> 
>    The reason is that the "filename" argument passed to plugin code
>    is prefixed with "file://", which you need to strip off in the
>    plugin callback functions. I've ported xmms-fc to BMP a week
>    ago to have more code for testing BMP and ran into the same
>    issue.

Patch attached to resolve this blocker. Confirmed that it works (with
Dave Grohl's 1993 pre Foo Fighters demo tape!).

~spot
-- 
Tom "spot" Callaway: Red Hat Sales Engineer || GPG Fingerprint: 93054260
Fedora Extras Steering Committee Member (RPM Standards and Practices)
Aurora Linux Project Leader: http://auroralinux.org
Lemurs, llamas, and sparcs, oh my!
--- bmp-flac-2/plugin.c.patch0	2005-04-16 12:29:15.000000000 -0500
+++ bmp-flac-2/plugin.c	2005-04-28 18:01:53.000000000 -0500
@@ -195,8 +195,12 @@
 
 int FLAC_XMMS__is_our_file(char *filename)
 {
+	const char prefix[] = "file://";
 	char *ext;
 
+	if ( 0 == strncasecmp( filename, prefix, strlen(prefix) ) )
+		filename += strlen(prefix);
+
 	ext = strrchr(filename, '.');
 	if(ext)
 		if(!strcasecmp(ext, ".flac") || !strcasecmp(ext, ".fla"))
@@ -207,6 +211,7 @@
 void FLAC_XMMS__play_file(char *filename)
 {
 	FILE *f;
+	const char prefix[] = "file://";
 
 	sample_buffer_first_ = sample_buffer_last_ = 0;
 	audio_error_ = false;
@@ -216,6 +221,8 @@
 	file_info_.play_thread_open = false;
 	file_info_.has_replaygain = false;
 
+	if ( 0 == strncasecmp( filename, prefix, strlen(prefix) ) )
+		filename += strlen(prefix);
 	if(0 == (f = fopen(filename, "r")))
 		return;
 	fclose(f);
@@ -321,6 +328,10 @@
 void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec)
 {
 	FLAC__StreamMetadata streaminfo;
+	const char prefix[] = "file://";
+
+	if ( 0 == strncasecmp( filename, prefix, strlen(prefix) ) )
+		filename += strlen(prefix);
 
 	if(0 == filename)
 		filename = "";
--- bmp-flac-2/wrap_id3.c.patch0	2005-04-16 12:29:15.000000000 -0500
+++ bmp-flac-2/wrap_id3.c	2005-04-28 18:00:13.000000000 -0500
@@ -77,6 +77,10 @@
 	char *ret = NULL;
 	TitleInput *input = NULL;
 	FLAC_Plugin__CanonicalTag tag;
+	const char prefix[] = "file://";
+
+	if ( 0 == strncasecmp( filename, prefix, strlen(prefix) ) )
+		filename += strlen(prefix);
 
 	FLAC_plugin__canonical_tag_init(&tag);
 
--- bmp-flac-2/fileinfo.c.patch0	2005-04-16 12:29:15.000000000 -0500
+++ bmp-flac-2/fileinfo.c	2005-04-28 18:00:13.000000000 -0500
@@ -235,6 +235,10 @@
 {
 	unsigned i;
 	gchar *title;
+	const char prefix[] = "file://";
+
+	if ( 0 == strncasecmp( filename, prefix, strlen(prefix) ) )
+		filename += strlen(prefix);
 
 	if (!window)
 	{

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]