[xiph-commits] r13542 - trunk/ezstream/src

moritz at svn.xiph.org moritz at svn.xiph.org
Mon Aug 13 20:32:14 PDT 2007


Author: moritz
Date: 2007-08-13 20:32:13 -0700 (Mon, 13 Aug 2007)
New Revision: 13542

Modified:
   trunk/ezstream/src/ezstream.c
   trunk/ezstream/src/util.c
   trunk/ezstream/src/util.h
Log:
Ticket #1225, reported by matpoc at lenta dot ru: Bring back special case
for streaming MP3 files without reencoding, which was lost during the many
changes in 0.3.0 and subsequently forgotten. Sorry for the inconvenience,
and thanks for the report.


Modified: trunk/ezstream/src/ezstream.c
===================================================================
--- trunk/ezstream/src/ezstream.c	2007-08-13 21:33:27 UTC (rev 13541)
+++ trunk/ezstream/src/ezstream.c	2007-08-14 03:32:13 UTC (rev 13542)
@@ -624,7 +624,9 @@
 			close(stderr_fd);
 
 		return (filep);
-	}
+	} else if (strrcasecmp(fileName, ".mp3") == 0)
+		/* MP3 streams are special: */
+		setMetadata(shout, mdata, NULL);
 
 	metadata_free(&mdata);
 
@@ -816,7 +818,7 @@
 			clearerr(filepstream);
 			ret = STREAM_CONT;
 		} else
-			printf("%s: streamFile(): Error while reading '%s': %s\n",
+			printf("%s: sendStream(): Error while reading '%s': %s\n",
 			       __progname, fileName, strerror(errno));
 	}
 
@@ -1306,21 +1308,16 @@
 
 	if (shout_open(shout) == SHOUTERR_SUCCESS) {
 		int	ret;
-		char	*tmpFileName, *p;
 
 		printf("%s: Connected to http://%s:%d%s\n", __progname,
 		       host, port, mount);
 
-		tmpFileName = xstrdup(pezConfig->fileName);
-		for (p = tmpFileName; *p != '\0'; p++)
-			*p = tolower((int)*p);
 		if (pezConfig->fileNameIsProgram ||
-		    strrcmp(tmpFileName, ".m3u") == 0 ||
-		    strrcmp(tmpFileName, ".txt") == 0)
+		    strrcasecmp(pezConfig->fileName, ".m3u") == 0 ||
+		    strrcasecmp(pezConfig->fileName, ".txt") == 0)
 			playlistMode = 1;
 		else
 			playlistMode = 0;
-		xfree(tmpFileName);
 
 		if (vFlag && pezConfig->fileNameIsProgram)
 			printf("%s: Using program '%s' to get filenames for streaming\n",

Modified: trunk/ezstream/src/util.c
===================================================================
--- trunk/ezstream/src/util.c	2007-08-13 21:33:27 UTC (rev 13541)
+++ trunk/ezstream/src/util.c	2007-08-14 03:32:13 UTC (rev 13542)
@@ -21,9 +21,12 @@
 # include "config.h"
 #endif
 
+#include <ctype.h>
+#include <stdio.h>
 #include <string.h>
 
 #include "util.h"
+#include "xalloc.h"
 
 int
 strrcmp(const char *s, const char *sub)
@@ -36,3 +39,25 @@
 
 	return (memcmp(s + slen - sublen, sub, sublen));
 }
+
+int
+strrcasecmp(const char *s, const char *sub)
+{
+	char		*s_cpy = xstrdup(s);
+	char		*sub_cpy = xstrdup(sub);
+	char		*p;
+	int		 ret;
+
+	for (p = s_cpy; *p != '\0'; p++)
+		*p = tolower((int)*p);
+
+	for (p = sub_cpy; *p != '\0'; p++)
+		*p = tolower((int)*p);
+
+	ret = strrcmp(s_cpy, sub_cpy);
+
+	xfree(s_cpy);
+	xfree(sub_cpy);
+
+	return (ret);
+}

Modified: trunk/ezstream/src/util.h
===================================================================
--- trunk/ezstream/src/util.h	2007-08-13 21:33:27 UTC (rev 13541)
+++ trunk/ezstream/src/util.h	2007-08-14 03:32:13 UTC (rev 13542)
@@ -21,5 +21,6 @@
 #define __UTIL_H__
 
 int	strrcmp(const char *, const char *);
+int	strrcasecmp(const char *, const char *);
 
 #endif /* __UTIL_H__ */



More information about the commits mailing list