movenc: Allow to request not to use edit lists

In this case, shift tracks to start from zero instead (potentially
stretching the first sample in tracks that start later than the
first one).

Some software does not support edit lists at all, the adobe flash
player seems to be one of these. This results in AV sync errors when
edit lists are used to adjust AV sync.

Some players, such as QuickTime, don't respect the duration for
audio packets, so if an audio track starts later than the video
track and the first audio sample gets a duration longer than the
actual amount of data in it, the result will be out of sync.

Based on patches by Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin@martin.st>
movenc: Remove a now redundant check

When using the new first_trun flag instead of checking the track id,
we don't need to have a special case for the separate_moof flag
any longer.

This simplifies the complicated codepath ever so slightly.

Signed-off-by: Martin Storsjö <martin@martin.st>
movenc: Write correct presentation timestamps in tfra

Previously we wrote decoding timestamps here, while the specs
say it should be presentation timestamps.

Signed-off-by: Martin Storsjö <martin@martin.st>
Merge commit '1d8a0c1b43e58332a3a15c67d4adc161713cade8'

* commit '1d8a0c1b43e58332a3a15c67d4adc161713cade8':
  movenc: Allow to request not to use edit lists

Conflicts:
	libavformat/movenc.c

See: 537ef8bebf8a35aab448db6ec876e275a10f0f15
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'e7d20f12c5eff5570cd897f3ce3a88456024036b'

* commit 'e7d20f12c5eff5570cd897f3ce3a88456024036b':
  movenc: Remove a now redundant check

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Fix make checkheaders for libavcodec/vorbis_parser.h.
Merge commit '9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d'

* commit '9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d':
  movenc: Write correct presentation timestamps in tfra

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Fix read-after-free in matroska_read_seek().

In matroska_read_seek(), |tracks| is assigned at the begining of the function.
However, functions like matroska_parse_cues() could reallocate the tracks so
that |tracks| can get invalidated.

This CL assigns |tracks| only before we use it so that it won't be invalidated.

BUG=427266
TEST=Test case in associated bug passes now.

Change-Id: I9c7065fe8f4311ca846076281df2282d190ed344

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg_opt: free incorrect priv_data for feed stream

new_output_stream creates a codec context with arbitraty picked codec.
Later data is updated, but priv_data are left alone.
There is a bit chance there is a mismatch between codecs.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>