Commit Graph

6 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
Diego Biurrun 7abd35a1ff avformat: Add av_cold attributes to init functions missing them 2013-05-05 18:33:04 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Martin Storsjö fa6dce4c57 rtpdec: Interpret the different G726 names as bits_per_coded_sample
For the standardized 8 kHz sample rate, this works exactly the same.
For nonstandard sample rates, the different predefined G726
names (G726-16, G726-24, G726-32, G726-40) are interpreted as an
indication of the bits per coded sample, even though their
actual bitrates aren't what the name specifies.

This feels more sane than using free-form names for nonstandard
sample rate/bitrate combinations, e.g like G726-22, G726-33
for 11025 Hz.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-12-01 23:19:24 +02:00
Martin Storsjö c8f0e88b20 rtpdec: Templatize the code for different g726 bitrate variants
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-30 23:20:07 +02:00
Miroslav Slugeň 06d7325ab1 rtpdec: Add support for G726 audio
This requires using a separate init function, since there
isn't necessarily any fmtp lines for this codec, so
parse_sdp_a_line won't be called. Incorporating it with the
alloc function wouldn't do either, since it is called before
the full rtpmap line is parsed (where the sample rate is
extracted).

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-30 17:39:32 +02:00