[FFmpeg-devel] [PATCH 3/6] avformat/s337m: New ff_s337m_probe()

Tomas Härdin git at haerdin.se
Thu Feb 16 12:36:41 EET 2023


mån 2023-02-13 klockan 19:09 +0100 skrev Nicolas Gaullier:
> +    do {
> +        uint64_t state;
> +        int data_type, data_size, offset;
> +        while (pos < size - 12 && !buf[pos]) {
> +            pos++;
> +        }
> +        if (pos >= size - 12 || pos <
> S337M_PROBE_GUARDBAND_MIN_BYTES || pos % (container_word_bits == 16 ?
> 4 : 6))
> +            return 0;
> +        state = container_word_bits == 16 ? AV_RB32(buf + pos) :
> AV_RB48(buf + pos);
> +        if (!IS_LE_MARKER(state))
> +            return 0;
> +        data_type = container_word_bits == 16 ? AV_RL16(buf + pos +
> 4) : AV_RL24(buf + pos + 6);
> +        data_size = container_word_bits == 16 ? AV_RL16(buf + pos +
> 6) : AV_RL24(buf + pos + 9);
> +        if (s337m_get_offset_and_codec(NULL, state, data_type,
> data_size, container_word_bits, &offset, codec))
> +            return 0;
> +        pos = ++consecutive_codes * (offset + 4*(container_word_bits
> == 16 ? 4 : 6));
> +    } while (consecutive_codes < 3);
> +
> +    return AVPROBE_SCORE_MAX;
> +}

The logic here is a bit hairy and I don't have time atm to digest it,
but is it entirely contained in S337m or would one need to read other
specs too?

/Tomas



More information about the ffmpeg-devel mailing list