command: use property_time() for sub-start and sub-end

This gives these properties the "time" type, which allows them to be pretty-printed as HH:MM:SS easily (but also still allows raw formatting using e.g. ${=sub-start}).
This commit is contained in:
rcombs 2024-04-17 01:13:21 -07:00 committed by sfan5
parent 2f8038c598
commit d3a63e16d2
3 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1 @@
change type of `sub-start` and `sub-end` properties to time

View File

@ -2867,6 +2867,11 @@ Property list
subtitles, returns the first start time. If no current subtitle is present
null is returned instead.
This has a sub-property:
``sub-start/full``
``sub-start`` with milliseconds.
``secondary-sub-start``
Same as ``sub-start``, but for the secondary subtitles.
@ -2876,6 +2881,11 @@ Property list
if it's present but has unknown or incorrect duration, null is returned
instead.
This has a sub-property:
``sub-end/full``
``sub-end`` with milliseconds.
``secondary-sub-end``
Same as ``sub-end``, but for the secondary subtitles.

View File

@ -3062,7 +3062,7 @@ static int mp_property_sub_start(void *ctx, struct m_property *prop,
double start = get_times(ctx, prop, action, arg).start;
if (start == MP_NOPTS_VALUE)
return M_PROPERTY_UNAVAILABLE;
return m_property_double_ro(action, arg, start);
return property_time(action, arg, start);
}
@ -3072,7 +3072,7 @@ static int mp_property_sub_end(void *ctx, struct m_property *prop,
double end = get_times(ctx, prop, action, arg).end;
if (end == MP_NOPTS_VALUE)
return M_PROPERTY_UNAVAILABLE;
return m_property_double_ro(action, arg, end);
return property_time(action, arg, end);
}
static int mp_property_playlist_current_pos(void *ctx, struct m_property *prop,