]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/argo_brp.c
avformat/argo_brp: remove block_align check for audio
[ffmpeg] / libavformat / argo_brp.c
index af64a0d6dc18985155d376e18eb2e5767042b8bd..6d6da851e90ca7d07a106579c8254afcf8ef9238 100644 (file)
@@ -211,15 +211,16 @@ static int argo_brp_read_header(AVFormatContext *s)
             ArgoBVIDHeader *bvid = &hdr->extradata.bvid;
 
             st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
-
-            /* No decoder for this yet. */
-            st->codecpar->codec_id   = AV_CODEC_ID_NONE;
+            st->codecpar->codec_id   = AV_CODEC_ID_ARGO;
 
             bvid->num_frames = AV_RL32(buf +  0);
             bvid->width      = AV_RL32(buf +  4);
             bvid->height     = AV_RL32(buf +  8);
             bvid->depth      = AV_RL32(buf + 12);
 
+            if (bvid->num_frames == 0)
+                return AVERROR_INVALIDDATA;
+
             /* These are from 1990's games, sanity check this. */
             if (bvid->width >= 65536 || bvid->height >= 65536 ||
                 bvid->depth > 24     || bvid->depth % 8 != 0) {
@@ -228,15 +229,8 @@ static int argo_brp_read_header(AVFormatContext *s)
 
             st->codecpar->width  = bvid->width;
             st->codecpar->height = bvid->height;
-
-            if (bvid->depth == 8) {
-                st->codecpar->format = AV_PIX_FMT_PAL8;
-            } else if (bvid->depth == 24) {
-                st->codecpar->format = AV_PIX_FMT_RGB24;
-            } else {
-                avpriv_request_sample(s, "depth == %u", bvid->depth);
-                return AVERROR_PATCHWELCOME;
-            }
+            st->nb_frames = bvid->num_frames;
+            st->codecpar->bits_per_raw_sample = bvid->depth;
         } else if (hdr->codec_id == BRP_CODEC_ID_BASF) {
             /*
              * It would make the demuxer significantly more complicated
@@ -255,6 +249,8 @@ static int argo_brp_read_header(AVFormatContext *s)
 
             if ((ret = ff_argo_asf_validate_file_header(s, &hdr->extradata.basf)) < 0)
                 return ret;
+
+            st->nb_frames = hdr->extradata.basf.num_chunks;
         } else if (hdr->codec_id == BRP_CODEC_ID_MASK) {
             ArgoMASKHeader *mask = &hdr->extradata.mask;
 
@@ -396,9 +392,6 @@ static int argo_brp_read_packet(AVFormatContext *s, AVPacket *pkt)
             return AVERROR_INVALIDDATA;
 
         blk.size -= ASF_CHUNK_HEADER_SIZE;
-
-        if (blk.size % st->codecpar->block_align != 0)
-            return AVERROR_INVALIDDATA;
     }
 
     if ((ret = av_get_packet(s->pb, pkt, blk.size)) < 0)