]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/ads.c
avformat/avformat, utils: Make av_find_best_stream const-correct
[ffmpeg] / libavformat / ads.c
index 73ea7c7d54b8c46d9a3b4d7f43c1dcd85be4e59e..544d65282931a5a615cd5f8954f887d3cd556322 100644 (file)
@@ -23,7 +23,7 @@
 #include "avformat.h"
 #include "internal.h"
 
-static int ads_probe(AVProbeData *p)
+static int ads_probe(const AVProbeData *p)
 {
     if (memcmp(p->buf, "SShd", 4) ||
         memcmp(p->buf+32, "SSbd", 4))
@@ -34,8 +34,9 @@ static int ads_probe(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);