]> git.sesse.net Git - vlc/blobdiff - src/video_output/interlacing.c
configure: fix -ldl detection with the ThreadSanitizer
[vlc] / src / video_output / interlacing.c
index f85632615906b27270650cab6f509483c5f08cb0..13ec36febca165567f2e1b377b8f33361592a623 100644 (file)
@@ -6,19 +6,19 @@
  *
  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -38,7 +38,7 @@
  * You can use the non vout filter if and only if the video properties stay the
  * same (width/height/chroma/fps), at least for now.
  */
-static const char *deinterlace_modes[] = {
+static const char deinterlace_modes[][9]= {
     ""
     "discard",
     "blend",
@@ -50,11 +50,11 @@ static const char *deinterlace_modes[] = {
     "yadif2x",
     "phosphor",
     "ivtc",
-    NULL
 };
+
 static bool DeinterlaceIsModeValid(const char *mode)
 {
-    for (unsigned i = 0; deinterlace_modes[i]; i++) {
+    for (unsigned i = 0; i < ARRAY_SIZE(deinterlace_modes); i++) {
         if (!strcmp(deinterlace_modes[i], mode))
             return true;
     }
@@ -182,11 +182,12 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, bool is_interlaced)
 
     const module_config_t *optd = config_FindConfig(VLC_OBJECT(vout), "deinterlace");
     var_Change(vout, "deinterlace", VLC_VAR_CLEARCHOICES, NULL, NULL);
-    for (int i = 0; optd && i < optd->i_list; i++) {
-        val.i_int  = optd->pi_list[i];
-        text.psz_string = (char*)vlc_gettext(optd->ppsz_list_text[i]);
-        var_Change(vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text);
-    }
+    if (likely(optd != NULL))
+        for (unsigned i = 0; i < optd->list_count; i++) {
+            val.i_int = optd->list.i[i];
+            text.psz_string = vlc_gettext(optd->list_text[i]);
+            var_Change(vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text);
+        }
     var_AddCallback(vout, "deinterlace", DeinterlaceCallback, NULL);
     /* */
     var_Create(vout, "deinterlace-mode", VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_HASCHOICE);
@@ -197,14 +198,16 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, bool is_interlaced)
 
     const module_config_t *optm = config_FindConfig(VLC_OBJECT(vout), "deinterlace-mode");
     var_Change(vout, "deinterlace-mode", VLC_VAR_CLEARCHOICES, NULL, NULL);
-    for (int i = 0; optm && i < optm->i_list; i++) {
-        if (!DeinterlaceIsModeValid(optm->ppsz_list[i]))
-            continue;
-
-        val.psz_string  = optm->ppsz_list[i];
-        text.psz_string = (char*)vlc_gettext(optm->ppsz_list_text[i]);
-        var_Change(vout, "deinterlace-mode", VLC_VAR_ADDCHOICE, &val, &text);
-    }
+    if (likely(optm != NULL))
+        for (unsigned i = 0; i < optm->list_count; i++) {
+             if (!DeinterlaceIsModeValid(optm->list.psz[i]))
+                 continue;
+
+             val.psz_string  = optm->list.psz[i];
+             text.psz_string = vlc_gettext(optm->list_text[i]);
+             var_Change(vout, "deinterlace-mode", VLC_VAR_ADDCHOICE,
+                        &val, &text);
+         }
     var_AddCallback(vout, "deinterlace-mode", DeinterlaceCallback, NULL);
     /* */
     var_Create(vout, "deinterlace-needed", VLC_VAR_BOOL);