[FFmpeg-devel] [PATCH v2 5/7] avformat/argo_brp: support reading multiple ASF blocks at once
Zane van Iperen
zane at zanevaniperen.com
Fri Sep 18 15:05:01 EEST 2020
Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>
---
libavformat/argo_brp.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c
index 122f616ecc..a3e9846c74 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,21 +365,20 @@ 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)
+ if ((ret = ff_argo_asf_read(s->pb, st, pkt, ckhdr, brp->basf.blocks_read)) < 0)
return ret;
+ blocks_read = ret;
+
if ((ret = avio_seek(s->pb, old, SEEK_SET)) < 0)
return ret;
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;
- /* Need the ceil() because ((32 * 1000) / 44100) < 1 */
- brp->basf.lastpts += ceilf((ckhdr->num_samples * 1000.0f) / ckhdr->sample_rate);
+ brp->basf.blocks_read += blocks_read;
+ /* Need the ceil() because ((1 * 32 * 1000) / 44100) < 1 */
+ brp->basf.lastpts += ceilf((blocks_read * ckhdr->num_samples * 1000.0f) / ckhdr->sample_rate);
return 1;
}
--
2.25.4
More information about the ffmpeg-devel
mailing list