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 @@
1change 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
2867 subtitles, returns the first start time. If no current subtitle is present2867 subtitles, returns the first start time. If no current subtitle is present
2868 null is returned instead.2868 null is returned instead.
2869 2869
2870 This has a sub-property:
2871
2872 ``sub-start/full``
2873 ``sub-start`` with milliseconds.
2874
2870``secondary-sub-start``2875``secondary-sub-start``
2871 Same as ``sub-start``, but for the secondary subtitles.2876 Same as ``sub-start``, but for the secondary subtitles.
2872 2877
@@ -2876,6 +2881,11 @@ Property list · 3 unmodified lines
2876 if it's present but has unknown or incorrect duration, null is returned2881 if it's present but has unknown or incorrect duration, null is returned
2877 instead.2882 instead.
2878 2883
2884 This has a sub-property:
2885
2886 ``sub-end/full``
2887 ``sub-end`` with milliseconds.
2888
2879``secondary-sub-end``2889``secondary-sub-end``
2880 Same as ``sub-end``, but for the secondary subtitles.2890 Same as ``sub-end``, but for the secondary subtitles.
2881 2891
player/command.c+2−2
@@ -3062,7 +3062,7 @@ static int mp_property_sub_start(void *ctx, struct m_property *prop, · 3061 unmodified lines
3062 double start = get_times(ctx, prop, action, arg).start;3062 double start = get_times(ctx, prop, action, arg).start;
3063 if (start == MP_NOPTS_VALUE)3063 if (start == MP_NOPTS_VALUE)
3064 return M_PROPERTY_UNAVAILABLE;3064 return M_PROPERTY_UNAVAILABLE;
3065 return m_property_double_ro(action, arg, start);3065 return property_time(action, arg, start);
3066}3066}
3067 3067
3068 3068
@@ -3072,7 +3072,7 @@ static int mp_property_sub_end(void *ctx, struct m_property *prop, · 3 unmodified lines
3072 double end = get_times(ctx, prop, action, arg).end;3072 double end = get_times(ctx, prop, action, arg).end;
3073 if (end == MP_NOPTS_VALUE)3073 if (end == MP_NOPTS_VALUE)
3074 return M_PROPERTY_UNAVAILABLE;3074 return M_PROPERTY_UNAVAILABLE;
3075 return m_property_double_ro(action, arg, end);3075 return property_time(action, arg, end);
3076}3076}
3077 3077
3078static int mp_property_playlist_current_pos(void *ctx, struct m_property *prop,3078static 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