diff mbox series

[FFmpeg-devel,01/10] avformat/argo_asf: fix enforcement of chunk count

Message ID 20200920080528.26200-2-zane@zanevaniperen.com
State Accepted
Commit 101ac40f69c51605347fa2b7f5c76481592acd28
Headers show
Series argo_brp cleanups and fixes | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Zane van Iperen Sept. 20, 2020, 8:06 a.m. UTC
Enforcing num_chunks == 1 only makes sense when demuxing from an ASF
file. When embedded in a BRP file, an ASF stream can have multiple chunks.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
 libavformat/argo_asf.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Comments

Paul B Mahol Sept. 20, 2020, 8:54 a.m. UTC | #1
On Sun, Sep 20, 2020 at 08:06:18AM +0000, Zane van Iperen wrote:
> Enforcing num_chunks == 1 only makes sense when demuxing from an ASF
> file. When embedded in a BRP file, an ASF stream can have multiple chunks.
> 
> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
> ---
>  libavformat/argo_asf.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 

LGTM this set except last two patches (patch 9 and patch 10), they are not needed.

I would like to commit that lines when actual decoder comes not before.
Zane van Iperen Sept. 20, 2020, 9:06 a.m. UTC | #2
On Sun, 20 Sep 2020 10:54:44 +0200
"Paul B Mahol" <onemda@gmail.com> wrote:

> 
> On Sun, Sep 20, 2020 at 08:06:18AM +0000, Zane van Iperen wrote:
> > Enforcing num_chunks == 1 only makes sense when demuxing from an ASF
> > file. When embedded in a BRP file, an ASF stream can have multiple chunks.
> >
> > Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
> > ---
> >  libavformat/argo_asf.c | 17 ++++++++++-------
> >  1 file changed, 10 insertions(+), 7 deletions(-)
> >
> 
> LGTM this set except last two patches (patch 9 and patch 10), they are not needed.
> 
> I would like to commit that lines when actual decoder comes not before.

Okay, I'll leave them out.
diff mbox series

Patch

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 048e5441d6..eb0c18601d 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -59,11 +59,6 @@  int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader
     if (hdr->magic != ASF_TAG || hdr->num_chunks == 0)
         return AVERROR_INVALIDDATA;
 
-    if (hdr->num_chunks > 1) {
-        avpriv_request_sample(s, ">1 chunk");
-        return AVERROR_PATCHWELCOME;
-    }
-
     if (hdr->chunk_offset < ASF_FILE_HEADER_SIZE)
         return AVERROR_INVALIDDATA;
 
@@ -139,8 +134,12 @@  int ff_argo_asf_fill_stream(AVStream *st, const ArgoASFFileHeader *fhdr,
 
     avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
     st->start_time      = 0;
-    st->duration        = ckhdr->num_blocks * ckhdr->num_samples;
-    st->nb_frames       = ckhdr->num_blocks;
+
+    if (fhdr->num_chunks == 1) {
+        st->duration        = ckhdr->num_blocks * ckhdr->num_samples;
+        st->nb_frames       = ckhdr->num_blocks;
+    }
+
     return 0;
 }
 
@@ -199,6 +198,10 @@  static int argo_asf_read_header(AVFormatContext *s)
     if ((ret = ff_argo_asf_validate_file_header(s, &asf->fhdr)) < 0)
         return ret;
 
+    /* This should only be 1 in ASF files. >1 is fine if in BRP. */
+    if (asf->fhdr.num_chunks != 1)
+        return AVERROR_INVALIDDATA;
+
     if ((ret = avio_skip(pb, asf->fhdr.chunk_offset - ASF_FILE_HEADER_SIZE)) < 0)
         return ret;