[vlc-commits] input:item: use a define for vlc://nop

Steve Lhomme git at videolan.org
Thu Jul 26 10:00:40 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jul 26 07:22:58 2018 +0200| [887b2e0a785f0d54f683c57fbf0e89f710c671c9] | committer: Steve Lhomme

input:item: use a define for vlc://nop

So we can document what it means

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

 include/vlc_input_item.h              | 2 ++
 lib/media.c                           | 2 +-
 modules/demux/playlist/xspf.c         | 4 ++--
 modules/lua/libs/sd.c                 | 2 +-
 modules/services_discovery/xcb_apps.c | 2 +-
 src/input/item.c                      | 2 +-
 6 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index ae55453499..219e7d268c 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -122,6 +122,8 @@ struct input_item_t
                                           preparsing.*/
 };
 
+#define INPUT_ITEM_URI_NOP "vlc://nop" /* dummy URI for node/directory items */
+
 #define INPUT_DURATION_INVALID   VLC_TICK_INVALID
 #define INPUT_DURATION_ZERO      0
 #define INPUT_DURATION_UNKNOWN   (-1)
diff --git a/lib/media.c b/lib/media.c
index 0b121d06b3..5ffa91b47d 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -503,7 +503,7 @@ libvlc_media_t * libvlc_media_new_as_node( libvlc_instance_t *p_instance,
     libvlc_media_t * p_md;
     libvlc_media_list_t * p_subitems;
 
-    p_input_item = input_item_New( "vlc://nop", psz_name );
+    p_input_item = input_item_New( INPUT_ITEM_URI_NOP, psz_name );
 
     if (!p_input_item)
     {
diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index 19270291b5..7370971042 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -449,7 +449,7 @@ static bool parse_track_node COMPLEX_INTERFACE
         /* Make sure we have a URI */
         char *psz_uri = input_item_GetURI(p_new_input);
         if (!psz_uri)
-            input_item_SetURI(p_new_input, "vlc://nop");
+            input_item_SetURI(p_new_input, INPUT_ITEM_URI_NOP);
         else
             free(psz_uri);
 
@@ -602,7 +602,7 @@ static bool parse_vlcnode_node COMPLEX_INTERFACE
         return false;
     }
     input_item_t *p_new_input =
-        input_item_NewDirectory("vlc://nop", psz_title, ITEM_NET_UNKNOWN);
+        input_item_NewDirectory(INPUT_ITEM_URI_NOP, psz_title, ITEM_NET_UNKNOWN);
     free(psz_title);
     if (p_new_input)
     {
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index f72dadc246..2c971768d1 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -295,7 +295,7 @@ static input_item_t *vlclua_sd_create_node( services_discovery_t *p_sd,
     }
 
     const char *psz_name = lua_tostring( L, -1 );
-    input_item_t *p_input = input_item_NewExt( "vlc://nop", psz_name, INPUT_DURATION_UNKNOWN,
+    input_item_t *p_input = input_item_NewExt( INPUT_ITEM_URI_NOP, psz_name, INPUT_DURATION_UNKNOWN,
                                                ITEM_TYPE_NODE,
                                                ITEM_NET_UNKNOWN );
     lua_pop( L, 1 );
diff --git a/modules/services_discovery/xcb_apps.c b/modules/services_discovery/xcb_apps.c
index 7c40817c1c..649835b388 100644
--- a/modules/services_discovery/xcb_apps.c
+++ b/modules/services_discovery/xcb_apps.c
@@ -164,7 +164,7 @@ static int Open (vlc_object_t *obj)
     }
 
     p_sys->apps = NULL;
-    p_sys->apps_root = input_item_NewExt("vlc://nop", _("Applications"), INPUT_DURATION_UNKNOWN,
+    p_sys->apps_root = input_item_NewExt(INPUT_ITEM_URI_NOP, _("Applications"), INPUT_DURATION_UNKNOWN,
                                          ITEM_TYPE_NODE, ITEM_LOCAL);
     if (likely(p_sys->apps_root != NULL))
         services_discovery_AddItem(sd, p_sys->apps_root);
diff --git a/src/input/item.c b/src/input/item.c
index 5d8c023ee9..12baf470e8 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1666,7 +1666,7 @@ static int rdh_unflatten(struct vlc_readdir_helper *p_rdh,
                 psz_subpathname = p_rdh_dir->psz_path;
 
             input_item_t *p_item =
-                input_item_NewExt("vlc://nop", psz_subpathname, INPUT_DURATION_INVALID,
+                input_item_NewExt(INPUT_ITEM_URI_NOP, psz_subpathname, INPUT_DURATION_INVALID,
                                   ITEM_TYPE_DIRECTORY, i_net);
             if (p_item == NULL)
             {



More information about the vlc-commits mailing list