diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-19 19:59:44 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-19 20:23:04 +0100 |
commit | 660a8b43abdbafd746e78184703ea29b774cb3ae (patch) | |
tree | 4b2b4b708f87170d1def5ae95798fb1c15decc18 /libavformat/avienc.c | |
parent | be44856483303d1af3cef1fc7a52db1fc0f49bd3 (diff) | |
download | ffmpeg-660a8b43abdbafd746e78184703ea29b774cb3ae.tar.gz |
avformat/avienc: write last frame duration
Fixes small part of Ticket 3052
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r-- | libavformat/avienc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 35f4d02d31..944c1548a9 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -67,6 +67,8 @@ typedef struct { int entry; int max_size; + int64_t last_dts; + AVIIndex indexes; } AVIStream; @@ -614,6 +616,9 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) if ((ret = write_skip_frames(s, stream_index, pkt->dts)) < 0) return ret; + if (pkt->dts != AV_NOPTS_VALUE) + avist->last_dts = pkt->dts + pkt->duration; + avist->packet_count++; // Make sure to put an OpenDML chunk when the file size exceeds the limits @@ -677,6 +682,11 @@ static int avi_write_trailer(AVFormatContext *s) int i, j, n, nb_frames; int64_t file_size; + for (i = 0; i < s->nb_streams; i++) { + AVIStream *avist = s->streams[i]->priv_data; + write_skip_frames(s, i, avist->last_dts); + } + if (pb->seekable) { if (avi->riff_id == 1) { ff_end_tag(pb, avi->movi_list); |