aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/libmodplug.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-18 17:55:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-20 14:58:50 +0200
commitc605adbf562fbf535e83ae427bb681bc45e440c8 (patch)
treedd14abbd58717c51b9796e53dcb2b7763b145547 /libavformat/libmodplug.c
parent2d70f11ef5d4bca1e4921053d69a58b250035184 (diff)
downloadffmpeg-c605adbf562fbf535e83ae427bb681bc45e440c8.tar.gz
avformat/libmodplug: Reduce the probe score for small input
This ensures that theres enough data for mpeg_probe() to recognize mpeg-ps Fixes Ticket2583 Based on code by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/libmodplug.c')
-rw-r--r--libavformat/libmodplug.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/libavformat/libmodplug.c b/libavformat/libmodplug.c
index 193c3b26f7..836b7c2ec0 100644
--- a/libavformat/libmodplug.c
+++ b/libavformat/libmodplug.c
@@ -347,6 +347,19 @@ 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)) {
+ if (p->buf_size < 16384)
+ return AVPROBE_SCORE_EXTENSION/2-1;
+ else
+ return AVPROBE_SCORE_EXTENSION;
+ }
+ return 0;
+}
+
static const AVClass modplug_class = {
.class_name = "ModPlug demuxer",
.item_name = av_default_item_name,
@@ -358,11 +371,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,
};