[FFmpeg-cvslog] avformat/dv: always set audio packet duration
Paul B Mahol
git at videolan.org
Sun Sep 12 23:24:36 EEST 2021
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Sep 6 19:48:54 2021 +0200| [d1971d69c749bce315788376c94f9464860f115f] | committer: Paul B Mahol
avformat/dv: always set audio packet duration
If audio packet is present in DV stream it have duration of 1 in DV timebase units.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1971d69c749bce315788376c94f9464860f115f
---
libavformat/dv.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavformat/dv.c b/libavformat/dv.c
index d7909683c3..b2b74162df 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -48,6 +48,7 @@ struct DVPacket {
int stream_index;
int flags;
int64_t pos;
+ int64_t duration;
};
struct DVDemuxContext {
@@ -276,6 +277,7 @@ static int dv_extract_audio_info(DVDemuxContext *c, const uint8_t *frame)
c->audio_pkt[i].stream_index = c->ast[i]->index;
c->audio_pkt[i].flags |= AV_PKT_FLAG_KEY;
c->audio_pkt[i].pts = AV_NOPTS_VALUE;
+ c->audio_pkt[i].duration = 0;
c->audio_pkt[i].pos = -1;
}
c->ast[i]->codecpar->sample_rate = dv_audio_frequency[freq];
@@ -374,6 +376,7 @@ int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
pkt->stream_index = c->audio_pkt[i].stream_index;
pkt->flags = c->audio_pkt[i].flags;
pkt->pts = c->audio_pkt[i].pts;
+ pkt->duration = c->audio_pkt[i].duration;
pkt->pos = c->audio_pkt[i].pos;
c->audio_pkt[i].size = 0;
@@ -404,6 +407,7 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
c->audio_pkt[i].pos = pos;
c->audio_pkt[i].size = size;
c->audio_pkt[i].pts = (c->sys->height == 720) ? (c->frames & ~1) : c->frames;
+ c->audio_pkt[i].duration = 1;
ppcm[i] = c->audio_buf[i];
}
if (c->ach)
More information about the ffmpeg-cvslog
mailing list