[vlc-devel] [v4 01/10] vlc_input_item: rename INPUT_DURATION_INVALID to INPUT_DURATION_UNSET
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jul 27 12:49:01 CEST 2018
A duration cannot be invalid and the define is used for items where a duration
should not be set like nodes and directories.
It's also used by input_item_New() on items that don't have the duration when
the source is parsed by may get it when parsed in the input thread.
---
include/vlc_input_item.h | 8 +++++---
src/input/item.c | 4 ++--
src/playlist/tree.c | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 0347be2bfe..130882054e 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -124,7 +124,9 @@ struct input_item_t
#define INPUT_ITEM_URI_NOP "vlc://nop" /* dummy URI for node/directory items */
-#define INPUT_DURATION_INVALID VLC_TICK_INVALID /* an item with no duration, like a node/directory */
+/* placeholder duration for items with no known duration at time of creation
+ * 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) */
@@ -341,7 +343,7 @@ 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, INPUT_DURATION_INVALID, ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN )
+ input_item_NewExt( psz_uri, psz_name, INPUT_DURATION_UNSET, ITEM_TYPE_UNKNOWN, ITEM_NET_UNKNOWN )
#define input_item_NewCard( psz_uri, psz_name ) \
input_item_NewExt( psz_uri, psz_name, INPUT_DURATION_INVALID, ITEM_TYPE_CARD, ITEM_LOCAL )
@@ -353,7 +355,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, INPUT_DURATION_INVALID, ITEM_TYPE_DIRECTORY, i_net )
+ input_item_NewExt( psz_uri, psz_name, INPUT_DURATION_UNSET, 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 12baf470e8..6578a57bdf 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1666,7 +1666,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(INPUT_ITEM_URI_NOP, psz_subpathname, INPUT_DURATION_INVALID,
+ input_item_NewExt(INPUT_ITEM_URI_NOP, psz_subpathname, INPUT_DURATION_UNSET,
ITEM_TYPE_DIRECTORY, i_net);
if (p_item == NULL)
{
@@ -1806,7 +1806,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, INPUT_DURATION_INVALID, i_type,
+ input_item_t *p_item = input_item_NewExt(psz_uri, psz_filename, INPUT_DURATION_UNSET, i_type,
i_net);
if (p_item == NULL)
return VLC_ENOMEM;
diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index cb269abf57..b55fded4b2 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, INPUT_DURATION_INVALID, ITEM_TYPE_NODE,
+ p_new_input = input_item_NewExt( NULL, psz_name, INPUT_DURATION_UNSET, ITEM_TYPE_NODE,
ITEM_NET_UNKNOWN );
if( !p_new_input )
return NULL;
--
2.17.0
More information about the vlc-devel
mailing list