movenc: Allow setting start_dts/start_cts before writing actual packets
authorMartin Storsjö <martin@martin.st>
Tue, 3 Nov 2015 20:16:21 +0000 (22:16 +0200)
committerMartin Storsjö <martin@martin.st>
Wed, 11 Nov 2015 20:53:31 +0000 (22:53 +0200)
commitbef3b1f59f036aba4a5fe599b2480f6bd9e6b280
tree9bddf06ae485a5d8bd2398cd07100db5c29adb85
parent3eeb7edfc2a1157b7b0e0ce21ac2cd44d55d405b
movenc: Allow setting start_dts/start_cts before writing actual packets

By writing a zero-sized packet, the caller can communicate the
start_dts/start_cts for the stream without actually writing
the first packet.

This allows doing random-access writing of fragments when the
start dts of the stream isn't zero, so that the edit list in the moov
is written based on timestamps from the nominal start time signaled
via the zero-sized packet, while the first proper packet written
corresponds to a later fragment.

To avoid potential unexpected behaviour, empty packets only set
start_dts if the frag_discont flag is set.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/movenc.c