[vlc-devel] [v4 02/10] vlc_input_item: rename INPUT_DURATION_UNKNOWN to INPUT_DURATION_INDEFINITE

Steve Lhomme robux4 at ycbcr.xyz
Fri Jul 27 12:49:02 CEST 2018


For sources with no exact time limits, therefore it should not be used as such.
---
 include/vlc_input_item.h              | 2 +-
 modules/control/oldrc.c               | 2 +-
 modules/demux/playlist/m3u.c          | 2 +-
 modules/lua/libs/sd.c                 | 3 ++-
 modules/lua/vlc.c                     | 2 +-
 modules/services_discovery/os2drive.c | 2 +-
 modules/services_discovery/sap.c      | 2 +-
 modules/services_discovery/udev.c     | 3 ++-
 modules/services_discovery/upnp.cpp   | 2 +-
 modules/services_discovery/windrive.c | 2 +-
 modules/services_discovery/xcb_apps.c | 3 ++-
 11 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 130882054e..f5c9384845 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -128,7 +128,7 @@ struct input_item_t
  * it may remain the duration for items like a node/directory */
 #define INPUT_DURATION_UNSET      VLC_TICK_INVALID
 #define INPUT_DURATION_ZERO      0     /* an item with a zero duration */
-#define INPUT_DURATION_UNKNOWN   (-1)  /* an item with no duration (live/continuous source) */
+#define INPUT_DURATION_INDEFINITE (-1) /* item with a known indefinite duration (live/continuous source) */
 
 enum input_item_net_type
 {
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 7a780e868d..7f4e435ab3 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -1156,7 +1156,7 @@ static void print_playlist( intf_thread_t *p_intf, playlist_item_t *p_item, int
     char psz_buffer[MSTRTIME_MAX_SIZE];
     for( int i = 0; i< p_item->i_children; i++ )
     {
-        if( p_item->pp_children[i]->p_input->i_duration != INPUT_DURATION_UNKNOWN )
+        if( p_item->pp_children[i]->p_input->i_duration != INPUT_DURATION_INDEFINITE )
         {
             secstotimestr( psz_buffer, p_item->pp_children[i]->p_input->i_duration / CLOCK_FREQ );
             msg_rc( "|%*s- %s (%s)", 2 * i_level, "", p_item->pp_children[i]->p_input->psz_name, psz_buffer );
diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index ffc534d7a5..f949de072e 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -218,7 +218,7 @@ static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems )
     char       *psz_artist = NULL;
     char       *psz_album_art = NULL;
     int        i_parsed_duration = 0;
-    vlc_tick_t i_duration = INPUT_DURATION_UNKNOWN;
+    vlc_tick_t i_duration = INPUT_DURATION_INDEFINITE;
     const char**ppsz_options = NULL;
     char *    (*pf_dup) (const char *) = p_demux->p_sys;
     int        i_options = 0;
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index 2c971768d1..bcc6787159 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -295,7 +295,8 @@ 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( INPUT_ITEM_URI_NOP, psz_name, INPUT_DURATION_UNKNOWN,
+    input_item_t *p_input = input_item_NewExt( INPUT_ITEM_URI_NOP, psz_name,
+                                               INPUT_DURATION_INDEFINITE,
                                                ITEM_TYPE_NODE,
                                                ITEM_NET_UNKNOWN );
     lua_pop( L, 1 );
diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index 802c58153c..e6419fa234 100644
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -484,7 +484,7 @@ input_item_t *vlclua_read_input_item(vlc_object_t *obj, lua_State *L)
         msg_Warn(obj, "Playlist item name should be a string" );
 
     /* Read duration */
-    vlc_tick_t duration = INPUT_DURATION_UNKNOWN;
+    vlc_tick_t duration = INPUT_DURATION_INDEFINITE;
 
     lua_getfield( L, -3, "duration" );
     if (lua_isnumber(L, -1))
diff --git a/modules/services_discovery/os2drive.c b/modules/services_discovery/os2drive.c
index 78e2e4743f..ffc87aa539 100644
--- a/modules/services_discovery/os2drive.c
+++ b/modules/services_discovery/os2drive.c
@@ -90,7 +90,7 @@ static int Open (vlc_object_t *obj)
             letter = 'A' + drive;
 
             mrl[8] = name[0] = letter;
-            item = input_item_NewDisc (mrl, name, INPUT_DURATION_UNKNOWN);
+            item = input_item_NewDisc (mrl, name, INPUT_DURATION_INDEFINITE);
             msg_Dbg (sd, "adding %s (%s)", mrl, name);
             if (item == NULL)
                 break;
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index a3233f3b26..44b79a23af 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -850,7 +850,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint32_t *i_source,
 
     /* Released in RemoveAnnounce */
     p_input = input_item_NewStream( p_sap->p_sdp->psz_uri, p_sdp->psz_sessionname,
-                                    INPUT_DURATION_UNKNOWN );
+                                    INPUT_DURATION_INDEFINITE );
     if( unlikely(p_input == NULL) )
     {
         free( p_sap );
diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index e4e9221fa6..752b5d2cbc 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -168,7 +168,8 @@ static int AddDevice (services_discovery_t *sd, struct udev_device *dev)
     if (mrl == NULL)
         return 0; /* don't know if it was an error... */
     char *name = p_sys->subsys->get_name (dev);
-    input_item_t *item = input_item_NewExt (mrl, name ? name : mrl, INPUT_DURATION_UNKNOWN,
+    input_item_t *item = input_item_NewExt (mrl, name ? name : mrl,
+                                            INPUT_DURATION_INDEFINITE,
                                             p_sys->subsys->item_type, ITEM_LOCAL);
     msg_Dbg (sd, "adding %s (%s)", mrl, name);
     free (name);
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index e4183a1486..6e357480e8 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -864,7 +864,7 @@ namespace
 
         input_item_t *createNewItem(IXML_Element *p_resource)
         {
-            vlc_tick_t i_duration = INPUT_DURATION_UNKNOWN;
+            vlc_tick_t i_duration = INPUT_DURATION_INDEFINITE;
             const char* psz_resource_url = xml_getChildElementValue( p_resource, "res" );
             if( !psz_resource_url )
                 return NULL;
diff --git a/modules/services_discovery/windrive.c b/modules/services_discovery/windrive.c
index 447984e480..b0d2b0f83c 100644
--- a/modules/services_discovery/windrive.c
+++ b/modules/services_discovery/windrive.c
@@ -76,7 +76,7 @@ static int Open (vlc_object_t *obj)
             continue;
 
         mrl[8] = name[0] = letter;
-        item = input_item_NewDisc (mrl, name, INPUT_DURATION_UNKNOWN);
+        item = input_item_NewDisc (mrl, name, INPUT_DURATION_INDEFINITE);
         msg_Dbg (sd, "adding %s (%s)", mrl, name);
         if (item == NULL)
             break;
diff --git a/modules/services_discovery/xcb_apps.c b/modules/services_discovery/xcb_apps.c
index 649835b388..6c44797e2a 100644
--- a/modules/services_discovery/xcb_apps.c
+++ b/modules/services_discovery/xcb_apps.c
@@ -164,7 +164,8 @@ static int Open (vlc_object_t *obj)
     }
 
     p_sys->apps = NULL;
-    p_sys->apps_root = input_item_NewExt(INPUT_ITEM_URI_NOP, _("Applications"), INPUT_DURATION_UNKNOWN,
+    p_sys->apps_root = input_item_NewExt(INPUT_ITEM_URI_NOP, _("Applications"),
+                                         INPUT_DURATION_INDEFINITE,
                                          ITEM_TYPE_NODE, ITEM_LOCAL);
     if (likely(p_sys->apps_root != NULL))
         services_discovery_AddItem(sd, p_sys->apps_root);
-- 
2.17.0



More information about the vlc-devel mailing list