On Sun, Mar 22, 2020 at 04:47:39AM +0100, Andreas Rheinhardt wrote: > If reading the header fails, the demuxer's read_close() function (if > existing) is not called automatically; instead several demuxers call it > via "goto fail" in read_header(). > > This commit intends to change this by adding a flag to AVInputFormat > that can be used to set on a per-AVInputFormat basis whether read_close() > should be called generically after an error during read_header(). > > The flag controlling this behaviour has been added because it might be > unsafe to call read_close() generally (e.g. this might lead to > read_close() being called twice and this might e.g. lead to double-frees > if av_free() instead of av_freep() is used; or a size field has not > been reset after freeing the elements (see the mov demuxer for an > example of this)). Yet the intention is to check and fix all demuxers > and make the flag redundant in the medium run. > > The flag has been added to a new internal field of AVInputFormat, > flags_internal. When it has become redundant, it can be removed again > at the next major version bump. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> > --- > libavformat/avformat.h | 7 +++++++ > libavformat/utils.c | 11 +++++++++-- > 2 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/libavformat/avformat.h b/libavformat/avformat.h > index 9b9b634ec3..50b90788b1 100644 > --- a/libavformat/avformat.h > +++ b/libavformat/avformat.h > @@ -780,6 +780,13 @@ typedef struct AVInputFormat { > * @see avdevice_capabilities_free() for more details. > */ > int (*free_device_capabilities)(struct AVFormatContext *s, struct > AVDeviceCapabilitiesQuery *caps); > + > +#define FF_INPUTFORMAT_HEADER_CLEANUP 0x0001 /**< read_close() should be > called > + on read_header() failure */ > + /** > + * Can use flags: FF_INPUTFORMAT_HEADER_CLEANUP > + */ > + int flags_internal; > } AVInputFormat; > /** > * @}
This feature is a good idea. thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".