History

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}).

rcombs committed 2 years ago

Commit d3a63e11 parent 2f8038c3 files · +13 −2Browse files

Unified · Split

3 files
  1. DOCS/interface-changes/sub-times.txt +1 −0
  2. DOCS/man/input.rst +10 −0
  3. player/command.c +2 −2
DOCS/interface-changes/sub-times.txt+1−0
@@ -0,0 +1 @@
1+change type of `sub-start` and `sub-end` properties to time
DOCS/man/input.rst+10−0
@@ -2867,6 +2867,11 @@ Property list · 2866 unmodified lines
28672867 subtitles, returns the first start time. If no current subtitle is present
28682868 null is returned instead.
28692869
2870+ This has a sub-property:
2871+
2872+ ``sub-start/full``
2873+ ``sub-start`` with milliseconds.
2874+
28702875 ``secondary-sub-start``
28712876 Same as ``sub-start``, but for the secondary subtitles.
28722877
@@ -2876,6 +2881,11 @@ Property list · 3 unmodified lines
28762881 if it's present but has unknown or incorrect duration, null is returned
28772882 instead.
28782883
2884+ This has a sub-property:
2885+
2886+ ``sub-end/full``
2887+ ``sub-end`` with milliseconds.
2888+
28792889 ``secondary-sub-end``
28802890 Same as ``sub-end``, but for the secondary subtitles.
28812891
player/command.c+2−2
@@ -3062,7 +3062,7 @@ static int mp_property_sub_start(void *ctx, struct m_property *prop, · 3061 unmodified lines
30623062 double start = get_times(ctx, prop, action, arg).start;
30633063 if (start == MP_NOPTS_VALUE)
30643064 return M_PROPERTY_UNAVAILABLE;
3065− return m_property_double_ro(action, arg, start);
3065+ return property_time(action, arg, start);
30663066 }
30673067
30683068
@@ -3072,7 +3072,7 @@ static int mp_property_sub_end(void *ctx, struct m_property *prop, · 3 unmodified lines
30723072 double end = get_times(ctx, prop, action, arg).end;
30733073 if (end == MP_NOPTS_VALUE)
30743074 return M_PROPERTY_UNAVAILABLE;
3075− return m_property_double_ro(action, arg, end);
3075+ return property_time(action, arg, end);
30763076 }
30773077
30783078 static int mp_property_playlist_current_pos(void *ctx, struct m_property *prop,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t