diff mbox series

[FFmpeg-devel,5/5] avformat/argo_brp: support reading multiple ASF blocks at once

Message ID 20200916073836.27644-5-zane@zanevaniperen.com
State Superseded
Headers show
Series [FFmpeg-devel,1/5] avcodec/adpcm_argo: support decoding multiple frames
Related show

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. 16, 2020, 7:39 a.m. UTC
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
 libavformat/argo_brp.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c
index 122f616ecc..4716ad85eb 100644
--- a/libavformat/argo_brp.c
+++ b/libavformat/argo_brp.c
@@ -86,7 +86,7 @@  typedef struct ArgoBRPDemuxContext {
     struct {
         int                 index;
         ArgoASFChunkHeader  ckhdr;
-        int64_t             blocks_read;
+        uint32_t            blocks_read;
         int64_t             offset;
         /* ms, not samples. */
         int64_t             lastpts;
@@ -340,13 +340,14 @@  static int argo_brp_read_basf(AVFormatContext *s, AVPacket *pkt,
                               ArgoBRPDemuxContext *brp, int ignorepts)
 {
     ArgoASFChunkHeader *ckhdr = &brp->basf.ckhdr;
-    AVCodecParameters *par;
+    AVStream *st;
     int64_t ret, old;
+    uint32_t blocks_read;
 
     if (brp->basf.index < 0)
         return 0;
 
-    par = s->streams[brp->basf.index]->codecpar;
+    st = s->streams[brp->basf.index];
 
     if (brp->basf.blocks_read >= ckhdr->num_blocks)
         return 0;
@@ -364,7 +365,8 @@  static int argo_brp_read_basf(AVFormatContext *s, AVPacket *pkt,
     else if (ret != brp->basf.offset)
         return AVERROR(EIO);
 
-    if ((ret = av_get_packet(s->pb, pkt, par->frame_size)) < 0)
+    blocks_read = brp->basf.blocks_read;
+    if ((ret = ff_argo_asf_read(s->pb, st, pkt, ckhdr, &blocks_read)) < 0)
         return ret;
 
     if ((ret = avio_seek(s->pb, old, SEEK_SET)) < 0)
@@ -372,11 +374,8 @@  static int argo_brp_read_basf(AVFormatContext *s, AVPacket *pkt,
     else if (ret != old)
         return AVERROR(EIO);
 
-    pkt->stream_index      = brp->basf.index;
-    pkt->duration          = ckhdr->num_samples;
-
     brp->basf.offset      += pkt->size;
-    brp->basf.blocks_read += 1;
+    brp->basf.blocks_read  = blocks_read;
     /* Need the ceil() because ((32 * 1000) / 44100) < 1 */
     brp->basf.lastpts     += ceilf((ckhdr->num_samples * 1000.0f) / ckhdr->sample_rate);
     return 1;