It is supposed to be a flag. The only currently defined value is
AVIO_SEEKABLE_NORMAL, but other ones may be added in the future.
However all the current lavf code treats this field as a bool (mainly
for historical reasons).
Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.
In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.
There are multiple important problems with this approach:
- the fields in AVCodecContext are in general one of
* stream parameters
* codec options
* codec state
However, it's not clear which ones are which. It is consequently
unclear which fields are a demuxer allowed to set or a muxer allowed to
read. This leads to erratic behaviour depending on whether decoding or
encoding is being performed or not (and whether it uses the AVStream
embedded codec context).
- various synchronization issues arising from the fact that the same
context is used by several different APIs (muxers/demuxers,
parsers, bitstream filters and encoders/decoders) simultaneously, with
there being no clear rules for who can modify what and the different
processes being typically delayed with respect to each other.
- avformat_find_stream_info() making it necessary to support opening
and closing a single codec context multiple times, thus
complicating the semantics of freeing various allocated objects in the
codec context.
Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
If the buffer provided to strftime is too small, the buffer contents
are indeterminate - it does not guarantee actually null terminating
the buffer.
Signed-off-by: Martin Storsjö <martin@martin.st>
Update mxf_set_audio_pts to use the container-provided information.
The UL is marked as "to be changed in the future", but the current
samples in the wild do use it.
Some files set the PreviousPartition field to point to its own offset.
If we are parsing forward the Previous partition is immediately known
and its value could be used, otherwise we can safely point to the
header.
Reported-By: Jean Baptiste Kempf <jb@videolan.org>
The MSVCRT version of strftime calls the invalid parameter handler
if the struct values in struct tm are invalid. In case no invalid
parameter handler is set for the process, the process is aborted.
This fixes fate failures on MSVC builds since 570af382.
Based on a patch by Hendrik Leppkes.
Signed-off-by: Martin Storsjö <martin@martin.st>
Get the last partition offset and use it when footer partition
offset is missing.
Footer partition may not be present and even if present footer
partition offset may not be set in any partition except last one.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Extrapolate audio timestamps based on the number of samples demuxed.
Deal with some MXF nastiness involving fractional number of
samples per EditUnit when seeking (the specs handwave this away).
Further fixes from Tomas Härdin.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Such files have IndexTableSegments which when parsed cover EditUnit
ranges like this:
[0,1)
[249,250)
[249,377)
[0,249)
where each interval is
[IndexStartPosition, IndexStartPosition + IndexDuration)
This would be reduced to a sparse index like:
[0,1), [249,250)
instead of the full range:
[0,249), [249,377)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Generate extradata with SPS/PPS based on container dimensions.
Authors of this commit are: Reimar and Thomas Mundt
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Fixes audio packet pts values in some files generated by AVID TRMG 3.01.
Signed-off-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Tomas Härdin <tomas.hardin@codemill.se>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Fixes sync in some samples (e.g. bugs 7581 and 8374 in VLC).
Based on a commit by Matthieu Bouron <matthieu.bouron@gmail.com>
Reported-by: Jean-Baptiste Kempf <jb@videolan.org>
CC: libav-stable@libav.org
The following out-of-memory check is broken.
*sorted_segments = av_mallocz(...);
if (!sorted_segments) { ... }
The correct NULL check should use *sorted_segments.
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>