mkv: Refactor mkv_write_packet

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
mkv: Add options for specifying cluster limits

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
mkv: Flush the old cluster before writing a new one

This simplifies keeping track of cluster boundaries for e.g.
livestreaming of WebM.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
mkv: Allow flushing the current cluster in progress

Allow emitting the current cluster that is being written before
starting a new one, simplifying how to figure out where clusters
are positioned in the output stream (for live streaming).

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
mov: Set the timescale for data streams

Data streams have a defined timebase, do not ignore it.
mov: Compute max duration among the tracks with a timescale

Prevent an assert.
mov: Prevent segfaults on mov_write_hdlr_tag

Do not segfault when writing tracks such as tmcd by writing them down
as generic DataHandlers if not known.