Since it is declared as a string AVOption, the generic freeing code
attempts to free it on codec close. Some codecs might have already freed
it elsewhere (or didn't even allocate it with av_malloc() in the first
place), so this might lead to an invalid free.
There is no point in having this field accessible as an AVOption, so
remove it from the options table.
Fixes Bug 380.
CC: libav-stable@libav.org
Error out on init if a codec with CODEC_CAP_EXPERIMENTAL is requested
and strict_std_compliance is not FF_COMPLIANCE_EXPERIMENTAL.
Move the check from avconv to avcodec_open2() and return
AVERROR_EXPERIMENTAL accordingly.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* cus/stable:
ffplay: if there is no audio stream, use external clock by default
ffplay: use get_master_sync_type where necessary
ffplay: add get_master_sync_type function
ffplay: only check external clock if current frame serial matches the displayed frame serial
ffplay: add serial field to PacketQueue entry and populate it
ffplay: fix external time sync mode
ffplay: initialize audio and video pts drift
ffplay: fix nosync threshold check in synchronize_audio
ffplay: use framedrop by default when sync is not done to video
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit introduces a new AVPacket side data type:
AV_PKT_DATA_STRINGS_METADATA. Its main goal is to provide a way to
transmit the metadata from the AVFilterBufferRef up to the AVFrame. This
is at the moment "only" useful for lavfi input from libavdevice:
lavd/lavfi only outputs packets, and the metadata from the buffer ref
kept in its context needs to be transmitted from the packet to the frame
by the decoders. The buffer ref can be destroyed at any time (along with
the metadata), and a duplication of the AVPacket needs to duplicate the
metadata as well, so the choice of using the side data to store them was
selected.
Making sure lavd/lavfi raises the metadata is useful to allow tools like
ffprobe to access the filters metadata (it is at the moment the only
way); ffprobe will now automatically show the AVFrame metadata in any
customizable output format for users. API users will also be able to
access the AVFrame->metadata pointer the same way ffprobe does
(av_frame_get_metadata).
All the changes are done in this single commit to avoid some memory
leaks: for instances, the changes in lavfi/avcodec.c are meant to
duplicate the metadata from the buffer ref into the AVFrame. Unless we
have an internal way of freeing the AVFrame->metadata automatically, it
will leak in most of the user apps. To fix this problem, we introduce
AVCodecContext->metadata and link avctx->metadata to the current
frame->metadata and free it at each decode frame call (and in the codec
closing callback for the last one). But doing this also means to update
the way the tiff decoder already handles the AVFrame->metadata (it's the
only one decoder with frame metadata at the moment), by making sure it
is not trying to free a pointer already freed by the lavc internals.
The lavfi/avcodec.c buffer ref code is based on an old Thomas Kühnel
work, the rest of the code belongs to the commit author.
Signed-off-by: Thomas Kühnel <kuehnelth@googlemail.com>
Signed-off-by: Clément Bœsch <ubitux@gmail.com>
Otherwise playing the video could be much slower than realtime if the system
can't decode or display the frames fast enough.
Signed-off-by: Marton Balint <cus@passwd.hu>
The real av_sync_type may be different to VideoState->av_sync_type, because the
required audio or video stream for audio or video clock may not be available.
We will use a function to query the real av_sync_type which is used for
determining the master clock.
Signed-off-by: Marton Balint <cus@passwd.hu>
The purpose of the serial field is to accompany the decoded data during the
decoding process to know if the decoded data belongs to the data stream after
the latest packet queue flush.
Signed-off-by: Marton Balint <cus@passwd.hu>
We now initalize the external clock to 0 and, we use the system clock to
regulate the timings of audio and video in external clock sync mode. We
recover from external clock sync loss, when the delay to external clock is
bigger than AV_NOSYNC_THRESHOLD.
Signed-off-by: Marton Balint <cus@passwd.hu>