Use av_mallocz_array instead of iterating and check the returned memory.
Check returned memory and cleanly exit in case of error during the loop.
Avoid a null pointer dereference for invalid data.
CC: libav-stable@libav.org
Bug-Id: CID 29575
vorbis_parser.o is built unconditionally since 5e80fb7ff, and the
unconditionally built parts of it depend on xiph.o.
This fixes builds with --disable-everything.
Signed-off-by: Martin Storsjö <martin@martin.st>
The latest fdk-aac code drop (from android 5.0) changed the channel
layout enums (changing the value of existing enum constants), and
renamed the option for downmixing.
The failsafe comparison between ctype and FF_ARRAY_ELEMS(channel_counts)
can trigger warnings (-Wtautological-constant-out-of-range-compare)
when building with the old FDK AAC releases, where it can't be
out of range with the enum values used there.
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
This avoids a potential crash if writing a fragmented psp mp4
(which probably is only a hypothetical scenario).
Signed-off-by: Martin Storsjö <martin@martin.st>
Previously we wrote decoding timestamps here, while the specs
say it should be presentation timestamps.
Signed-off-by: Martin Storsjö <martin@martin.st>
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>
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>
This is the same logic as is invoked on AVFMT_TS_NEGATIVE,
but which can be enabled manually, or can be enabled
in muxers which only need it in certain conditions.
Also allow using the same mechanism to force streams to start
at 0.
Signed-off-by: Martin Storsjö <martin@martin.st>
The only parameters needed by the demuxers are the sample rate and sample
count, which can be trivially extracted manually, without resorting to
an avpriv function.
It will not be set unless the codec context is used as the encoding
context, which is discouraged. For MP2, av_get_audio_frame_duration()
will already set the frame size properly. For MP3, set the frame size
explicitly.
Currently, the API takes an external AVCodecContext, which is used only
for extradata and logging. This change will allow to it to work without
an AVCodecContext in the following commits.
It is never an error if this method failed. If rt->live was
explicitly set to 0 (known to be a recorded file), print it
as a warning, otherwise print it as a debug message.
Based on a patch by Michael Niedermayer.
Signed-off-by: Martin Storsjö <martin@martin.st>
The application will destroy the underlying hardware handles when
get_format() gets called again. Also this ensures the
deinitialization takes place if the get_format callback returns an
error.
Regression from 1c80c9d7ef.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>