[FFmpeg-devel] [PATCH v3 2/2] avformat: add demuxer for argonaut games' ASF format

Carl Eugen Hoyos ceffmpeg at gmail.com
Tue Jan 21 15:14:44 EET 2020


Am Di., 21. Jan. 2020 um 11:09 Uhr schrieb Zane van Iperen
<zane at zanevaniperen.com>:

> +static int argo_asf_probe(const AVProbeData *p)
> +{
> +    int score;
> +    ArgoASFFileHeader hdr;
> +
> +    av_assert0(AVPROBE_PADDING_SIZE >= ASF_FILE_HEADER_SIZE);
> +
> +    argo_asf_parse_file_header(&hdr, p->buf);
> +
> +    if (hdr.magic != ASF_TAG)
> +        return 0;

> +    /* If this is huge, then it's very likely not an ASF file. */
> +    if (hdr.chunk_offset > INT_MAX)
> +        return 1;

Am I correct that this tests only one bit?
This makes sense for many probe functions that can easily
return false positives based on weak heuristics, probe
functions typically return high scores for matching first 32
bits though.

> +    score = 0;
> +    if (argo_asf_is_known_version(&hdr))
> +        score += (AVPROBE_SCORE_MAX / 2) + 1;

Unusual code style.

> +    /* Have only ever seen these with 1 chunk. */
> +    if (hdr.num_chunks == 1)
> +        score += 10;

Returns 0 for argo files with unknown version and more than
one chunk and 10 for for unknown version and one chunk.

Should be ~25 in both cases, feel free to return a higher
score if all tests pass, I just wanted to simplify the probe
function as testing 32 bit is what is usually done.

Carl Eugen


More information about the ffmpeg-devel mailing list