diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst index d80e24cbf0..dfd22ed6cb 100644 --- a/DOCS/man/mpv.rst +++ b/DOCS/man/mpv.rst @@ -338,6 +338,9 @@ g-e g-l Select a subtitle line to seek to. +g-L + Select a secondary subtitle line to seek to. + g-d Select an audio device. diff --git a/etc/input.conf b/etc/input.conf index a94fba0b6c..bc0a64ce24 100644 --- a/etc/input.conf +++ b/etc/input.conf @@ -191,6 +191,7 @@ #g-c script-binding select/select-chapter #g-e script-binding select/select-edition #g-l script-binding select/select-subtitle-line +#g-L script-binding select/select-secondary-subtitle-line #g-d script-binding select/select-audio-device #g-h script-binding select/select-watch-history #g-w script-binding select/select-watch-later diff --git a/etc/menu.conf b/etc/menu.conf index f9117b5dcd..dc27319381 100644 --- a/etc/menu.conf +++ b/etc/menu.conf @@ -107,6 +107,8 @@ P&layback Increase &delay add secondary-sub-delay 0.1 Decrease d&elay add secondary-sub-delay -0.1 + &Lines script-binding select/select-secondary-subtitle-line disabled=not secondary_sid or p["current-tracks/sub2/codec"] == "dvb_subtitle" or p["current-tracks/sub2/codec"] == "dvd_subtitle" or p["current-tracks/sub2/codec"] == "hdmv_pgs_subtitle" + &Window &Fullscreen cycle fullscreen checked=fullscreen &Border cycle border checked=border diff --git a/player/lua/select.lua b/player/lua/select.lua index b90e7c32b8..e0d26370d4 100644 --- a/player/lua/select.lua +++ b/player/lua/select.lua @@ -284,8 +284,8 @@ mp.add_key_binding(nil, "select-edition", function () }) end) -mp.add_key_binding(nil, "select-subtitle-line", function () - local lines = mp.get_property_native("sub-lines") +local function select_subtitle_line(secondary) + local lines = mp.get_property_native(secondary .. "sub-lines") if not lines then show_warning("Subtitle lines could not be retrieved.") @@ -294,7 +294,7 @@ mp.add_key_binding(nil, "select-subtitle-line", function () local items = {} local default_item - local delay = mp.get_property_native("sub-delay") + local delay = mp.get_property_native(secondary .. "sub-delay") local time_pos = mp.get_property_native("time-pos") - delay local duration = mp.get_property_native("duration", math.huge) @@ -320,6 +320,13 @@ mp.add_key_binding(nil, "select-subtitle-line", function () mp.commandv("seek", lines[i].start + delay, "absolute") end, }) +end + +mp.add_key_binding(nil, "select-subtitle-line", function () + select_subtitle_line("") +end) +mp.add_key_binding(nil, "select-secondary-subtitle-line", function () + select_subtitle_line("secondary-") end) local function format_audio_device(device)