From 42551a3407b0619c97cd4365bc277682c40234c3 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 10 Apr 2021 16:10:11 -0300 Subject: [PATCH] avcodec/h264dec: update exported AVOptions in the user-facing context Based on a patch by Hendrik Leppkes. Fixes ticket #9176. Signed-off-by: James Almer --- libavcodec/h264_slice.c | 12 ++++++++++++ libavcodec/h264dec.c | 1 + libavcodec/h264dec.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 62f7a61aed..9c2301d7e0 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -464,6 +464,18 @@ int ff_h264_update_thread_context(AVCodecContext *dst, return err; } +int ff_h264_update_thread_context_for_user(AVCodecContext *dst, + const AVCodecContext *src) +{ + H264Context *h = dst->priv_data; + const H264Context *h1 = src->priv_data; + + h->is_avc = h1->is_avc; + h->nal_length_size = h1->nal_length_size; + + return 0; +} + static int h264_frame_start(H264Context *h) { H264Picture *pic; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 1dd50ead9f..e5b77abc6a 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -1083,6 +1083,7 @@ AVCodec ff_h264_decoder = { FF_CODEC_CAP_ALLOCATE_PROGRESS | FF_CODEC_CAP_INIT_CLEANUP, .flush = h264_decode_flush, .update_thread_context = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context), + .update_thread_context_for_user = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context_for_user), .profiles = NULL_IF_CONFIG_SMALL(ff_h264_profiles), .priv_class = &h264_class, }; diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index b3677cdbb9..8954b74795 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -849,6 +849,8 @@ int ff_h264_queue_decode_slice(H264Context *h, const H2645NAL *nal); int ff_h264_execute_decode_slices(H264Context *h); int ff_h264_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); +int ff_h264_update_thread_context_for_user(AVCodecContext *dst, + const AVCodecContext *src); void ff_h264_flush_change(H264Context *h);