While most Wayland compositors provide a socket path indicated by
environment variable WAYLAND_DISPLAY, others may sometimes bequeath a
socket file descriptor specified by WAYLAND_SOCKET.
With --osd-border-style=opaque-box and background-box, respect
--osd-shadow-offset.
I am not sure if --osd-shadow-offset should be inherited with
--osd-border-style=outline-and-shadow, especially since it doesn't let
you specify different x and y offsets.
The current OSD font size is excessively large, causing most
messages—except for very short ones to overflow horizontally.
I conducted testing across multiple devices of varying screen sizes and
under different scenarios. The adjusted font size strikes a good balance
for readability on non-high-DPI displays, while high-DPI displays should
utilize DPI scaling as needed.
Additionally, I compared the font sizes of subtitles and UI elements
across various VOD platforms, which generally use smaller font in most
cases.
The current sub font size was significantly larger than even PGS
subtitles, which are quite large on their own. Now, they are comparable.
The subtitle font size was chosen based on recommendations from the BBC
Subtitle Guidelines. It is set to 8% of the video height with a
recommended scaling factor of 0.67. Therefore, at 720p (the reference
size for mpv font scaling), the calculation is 8% * 0.67 * 720 = 38.592,
rounded down to 38. This value falls within the recommended scaling
range of x0.5–x1 for desktop PCs/Laptops and TVs (32"–42"). For more
information, see
https://www.bbc.co.uk/accessibility/forproducts/guides/subtitles/#Presentation-font-size.
OSD font size is smaller than font as those elements shouldn't be
distractful and only noticable when the user wants to look at them.
Outline size is set to 5.5% of font size.
It already prints %, so there's no need for '/100'. Also, use the print
helper while at it.
6ea08be59a added a percent sign but didn't
remove '/100', so we ended up with both, which is redundant.
Observing playlist property with "native" type is too expensive for
larger playlists, and we only observe this property to
activate/deactivate next/prev buttons on the osc. We actually only need
to know if the playlist-count has changed, nothing else.
Fixes: https://github.com/mpv-player/mpv/issues/15264
If a hook event can't be sent to a client because it no longer exists,
stop logging it as a warning, as there is no way for a client to remove
hooks, so it is expected that the hook can't be sent. This is documented
in libmpv/client.h.
If the hook event can't be sent for other reasons, like the event queue
being full (currently the only other possible reason), keep logging as
warning.
Also add the client and hook type to the message. They are also logged
just above, but only in verbose mode, so when only the warning is logged
you didn't see the client before.
auto_profiles.lua logs these warning since 5dc4047415, and this commit
fixes that.
Fixes#15244.
Unsetting _G.mp_event_loop at the top level quits the script, but not
within callbacks. Use the new exit() function instead. Fixes e2284fba18.
This actually has an edge case since e2284fba18 where you can add auto
profiles only later with load-config-file and the script stays unloaded,
but it's still reasonable to quit if mpv.conf has no conditional
profiles. You could always explicitly set --load-auto-profiles=yes in
this case.
Scripts can terminate execution by setting mp.keep_running = false. Add
an exit() function to wrap setting mp.keep_running and properly expose
this feature. It can be used e.g. by a thumbnail script to spawn workers
with load-script and then let them quit.
It is not added to the mp namespace as mp.exit because that would make
it look like it terminates mpv.
This mirrors the exit() function which already exists in js.
The note in javascript.rst about having to remove key bindings before
exit is not kept because they are actually removed automatically since
bf385e1140 (though it was accurate when the JS backend was developed
before upstreaming it).
The command is documented to use the same syntax as input.conf, but
it doesn't work with sequence keys because it uses
mp_input_get_key_from_name for checking key names, when it should
use mp_input_get_keys_from_string instead.
Fix this by using the correct function.
Also move the loading of profiles and input section activation in one
place. Leaving this in mp_initialize has the drawback that encoding
section profile will overwrite options set by the user in the command
line, since it's set after the CLI options are parsed and processed.
mp_parse_cfgfiles happens before parsing the CLI, so loading the profile
there is better.
Calculate the hovered item from the bottom of the screen where the
console is anchored. This is simpler and accurate because it accounts
for the fact that the empty line between the log and the input line
isn't as tall as a full line, for the exact height of an always visible
OSC bottombar, and for the empty top pixels present because the height
isn't an integer multiple of the font size.
Replace the rounding to calculate the hovered line with ceil which is
what you would expect to work. Rounding worked better before because it
compensated for the errors fixed by the previous 2 commits.
This reverts commit 5e65999eb2.
This was wrong because an empty line doesn't occupy as much height as a
filled line. But update the comment so it is not unclear like before why
1.5 is subtracted.
Currently --script-opt=stats-font_size=n is much bigger than
--osd-font-size=n, which can confuse users, so calculate sizes the same
way.
The \fs value to replicate --osd-font-size is
${osd-font-size} * 288 / 720 with --osd-scale-by-window, and
\fs${osd-font-size} * 288 / ${osd-height}
with --osd-scale-by-window=no. This is because
sub/osd_libass.c:update_playres() sets
track->PlayResY = ass->res_y ? ass->res_y : MP_ASS_FONT_PLAYRESY,
where MP_ASS_FONT_PLAYRESY is 288.
This also works with persistent_overlay=yes.
{\fscx100}{\fscy100} would also replicate --osd-font-size with show-text
and with osd-verlay + --osd-scale-by-window, but not with osd-overlay +
--osd-scale-by-window=no.
The default sizes are multiplied by 720/288 = 2.5 to keep them the same
as before.
In the select menu there are no completions to align in a grid, so the
better looking proportional font of --osd-font can be used by default.
It is also easier to read for the visually impaired.
The text width calculation is no longer performed if the console is only
opened through select, it is only performed the first time something is
completed. This avoids having to pass an argument to get_font() to make
it use the monospace font regardless of selectable_items.
Fixes#15176.
Add support for tracking playlist_title and playlist_id metadata
corresponding to a given playlist url and the entries associated
with it.
This allows the inclusion of ytdl_playlist_title and ytdl_playlist_id
in the metadata property for single videos which have a corresponding
playlist-path property.
This commit also resolvesyt-dlp/yt-dlp#11234