[FFmpeg-cvslog] lavf: if id3v2 tag is present and all else fails, guess by file extension

Michael Niedermayer michaelni at gmx.at
Thu Apr 7 12:43:47 CEST 2011


On Thu, Apr 07, 2011 at 07:38:44AM +0200, Reimar Döffinger wrote:
> 
> 
> On 7 Apr 2011, at 03:43, git at videolan.org (Anton Khirnov) wrote:
> 
> > ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Apr  5 12:19:35 2011 +0200| [56a1000917694b2277064c5573b0dd818ad7a379] | committer: Anton Khirnov
> > 
> > lavf: if id3v2 tag is present and all else fails, guess by file extension
> > 
> >> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56a1000917694b2277064c5573b0dd818ad7a379
> > ---
> > 
> > libavformat/utils.c |   13 ++++++++++++-
> > 1 files changed, 12 insertions(+), 1 deletions(-)
> > 
> > diff --git a/libavformat/utils.c b/libavformat/utils.c
> > index 31eddec..a5d4a6f 100644
> > --- a/libavformat/utils.c
> > +++ b/libavformat/utils.c
> > @@ -371,7 +371,7 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score
> > {
> >     AVProbeData lpd = *pd;
> >     AVInputFormat *fmt1 = NULL, *fmt;
> > -    int score;
> > +    int score, id3 = 0;
> > 
> >     if (lpd.buf_size > 10 && ff_id3v2_match(lpd.buf, ID3v2_DEFAULT_MAGIC)) {
> >         int id3len = ff_id3v2_tag_len(lpd.buf);
> > @@ -379,6 +379,7 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score
> >             lpd.buf += id3len;
> >             lpd.buf_size -= id3len;
> >         }
> > +        id3 = 1;
> >     }
> > 
> >     fmt = NULL;
> > @@ -399,6 +400,16 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score
> >         }else if (score == *score_max)
> >             fmt = NULL;
> >     }
> > +
> > +    /* a hack for files with huge id3v2 tags -- try to guess by file extension. */
> > +    if (!fmt && id3 && *score_max < AVPROBE_SCORE_MAX/4) {
> > +        while ((fmt = av_iformat_next(fmt)))
> > +            if (fmt->extensions && av_match_ext(lpd.filename, fmt->extensions)) {
> > +                *score_max = AVPROBE_SCORE_MAX/4;
> > +                break;
> > +            }
> 
> It seems unreasonable to override even scores of max/4 - 1, and max/4 sure is very high for a value based on nothing but extension!

yes, and its not merged like this into ffmpeg.
See the merge mail:
  REIMPLEMENTED in 2 lines of code:  lavf: if id3v2 tag is present and all else fails, guess by file extension

iam just using score=1 in that reimplementation ...


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20110407/ab612411/attachment.asc>


More information about the ffmpeg-cvslog mailing list