]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/ads.c
avcodec/Makefile: Remove obsolete dependency of eatqi dec on rl.o
[ffmpeg] / libavformat / ads.c
index f25141b3c647ef25595fe40216f98c6f4ae0d9e5..e7b419ce8d4895b3879e4205eb4274b6537788cc 100644 (file)
@@ -34,8 +34,9 @@ static int ads_probe(const AVProbeData *p)
 
 static int ads_read_header(AVFormatContext *s)
 {
-    int align, codec, size;
+    int align, codec;
     AVStream *st;
+    int64_t size;
 
     st = avformat_new_stream(s, NULL);
     if (!st)
@@ -62,7 +63,7 @@ static int ads_read_header(AVFormatContext *s)
     st->codecpar->block_align = st->codecpar->channels * align;
     avio_skip(s->pb, 12);
     size = avio_rl32(s->pb);
-    if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_PSX)
+    if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_PSX && size >= 0x40)
         st->duration = (size - 0x40) / 16 / st->codecpar->channels * 28;
     avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
 
@@ -79,7 +80,7 @@ static int ads_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat ff_ads_demuxer = {
+const AVInputFormat ff_ads_demuxer = {
     .name           = "ads",
     .long_name      = NULL_IF_CONFIG_SMALL("Sony PS2 ADS"),
     .read_probe     = ads_probe,