Preselect and seek to the correct subtitle line when there is a sub-delay. Also slightly increase the offset without a video track else it occasionally doesn't seek to the selected line with non-0 sub-delay and no video. This now uses the same offset as sub/sd.h.
Showing the changes to player/lua/select.lua (1 of 1 file). Show all
Unified · Split
| @@ -232,7 +232,8 @@ mp.add_forced_key_binding(nil, "select-subtitle-line", function () · 231 unmodified lines | |||
| 232 | local sub_lines = {} | 232 | local sub_lines = {} |
| 233 | local sub_times = {} | 233 | local sub_times = {} |
| 234 | local default_item | 234 | local default_item |
| 235 | local time_pos = mp.get_property_native("time-pos") | 235 | local delay = mp.get_property_native("sub-delay") |
| 236 | local time_pos = mp.get_property_native("time-pos") - delay | ||
| 236 | local duration = mp.get_property_native("duration", math.huge) | 237 | local duration = mp.get_property_native("duration", math.huge) |
| 237 | 238 | ||
| 238 | -- Strip HTML and ASS tags. | 239 | -- Strip HTML and ASS tags. |
| @@ -254,9 +255,11 @@ mp.add_forced_key_binding(nil, "select-subtitle-line", function () · 15 unmodified lines | |||
| 254 | submit = function (index) | 255 | submit = function (index) |
| 255 | -- Add an offset to seek to the correct line while paused without a | 256 | -- Add an offset to seek to the correct line while paused without a |
| 256 | -- video track. | 257 | -- video track. |
| 257 | local offset = mp.get_property_native("current-tracks/video/image") == false | 258 | if mp.get_property_native("current-tracks/video/image") ~= false then |
| 258 | and 0 or .09 | 259 | delay = delay + 0.1 |
| 259 | mp.commandv("seek", sub_times[index] + offset, "absolute") | 260 | end |
| 261 | |||
| 262 | mp.commandv("seek", sub_times[index] + delay, "absolute") | ||
| 260 | end, | 263 | end, |
| 261 | }) | 264 | }) |
| 262 | end) | 265 | end) |