Share the utf8 to wchar conversion routine between lavf and lavu

This doesn't add any dependency on library internals, since this
only is a static inline function that gets built into each of the
calling functions - this is only to reduce the code duplication.

Signed-off-by: Martin Storsjö <martin@martin.st>
lavf: Use MoveFileEx instead of rename/_wrename on windows

This allows getting the normal unix semantics, where a rename
allows replacing an existing file.

Based on a suggestion by Reimar Döffinger.

Signed-off-by: Martin Storsjö <martin@martin.st>
Revert "lavf: Don't try to update files atomically with renames on windows"

This reverts commit b9d08c77a44390b0848c06f20bc0e9e951ba6a3c.

After taking MoveFileEx into use, we can replace files with renames
on windows as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
dashenc: Extend write_time to allow rounding to a certain number of decimals

Also allow overriding the rounding direction.

This is similar to what we have in sidxindex already.
dashenc: Set the Period start time to the latest stream start time when using timeline

If one stream doesn't start exactly at time 0 (as signaled via
the SegmentTimeline) while the Period says playback starts at 0,
dash.js won't be able to start playing it, since it doesn't find
any segment corresponding to time 0.

Currently this isn't needed yet, when segment timestamps are based
on dts (which by default are adjusted to start at zero), but will
become necessary later.
dashenc: Use pts for MPD timestamps

This should be more correct. This also should give more sensible
switching between video streams with different amount of b-frame
delay.
dashenc: Force the start timestamp to zero

This works around an issue in the current git version of dash.js.
movenc: Adjust the pts of new fragments similarly to what is done for dts

The pts and the corresponding duration is written in sidx
atoms, thus make sure these match up correctly.