flvdec: Document how the duration is retrieved at the end of the file

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

On windows, rename(2) will fail if the target file exists. On
unix this trick is used to make sure that people reading the file
either will get the full previous file, or the full new version
of the file, but no intermediate version.

Signed-off-by: Martin Storsjö <martin@martin.st>
lavf: Use wchar functions for filenames on windows for mkdir/rmdir/rename/unlink

This makes sure that the internal utf8 path names are handled
properly - the normal file handling functions assume path names
are in the native codepage, which isn't utf8.

This assumes that the tools outside of lavf don't use the mkdir
definition. (The tools don't do the same reading of command line
parameters as wchar either - they probably won't handle all possible
unicode file parameters properly, but at least work more predictably
if no utf8/wchar conversion is involved.)

This is moved further down in os_support.h, since windows.h shouldn't
be included before winsock2.h, while io.h needs to be included before
the manual defines for lseek functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
vc1pred: remove logically dead code

CC: libav-stable@libav.org
Bug-Id: CID 1245699 / CID 1245700
lpc: remove unneeded {}

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
vorbis_parser: Move vp check to avoid a null pointer dereference

CC: libav-stable@libav.org
Bug-Id: CID 1251347
vc1: Simplify a little setting the intra variables

The code currently set the information in at least 4 places, spare
some pointless loops.

Make the code in the loop a little uniform to make easier factorize
it out later.
vc1: Set the is_intra bitfield to all 1 when needed

Keep the code as similar as possible across the codepaths to
ease spotting it for factorization.

Based on a patch from Michael Niedermayer <michaelni@gmx.at>.
vc1: Use the correct shift amount

`is_intra` is a 6bits bitfield.

CC: libav-stable@libav.org
Bug-Id: CID 1194380 / CID 1194381

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
hnm4: Use av_image_check_size

As done for all the other codecs not calling it indirectly.

CC: libav-stable@libav.org
Bug-Id: CID 1135770 / CID 1135771
hnm4: change width/height to int to fix hypothetical integer overflows

CC: libav-stable@libav.org
Bug-Id: CID 1135770 / CID 1135771
vf_interlace: x86: improve asm performance

4775 decicycles -> 3688 decicycles
vorbis_parser: Include stdint.h in the header, to make it work standalone

This fixes "make checkheaders".

Signed-off-by: Martin Storsjö <martin@martin.st>
movenc: Add a flag for indicating a discontinuous fragment

This allows creating a later mp4 fragment without sequentially
writing the earlier ones before (when called from a segmenter).

Normally when writing a fragmented mp4 file sequentially, the
first timestamps of a fragment are adjusted to match the
end of the previous fragment, to make sure the timestamp is the
same, even if it is calculated as the sum of previous fragment
durations. (And for the first packet in a file, the offset of
the first packet is written using an edit list.)

When writing an individual mp4 fragment discontinuously like this
(with potentially writing the earlier fragments separately later),
there's a risk of getting a gap in the timeline if the duration
field of the last packet in the previous fragment doesn't match up
with the start time of the next fragment.

Using this requires setting -avoid_negative_ts make_non_negative
(or -avoid_negative_ts 0).

Signed-off-by: Martin Storsjö <martin@martin.st>
movenc: Expose the fragment index as an avoption

This allows setting the right fragment number if doing
random-access writing of fragments, and also allows reading the
current sequence number.

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.