[vlc-devel] [PATCH v4 08/23] video_output: use filter lock to change deinterlacing in the vout thread

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 21 11:59:26 CEST 2020


We don't use the control lock anymore, just the filters lock.

Now the interlacing mode change is applied in frame by frame mode.

Remove related control push/clean functions.
---
 src/video_output/control.c      |  8 --------
 src/video_output/control.h      |  3 ---
 src/video_output/video_output.c | 13 +++++++------
 3 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/src/video_output/control.c b/src/video_output/control.c
index af1a714dc48..3b7fabb07e9 100644
--- a/src/video_output/control.c
+++ b/src/video_output/control.c
@@ -88,14 +88,6 @@ void vout_control_PushVoid(vout_control_t *ctrl, int type)
     vout_control_cmd_Init(&cmd, type);
     vout_control_Push(ctrl, &cmd);
 }
-void vout_control_PushBool(vout_control_t *ctrl, int type, bool boolean)
-{
-    vout_control_cmd_t cmd;
-
-    vout_control_cmd_Init(&cmd, type);
-    cmd.boolean = boolean;
-    vout_control_Push(ctrl, &cmd);
-}
 
 void vout_control_Hold(vout_control_t *ctrl)
 {
diff --git a/src/video_output/control.h b/src/video_output/control.h
index ed4613d6c14..5d84db34d13 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -28,7 +28,6 @@
 /* */
 enum {
     VOUT_CONTROL_TERMINATE,
-    VOUT_CONTROL_CHANGE_INTERLACE,      /* boolean */
 
     VOUT_CONTROL_MOUSE_STATE,           /* vlc_mouse_t */
 };
@@ -37,7 +36,6 @@ typedef struct {
     int type;
 
     union {
-        bool    boolean;
         vlc_mouse_t mouse;
     };
 } vout_control_cmd_t;
@@ -66,7 +64,6 @@ void vout_control_WaitEmpty(vout_control_t *);
 
 void vout_control_Push(vout_control_t *, vout_control_cmd_t *);
 void vout_control_PushVoid(vout_control_t *, int type);
-void vout_control_PushBool(vout_control_t *, int type, bool boolean);
 void vout_control_Wake(vout_control_t *);
 void vout_control_Hold(vout_control_t *);
 void vout_control_Release(vout_control_t *);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 43aabccac89..c9e8743496e 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -173,6 +173,7 @@ typedef struct vout_thread_sys_t
     struct {
         vlc_mutex_t     lock;
         bool            changed;
+        bool            new_interlaced;
         char            *new_filters;
         char            *configuration;
         video_format_t    src_fmt;
@@ -771,7 +772,9 @@ void vout_ControlChangeInterlacing(vout_thread_t *vout, bool set)
 {
     vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
     assert(!sys->dummy);
-    vout_control_PushBool(&sys->control, VOUT_CONTROL_CHANGE_INTERLACE, set);
+    vlc_mutex_lock(&sys->filter.lock);
+    sys->filter.new_interlaced = set;
+    vlc_mutex_unlock(&sys->filter.lock);
 }
 
 void vout_ControlChangeSubSources(vout_thread_t *vout, const char *filters)
@@ -1462,9 +1465,10 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
     assert(sys->clock);
 
     vlc_mutex_lock(&sys->filter.lock);
-    if (sys->filter.changed)
+    if (sys->filter.changed ||
+        sys->private.interlacing.has_deint != sys->filter.new_interlaced)
     {
-        ThreadChangeFilters(vout, sys->filter.new_filters, NULL, true);
+        ThreadChangeFilters(vout, sys->filter.new_filters, &sys->filter.new_interlaced, true);
     }
     vlc_mutex_unlock(&sys->filter.lock);
 
@@ -1860,9 +1864,6 @@ static void *Thread(void *object)
             switch(cmd.type) {
                 case VOUT_CONTROL_TERMINATE:
                     return NULL; /* no need to clean &cmd */
-                case VOUT_CONTROL_CHANGE_INTERLACE:
-                    ThreadChangeFilters(vout, NULL, &cmd.boolean, false);
-                    break;
                 case VOUT_CONTROL_MOUSE_STATE:
                     ThreadProcessMouseState(vout, &cmd.mouse);
                     break;
-- 
2.26.2



More information about the vlc-devel mailing list