[vlc-commits] Reworked the way avformat input are blacklisted.

Laurent Aimar git at videolan.org
Thu Dec 15 23:30:24 CET 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Dec 15 22:14:16 2011 +0100| [0ddd6effdc4668eff50d178c8976de4417e17206] | committer: Laurent Aimar

Reworked the way avformat input are blacklisted.

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

 modules/demux/avformat/demux.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index f35d0e5..739ac2a 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -139,18 +139,24 @@ int OpenDemux( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    /* Don't try to handle MPEG unless forced */
-    if( !p_demux->b_force &&
-        ( !strcmp( fmt->name, "mpeg" ) ||
-          !strcmp( fmt->name, "vcd" ) ||
-          !strcmp( fmt->name, "vob" ) ||
-          !strcmp( fmt->name, "mpegts" ) ||
-          /* libavformat's redirector won't work */
-          !strcmp( fmt->name, "redir" ) ||
-          !strcmp( fmt->name, "sdp" ) ) )
+    if( !p_demux->b_force )
     {
-        free( psz_url );
-        return VLC_EGENERIC;
+        static const char ppsz_blacklist[][16] = {
+            /* Don't handle MPEG unless forced */
+            "mpeg", "vcd", "vob", "mpegts",
+            /* libavformat's redirector won't work */
+            "redir", "sdp",
+            ""
+        };
+
+        for( int i = 0; *ppsz_blacklist[i]; i++ )
+        {
+            if( !strcmp( fmt->name, ppsz_blacklist[i] ) )
+            {
+                free( psz_url );
+                return VLC_EGENERIC;
+            }
+        }
     }
 
     /* Don't trigger false alarms on bin files */



More information about the vlc-commits mailing list