[FFmpeg-devel] [PATCH 5/5] avformat/argo_brp: support reading multiple ASF blocks at once
Zane van Iperen
zane at zanevaniperen.com
Wed Sep 16 10:39:28 EEST 2020
Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>
---
libavformat/argo_brp.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
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;
--
2.25.4
More information about the ffmpeg-devel
mailing list