summaryrefslogtreecommitdiff
path: root/libavformat/format.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-01-30 21:48:16 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-30 22:25:31 +0100
commit8619582bdf1be5ee58655a01d42da547f727b19b (patch)
treebee4dd10450a40a00bb4bcd849a8067649307804 /libavformat/format.c
parent32bf4a72e326a2c18b45672e6b8ec9d4a71d47da (diff)
downloadffmpeg-8619582bdf1be5ee58655a01d42da547f727b19b.tar.gz
avformat/format: Replace nodat by enum
This makes the code much more readable Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/format.c')
-rw-r--r--libavformat/format.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/libavformat/format.c b/libavformat/format.c
index ffddb13782..9d14c67913 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -171,8 +171,13 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
{
AVProbeData lpd = *pd;
AVInputFormat *fmt1 = NULL, *fmt;
- int score, nodat = 0, score_max = 0;
+ int score, score_max = 0;
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)
lpd.buf = (unsigned char *) zerobuffer;
@@ -183,9 +188,9 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
lpd.buf += id3len;
lpd.buf_size -= id3len;
} else if (id3len >= PROBE_BUF_MAX) {
- nodat = 2;
+ nodat = ID3_GREATER_MAX_PROBE;
} else
- nodat = 1;
+ nodat = ID3_GREATER_PROBE;
}
fmt = NULL;
@@ -198,9 +203,9 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
if (score)
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 (nodat == 0) score = FFMAX(score, 1);
- else if (nodat == 1) score = FFMAX(score, AVPROBE_SCORE_EXTENSION / 2 - 1);
- else score = FFMAX(score, AVPROBE_SCORE_EXTENSION);
+ if (nodat == NO_ID3) score = FFMAX(score, 1);
+ else if (nodat == ID3_GREATER_PROBE) score = FFMAX(score, AVPROBE_SCORE_EXTENSION / 2 - 1);
+ else score = FFMAX(score, AVPROBE_SCORE_EXTENSION);
}
} else if (fmt1->extensions) {
if (av_match_ext(lpd.filename, fmt1->extensions))
@@ -214,7 +219,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
} else if (score == score_max)
fmt = NULL;
}
- if (nodat == 1)
+ if (nodat == ID3_GREATER_PROBE)
score_max = FFMIN(AVPROBE_SCORE_EXTENSION / 2 - 1, score_max);
*score_ret = score_max;