lavf: replace AVStream.codec with AVStream.codecpar

Multimedia / Libav - Anton Khirnov [khirnov.net] - 23 February 2016 10:01 UTC

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.

9200514 lavf: replace AVStream.codec with AVStream.codecpar
libavdevice/alsa.c | 2 +-
libavdevice/alsa_dec.c | 14 +-
libavdevice/alsa_enc.c | 10 +-
libavdevice/bktr.c | 13 +-
libavdevice/fbdev.c | 16 +-
libavdevice/jack.c | 10 +-
libavdevice/libcdio.c | 12 +-
libavdevice/libdc1394.c | 15 +-
libavdevice/oss_dec.c | 8 +-
libavdevice/oss_enc.c | 4 +-
libavdevice/pulse.c | 8 +-
libavdevice/sndio_dec.c | 8 +-
libavdevice/sndio_enc.c | 4 +-
libavdevice/v4l2.c | 18 +-
libavdevice/vfwcap.c | 35 +--
libavdevice/x11grab.c | 15 +-
libavdevice/xcbgrab.c | 11 +-
libavformat/4xm.c | 44 ++--
libavformat/a64.c | 10 +-
libavformat/aacdec.c | 4 +-
libavformat/adtsenc.c | 8 +-
libavformat/adxdec.c | 34 +--
libavformat/aea.c | 20 +-
libavformat/aiffdec.c | 68 ++---
libavformat/aiffenc.c | 34 +--
libavformat/amr.c | 36 +--
libavformat/anm.c | 18 +-
libavformat/apc.c | 32 +--
libavformat/ape.c | 22 +-
libavformat/apetag.c | 16 +-
libavformat/asfdec.c | 30 +--
libavformat/asfenc.c | 58 ++---
libavformat/assdec.c | 10 +-
libavformat/assenc.c | 16 +-
libavformat/au.c | 30 +--
libavformat/audiointerleave.c | 12 +-
libavformat/avformat.h | 24 +-
libavformat/avidec.c | 135 +++++-----
libavformat/avienc.c | 98 +++----
libavformat/avisynth.c | 58 ++---
libavformat/avs.c | 12 +-
libavformat/bethsoftvid.c | 24 +-
libavformat/bfi.c | 36 +--
libavformat/bink.c | 46 ++--
libavformat/bmv.c | 20 +-
libavformat/c93.c | 10 +-
libavformat/cafdec.c | 64 ++---
libavformat/cdg.c | 4 +-
libavformat/cdxl.c | 26 +-
libavformat/dashenc.c | 60 ++---
libavformat/dauddec.c | 18 +-
libavformat/daudenc.c | 4 +-
libavformat/dfa.c | 8 +-
libavformat/dsicin.c | 26 +-
libavformat/dss.c | 16 +-
libavformat/dump.c | 34 ++-
libavformat/dv.c | 43 ++--
libavformat/dvenc.c | 25 +-
libavformat/dxa.c | 20 +-
libavformat/eacdata.c | 10 +-
libavformat/electronicarts.c | 32 +--
libavformat/ffmetadec.c | 4 +-
libavformat/filmstripdec.c | 20 +-
libavformat/filmstripenc.c | 6 +-
libavformat/flac_picture.c | 8 +-
libavformat/flacdec.c | 14 +-
libavformat/flacenc.c | 16 +-
libavformat/flic.c | 54 ++--
libavformat/flvdec.c | 249 +++++++++---------
libavformat/flvenc.c | 152 +++++------
libavformat/g722.c | 16 +-
libavformat/g723_1.c | 12 +-
libavformat/gif.c | 33 +--
libavformat/gsmdec.c | 12 +-
libavformat/gxf.c | 78 +++---
libavformat/gxfenc.c | 62 ++---
libavformat/hdsenc.c | 14 +-
libavformat/hls.c | 2 +-
libavformat/hlsenc.c | 6 +-
libavformat/hnm.c | 18 +-
libavformat/id3v2.c | 4 +-
libavformat/id3v2enc.c | 2 +-
libavformat/idcin.c | 38 +--
libavformat/idroqdec.c | 36 +--
libavformat/iff.c | 54 ++--
libavformat/ilbc.c | 36 +--
libavformat/img2dec.c | 28 +-
libavformat/img2enc.c | 16 +-
libavformat/internal.h | 16 ++
libavformat/ipmovie.c | 38 +--
libavformat/isom.c | 32 +--
libavformat/iss.c | 30 +--
libavformat/iv8.c | 4 +-
libavformat/ivfdec.c | 10 +-
libavformat/ivfenc.c | 12 +-
libavformat/jvdec.c | 24 +-
libavformat/latmenc.c | 16 +-
libavformat/lmlm4.c | 8 +-
libavformat/lxfdec.c | 32 +--
libavformat/matroskadec.c | 118 ++++-----
libavformat/matroskaenc.c | 194 +++++++-------
libavformat/mm.c | 22 +-
libavformat/mmf.c | 26 +-
libavformat/mov.c | 356 +++++++++++++-------------
libavformat/mov_chan.c | 4 +-
libavformat/movenc-test.c | 36 +--
libavformat/movenc.c | 519 +++++++++++++++++++-------------------
libavformat/movenc.h | 2 +-
libavformat/movenchint.c | 12 +-
libavformat/mp3dec.c | 6 +-
libavformat/mp3enc.c | 22 +-
libavformat/mpc.c | 22 +-
libavformat/mpc8.c | 20 +-
libavformat/mpeg.c | 4 +-
libavformat/mpegenc.c | 26 +-
libavformat/mpegts.c | 102 ++++----
libavformat/mpegtsenc.c | 55 ++--
libavformat/mpjpegdec.c | 4 +-
libavformat/msnwc_tcp.c | 10 +-
libavformat/mtv.c | 22 +-
libavformat/mux.c | 82 +++---
libavformat/mvdec.c | 74 +++---
libavformat/mvi.c | 36 +--
libavformat/mxfdec.c | 116 ++++-----
libavformat/mxfenc.c | 92 +++----
libavformat/mxg.c | 18 +-
libavformat/ncdec.c | 4 +-
libavformat/nsvdec.c | 26 +-
libavformat/nutdec.c | 44 ++--
libavformat/nutenc.c | 72 +++---
libavformat/nuv.c | 72 +++---
libavformat/oggdec.c | 2 +-
libavformat/oggenc.c | 80 +++---
libavformat/oggparsecelt.c | 14 +-
libavformat/oggparsedirac.c | 28 +-
libavformat/oggparseflac.c | 16 +-
libavformat/oggparseogm.c | 46 ++--
libavformat/oggparseopus.c | 12 +-
libavformat/oggparseskeleton.c | 2 +-
libavformat/oggparsespeex.c | 24 +-
libavformat/oggparsetheora.c | 26 +-
libavformat/oggparsevorbis.c | 22 +-
libavformat/oggparsevp8.c | 8 +-
libavformat/omadec.c | 50 ++--
libavformat/omaenc.c | 28 +-
libavformat/paf.c | 22 +-
libavformat/pcm.c | 8 +-
libavformat/pcmdec.c | 26 +-
libavformat/pmpdec.c | 18 +-
libavformat/psxstr.c | 34 +--
libavformat/pva.c | 8 +-
libavformat/qcp.c | 12 +-
libavformat/r3d.c | 24 +-
libavformat/rawdec.c | 8 +-
libavformat/rawvideodec.c | 16 +-
libavformat/rdt.c | 8 +-
libavformat/riff.h | 6 +-
libavformat/riffdec.c | 79 +++---
libavformat/riffenc.c | 131 +++++-----
libavformat/rl2.c | 44 ++--
libavformat/rmdec.c | 114 ++++-----
libavformat/rmenc.c | 46 ++--
libavformat/rpl.c | 72 +++---
libavformat/rsodec.c | 14 +-
libavformat/rsoenc.c | 14 +-
libavformat/rtp.c | 28 +-
libavformat/rtp.h | 8 +-
libavformat/rtpdec.c | 6 +-
libavformat/rtpdec_amr.c | 8 +-
libavformat/rtpdec_asf.c | 6 +-
libavformat/rtpdec_formats.h | 2 +-
libavformat/rtpdec_g726.c | 6 +-
libavformat/rtpdec_h264.c | 20 +-
libavformat/rtpdec_hevc.c | 30 +--
libavformat/rtpdec_ilbc.c | 6 +-
libavformat/rtpdec_latm.c | 14 +-
libavformat/rtpdec_mpeg12.c | 2 +-
libavformat/rtpdec_mpeg4.c | 18 +-
libavformat/rtpdec_qdm2.c | 28 +-
libavformat/rtpdec_qt.c | 4 +-
libavformat/rtpdec_svq3.c | 16 +-
libavformat/rtpdec_xiph.c | 33 +--
libavformat/rtpenc.c | 44 ++--
libavformat/rtpenc_aac.c | 2 +-
libavformat/rtpenc_chain.c | 4 +-
libavformat/rtpenc_h264_hevc.c | 4 +-
libavformat/rtpenc_jpeg.c | 16 +-
libavformat/rtpenc_latm.c | 2 +-
libavformat/rtpenc_mpegts.c | 4 +-
libavformat/rtsp.c | 68 ++---
libavformat/sapdec.c | 4 +-
libavformat/sauce.c | 8 +-
libavformat/sdp.c | 174 ++++++-------
libavformat/segafilm.c | 38 +--
libavformat/segment.c | 6 +-
libavformat/sierravmd.c | 56 ++--
libavformat/siff.c | 24 +-
libavformat/smacker.c | 64 ++---
libavformat/smjpegdec.c | 26 +-
libavformat/smjpegenc.c | 26 +-
libavformat/smoothstreamingenc.c | 42 +--
libavformat/smush.c | 36 +--
libavformat/sol.c | 14 +-
libavformat/soxdec.c | 30 +--
libavformat/soxenc.c | 18 +-
libavformat/spdifdec.c | 10 +-
libavformat/spdifenc.c | 2 +-
libavformat/srtdec.c | 4 +-
libavformat/swf.h | 2 +-
libavformat/swfdec.c | 36 +--
libavformat/swfenc.c | 90 +++----
libavformat/takdec.c | 18 +-
libavformat/thp.c | 24 +-
libavformat/tiertexseq.c | 28 +-
libavformat/tmv.c | 40 +--
libavformat/tta.c | 24 +-
libavformat/tty.c | 10 +-
libavformat/txd.c | 4 +-
libavformat/utils.c | 323 +++++++++++++++++-------
libavformat/vc1test.c | 16 +-
libavformat/vc1testenc.c | 10 +-
libavformat/version.h | 3 +
libavformat/voc_packet.c | 34 +--
libavformat/vocdec.c | 2 +-
libavformat/vocenc.c | 26 +-
libavformat/vqf.c | 42 +--
libavformat/wavdec.c | 26 +-
libavformat/wavenc.c | 12 +-
libavformat/wc3movie.c | 30 +--
libavformat/westwood_aud.c | 22 +-
libavformat/westwood_vqa.c | 44 ++--
libavformat/wtv.c | 60 ++---
libavformat/wvdec.c | 12 +-
libavformat/wvenc.c | 2 +-
libavformat/xa.c | 16 +-
libavformat/xmv.c | 36 +--
libavformat/xwma.c | 48 ++--
libavformat/yop.c | 36 +--
libavformat/yuv4mpegdec.c | 24 +-
libavformat/yuv4mpegenc.c | 30 +--
tests/ref/fate/iv8-demux | 10 +-
tests/ref/fate/lmlm4-demux | 180 ++++++-------
tests/ref/fate/movenc | 38 +--
tests/ref/fate/mxf-demux | 190 +++++++-------
tests/ref/fate/nc-demux | 182 ++++++-------
tests/ref/fate/wtv-demux | 68 ++---
tests/ref/lavf/flv_fmt | 2 +-
tests/ref/vsynth/vsynth1-flashsv | 2 +-
tests/ref/vsynth/vsynth1-flv | 2 +-
tests/ref/vsynth/vsynth2-flashsv | 2 +-
tests/ref/vsynth/vsynth2-flv | 2 +-
251 files changed, 4515 insertions(+), 4304 deletions(-)

Upstream: git.libav.org


  • Share