[FFmpeg-devel] [PATCH] Stricter TMV probe

Reimar Döffinger Reimar.Doeffinger
Mon Sep 14 21:51:39 CEST 2009


On Mon, Sep 14, 2009 at 02:34:50PM -0500, Daniel Verkamp wrote:
> Hi,
> 
> In the spirit of the discussion about probe scores, here is an
> improved probe routine for TMV (currently it is only checking for 4
> printable-ASCII bytes at the beginning of the file).
> 
> Thanks,
> -- Daniel Verkamp

> Index: libavformat/tmv.c
> ===================================================================
> --- libavformat/tmv.c	(revision 19841)
> +++ libavformat/tmv.c	(working copy)
> @@ -45,7 +45,12 @@
>  
>  static int tmv_probe(AVProbeData *p)
>  {
> -    if (AV_RL32(p->buf) == TMV_TAG)
> +    if (AV_RL32(p->buf) == TMV_TAG &&
> +        AV_RL16(p->buf+4) && // samplerate
> +        AV_RL16(p->buf+6) && // chunksize
> +               !p->buf[8] && // compmethod
> +                p->buf[9] && // charcols
> +                p->buf[10])  // charrows

Not really related to this specific patch, just because every probe
function checks sample_rate:
A lot of demuxers (including that one) do not validate it in
read_header, ending up with 1/0 as time base. That really is not ok (and
as said, I have the impression a lot of demuxers do that).



More information about the ffmpeg-devel mailing list