]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/ads.c
hwcontext_vulkan: reorder structure fields and add spaces in between
[ffmpeg] / libavformat / ads.c
index 73ea7c7d54b8c46d9a3b4d7f43c1dcd85be4e59e..e7b419ce8d4895b3879e4205eb4274b6537788cc 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);
 
@@ -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,