[vlc-commits] libvlc: change set_deinterlace function

Luis Fernandes git at videolan.org
Wed May 9 09:39:52 CEST 2018


vlc | branch: master | Luis Fernandes <zipleen at gmail.com> | Sat May  5 17:34:14 2018 +0100| [4dc621ab66545b99f84f2af7dd8fc951c8c6d4c2] | committer: Thomas Guillem

libvlc: change set_deinterlace function

Users will be able to change the deinterlace mode without forcing it.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 include/vlc/libvlc_media_player.h |  7 +++++--
 lib/video.c                       | 26 ++++++++++++--------------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 7348728d9e..9ef1ddec24 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1406,10 +1406,13 @@ int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
  * Enable or disable deinterlace filter
  *
  * \param p_mi libvlc media player
- * \param psz_mode type of deinterlace filter, NULL to disable
+ * \param deinterlace state -1: auto (default), 0: disabled, 1: enabled
+ * \param psz_mode type of deinterlace filter, NULL for current/default filter
+ * \version LibVLC 4.0.0 and later
  */
 LIBVLC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
-                                                  const char *psz_mode );
+                                              int deinterlace,
+                                              const char *psz_mode );
 
 /**
  * Get an integer marquee option value
diff --git a/lib/video.c b/lib/video.c
index 536555c436..53b5de49db 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -592,13 +592,17 @@ end:
 }
 
 /******************************************************************************
- * libvlc_video_set_deinterlace : enable deinterlace
+ * libvlc_video_set_deinterlace : enable/disable/auto deinterlace and filter
  *****************************************************************************/
-void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
+void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi, int deinterlace,
                                    const char *psz_mode )
 {
+    if (deinterlace != 0 && deinterlace != 1)
+        deinterlace = -1;
+
     if (psz_mode == NULL)
         psz_mode = "";
+
     if (*psz_mode
      && strcmp (psz_mode, "blend")    && strcmp (psz_mode, "bob")
      && strcmp (psz_mode, "discard")  && strcmp (psz_mode, "linear")
@@ -608,13 +612,10 @@ void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
      && strcmp (psz_mode, "auto"))
         return;
 
-    if (*psz_mode)
-    {
+    if (*psz_mode && deinterlace != 0)
         var_SetString (p_mi, "deinterlace-mode", psz_mode);
-        var_SetInteger (p_mi, "deinterlace", 1);
-    }
-    else
-        var_SetInteger (p_mi, "deinterlace", 0);
+
+    var_SetInteger (p_mi, "deinterlace", deinterlace);
 
     size_t n;
     vout_thread_t **pp_vouts = GetVouts (p_mi, &n);
@@ -622,13 +623,10 @@ void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
     {
         vout_thread_t *p_vout = pp_vouts[i];
 
-        if (*psz_mode)
-        {
+        if (*psz_mode && deinterlace != 0)
             var_SetString (p_vout, "deinterlace-mode", psz_mode);
-            var_SetInteger (p_vout, "deinterlace", 1);
-        }
-        else
-            var_SetInteger (p_vout, "deinterlace", 0);
+
+        var_SetInteger (p_vout, "deinterlace", deinterlace);
         vlc_object_release (p_vout);
     }
     free (pp_vouts);



More information about the vlc-commits mailing list