[FFmpeg-devel] [PATCH] common ID3v2 support for all formats

Reimar Döffinger Reimar.Doeffinger
Tue Nov 9 08:38:25 CET 2010


On Wed, Nov 03, 2010 at 11:05:41PM +0100, Reimar D?ffinger wrote:
> I'd suggest to just set score_max, something like below.
> Of course doesn't work so well for anyone calling it with
> *score_max == AVPROBE_SCORE_MAX/4 from the start.
> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c (revision 25668)
> +++ libavformat/utils.c (working copy)
> @@ -353,13 +353,15 @@
>      AVProbeData lpd = *pd;
>      AVInputFormat *fmt1, *fmt;
>      int score;
> +    int found_incomplete_id3v2 = 0;
>  
>      if (lpd.buf_size > 10 && ff_id3v2_match(lpd.buf, ID3v2_DEFAULT_MAGIC)) {
>          int id3len = ff_id3v2_tag_len(lpd.buf);
>          if (lpd.buf_size > id3len + 16) {
>              lpd.buf += id3len;
>              lpd.buf_size -= id3len;
> -        }
> +        } else
> +            found_incomplete_id3v2 = 1;
>      }
>  
>      fmt = NULL;
> @@ -380,6 +382,8 @@
>          }else if (score == *score_max)
>              fmt = NULL;
>      }
> +    if (!fmt && found_incomplete_id3v2)
> +        *score_max = FFMAX(*score_max, AVPROBE_SCORE_MAX/4);

I realize that this probably leaves a corner-case for buf_size == id3len + 16
where it will probably return a score of 0.
Probably it should be a condition like
buf_size < id3len + 2048
where it continues to return a score.



More information about the ffmpeg-devel mailing list