[vlc-devel] [PATCH 5/9] modules: make use of the special duration value INPUT_DURATION_UNKNOWN
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jul 6 15:01:31 CEST 2018
Instead of a hardcoded value (which is not VLC_TICK_INVALID)
---
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/udev.c | 2 +-
modules/services_discovery/xcb_apps.c | 2 +-
7 files changed, 7 insertions(+), 7 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 2de4083914..e81cd3a9d6 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/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/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);
--
2.17.0
More information about the vlc-devel
mailing list