diff mbox series

[FFmpeg-devel,1/3] libswscale/options: Add parent_log_context_offset to AVClass

Message ID AM7PR03MB6660ACD943BA4A15B9C998888FDE9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit a1255a350d4629ca9f0073289ae8e2862aa0d9e1
Headers show
Series [FFmpeg-devel,1/3] libswscale/options: Add parent_log_context_offset to AVClass
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 18, 2021, 3:40 a.m. UTC
This allows to associate log messages from slice contexts to
the user-visible SwsContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libswscale/options.c          | 1 +
 libswscale/swscale_internal.h | 2 ++
 libswscale/utils.c            | 2 ++
 3 files changed, 5 insertions(+)

Comments

Paul B Mahol Sept. 18, 2021, 10:22 a.m. UTC | #1
probably fine
diff mbox series

Patch

diff --git a/libswscale/options.c b/libswscale/options.c
index 4b71a23e37..f6ea9e1f9d 100644
--- a/libswscale/options.c
+++ b/libswscale/options.c
@@ -91,6 +91,7 @@  const AVClass ff_sws_context_class = {
     .class_name = "SWScaler",
     .item_name  = sws_context_to_name,
     .option     = swscale_options,
+    .parent_log_context_offset = OFFSET(parent),
     .category   = AV_CLASS_CATEGORY_SWSCALER,
     .version    = LIBAVUTIL_VERSION_INT,
 };
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index fbfc08a89f..0d60dd2e6f 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -301,6 +301,8 @@  typedef struct SwsContext {
      */
     const AVClass *av_class;
 
+    struct SwsContext *parent;
+
     AVSliceThread      *slicethread;
     struct SwsContext **slice_ctx;
     int                *slice_err;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 25051ead72..84a29c4dc7 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1214,6 +1214,8 @@  static int context_init_threaded(SwsContext *c,
         if (!c->slice_ctx[i])
             return AVERROR(ENOMEM);
 
+        c->slice_ctx[i]->parent = c;
+
         ret = av_opt_copy((void*)c->slice_ctx[i], (void*)c);
         if (ret < 0)
             return ret;