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.
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
This file with the incorrect name was added after the name was fixed in all other files.
This is thus fixing a mistake
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'c0de9159a7ba5707aa0a5c2bc73ae78b7b87ec46':
avdevice: Give names to anonymously typedeffed structs
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'cb0244daaca83ab666798818f74f5181bf6bc387':
bktr: Changed a missed occurrance of open into avpriv_open
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '124134e42455763b28cc346fed1d07017a76e84e':
avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member
Conflicts:
libavcodec/aacenc.c
libavcodec/libopenjpegenc.c
libavcodec/options_table.h
libavdevice/bktr.c
libavdevice/v4l2.c
libavdevice/x11grab.c
libavfilter/af_amix.c
libavfilter/vf_drawtext.c
libavformat/movenc.c
libavformat/options_table.h
libavutil/opt.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master:
asf: only set index_read if the index contained entries.
cabac: add overread protection to BRANCHLESS_GET_CABAC().
cabac: increment jump locations by one in callers of BRANCHLESS_GET_CABAC().
cabac: remove unused argument from BRANCHLESS_GET_CABAC_UPDATE().
cabac: use struct+offset instead of memory operand in BRANCHLESS_GET_CABAC().
h264: add overread protection to get_cabac_bypass_sign_x86().
h264: reindent get_cabac_bypass_sign_x86().
h264: use struct offsets in get_cabac_bypass_sign_x86().
h264: fix overreads in cabac reader.
wmall: fix seeking.
lagarith: fix buffer overreads.
dvdec: drop unnecessary dv_tablegen.h #include
build: fix doc generation errors in parallel builds
Replace memset(0) by zero initializations.
faandct: Remove FAAN_POSTSCALE define and related code.
dvenc: print allowed profiles if the video doesn't conform to any of them.
avcodec_encode_{audio,video}: only reallocate output packet when it has non-zero size.
FATE: add a test for vp8 with changing frame size.
fate: add kgv1 fate test.
oggdec: calculate correct timestamps in Ogg/FLAC
Conflicts:
libavcodec/4xm.c
libavcodec/cook.c
libavcodec/dvdata.c
libavcodec/dvdsubdec.c
libavcodec/lagarith.c
libavcodec/lagarithrac.c
libavcodec/utils.c
tests/fate/video.mak
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master: (29 commits)
cabac: Move code only used within the CABAC test program into the test program.
vp56: Drop unnecessary cabac.h #include.
h264-test: Initialize AVCodecContext.av_class.
build: Skip compiling network.h and rtsp.h if networking is not enabled.
cosmetics: drop some pointless parentheses
Disable annoying warning without changing behavior
faq: Solutions for common problems with sample paths when running FATE.
avcodec: attempt to clarify the CODEC_CAP_DELAY documentation
avcodec: fix avcodec_encode_audio() documentation.
FATE: xmv-demux test; exercise the XMV demuxer without decoding the perceptual codecs inside.
vqf: recognize more metadata chunks
FATE test: BMV demuxer and associated video and audio decoders.
FATE: indeo4 video decoder test.
FATE: update xxan-wc4 test to a sample with more code coverage.
Change the recent h264_mp4toannexb bitstream filter test to output to an elementary stream rather than a program stream.
g722enc: validate AVCodecContext.trellis
g722enc: set frame_size, and also handle an odd number of input samples
g722enc: split encoding into separate functions for trellis vs. no trellis
mpegaudiodec: Use clearer pointer math
tta: Fix returned error code at EOF
...
Conflicts:
libavcodec/h264.c
libavcodec/indeo3.c
libavcodec/interplayvideo.c
libavcodec/ivi_common.c
libavcodec/libxvidff.c
libavcodec/mpegvideo.c
libavcodec/ppc/mpegvideo_altivec.c
libavcodec/tta.c
libavcodec/utils.c
libavfilter/vsrc_buffer.c
libavformat/Makefile
tests/fate/indeo.mak
tests/ref/acodec/g722
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master:
rtpdec: Templatize the code for different g726 bitrate variants
rv40: move loop filter to rv34dsp context
lavf: make av_set_pts_info private.
rtpdec: Add support for G726 audio
rtpdec: Add an init function that can do custom codec context initialization
avconv: make copy_tb on by default.
matroskadec: don't set codec timebase.
rmdec: don't set codec timebase.
avconv: compute next_pts from input packet duration when possible.
lavf: estimate frame duration from r_frame_rate.
avconv: update InputStream.pts in the streamcopy case.
Conflicts:
avconv.c
libavdevice/alsa-audio-dec.c
libavdevice/bktr.c
libavdevice/fbdev.c
libavdevice/libdc1394.c
libavdevice/oss_audio.c
libavdevice/v4l.c
libavdevice/v4l2.c
libavdevice/vfwcap.c
libavdevice/x11grab.c
libavformat/au.c
libavformat/eacdata.c
libavformat/flvdec.c
libavformat/mpegts.c
libavformat/mxfenc.c
libavformat/rtpdec_g726.c
libavformat/wtv.c
libavformat/xmv.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master: (23 commits)
x86inc: use sse versions of common macros instead of sse2 when applicable
doc/APIchanges: add missing dates and hashes
lavf: don't return from void av_update_cur_dts()
Changelog: add more entries.
Changelog: update ffmpeg/avconv incompatibility list.
avconv: remove some redundant temporary variables.
avconv: fix broken indentation
avconv: move copy_initial_nonkeyframes to the options context.
avconv: use file:stream instead of file.stream in log messages.
doc/avconv: elaborate on basic functionality.
doc/avconv: -sample_fmts, not -help sample_fmts prints the sample formats
openssl: Only use CRYPTO_set_id_callback on OpenSSL < 1.0.0
Call avformat_network_init/deinit in the programs
Remove leftover includes of strings.h
avutil: Don't allow using strcasecmp/strncasecmp
Replace all usage of strcasecmp/strncasecmp
avstring: Add locale independent implementations of strcasecmp/strncasecmp
avstring: Add locale independent implementations of toupper/tolower
cosmetics: insert some spaces in explicit enum value assignments
move 8SVX audio codecs to the audio codec list part on the next bump
...
Conflicts:
avprobe.c
doc/APIchanges
ffplay.c
ffserver.c
libavcodec/avcodec.h
libavdevice/bktr.c
libavdevice/v4l.c
libavdevice/v4l2.c
libavformat/matroskaenc.c
libavformat/wtv.c
libavutil/avstring.c
libavutil/avstring.h
libavutil/avutil.h
libswscale/x86/swscale_template.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master:
presets: rename presets directory
lavc: make avcodec_get_context_defaults3 "officially" public
lavf: replace av_new_stream->avformat_new_stream part II.
lavf,lavd: replace av_new_stream->avformat_new_stream part I.
lavf: add avformat_new_stream as a replacement for av_new_stream.
Use correct scaling table for bwd-pred MVs in second B-field
Ut Video decoder
Makefile: change presets extension to .avpreset
lavfi: add rgbtestsrc source, ported from MPlayer libmpcodecs
lavfi: add testsrc source
AVOptions: add documentation.
presets: update libx264 ffpresets
Conflicts:
Changelog
doc/APIchanges
doc/ffmpeg.texi
ffpresets/libx264-ipod320.ffpreset
ffpresets/libx264-ipod640.ffpreset
ffserver.c
libavcodec/avcodec.h
libavcodec/options.c
libavcodec/version.h
libavdevice/libdc1394.c
libavfilter/avfilter.h
libavfilter/vsrc_testsrc.c
libavformat/flvdec.c
libavformat/riff.c
libavformat/version.h
libavformat/wtv.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master:
flvdec: Fix invalid pointer deferences when parsing index
configure: disable hardware capabilities ELF section with suncc on Solaris x86
Use explicit struct initializers for AVCodec declarations.
Use explicit struct initializers for AVOutputFormat/AVInputFormat declarations.
adpcmenc: Set bits_per_coded_sample
adpcmenc: fix QT IMA ADPCM encoder
adpcmdec: Fix QT IMA ADPCM decoder
permit decoding of multichannel ADPCM_EA_XAS
Fix input buffer size check in adpcm_ea decoder.
fft: avoid a signed overflow
mpegps: Handle buffer exhaustion when reading packets.
Conflicts:
libavcodec/adpcm.c
libavcodec/adpcmenc.c
libavdevice/alsa-audio-enc.c
libavformat/flvdec.c
libavformat/mpeg.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master:
Fix NASM include directive
dsputil_mmx: Honor HAVE_AMD3DNOW
lavf,lavd: remove all usage of AVFormatParameters from demuxers.
jack: add 'channels' private option.
VC-1: fix reading of custom PAR.
Remove redundant and dubious video codec detection by its extradata
mpeg12: remove repeat-field code disabled since May 2002
patch checklist: suggest fate instead of regression tests
Turn on resampling on sudden size change instead of bailing out during recode.
avtools: reinitialise filter chain when input video stream changes dimensions
Conflicts:
Makefile
avconv.c
doc/developer.texi
ffplay.c
libavcodec/x86/dsputil_mmx.c
libavdevice/libdc1394.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
AVFormatParameters are converted into corresponding private options in
av_open_input_file/stream() compat wrappers, so accessing them from
demuxers is redundant.
* qatar/master:
doxygen: Consistently use '@' instead of '\' for Doxygen markup.
Use av_printf_format to check the usage of printf style functions
Add av_printf_format, for marking printf style format strings and their parameters
ARM: enable thumb for Cortex-M* CPUs
nsvdec: Propagate error values instead of returning 0 in nsv_read_header().
build: remove SRC_PATH_BARE variable
build: move basic rules and variables to main Makefile
build: move special targets to end of main Makefile
lavdev: improve feedback in case of invalid frame rate/size
vfwcap: prefer "framerate_q" over "fps" in vfw_read_header()
v4l2: prefer "framerate_q" over "fps" in v4l2_set_parameters()
fbdev: prefer "framerate_q" over "fps" in device context
bktr: prefer "framerate" over "fps" for grab_read_header()
ALSA: implement channel layout for playback.
alsa: support unsigned variants of already supported signed formats.
alsa: add support for more formats.
ARM: allow building in Thumb2 mode
Conflicts:
common.mak
doc/APIchanges
libavcodec/vdpau.h
libavdevice/alsa-audio-common.c
libavdevice/fbdev.c
libavdevice/libdc1394.c
libavutil/avutil.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Show the invalid string in the error message.
While at it also prefer "Could not" over "Couldn't", plain forms are
preferred over contractions (simplify readability, especially for non
English-savvy people).
Signed-off-by: Anton Khirnov <anton@khirnov.net>
The variable is used for containing the parsed value of s1->framerate,
using a lexically consistent name ease readability/understanding.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
* qatar/master:
Remove some unused scripts from tools/.
Add x86 assembly for some 10-bit H.264 intra predict functions.
v4l2: do not force NTSC as standard
Skip tableprint.h during 'make checkheaders'.
Remove unnecessary LIBAVFORMAT_BUILD #ifdef.
Drop explicit filenames from @file Doxygen tags.
Skip generated table headers during 'make checkheaders'.
lavf,lavc: free avoptions in a generic way.
AVOptions: add av_opt_free convenience function.
tableprint: Restore mistakenly deleted common.h #include for FF_ARRAY_ELEMS.
tiff: print log in case of unknown / unsupported tag.
tiff: fix linesize for mono-white/black formats.
Fix build of eval-test program
configure: Document --enable-vaapi
ac3enc: extract all exponents for the frame at once
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master:
ARM: remove MULL inline asm
mathops: use MUL64 macro where it forms part of other ops
tty: factorise returning error codes.
rawdec: add framerate private option.
x11grab: add framerate private option.
fbdev,v4l2: remove some forgotten uses of AVFormatParameters.time_base.
bktr: don't error when AVFormatParameters.time_base isn't set.
cmdutils: add missing const qualifier
Skip headers not designed to work standalone during 'make checkheaders'.
Add missing #includes to make headers self-contained.
musepack: remove unnecessary #include from mpcdata.h
musepack: remove extraneous mpcdata.h inclusions
Fix error check in av_file_map()
Conflicts:
cmdutils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>