[vlc-commits] input: item: do NOT preparse unknown access (fix #16823)

Francois Cartegnie git at videolan.org
Thu Apr 14 10:34:56 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Apr 13 21:46:48 2016 +0200| [c315367c34f709621f711808acfa362741b3f663] | committer: Francois Cartegnie

input: item: do NOT preparse unknown access (fix #16823)

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

 src/input/item.c         |   27 ++++++++++++++++-----------
 src/playlist/preparser.c |    1 +
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/input/item.c b/src/input/item.c
index 937ed91..dc42eba 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1085,6 +1085,7 @@ static int GuessType( const input_item_t *p_item, bool *p_net )
         { "sftp",   ITEM_TYPE_FILE, true },
         { "shm",    ITEM_TYPE_CARD, false },
         { "smb",    ITEM_TYPE_FILE, true },
+        { "stream", ITEM_TYPE_STREAM, false },
         { "svcd",   ITEM_TYPE_DISC, false },
         { "tcp",    ITEM_TYPE_STREAM, true },
         { "terres", ITEM_TYPE_CARD, false }, /* terrestrial */
@@ -1095,22 +1096,26 @@ static int GuessType( const input_item_t *p_item, bool *p_net )
         { "vcd",    ITEM_TYPE_DISC, false },
         { "window", ITEM_TYPE_CARD, false },
     };
-    const struct item_type_entry *e;
+    int i_item_type = ITEM_TYPE_UNKNOWN;
+    *p_net = false;
 
     if( !strstr( p_item->psz_uri, "://" ) )
-        return ITEM_TYPE_FILE;
-
-    e = bsearch( p_item->psz_uri, tab, sizeof( tab ) / sizeof( tab[0] ),
-                 sizeof( tab[0] ), typecmp );
-    if( e )
     {
-        *p_net = e->b_net;
-        return e->i_type;
-    } else
+        i_item_type = ITEM_TYPE_FILE;
+    }
+    else
     {
-        *p_net = false;
-        return ITEM_TYPE_FILE;
+        const struct item_type_entry *e =
+            bsearch( p_item->psz_uri, tab, sizeof( tab ) / sizeof( tab[0] ),
+                     sizeof( tab[0] ), typecmp );
+        if( e )
+        {
+            *p_net = e->b_net;
+            i_item_type = e->i_type;
+        }
     }
+
+    return i_item_type;
 }
 
 input_item_node_t *input_item_node_Create( input_item_t *p_input )
diff --git a/src/playlist/preparser.c b/src/playlist/preparser.c
index 2870875..f333026 100644
--- a/src/playlist/preparser.c
+++ b/src/playlist/preparser.c
@@ -171,6 +171,7 @@ static void Preparse( playlist_preparser_t *preparser, input_item_t *p_item,
 
     bool b_preparse = false;
     switch (i_type) {
+    case ITEM_TYPE_STREAM:
     case ITEM_TYPE_FILE:
     case ITEM_TYPE_DIRECTORY:
     case ITEM_TYPE_PLAYLIST:



More information about the vlc-commits mailing list