[vlc-devel] [PATCH 2/5] modules: make use of the special duration value INPUT_UNKNOWN_DURATION

Rémi Denis-Courmont remi at remlab.net
Sat Jun 23 09:53:31 CEST 2018


The duration of vlc://nop is *not* unknown. It's zero.

Le 23 juin 2018 08:26:14 GMT+01:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>Instead of a hardcoded value (which is not VLC_TS_INVALID)
>---
> modules/control/oldrc.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 +-
> src/playlist/tree.c                   | 2 +-
> 6 files changed, 6 insertions(+), 6 deletions(-)
>
>diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
>index 2c9c2728e33..62eeb2061c5 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_UNKNOWN_DURATION )
>         {
>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/lua/libs/sd.c b/modules/lua/libs/sd.c
>index e0e3f91f8a8..72238186c09 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_UNKNOWN_DURATION,
>                                                ITEM_TYPE_NODE,
>                                                ITEM_NET_UNKNOWN );
>     lua_pop( L, 1 );
>diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
>index 65631558e64..5dd68cead15 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_UNKNOWN_DURATION;
> 
>     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 d297f4708da..504f1f503e6 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_UNKNOWN_DURATION,
>                                 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 659df39384b..570ea98e034 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_UNKNOWN_DURATION,
>                                          ITEM_TYPE_NODE, ITEM_LOCAL);
>     if (likely(p_sys->apps_root != NULL))
>         services_discovery_AddItem(sd, p_sys->apps_root);
>diff --git a/src/playlist/tree.c b/src/playlist/tree.c
>index d642ce4bde2..158661440e6 100644
>--- a/src/playlist/tree.c
>+++ b/src/playlist/tree.c
>@@ -66,7 +66,7 @@ playlist_item_t * playlist_NodeCreate( playlist_t
>*p_playlist,
>     PL_ASSERT_LOCKED;
>     if( !psz_name ) psz_name = _("Undefined");
> 
>-    p_new_input = input_item_NewExt( NULL, psz_name, VLC_TS_INVALID,
>ITEM_TYPE_NODE,
>+    p_new_input = input_item_NewExt( NULL, psz_name,
>INPUT_UNKNOWN_DURATION, ITEM_TYPE_NODE,
>                                      ITEM_NET_UNKNOWN );
>     if( !p_new_input )
>         return NULL;
>-- 
>2.17.0
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180623/17a4a5d3/attachment.html>


More information about the vlc-devel mailing list