commit 410c5a93a721eeb41ce2a5f8cc9c36031c9c42bc
parent f002f518df8a24a68d85d02781963c8ff9038317
Author: Heikki Lindholm <holin@iki.fi>
Date: Sun, 30 Dec 2007 09:44:04 +0000
clean up
Diffstat:
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/plugins/flvextractor.c b/src/plugins/flvextractor.c
@@ -603,19 +603,21 @@ static char * printVideoFormat(FLVStreamState *state)
size_t len = MAX_FLV_FORMAT_LINE;
n = 0;
+ /* some files seem to specify only the width or the height, print '?' for
+ * the unknown dimension */
if (state->videoWidth != -1 || state->videoHeight != -1) {
if (n < len) {
if (state->videoWidth != -1)
n += snprintf(s+n, len-n, "%d", state->videoWidth);
else
- n += snprintf(s+n, len-n, "%d", state->videoWidth);
+ n += snprintf(s+n, len-n, "?");
}
if (n < len) {
if (state->videoHeight != -1)
- n += snprintf(s+n, len-n, "%d", state->videoHeight);
+ n += snprintf(s+n, len-n, "x%d", state->videoHeight);
else
- n += snprintf(s+n, len-n, "%d", state->videoHeight);
+ n += snprintf(s+n, len-n, "x?");
}
}
@@ -648,16 +650,11 @@ static char * printVideoFormat(FLVStreamState *state)
static char * printAudioFormat(FLVStreamState *state)
{
- char *s;
+ char s[MAX_FLV_FORMAT_LINE+1];
int n;
size_t len = MAX_FLV_FORMAT_LINE;
- s = malloc(len);
- if (s == NULL)
- return NULL;
-
n = 0;
-
if (state->audioRate != -1 && n < len) {
n += snprintf(s+n, len-n, "%s Hz", FLVAudioSampleRates[state->audioRate]);
}
@@ -693,12 +690,9 @@ static char * printAudioFormat(FLVStreamState *state)
n += snprintf(s+n, len-n, "%.4f kbps", state->audioDataRate);
}
- if (n == 0) {
- free(s);
- s = NULL;
- }
-
- return s;
+ if (n == 0)
+ return NULL;
+ return strdup(s);
}
struct EXTRACTOR_Keywords *