[vlc-commits] modules: make use of the special duration value INPUT_DURATION_UNKNOWN

Steve Lhomme git at videolan.org
Sat Jul 7 10:17:11 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Sat Jun 23 09:11:21 2018 +0200| [51cb7df9ede60da180724a5fca09984aa1400127] | committer: Steve Lhomme

modules: make use of the special duration value INPUT_DURATION_UNKNOWN

Instead of a hardcoded value (which is not VLC_TICK_INVALID)

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

 modules/control/oldrc.c               | 2 +-
 modules/demux/playlist/m3u.c          | 2 +-
 modules/demux/playlist/podcast.c      | 2 +-
 modules/lua/libs/sd.c                 | 2 +-
 modules/lua/vlc.c                     | 2 +-
 modules/services_discovery/os2drive.c | 2 +-
 modules/services_discovery/sap.c      | 2 +-
 modules/services_discovery/udev.c     | 2 +-
 modules/services_discovery/upnp.cpp   | 2 +-
 modules/services_discovery/windrive.c | 2 +-
 modules/services_discovery/xcb_apps.c | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 3cdbf8f04e..5ce7764205 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 != -1 )
+        if( p_item->pp_children[i]->p_input->i_duration != INPUT_DURATION_UNKNOWN )
         {
             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 e58bcb7121..ffc534d7a5 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 = -1;
+    vlc_tick_t i_duration = INPUT_DURATION_UNKNOWN;
     const char**ppsz_options = NULL;
     char *    (*pf_dup) (const char *) = p_demux->p_sys;
     int        i_options = 0;
diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c
index 8dc47c3721..200a1d0b8c 100644
--- a/modules/demux/playlist/podcast.c
+++ b/modules/demux/playlist/podcast.c
@@ -385,6 +385,6 @@ static vlc_tick_t strTimeToMTime( const char *psz )
     case 2:
         return (vlc_tick_t)( h*60 + m ) * CLOCK_FREQ;
     default:
-        return -1;
+        return INPUT_DURATION_UNKNOWN;
     }
 }
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index e0e3f91f8a..f72dadc246 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, -1,
+    input_item_t *p_input = input_item_NewExt( "vlc://nop", psz_name, INPUT_DURATION_UNKNOWN,
                                                ITEM_TYPE_NODE,
                                                ITEM_NET_UNKNOWN );
     lua_pop( L, 1 );
diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index 6caec54d3c..802c58153c 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 = -1;
+    vlc_tick_t duration = INPUT_DURATION_UNKNOWN;
 
     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 36343607b9..78e2e4743f 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, -1);
+            item = input_item_NewDisc (mrl, name, INPUT_DURATION_UNKNOWN);
             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 04d3e67d5d..e58647d5ad 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -855,7 +855,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,
-                                    -1 );
+                                    INPUT_DURATION_UNKNOWN );
     if( unlikely(p_input == NULL) )
     {
         free( p_sap );
diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index d297f4708d..e4e9221fa6 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -168,7 +168,7 @@ 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, -1,
+    input_item_t *item = input_item_NewExt (mrl, name ? name : mrl, INPUT_DURATION_UNKNOWN,
                                             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 c5e51c3b1b..0646b375f5 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -861,7 +861,7 @@ namespace
 
         input_item_t *createNewItem(IXML_Element *p_resource)
         {
-            vlc_tick_t i_duration = -1;
+            vlc_tick_t i_duration = INPUT_DURATION_UNKNOWN;
             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 922d497548..447984e480 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, -1);
+        item = input_item_NewDisc (mrl, name, INPUT_DURATION_UNKNOWN);
         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 659df39384..7c40817c1c 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"), -1,
+    p_sys->apps_root = input_item_NewExt("vlc://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);



More information about the vlc-commits mailing list