summaryrefslogtreecommitdiff
path: root/libavformat/demux.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-05-21 02:15:26 +0200
committerPaul B Mahol <onemda@gmail.com>2023-05-25 19:51:47 +0200
commite7cadd0ee5a3d0da64b6c9a66b6609aef8e1977d (patch)
tree9168568cb26ce0eefa6248c79a2b5bc72d2de253 /libavformat/demux.c
parenta1838c59bb866bb6d2d1ad07f7df128a1804de40 (diff)
avformat/demux: add support to derive timestamps from packet durations for video
Diffstat (limited to 'libavformat/demux.c')
-rw-r--r--libavformat/demux.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/demux.c b/libavformat/demux.c
index dec02a1a6b..b3f563ccc7 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1195,6 +1195,11 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
st->time_base,
AV_ROUND_DOWN);
}
+ } else if ((s->iformat->flags & AVFMT_NOTIMESTAMPS) && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+ if (st->time_base.num > 0 && st->time_base.den > 0 &&
+ sti->parser->duration) {
+ out_pkt->duration = sti->parser->duration;
+ }
}
out_pkt->stream_index = st->index;