[vlc-devel] [PATCH 0/9] Input Items duration cleaning
robux4 at ycbcr.xyz
Fri Jul 6 15:01:26 CEST 2018
Right now -1 and VLC_TICK_INVALID are used in the code. -1 seems to refer to
items with no duration set at all (not particularly 0) and some are set
VLC_TICK_INVALID which is actually 0 which is proper duration, at least it's
The first few patches just creates some defines and replace the values in
the code with the appropriate define.
What used to be VLC_TICK_INVALID is then set to 0 explicitly and things become
a little clearer, for instance a directory has a duration of 0.
It's always to call input_item_GetDuration() an an item with an Unknown
duration. In that case we should return 0 rather than -1 (or whatever value the
define uses) (patch #7).
In m3u a loop on items started with an init of Unknown and then in the loop
resets to Zero, but Unknown seems to be the right value here (patch #8).
Items created by input_item_New() are init with a duration of 0, but it seems
that Unknown is more appropriate (Patch #9).
There is the case of "vlc://nop" in parts of the code it can be an directory
(duration Zero for now), a node (duration Unknown but not always) or some other
types with not specific durations. I am not sure which is the proper duration.
We may decide that the Unknown/Unset duration is 0 which would solve this issue.
Steve Lhomme (9):
vlc_input_item: add a define for the known zero duration
core: make use of the special duration value INPUT_DURATION_ZERO
modules: make use of the special duration value INPUT_DURATION_ZERO
vlc_input_item: add a define for the unset duration
modules: make use of the special duration value INPUT_DURATION_UNKNOWN
vlc_input_item: set INPUT_DURATION_ZERO explicitly to 0
input: return 0 when the duration is unknown, rather than -1
m3u: reset the duration to unknown after an item is parsed
vlc_input_item: init item to an unknown value by default instead of 0
include/vlc_input_item.h | 9 ++++++---
modules/control/oldrc.c | 2 +-
modules/demux/playlist/m3u.c | 4 ++--
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 +-
src/input/item.c | 6 ++++--
src/playlist/tree.c | 2 +-
10 files changed, 19 insertions(+), 14 deletions(-)
More information about the vlc-devel