Commit Graph

14 Commits

Author SHA1 Message Date
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
Andreas Cadhalpun 8e9c39e81f mov: abort on EOF in ff_mov_read_chan
Otherwise the loop can take a lot of time if num_descr is very large.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-05-31 13:05:12 +02: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
Justin Ruggles a903f8f087 Include libavutil/channel_layout.h instead of libavutil/audioconvert.h
Also reorder some other #include when applicable.
2012-11-11 13:35:12 -05:00
Martin Storsjö 7b699d8136 mov_chan: Only set the channel_layout if setting it to a nonzero value
If regularly parsing new chan atoms (as in rtpdec_qt), but the
chan atoms don't actually contain any channel layout, don't reset
the value that the caller has filled in (by guessing).

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-08 01:30:44 +03:00
Martin Storsjö 5f72bc02f8 mov_chan: Reindent an incorrectly indented line
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-08 01:30:43 +03:00
Samuel Pitoiset 9afb7061f9 mov_chan: Pass a separate AVIOContext for reading
This fixes crashes when called from rtpdec_qt, where
AVFormatContext->pb is null, a crash present since 3bab7cd128.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-07 10:49:35 +03:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Justin Ruggles 3bab7cd128 avformat: move 'chan' tag parsing to mov_chan.c to share with the CAF demuxer 2012-07-19 13:26:45 -04:00
Alex Converse a112822597 movenc: Add channel layouts for PCM. 2012-06-27 13:47:58 -07:00
Martin Storsjö 44fdf37c94 mov_chan: Fix operator precedence by adding parentheses
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-17 17:51:50 +03:00
Alex Converse 3e6e89b3d6 mov: Add missing terminator to mov_ch_layout_map_1ch.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: Libav-stable@libav.org
2012-03-22 13:56:44 -07:00
Alex Converse 4274e481c0 mov: Support MOV_CH_LAYOUT_USE_DESCRIPTIONS for labeled descriptions. 2012-01-05 10:34:06 -08:00
Justin Ruggles 1fdf18f4b7 mov: add support for reading and writing the 'chan' tag
This implements reading the tag in the demuxer and adds support for writing it
in the muxer. Some example channel layout tables for muxing are included for
ac3, aac, and alac, but they are not utilized yet.
2011-12-09 16:12:58 -05:00