[FFmpeg-devel] [PATCH] libmodplug: lower probe score

Paul B Mahol onemda at gmail.com
Fri May 17 17:29:33 CEST 2013


On 5/17/13, Nicolas George <nicolas.george at normalesup.org> wrote:
> L'octidi 28 floreal, an CCXXI, Paul B Mahol a ecrit :
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
>>  libavformat/libmodplug.c | 13 +++++++++++--
>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/libmodplug.c b/libavformat/libmodplug.c
>> index 193c3b2..2acd344 100644
>> --- a/libavformat/libmodplug.c
>> +++ b/libavformat/libmodplug.c
>> @@ -347,6 +347,15 @@ static int modplug_read_seek(AVFormatContext *s, int
>> stream_idx, int64_t ts, int
>>      return 0;
>>  }
>>
>> +static const char modplug_extensions[] =
>> "669,abc,amf,ams,dbm,dmf,dsm,far,it,mdl,med,mid,mod,mt2,mtm,okt,psm,ptm,s3m,stm,ult,umx,xm,itgz,itr,itz,mdgz,mdr,mdz,s3gz,s3r,s3z,xmgz,xmr,xmz";
>> +
>> +static int modplug_probe(AVProbeData *p)
>> +{
>> +    if (av_match_ext(p->filename, modplug_extensions))
>> +        return AVPROBE_SCORE_MAX / 20;
>> +    return 0;
>> +}
>> +
>>  static const AVClass modplug_class = {
>>      .class_name = "ModPlug demuxer",
>>      .item_name  = av_default_item_name,
>> @@ -358,11 +367,11 @@ AVInputFormat ff_libmodplug_demuxer = {
>>      .name           = "libmodplug",
>>      .long_name      = NULL_IF_CONFIG_SMALL("ModPlug demuxer"),
>>      .priv_data_size = sizeof(ModPlugContext),
>> +    .read_probe     = modplug_probe,
>>      .read_header    = modplug_read_header,
>>      .read_packet    = modplug_read_packet,
>>      .read_close     = modplug_read_close,
>>      .read_seek      = modplug_read_seek,
>> -    .extensions     =
>> "669,abc,amf,ams,dbm,dmf,dsm,far,it,mdl,med,mid,mod,mt2,mtm,okt,psm,ptm,s3m,stm,ult,umx,xm"
>> -
>> ",itgz,itr,itz,mdgz,mdr,mdz,s3gz,s3r,s3z,xmgz,xmr,xmz", // compressed
>> mods
>> +    .extensions     = modplug_extensions,
>>      .priv_class     = &modplug_class,
>>  };
>
> The probe function seems redundant with the work that lavf already does
> with
> the extensions field. Or did I miss something?

There are mpeg files with .mod extension.

Such mpeg file without any extensions get score of 52.
With .mod extension it got score of 50 and probed as libmodplug.

AVPROBE_SCORE_EXTENSION is defined as 50.

>
> Furthermore, AVPROBE_SCORE_EXTENSION was introduced recently, it would
> probably a better choice than AVPROBE_SCORE_MAX / 20.
>
> Regards,
>
> --
>   Nicolas George
>


More information about the ffmpeg-devel mailing list