[vlc-commits] vlc_input_item: fix unknown duration value

Steve Lhomme git at videolan.org
Sat May 5 18:10:15 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri May  4 10:00:58 2018 +0200| [cdf1e006273d0c902f7ac5b6e3a0ac16cef59dc0] | committer: Rémi Denis-Courmont

vlc_input_item: fix unknown duration value

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 include/vlc_input_item.h | 6 +++---
 src/input/item.c         | 4 ++--
 src/playlist/item.c      | 2 +-
 src/playlist/tree.c      | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 62a81d31de..cb6a9b61a1 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -331,10 +331,10 @@ VLC_API input_item_t * input_item_NewExt( const char *psz_uri,
                                           enum input_item_net_type i_net ) VLC_USED;
 
 #define input_item_New( psz_uri, psz_name ) \
-    input_item_NewExt( psz_uri, psz_name, -1, ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN )
+    input_item_NewExt( psz_uri, psz_name, VLC_TS_INVALID, ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN )
 
 #define input_item_NewCard( psz_uri, psz_name ) \
-    input_item_NewExt( psz_uri, psz_name, -1, ITEM_TYPE_CARD, ITEM_LOCAL )
+    input_item_NewExt( psz_uri, psz_name, VLC_TS_INVALID, ITEM_TYPE_CARD, ITEM_LOCAL )
 
 #define input_item_NewDisc( psz_uri, psz_name, i_duration ) \
     input_item_NewExt( psz_uri, psz_name, i_duration, ITEM_TYPE_DISC, ITEM_LOCAL )
@@ -343,7 +343,7 @@ VLC_API input_item_t * input_item_NewExt( const char *psz_uri,
     input_item_NewExt( psz_uri, psz_name, i_duration, ITEM_TYPE_STREAM, ITEM_NET )
 
 #define input_item_NewDirectory( psz_uri, psz_name, i_net ) \
-    input_item_NewExt( psz_uri, psz_name, -1, ITEM_TYPE_DIRECTORY, i_net )
+    input_item_NewExt( psz_uri, psz_name, VLC_TS_INVALID, ITEM_TYPE_DIRECTORY, i_net )
 
 #define input_item_NewFile( psz_uri, psz_name, i_duration, i_net ) \
     input_item_NewExt( psz_uri, psz_name, i_duration, ITEM_TYPE_FILE, i_net )
diff --git a/src/input/item.c b/src/input/item.c
index 8ad8a01f7c..05b7ea11cb 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1664,7 +1664,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, -1,
+                input_item_NewExt("vlc://nop", psz_subpathname, VLC_TS_INVALID,
                                   ITEM_TYPE_DIRECTORY, i_net);
             if (p_item == NULL)
             {
@@ -1804,7 +1804,7 @@ int vlc_readdir_helper_additem(struct vlc_readdir_helper *p_rdh,
             return i_ret;
     }
 
-    input_item_t *p_item = input_item_NewExt(psz_uri, psz_filename, -1, i_type,
+    input_item_t *p_item = input_item_NewExt(psz_uri, psz_filename, VLC_TS_INVALID, i_type,
                                              i_net);
     if (p_item == NULL)
         return VLC_ENOMEM;
diff --git a/src/playlist/item.c b/src/playlist/item.c
index d2e98ff195..deaedfe1e6 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -717,7 +717,7 @@ void playlist_SendAddNotify( playlist_t *p_playlist, playlist_item_t *item )
 mtime_t playlist_GetNodeDuration( playlist_item_t* node )
 {
     mtime_t duration = input_item_GetDuration( node->p_input );
-    if( duration == -1 )
+    if( duration == VLC_TS_INVALID )
         duration = 0;
 
     for( int i = 0; i < node->i_children; i++ )
diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index 32d67acebb..d642ce4bde 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, -1, ITEM_TYPE_NODE,
+    p_new_input = input_item_NewExt( NULL, psz_name, VLC_TS_INVALID, ITEM_TYPE_NODE,
                                      ITEM_NET_UNKNOWN );
     if( !p_new_input )
         return NULL;



More information about the vlc-commits mailing list