[vlc-commits] video_output: get rid of the internal "deinterlace-needed" variable

Steve Lhomme git at videolan.org
Fri Nov 13 16:52:53 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov  6 15:00:00 2020 +0100| [3d0e4ebb14b1eb4e572cc680815209c507dd6ded] | committer: Steve Lhomme

video_output: get rid of the internal "deinterlace-needed" variable

We can do the same as the callback manually, when we the the value.

The value was always equal to sys->interlacing.is_interlaced.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3d0e4ebb14b1eb4e572cc680815209c507dd6ded
---

 src/video_output/interlacing.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/video_output/interlacing.c b/src/video_output/interlacing.c
index 438bc97555..406891d877 100644
--- a/src/video_output/interlacing.c
+++ b/src/video_output/interlacing.c
@@ -66,16 +66,12 @@ static inline vout_thread_interlacing_t *vout_to_interlacing(vout_thread_t *vout
     return &container_of(vout, vout_sys_t, obj)->interlacing;
 }
 
-static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
-                               vlc_value_t oldval, vlc_value_t newval, void *data)
+static int ChangeInterlacing(vout_thread_t *vout)
 {
-    VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(newval); VLC_UNUSED(data);
-    vout_thread_t *vout = (vout_thread_t *)object;
-
-    /* */
+    vout_thread_interlacing_t *sys = vout_to_interlacing(vout);
     const int  deinterlace_state = var_GetInteger(vout, "deinterlace");
     char       *mode             = var_GetString(vout,  "deinterlace-mode");
-    const bool is_needed         = var_GetBool(vout,    "deinterlace-needed");
+    const bool is_needed         = sys->is_interlaced;
     if (!mode || !DeinterlaceIsModeValid(mode))
     {
         free(mode);
@@ -95,6 +91,16 @@ static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
     return VLC_SUCCESS;
 }
 
+static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
+                               vlc_value_t oldval, vlc_value_t newval, void *data)
+{
+    VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(newval); VLC_UNUSED(data);
+    vout_thread_t *vout = (vout_thread_t *)object;
+
+    /* */
+    return ChangeInterlacing(vout);
+}
+
 void vout_InitInterlacingSupport(vout_thread_t *vout)
 {
     vout_thread_interlacing_t *sys = vout_to_interlacing(vout);
@@ -139,9 +145,6 @@ void vout_InitInterlacingSupport(vout_thread_t *vout)
                         val, vlc_gettext(optm->list_text[i]));
          }
     var_AddCallback(vout, "deinterlace-mode", DeinterlaceCallback, NULL);
-    /* */
-    var_Create(vout, "deinterlace-needed", VLC_VAR_BOOL);
-    var_AddCallback(vout, "deinterlace-needed", DeinterlaceCallback, NULL);
 
     /* Override the initial value from filters if present */
     char *filter_mode = NULL;
@@ -167,7 +170,7 @@ void vout_ReinitInterlacingSupport(vout_thread_t *vout)
 {
     vout_thread_interlacing_t *sys = vout_to_interlacing(vout);
     sys->is_interlaced = false;
-    var_SetBool(vout, "deinterlace-needed", false);
+    ChangeInterlacing(vout);
 }
 
 void vout_SetInterlacingState(vout_thread_t *vout, bool is_interlaced)
@@ -182,8 +185,8 @@ void vout_SetInterlacingState(vout_thread_t *vout, bool is_interlaced)
     {
         msg_Dbg(vout, "Detected %s video",
                  is_interlaced ? "interlaced" : "progressive");
-        var_SetBool(vout, "deinterlace-needed", is_interlaced);
         sys->is_interlaced = is_interlaced;
+        ChangeInterlacing(vout);
     }
     if (is_interlaced)
         sys->date = vlc_tick_now();



More information about the vlc-commits mailing list