0015-Users-will-be-able-to-change-the-deinterlace-mode-wi.patch 3.3 KB
Newer Older
Soomin Lee's avatar
Soomin Lee committed
1
From 1109ec892424828fe9b66cd24faddabe355ab476 Mon Sep 17 00:00:00 2001
2 3
From: Luis Fernandes <zipleen@gmail.com>
Date: Wed, 9 May 2018 10:44:43 +0100
4
Subject: [PATCH 15/24] Users will be able to change the deinterlace mode
5
 without forcing it.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

---
 include/vlc/libvlc_media_player.h |  5 ++++-
 lib/video.c                       | 29 ++++++++++++-----------------
 2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 20b220448b..cbb5ec251a 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1419,9 +1419,12 @@ 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 deinterlace mode -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,
+                                                  int deinterlace,
                                                   const char *psz_mode );
28
 
29 30 31 32 33 34 35
 /**
diff --git a/lib/video.c b/lib/video.c
index a3e5b248e9..9bc0f634f5 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -663,14 +663,15 @@ end:
 }
36
 
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
 /******************************************************************************
- * 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 (psz_mode == NULL)
-        psz_mode = "";
-    if (*psz_mode
+    if (deinterlace != 0 && deinterlace != 1)
+        deinterlace = -1;
+
+    if (psz_mode
      && strcmp (psz_mode, "blend")    && strcmp (psz_mode, "bob")
      && strcmp (psz_mode, "discard")  && strcmp (psz_mode, "linear")
      && strcmp (psz_mode, "mean")     && strcmp (psz_mode, "x")
@@ -679,13 +680,10 @@ void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
      && strcmp (psz_mode, "auto"))
         return;
58
 
59 60 61 62 63 64 65 66 67 68
-    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);
69
 
70 71 72 73 74
     size_t n;
     vout_thread_t **pp_vouts = GetVouts (p_mi, &n);
@@ -693,13 +691,10 @@ void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
     {
         vout_thread_t *p_vout = pp_vouts[i];
75
 
76 77 78 79 80 81 82 83 84 85 86 87 88
-        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);
89 90
-- 
2.19.1
91