From d23ebe69e881cace4a79694d776089b3728e3308 Mon Sep 17 00:00:00 2001 From: oddsock Date: Wed, 22 Dec 2004 01:49:56 +0000 Subject: [PATCH] add passthorough support for unknown types git-svn-id: https://svn.xiph.org/trunk/ezstream@8519 0101bb08-14d6-0310-b084-bc0e0c8e3800 --- src/ezstream.c | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/src/ezstream.c b/src/ezstream.c index 7545d4e..6a38e44 100644 --- a/src/ezstream.c +++ b/src/ezstream.c @@ -139,25 +139,44 @@ char* buildCommandString(char *extension, char *fileName, char *metadata) 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 @@ FILE *openResource(shout_t *shout, char *fileName) _setmode(_fileno(stdin), _O_BINARY); #endif filep = stdin; + return filep; } else { char extension[25];