This:
- Removes the dependency of ffmpeg in PATH - useful on Windows, macOS
(?), Flatpak.
- Will support subrandr.
- Avoids redownloading network subtitles.
- Avoids slow demuxing of large mkvs.
- But no longer returns future lines of embedded subtitles.
- No longer returns embedded lines of regions you seeked beyond without
playing them.
- Changing sub track drops cached subtitles.
try to define a `[foo \ "bar"]` profile in mpv.conf, the command
to apply it in context-menu is `apply-profile foo \ "bar"`,
which is obviously incorrect, the correct command should be
`apply-profile "foo \\ \"bar\""`.
for string arguments that may contain spaces or some special
characters, we need to quote and escape them in JSON-style,
fortunately, `utils.format_json` can do this very well.
The playlist submenu does not update in this edge case:
- Have a playlist-count > 99 on the first vo-configured. This makes
playlist() return before observing --osd-playlist-entry.
- Remove playlist entries until the count is < 100
- Change --osd-playlist-entry
- Show the playlist submenu before changing the playlist
Observing playlist-pos and playlist-count is not enough to update it
after playlist-move, but we can observe any playlist property with type
none to get notified of every MP_EVENT_CHANGE_PLAYLIST, even if the
property has not changed.
This is similar to the
mp.observe_property("vsync-jitter", "none", recorder) hack used by
stats.lua to replicate the deprecated tick event.
Fixes https://github.com/mpv-player/mpv/pull/16816#discussion_r2727498518
Make select.lua parse menu.conf on the first vo-configured and fill
menu-data with the properties referenced in menu.conf change. This is
disabled in the libmpv profile.
This is done from select.lua to reuse functions to format the data and
retrieve key bindings.
There is also a script-binding that opens the correct context menu
depending on --load-context-menu.
While the context menu is scrollable, for the playlist it is better to
start from around the current entry rather than from the beginning, and
since menu-data has no way to specify where to start, when there are
more than 25 items playlist items this adds … entries that open the
scrollable console menu when clicked.
input-bindings is parsed to show the shortcuts bound to commands. Since
it is not observable, it just uses the bindings from the first time the
context menu is opened.
Multimedia and numpad keys are also not shown to reduce clutter.
The old Context Menu section of the docs is merged in the more detailed
context_menu.rst to not repeat the same information.
Avoid showing forced key bindings by modal scripts that temporarily
overwrite keybindings, like console and stats. These have section
input_forced_$scriptName. Unfortunately this skips all keybindings added
with mp.add_forced_key_binding even if you may want to show them.
Also skip the OSC sections "input" and "window-controls"; these sections
are not called input_forced_osc because the OSC uses
mp.enable_key_bindings() directly instead of mp.add_key_binding().
This mainly benefits the shortcuts in the context menu that the next
commit will add, but is also useful select/select-binding.
This reverts commit ee05804bfa. Only the
select.lua part since osc.lua list formatting was removed.
Since playlist/N/filename is now normalized, it is never going to have
trailing slashes so there is no need to strip them.
Subtitle extraction preserves empty lines in LRC subtitles because they
are useful for separating verses and choruses. 036fae317c changed their
sub codec from subrip to text, so update select.lua accordingly.
Add script bindings to edit mpv.conf and input.conf, and add them to the
menu. These are useful as shortcuts, but the main motivation is that new
users often ask why they can't find mpv.conf and input.conf, so this
creates them if they don't exist.
When the first chapter is not at the start of the file but after the
current time position, the chapter property is -1, which prevented
displaying any chapter.
Fixes#16073.
I don't know why I didn't get it before but Lua's LSP now complains with
Compute `"Edition " .. (edition.id + 1)` first. You may need to add
brackets. [ambiguity-1].
Just move the parenthesis to make it happy.
In files other than MKVs edition-list is an empty table, not nil. It is
current-edition that is nil.
However nil still needs to be checked to not crash with mpv --idle.
There's no advantage in using the forced version here. It is a leftover
from when this was an external script and forced was necessary to bind
key sequences reliably until 3f83671f20.
If a playlist entry ends with a slash these scripts only show the
basename which is empty. Fix this by stripping trailing slashes so that
the last directory component becomes the basename.
Show the same flags in loadfile.c, select.lua and stats.lua. The only
differences are that only stats.lua prints both image and albumart
because it's supposed to show detailed track information, and select.lua
prints the image flag because pressing g-v doesn't show Video or Image
like in loadfile.c and stats.lua.
Stop making unselected tracks and editions grey because they can be hard
to read over a dark background (\033[2m would be hard to differentiate
from regular text with a light theme instead), and because there is no
way to not print the escape sequences in --log-file.
Just use the same circles as the OSD and OSC. We need to print the empty
circles for alignment on mlterm with East Asian fonts (we could also
make them invisible with \033[8m but it would still get added to log
files).
Add back the space before tracks and editions when printed after
"Playing..." or "Track switched" and similar, so they look like a
sub-section of it, consistently with the metadata which starts with
space which makes it look like a sub-section of the "File tags" line.
Leave 2 spaces between track columns.
Make the lang options only as long as the longest language.
Place hls-bitrate within the same parentheses as the other data.
Replace the incomprehensible (*) (f) and [P] with textual descriptions
within []. Also place external there.
Stop converting Hz to kHz for consistency with other log messages, e.g.
AO: [pipewire] 48000Hz stereo 2ch floatp
Remove the space in "2 ch" so it doesn't look like 2 separate values (We
considered using mp_chmap_to_str(&s->codec->channels) but it prints
values like "unknown2").
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.
There is no need to compare sub-start now that we don't check for exact
matches with ffmpeg's timestamps. time-pos can always be used.
Comparing time-pos removes the need for the workaround of sub-start of
embedded subtitles being earlier than ffmpeg's timestamps, as time-pos
is always slightly after sub-start.
Removing this workaround also fixes a bug present since 4059d1832b,
which started comparing numerical values of timestamps instead of
strings to determine the preselected subtitle line, where the line after
the current one is preselected when sub-start is greater than ffmpeg's
timestamps because they have been rounded, e.g. sub-start 10.001 is >
than ffmpeg's 10.00.
This will also allow considering --sub-delay in the comparisons, as
comparing sub-start - sub-delay would preselect the wrong lines.
Allow configuring whether to print the media-title, the filename or both
(as `<title> (<filename>)`) in show-text ${playlist}, the OSC playlist
and in the playlist selector.
Showing only titles hides information when files are badly tagged, or
when it hides the track numbers of album songs. But showing filenames is
not as useful as titles e.g. when playing URLs with media titles. This
option lets the user choose which one to show, or show both if switching
is inconvenient.
The OSC's playlist_media_title script-opt is removed because this option
is better since it works everywhere after configuring it once.
Closes#11653.
Also show the full URLs of playlist entries instead of their basenames
in osc.lua and select.lua, consistently with mp_property_playlist().
For simplicity, this just checks if entries contain :// instead of
replicating all of mp_is_url().
Co-authored-by: Kacper Michajłow <kasper93@gmail.com>