Various places needed to differentiate better between "no duration is
known or set for this packet" and "this packet has a duration of
0ms". The former means that no duration element should be written to
the file, and the use of `SimpleBlock` instead of `BlockGroup` is
OK. The latter on the other hand means that a `BlockGroup` must be
used and a duration element must be added.
This core change uncovered a couple of subtle bugs in other places
where subtitles were handled:
• The Matroska reader passed 0 as the duration even if no duration
element was present making it impossible for other code to
differentiate between "no duration present" and "duration present
but set to 0".
• The DVB subtitle packetizer always enforced writing the duration
even if the duration wasn't known.
• The Kate packetizer used a wrong dummy value of 1us for the duration
for the "end of stream" packet as the core would not write a
duration of 0.
• The text subtitle packetizer was using the difference between the
current packet and the following one for packets were the duration
was 0 or unknown. The correct behavior is to do this only if the
duration is unknown, not if it is 0.
Fixes#2490.
Unsupported edits such as dwells were simply ignored. If all of them
were ignored, then the new timeline was empty resulting in no data
being copied for that track. Instead simply ignore edit lists whose
new timeline ends up empty after the entries have been processed.
Fixes#2487.
When closing files that were opened for writing, cached data will not
be flushed to storage automatically anymore. This reverts the
workaround implemented for #2469. A new option was added to both
programs (`--flush-on-close`) that re-enables flushing for people who
are affected by data loss such as described in #2469.
The reason is that automatic flushing causes long delays in processing
queues when the output by mkvmerge/mkvextract isn't the final product but
just an intermediate result to be processed further.
Implements #2480.
The analyzer must be kept as it is needed when writing the chapters
back. This had always been the case until the implementation of #2439
where it got lost accidentally.
The result of not having the analyzer when saving is that the file is
truncated to a couple of KB, effectively destroying all of its content.
Fixes#2476.