diff mbox series

[FFmpeg-devel,4/4] avfiler/framesync: Remove redundant setting of AVClass

Message ID AM7PR03MB66604816475E9F9EB6E9D7CA8FDF9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Headers show
Series [FFmpeg-devel,1/4] avfilter/framesync: Separate framesync AVClass and auxiliary functions
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. 19, 2021, 4:46 a.m. UTC
Every filter exposing the framesync options via its child_next
callback already calls framesync_preinit() in its preinit callback.
So the filter is already preinited whenever its child_next is called.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/framesync.c | 5 -----
 libavfilter/framesync.h | 9 +++------
 2 files changed, 3 insertions(+), 11 deletions(-)

Comments

Nicolas George Sept. 23, 2021, 8:33 a.m. UTC | #1
Andreas Rheinhardt (12021-09-19):
> Every filter exposing the framesync options via its child_next
> callback already calls framesync_preinit() in its preinit callback.
> So the filter is already preinited whenever its child_next is called.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavfilter/framesync.c | 5 -----
>  libavfilter/framesync.h | 9 +++------
>  2 files changed, 3 insertions(+), 11 deletions(-)

That looks like a good change and you understand the logic of child
contexts better than me, so ok to both.

Regards,
diff mbox series

Patch

diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
index bc6fce81f4..7510550d8e 100644
--- a/libavfilter/framesync.c
+++ b/libavfilter/framesync.c
@@ -68,11 +68,6 @@  enum {
 
 static int consume_from_fifos(FFFrameSync *fs);
 
-const AVClass *ff_framesync_get_class(void)
-{
-    return &framesync_class;
-}
-
 void ff_framesync_preinit(FFFrameSync *fs)
 {
     if (fs->class)
diff --git a/libavfilter/framesync.h b/libavfilter/framesync.h
index 8436aba23b..c0a9d3e969 100644
--- a/libavfilter/framesync.h
+++ b/libavfilter/framesync.h
@@ -208,11 +208,6 @@  typedef struct FFFrameSync {
 
 } FFFrameSync;
 
-/**
- * Get the class for the framesync object.
- */
-const AVClass *ff_framesync_get_class(void);
-
 /**
  * Pre-initialize a frame sync structure.
  *
@@ -310,6 +305,9 @@  static const AVClass name##_class = {                                 \
     .child_next          = func_prefix##_child_next,                  \
 }
 
+/* A filter that uses the *_child_next-function from this macro
+ * is required to initialize the FFFrameSync structure in AVFilter.preinit
+ * via the *_framesync_preinit function defined alongside it. */
 #define FRAMESYNC_AUXILIARY_FUNCS(func_prefix, context, field)        \
 static int func_prefix##_framesync_preinit(AVFilterContext *ctx) {    \
     context *s = ctx->priv; \
@@ -318,7 +316,6 @@  static int func_prefix##_framesync_preinit(AVFilterContext *ctx) {    \
 } \
 static void *func_prefix##_child_next(void *obj, void *prev) {        \
     context *s = obj; \
-    s->fs.class = ff_framesync_get_class(); /* FIXME */ \
     return prev ? NULL : &s->field; \
 }