diff mbox series

[FFmpeg-devel,3/4] pthread_frame: introduce a codec callback to update the user-facing context

Message ID 20210410210023.27057-3-jamrial@gmail.com
State Accepted
Commit 82ebe0c7968262c7e27700b93bc58be0d7228458
Headers show
Series [FFmpeg-devel,1/4] avcodec/h264dec: add missing flags to is_avc and nal_length_size AVOptions | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer April 10, 2021, 9 p.m. UTC
From: Hendrik Leppkes <h.leppkes@gmail.com>

---
 libavcodec/codec.h         | 5 +++++
 libavcodec/pthread_frame.c | 2 ++
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index 50a22f6e3c..de050b2815 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -258,6 +258,11 @@  typedef struct AVCodec {
      * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
      */
     int (*update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src);
+
+    /**
+     * Copy variables back to the user-facing context
+     */
+    int (*update_thread_context_for_user)(struct AVCodecContext *dst, const struct AVCodecContext *src);
     /** @} */
 
     /**
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 9176027f15..ae5b000d97 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -326,6 +326,8 @@  FF_DISABLE_DEPRECATION_WARNINGS
         dst->coded_frame = src->coded_frame;
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
+        if (dst->codec->update_thread_context_for_user)
+            err = dst->codec->update_thread_context_for_user(dst, src);
     } else {
         if (dst->codec->update_thread_context)
             err = dst->codec->update_thread_context(dst, src);