diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-18 07:01:22 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-28 02:03:15 +0200 |
commit | 29f5c1e51b0d156f4650b96ab56c07727fe9a9b7 (patch) | |
tree | 2a52147902168fb65a3de28baddd76cdac0e11a0 /libavcodec/internal.h | |
parent | d07534b5f5f20b4f780f5b0284aca6354da00695 (diff) |
avcodec/avcodec: Store whether AVCodec->close needs to be called
Right now all AVCodecContexts except those using frame-threaded decoding
call the codec's init function and expect its close function to be
called. In order to make sure that the close function is not called for
frame-threaded decoding ff_frame_thread_free() resets
AVCodecContext.codec (and because of this it has to free the private
AVOptions of the main AVCodecContext itself). This is not obvious and
potentially fragile. Instead add a field to AVCodecInternal that
indicates whether close should be called for this AVCodecContext.
It is always zero when using frame-threaded decoding, so that resetting
the codec is no longer necessary and has been removed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/internal.h')
-rw-r--r-- | libavcodec/internal.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/internal.h b/libavcodec/internal.h index b101f20c40..60f65d3f2c 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -161,6 +161,12 @@ typedef struct AVCodecInternal { EncodeSimpleContext es; /** + * If this is set, then AVCodec->close (if existing) needs to be called + * for the parent AVCodecContext. + */ + int needs_close; + + /** * Number of audio samples to skip at the start of the next decoded frame */ int skip_samples; |