Commit 8619582b authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/format: Replace nodat by enum

This makes the code much more readable
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 32bf4a72
...@@ -171,8 +171,13 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, ...@@ -171,8 +171,13 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
{ {
AVProbeData lpd = *pd; AVProbeData lpd = *pd;
AVInputFormat *fmt1 = NULL, *fmt; AVInputFormat *fmt1 = NULL, *fmt;
int score, nodat = 0, score_max = 0; int score, score_max = 0;
const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE]; const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE];
enum nodat {
NO_ID3,
ID3_GREATER_PROBE,
ID3_GREATER_MAX_PROBE,
} nodat = NO_ID3;
if (!lpd.buf) if (!lpd.buf)
lpd.buf = (unsigned char *) zerobuffer; lpd.buf = (unsigned char *) zerobuffer;
...@@ -183,9 +188,9 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, ...@@ -183,9 +188,9 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
lpd.buf += id3len; lpd.buf += id3len;
lpd.buf_size -= id3len; lpd.buf_size -= id3len;
} else if (id3len >= PROBE_BUF_MAX) { } else if (id3len >= PROBE_BUF_MAX) {
nodat = 2; nodat = ID3_GREATER_MAX_PROBE;
} else } else
nodat = 1; nodat = ID3_GREATER_PROBE;
} }
fmt = NULL; fmt = NULL;
...@@ -198,8 +203,8 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, ...@@ -198,8 +203,8 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
if (score) if (score)
av_log(NULL, AV_LOG_TRACE, "Probing %s score:%d size:%d\n", fmt1->name, score, lpd.buf_size); av_log(NULL, AV_LOG_TRACE, "Probing %s score:%d size:%d\n", fmt1->name, score, lpd.buf_size);
if (fmt1->extensions && av_match_ext(lpd.filename, fmt1->extensions)) { if (fmt1->extensions && av_match_ext(lpd.filename, fmt1->extensions)) {
if (nodat == 0) score = FFMAX(score, 1); if (nodat == NO_ID3) score = FFMAX(score, 1);
else if (nodat == 1) score = FFMAX(score, AVPROBE_SCORE_EXTENSION / 2 - 1); else if (nodat == ID3_GREATER_PROBE) score = FFMAX(score, AVPROBE_SCORE_EXTENSION / 2 - 1);
else score = FFMAX(score, AVPROBE_SCORE_EXTENSION); else score = FFMAX(score, AVPROBE_SCORE_EXTENSION);
} }
} else if (fmt1->extensions) { } else if (fmt1->extensions) {
...@@ -214,7 +219,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, ...@@ -214,7 +219,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
} else if (score == score_max) } else if (score == score_max)
fmt = NULL; fmt = NULL;
} }
if (nodat == 1) if (nodat == ID3_GREATER_PROBE)
score_max = FFMIN(AVPROBE_SCORE_EXTENSION / 2 - 1, score_max); score_max = FFMIN(AVPROBE_SCORE_EXTENSION / 2 - 1, score_max);
*score_ret = score_max; *score_ret = score_max;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment