[vlc-devel] [PATCH v5 12/24] video_output: merge the new filters string and the kept filter configuration

Steve Lhomme robux4 at ycbcr.xyz
Mon Aug 24 09:41:53 CEST 2020


They do the same thing and the string is always used in ThreadChangeFilters no
matter what.
---
 src/video_output/video_output.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 352006247d8..6ad052eb25a 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -175,7 +175,6 @@ typedef struct vout_thread_sys_t
         vlc_mutex_t     lock;
         bool            changed;
         bool            new_interlaced;
-        char            *new_filters;
         char            *configuration;
         video_format_t    src_fmt;
         vlc_video_context *src_vctx;
@@ -743,18 +742,18 @@ void vout_ControlChangeFilters(vout_thread_t *vout, const char *filters)
     vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
     assert(!sys->dummy);
     vlc_mutex_lock(&sys->filter.lock);
-    if (sys->filter.new_filters)
+    if (sys->filter.configuration)
     {
-        if (filters == NULL || strcmp(sys->filter.new_filters, filters))
+        if (filters == NULL || strcmp(sys->filter.configuration, filters))
         {
-            free(sys->filter.new_filters);
-            sys->filter.new_filters = filters ? strdup(filters) : NULL;
+            free(sys->filter.configuration);
+            sys->filter.configuration = filters ? strdup(filters) : NULL;
             sys->filter.changed = true;
         }
     }
     else if (filters != NULL)
     {
-        sys->filter.new_filters = strdup(filters);
+        sys->filter.configuration = strdup(filters);
         sys->filter.changed = true;
     }
     vlc_mutex_unlock(&sys->filter.lock);
@@ -921,7 +920,6 @@ typedef struct {
 } vout_filter_t;
 
 static void ThreadChangeFilters(vout_thread_sys_t *vout,
-                                const char *filters,
                                 const bool *new_deinterlace)
 {
     vout_thread_sys_t *sys = vout;
@@ -948,8 +946,7 @@ static void ThreadChangeFilters(vout_thread_sys_t *vout,
         }
     }
 
-    if (filters == NULL) filters = sys->filter.configuration;
-    char *current = filters ? strdup(filters) : NULL;
+    char *current = sys->filter.configuration ? strdup(sys->filter.configuration) : NULL;
     while (current) {
         config_chain_t *cfg;
         char *name;
@@ -1031,11 +1028,6 @@ static void ThreadChangeFilters(vout_thread_sys_t *vout,
 
     es_format_Clean(&fmt_target);
 
-    if (sys->filter.configuration != filters) {
-        free(sys->filter.configuration);
-        sys->filter.configuration = filters ? strdup(filters) : NULL;
-    }
-
     sys->filter.changed = false;
 }
 
@@ -1104,7 +1096,7 @@ static int ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reuse,
                         vlc_video_context_Release(sys->filter.src_vctx);
                     sys->filter.src_vctx = pic_vctx ? vlc_video_context_Hold(pic_vctx) : NULL;
 
-                    ThreadChangeFilters(vout, NULL, NULL);
+                    ThreadChangeFilters(vout, NULL);
                 }
             }
         }
@@ -1453,7 +1445,7 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
     if (sys->filter.changed ||
         sys->private.interlacing.has_deint != sys->filter.new_interlaced)
     {
-        ThreadChangeFilters(vout, sys->filter.new_filters, &sys->filter.new_interlaced);
+        ThreadChangeFilters(vout, &sys->filter.new_interlaced);
     }
     vlc_mutex_unlock(&sys->filter.lock);
 
-- 
2.26.2



More information about the vlc-devel mailing list