From e1eb0fc960163402bbb4e630185790488f7d28ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 20 Apr 2016 23:10:37 +0300 Subject: movenc: Use packets in interleaving queues for the duration at the end of fragments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As long as caller only writes packets using av_interleaved_write_frame with no manual flushing, this should allow us to always have accurate durations at the end of fragments, since there should be at least one queued packet in each stream (except for the stream where the current packet is being written, but if the muxer itself does the cutting of fragments, it also has info about the next packet for that stream). Signed-off-by: Martin Storsjö --- libavformat/internal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libavformat/internal.h') diff --git a/libavformat/internal.h b/libavformat/internal.h index 4760ba89ff..bbdfd2f719 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -441,4 +441,14 @@ static inline int ff_rename(const char *oldpath, const char *newpath) */ void ff_format_io_close(AVFormatContext *s, AVIOContext **pb); +/** + * Find the next packet in the interleaving queue for the given stream. + * The packet is not removed from the interleaving queue, but only + * a pointer to it is returned. + * + * @return a pointer to the next packet, or NULL if no packet is queued + * for this stream. + */ +const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream); + #endif /* AVFORMAT_INTERNAL_H */ -- cgit v1.2.3