[vlc-devel] [PATCH v4 10/23] video_output: merge the new filters string and the kept filter configuration

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 21 11:59:28 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 245e22251b6..60bfbd7759e 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -174,7 +174,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;
@@ -751,18 +750,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);
@@ -929,7 +928,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;
@@ -956,8 +954,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;
@@ -1039,11 +1036,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;
 }
 
@@ -1112,7 +1104,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);
                 }
             }
         }
@@ -1461,7 +1453,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