diff options
author | rcombs <rcombs@rcombs.me> | 2024-04-17 01:13:21 -0700 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2024-04-18 13:11:01 +0200 |
commit | d3a63e16d2a32f4abc39eee8bdbb76baf53dbc35 (patch) | |
tree | 3bcac91c43f1c214529f868ed55e1543b7eb47ee | |
parent | 2f8038c59885d5db875097566e9d8e033f108e0a (diff) | |
download | mpv-d3a63e16d2a32f4abc39eee8bdbb76baf53dbc35.tar.bz2 mpv-d3a63e16d2a32f4abc39eee8bdbb76baf53dbc35.tar.xz |
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}).
-rw-r--r-- | DOCS/interface-changes/sub-times.txt | 1 | ||||
-rw-r--r-- | DOCS/man/input.rst | 10 | ||||
-rw-r--r-- | player/command.c | 4 |
3 files changed, 13 insertions, 2 deletions
diff --git a/DOCS/interface-changes/sub-times.txt b/DOCS/interface-changes/sub-times.txt new file mode 100644 index 0000000000..8c2929b15a --- /dev/null +++ b/DOCS/interface-changes/sub-times.txt @@ -0,0 +1 @@ +change type of `sub-start` and `sub-end` properties to time diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 0931ddb289..ae70585305 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -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. diff --git a/player/command.c b/player/command.c index 4814a897fd..190b1fc025 100644 --- a/player/command.c +++ b/player/command.c @@ -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, |