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

oddsock at motherfish-iii.xiph.org oddsock at motherfish-iii.xiph.org
Tue Dec 21 17:49:57 PST 2004


Author: oddsock
Date: 2004-12-21 17:49:56 -0800 (Tue, 21 Dec 2004)
New Revision: 8519

Modified:
   trunk/ezstream/src/ezstream.c
Log:
add passthorough support for unknown types


Modified: trunk/ezstream/src/ezstream.c
===================================================================
--- trunk/ezstream/src/ezstream.c	2004-12-22 00:19:44 UTC (rev 8518)
+++ trunk/ezstream/src/ezstream.c	2004-12-22 01:49:56 UTC (rev 8519)
@@ -139,25 +139,44 @@
 		printf("Unknown extension %s, cannot decode\n", extension);
 		return commandString;
 	}
-	encoder = strdup(getFormatEncoder(pezConfig->format));
-	if (strlen(encoder) == 0) {
-		printf("Unknown format %s, cannot encode\n", pezConfig->format);
-		return commandString;
-	}
 	newDecoderLen = strlen(decoder) + strlen(fileName) + 1;
 	newDecoder = (char *)malloc(newDecoderLen);
 	memset(newDecoder, '\000', newDecoderLen);
 	ReplaceString(decoder, newDecoder, "@T@", fileName);
 
-	newEncoderLen = strlen(encoder) + strlen(metadata) + 1;
-	newEncoder = (char *)malloc(newEncoderLen);
-	memset(newEncoder, '\000', newEncoderLen);
-	ReplaceString(encoder, newEncoder, "@M@", metadata);
+	encoder = strdup(getFormatEncoder(pezConfig->format));
+	if (strlen(encoder) == 0) {
+		printf("Unknown format %s, passing right on through!\n", pezConfig->format);
+		commandStringLen = strlen(newDecoder) + 1;
+		commandString = (char *)malloc(commandStringLen);
+		memset(commandString, '\000', commandStringLen);
+		sprintf(commandString, "%s", newDecoder);
+		if (decoder) {
+			free(decoder);
+		}
+		if (encoder) {
+			free(encoder);
+		}
+		return commandString;
+	}
+	else {
 
-	commandStringLen = strlen(newDecoder) + strlen(" | ") + strlen(newEncoder) + 1;
-	commandString = (char *)malloc(commandStringLen);
-	memset(commandString, '\000', commandStringLen);
-	sprintf(commandString, "%s | %s", newDecoder, newEncoder);
+		newEncoderLen = strlen(encoder) + strlen(metadata) + 1;
+		newEncoder = (char *)malloc(newEncoderLen);
+		memset(newEncoder, '\000', newEncoderLen);
+		ReplaceString(encoder, newEncoder, "@M@", metadata);
+
+		commandStringLen = strlen(newDecoder) + strlen(" | ") + strlen(newEncoder) + 1;
+		commandString = (char *)malloc(commandStringLen);
+		memset(commandString, '\000', commandStringLen);
+		sprintf(commandString, "%s | %s", newDecoder, newEncoder);
+	}
+	if (decoder) {
+		free(decoder);
+	}
+	if (encoder) {
+		free(encoder);
+	}
 	printf("Going to execute (%s)\n", commandString);
 	return(commandString);
 }
@@ -279,6 +298,7 @@
 		_setmode(_fileno(stdin), _O_BINARY);
 #endif
 		filep = stdin;
+		return filep;
 	}
 	else {
 		char extension[25];



More information about the commits mailing list