Commit Graph

145 Commits

Author SHA1 Message Date
Anton Khirnov 83548fe894 lavf: fix usage of AVIOContext.seekable
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.
2016-09-30 16:54:33 +02:00
Anton Khirnov 5ebef79abe Fix instances of broken indentation found by gcc 6 2016-07-31 08:19:27 +02:00
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Anton Khirnov 9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
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.
2016-02-23 17:01:58 +01:00
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Vittorio Giovara 1a3eb042c7 Replace av_dlog with normal av_log at trace level
This applies to every library where performance is not critical.
2015-04-19 12:41:59 +01:00
Martin Storsjö 6448f15af0 mxfdec: Fix the error handling for when strftime fails
The str variable is a char ** here.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-08 18:40:43 +02:00
Diego Biurrun daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Tomas Härdin 11467ecf51 mxfdec: reduce loop bound in mxf_read_pixel_layout()
Makes coverity less confused and code more readable.

Bug-Id: CID 732262
2014-10-27 19:08:02 +00:00
Martin Storsjö 9dcf239721 lavf: Check the return value of strftime
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>
2014-10-26 00:14:54 +03:00
Vittorio Giovara ad6b00d85f mxfdec: add missing break
CC: libav-stable@libav.org
Bug-Id: CID 732232
2014-10-24 23:48:57 +01:00
Luca Barbato 369380e1c4 mxf: Support AAC
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.
2014-08-17 16:11:16 +02:00
Luca Barbato 747cd9560c mxf: Add the UL for the MPEG2VideoDescriptor 2014-08-17 16:11:02 +02:00
Luca Barbato 304089aca7 mxf: Add UID print helpers
And use it to print non-parsed ULs.
2014-08-17 16:11:02 +02:00
Marc-Antoine Arnaud 259fe7280d mxf: Extract origin information from material and source track
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-07-28 22:17:42 +02:00
Marc-Antoine Arnaud c9d982aa11 mxf: Detect Vanc/Vbi SMPTE-436M mxf track
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-07-28 22:17:42 +02:00
Luca Barbato ad8f736b74 mxf: Remove typo
Reported-By: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-04-03 23:45:05 +02:00
Luca Barbato af9481d701 mxf: Lowercase UL strings
The specification uses lower case most of the time.
2014-03-19 12:04:15 +01:00
Luca Barbato 842ea36c74 mxf: Override faulty PreviousPartition entries
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>
2014-03-19 11:56:33 +01:00
Diego Biurrun d92024f18f lavf: more correct printf format specifiers 2014-03-11 13:13:41 +01:00
Martin Storsjö 8cafeb8bca mxfdec: Validate parameters to strftime
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>
2014-03-10 11:11:08 +02:00
Luca Barbato 5b977c1d4f mxf: Return meaningful errors 2014-03-06 19:28:20 +01:00
Paul B Mahol f06f6daaf8 mxf: Parse random index pack
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>
2014-03-06 19:28:20 +01:00
Matthieu Bouron 570af382ee mxf: Handle identification metadata
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-06 19:28:20 +01:00
Matthieu Bouron 5b930092c3 mxf: Set audio packets pts
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>
2014-03-06 19:28:20 +01:00
Janne Grunau b37effdc52 mxfdec: free descriptor extradata in .read_close()
Fixes memleak in fate-mxf-demux.
2014-02-09 18:50:53 +01:00
Matthieu Bouron c716624853 mxf: Read field dominance flag
And export the information in field_order.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-02-01 16:26:44 +01:00
Luca Barbato 7d56f2fffc mxf: Handle negative edit_rate
Default to 1/25.
2014-02-01 16:25:07 +01:00
Tomas Härdin cc1e3ace63 mxf: Fix potential leak in mxf_read_local_tags()
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-14 18:23:00 +01:00
Tomas Härdin 8b708f1c6b mxf: Correctly support files from Pinnacle Thunder
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>
2014-01-14 18:13:29 +01:00
Michael Niedermayer 0d6605c7ef mxf: Fix a possible leak of extradata
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-14 18:13:29 +01:00
Luca Barbato 1a4e4ad0e0 mxf: Use av_malloc_array 2014-01-14 18:13:29 +01:00
Luca Barbato f5fbbbc022 mxf: Drop unnecessary checks
av_reallocp_array does the check already.
2014-01-14 18:13:29 +01:00
Marton Balint aa0cb16c15 mxf: Fix off by one error in d10 aes3 decoding
Without this fix the last sample was missing from the packet.
2014-01-14 18:13:22 +01:00
Luca Barbato 42f9132218 mxf: Do not use int to check the seek position
Overly large files are to be expected.

Reported-by: Jean-Baptiste Kempf <jb@videolan.org>
2014-01-14 17:29:03 +01:00
Reimar Döffinger d84bd4650b mxf: Set AV_FIELD_PROGRESSIVE
Needed for AVC-intra

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-14 17:28:48 +01:00
Anton Khirnov 95fd52c11b mxfdec: set extradata size
The line setting it was mistakenly removed in
ecf442a58b
2013-11-29 14:19:47 +01:00
Diego Biurrun 8f8bc92365 Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
Reimar Döffinger ecf442a58b lavf: improve support for AVC-Intra files.
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>
2013-11-14 18:59:39 +01:00
Marton Balint 951d819006 mxfdec: update current edit unit when seeking in mxf files without index tables
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>
2013-11-14 18:59:17 +01:00
Matthieu Bouron 054454c63a mxf: Add jpeg2000 codec to intra only codecs
Conform with SMPTE RP 224 and SMPTE s422.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-10 18:22:46 +02:00
Luca Barbato ad0560fe74 mxf: Remove a typo
Introduced in 93370d1216
2013-10-01 13:43:48 +02:00
Anton Khirnov 93370d1216 mxfdec: set audio timebase to 1/samplerate
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
2013-09-29 21:50:30 +02:00
Alexandra Khirnova f369b9356c avformat: Use av_reallocp_array() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-10 12:38:32 +02:00
Diego Biurrun 2832ea26f3 Remove commented-out debug #define cruft 2013-05-16 00:23:30 +02:00
Diego Biurrun 1ecdf8912b avformat: av_log_ask_for_sample() ---> avpriv_request_sample() 2013-03-13 20:42:21 +01:00
Xi Wang 3b81bba3bc mxfdec: fix NULL checking in mxf_get_sorted_table_segments()
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>
2013-01-04 20:43:42 -05:00
Janne Grunau c84cce5a99 mxfdec: fix typo in mxf_read_seek()
Check the number of index tables before using byte offset based seeking
instead of the index_tables pointer.

Found by Måns Rullgård <mans@mansr.com>.
2012-11-15 17:37:09 +01:00
Martin Storsjö e002e3291e Use the new aes/md5/sha/tree allocation functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-11 23:35:28 +03:00
Janne Grunau bd141f5ec9 mxfdec: return error if no segments are available in mxf_get_sorted_table_segments
Fixes CID732275.
2012-10-10 21:24:32 +02:00