Commit Graph

53081 Commits

Author SHA1 Message Date
Dudemanguy 7d4abdbd45 wayland: rename wayland_format to compositor_format
Cosmetic. This is to better indicate that these formats come from the
compositor.
2024-09-16 00:07:36 +00:00
llyyr d02f03bc2b sub/sd_ass: don't override event attributes to mpv defaults
ASS_OVERRIDE_BIT_STYLE includes ASS_OVERRIDE_BIT_ATTRIBUTES, which we
don't want.

This prevents --sub-ass-override=force from overriding attributes such
as bold, italics, underline or strikeout to mpv defaults.
2024-09-15 20:10:51 +02:00
llyyr c7dce6a838 TOOLS/gen-mpv-desktop.py: set --no-config when probing protocols
Apparently for an user mpv would crash on startup if built with asan and
mpv attemps to load mpv-mpris. Just set --no-config so we don't load
anything external since this is more correct anyway.
2024-09-15 20:10:29 +02:00
Kacper Michajłow e41ee0524c f_auto_filters: don't set interlaced-only for userdeint
Not wanted apparently: https://github.com/mpv-player/mpv/pull/14822#discussion_r1758134111
2024-09-15 20:10:09 +02:00
Kacper Michajłow 6133033e33 DOCS/man/options.rst: fix nono typo
Fixes: f1f091759a
2024-09-15 19:20:23 +02:00
llyyr 22a7a0af8a vo_gpu_next: allow setting antiring value for cscale
This has been possible since 11771cdd82
but nobody bothered to map it to mpv until now?
2024-09-15 18:54:23 +02:00
nanahi f1f091759a DOCS/man/options.rst: clarify sub-ass-use-video-data a bit 2024-09-15 18:46:44 +02:00
nanahi d245e9dc8c DOCS/interface-changes: fix format for sub-ass-use-video-data 2024-09-15 18:46:44 +02:00
Guido Cella 030c283ef5 console.lua: respect --video-osd=no 2024-09-15 18:27:24 +02:00
Guido Cella 8592206c75 console.lua: truncate more characters with --msg-module and --msg-time
Fix the terminal width calculation for the select menu with these
options.
2024-09-15 18:27:24 +02:00
Guido Cella b98d4fde0d console.lua: fix highlighting the selected item with --msg-module
With --msg-module the select menu also highlights the "statusline" on
the next line. Fix this by resetting the color before \n instead of
after it.

This requires changing all log code to not preemptively add a newline,
which is actually simpler, though we have to modify the messages
received with log-message which already contain a newline.
2024-09-15 18:27:24 +02:00
nanahi b440821d18 osdep/terminal-win: reset tmp_buffers_key when uninit
To prevent potential undefined results when using a freed value.
2024-09-15 17:03:33 +02:00
nanahi 42b40d03f1 player/main: revert msg uninit order changes
msg must be the last module to uninit since pretty much
everything else uses logging.

This reverts commit f92d5da89c.
This reverts commit c1282d4d43.
2024-09-15 17:03:33 +02:00
Philip Langdale 429e379c7f DOCS/man/options.rst: update description of `hwdec=auto` behaviour
When I introduced the behaviour of `auto` trying every hwdec down the list
instead of giving up after the first one fails, I forgot to update this
part of the docs.
2024-09-14 19:35:31 -07:00
Kacper Michajłow ef19a4a09d sub/osd: add log if osd rendering takes too long time
Ideally it should be fast, it is on VO thread and steals precious frame
time budget. Looks like this is one of the main reasons why
display-resample on higher refresh rate displays is too slow.
2024-09-14 20:23:22 +02:00
Kacper Michajłow 0e43eea5bb meson: require Vulkan loader/headers >= 1.3.238
Even Debian stable has them, so no need to keep compatible with ancient
versions.

Note that this does not change runtime version requirement for Vulkan.

Fixes: https://github.com/mpv-player/mpv-build/issues/234
2024-09-14 17:20:16 +02:00
Kacper Michajłow 2aab3fc381 vd_lavc: add Vulkan hardware decoding to autoprobe
On platforms where it is unstable/experimental, it is disabled behind
environmental variable, so safe to probe it there too.

Fixes usage of hwdec=yes with gpu-api=vulkan, where hwdec would be not
enabled. Position it after older and more stable variants. That means
the -copy variant of the other API will likely be prefered.
2024-09-14 17:20:16 +02:00
Kacper Michajłow a6e13f41eb console.lua: sync colors after msg.c change
Keep ASS pallete the same, as it doesn't print trace messages anyway.
Remove only bold and keep debug gray.
2024-09-14 17:11:07 +02:00
Kacper Michajłow 4de6390d25 msg: don't use bold colors and instead use bright ones
Also avoid regular white/black, because it is often the terminal
background and invisible as foreground color.

Change debug messages to blue while at it to differentiate them from
trace ones.
2024-09-14 17:11:07 +02:00
Guido Cella 7362f72fdf console.lua: fix completing empty --dscale and --cscale
These options accept an empty value within their choices. If the user
didn't add manually input a quote before completing them, add quotes
automatically so that the blank value can actually be used.
2024-09-14 17:06:07 +02:00
Guido Cella dd77d0a7da vo_gpu{,_next}: convert scale options to type choice
This allows Tab completing them in the console and zsh, and using cycle
scale.

jinc is also added to --tscale=help's output, while before it was
missing because validate_scaler_opt() skipped filter windows with the
same name as a filter kernel, but the jinc kernel was skipped with
--tscale because it is polar.
2024-09-14 17:06:07 +02:00
llyyr d84a7c5112 stream: don't mark stdin as a filesystem file
Also rename the field to appropriately reflect what it is supposed to be
used for. The only other use of this was to search for ordered chapter
sources, and that makes no sense for mkv files from stdin.

This also fixes autocreate-playlist loading in the current directory
when the input file is stdin.
2024-09-14 16:17:44 +02:00
llyyr d2f3b66439 vulkan: don't tolerate suboptimal swapchain configurations
The comment was probably only ever true for x11, and it currently isn't
true anymore. X11 WSI used to return VK_SUBOPTIMAL_KHR in
vkQueuePresentKHR and vkAcquireNextImageKHR before, but as of
2b885b233f
it only returns VK_SUBOPTIMAL_KHR in vkAcquireNextImageKHR for
performance reasons. This makes it so that we don't have to tolerate
suboptimal swapchain configurations for the sake of smoother resizing.

On top of that, not recreating swapchain when it was suboptimal, it
also prevented mpv from being directly scanned out when fullscreened on
Wayland compositors. On Wayland, the preferred modifier from the wsi
may change depending on whether the window is fullscreened or not for
direct scan out. If mpv is fullscreened but not using modifiers that
can be directly scanned out, mpv will be receive VK_SUBOPTIMAL_KHR from
WSI and should recreate swapchain to use the right modifier with the
format mpv picked. mpv will always get the format it picks, WSI can't
give us a different format. This allows for recreating the swapchain
with modifiers that will allow mpv to be directly scanned out when the
window is fullscreened spanning an output on Wayland.

I checked X11 and Wayland myself to have no regressions when resizing,
and others have checked Windows and Mac to have no regressions.

With this, direct scanout with Vulkan on Wayland should just work.
You might also need https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31122
if your compositor enables explicit syncronization via
linux-drm-syncobj-v1.
2024-09-14 16:16:35 +02:00
llyyr a44a726301 ao_alsa: assume device lost if we couldn't recover after 10 attempts
ALSA API reports -EPIPE even when the the device is lost, which we
currently always assume to be an XRUN. If we assumed XRUN 10 times and
didn't manage to recover, just consider the device lost and try to
reconnect. Allows ao_alsa to recover from alsa server being killed then
reinitialized. And even in the worst case, this should be better than
the status quo of mpv attempting to prepare a PCM device indefinitely
until the user restarts mpv.

This is admittedly not ideal, and I don't think the -EPIPE hack is
necessary anymore, but I can only test on my setup and removing the
'assume -EPIPE is an XRUN' hack might break some setups for whatever
mysterious reasons.
2024-09-14 14:08:30 +02:00
llyyr 44da754018 ao_alsa: don't early exit out of the loop if we have an error
This would cause us to exit out of the loop with a goto anytime we ran
into XRUN or DRAINING and preparing PCM for use failed.
2024-09-14 14:08:30 +02:00
llyyr ec966fb866 ytdl_hook: add some more yt-dlp tags
These might be useful
2024-09-14 14:07:54 +02:00
Oneric 5357d18fe6 sub: add ass-video-aspect-override option
It is unclear whether there actually is any usecase for this option
which isn't better served by sub-ass-use-video-data and/or LayoutRes
overrides, but prior to the introduction of sub-ass-use-video-data
it was possible to pass along storage resolution while faking an
aspect ratio of 1:1.
sub-ass-video-aspect-override=1 combined with sub-ass-use-video-data=all
now makes this possible again.

The uper limit of a 10:1 aspect matches
the general video-aspect-override option.
2024-09-13 23:24:08 +02:00
Oneric 207b1a2c91 sub: merge vsfilter-aspect and vsfilter-blur-compat options
The naming for "blur-compat" was misleading since the setting
actually affects more than just blur affects. Additionally
forwarding storage resolution but forcing an aspect ratio
of 1.0 for the video is likely to result in odd rendering
and there’s no known usecase for it.

Both options control which video properties are exposed to libass
so to fix the aforementioned issues merge these settings into one
tri-state sub-ass-use-video-data.

The default V keybind now cycles through all states of
use-video-data instead of toggling vsfilter-aspect-compat.

Resolves: https://github.com/mpv-player/mpv/issues/10680
2024-09-13 23:24:08 +02:00
Kacper Michajłow f6d931301b vf_d3d11vpp: adjust options for userdeint filter
Fixes: #14816
2024-09-08 21:44:51 +02:00
Dudemanguy e6c536ae45 wayland: fix vertical resizing
Resizing in strictly the vertical direction has been broken forever on
wayland. It's because of how the keepaspect calculation always resized
with respect to the width. So if you moved the mouse strictly
vertically with no change left/right, the mpv window would never change
size since it just calculates with respect to the width that doesn't
change.

Fixing this is kind of weird and maybe someone should think of a better
algorithm for preserving aspect ratio (we just multiply by the gcd
basically), but whatever. You might naively try something like "resize
with respect to what direction changes the most" at first, but this
leads to very cludgy resizing since during a typical mouse dragging
motion, it will flip constantly from "resize w/ respect to the width"
and "resize w/ respect to the height". It "works" but it's really ugly
and not worth it.

The trick is to realize that we need to consider the resizing state as
one continuous motion, choose a direction initially, stick to it
throughout the entirety of the resize, and reset the relevant parameters
after we finish the resize. This ensures the direction never
unintuitively flips during a motion, but also allows for the strictly
vertical case to still work.

Might as well note it here in the commit, but mpv's resizing behavior
technically violates xdg-shell. For the resizing event, "[t]he window
geometry specified in the configure event is a maximum; the client
cannot resize beyond it." Well, we do obviously go beyond the maximum in
certain cases. For example consider resizing strictly horizontally. The
width value increases from the compositor but not the height. Since mpv
preserves aspect ratio by default, the height obviously must increase
which will go over the prescribed bounds by the compositor. This happens
before and after this commit, and I think everyone agrees is the desired
behavior. With this commit, now vertical resizing works which violates
xdg-shell in the same way. Before, it incidentally obeyed the protocol
since it did not resize at all, but let's presume users expect the
window to actually get bigger when they do a drag resize.

*: https://wayland.app/protocols/xdg-shell#xdg_toplevel:enum:state:entry:resizing
2024-09-08 18:36:17 +00:00
Kacper Michajłow 5edc8973eb various: use talloc_replace 2024-09-08 17:33:27 +02:00
Kacper Michajłow 3edbd30798 ta_utils: add talloc_replace
Helper to replace a string with a new one without reallocating the
buffer, if not needed.
2024-09-08 17:33:27 +02:00
Kacper Michajłow 077f05f7a1 ta_talloc: remove non-existent function prototype 2024-09-08 17:33:27 +02:00
Kacper Michajłow e7f153db58 stats.lua: don't use ASS tags when use_ass is false
Fixes terminal output.
2024-09-08 17:33:03 +02:00
nanahi f92d5da89c player/main: uninit input after terminal uninit
The terminal input thread holds the input_ctx reference.
Fixes: c1282d4d43
2024-09-08 17:14:37 +02:00
nanahi e169302e2d video/out/wayland_common: set key state only on keyboard_enter keys
These keys should be considered "being pressed" instead of an action of
press. This way, the keypress action won't be triggered; it now triggers
only when the key binding is repeatable and after the initial ar delay.
2024-09-07 18:14:56 +00:00
nanahi c4ff675198 input: add MP_KEY_STATE_SET_ONLY
Trivial.
2024-09-07 18:14:56 +00:00
nanahi 4295141703 input/keycodes: fix typo 2024-09-07 18:14:56 +00:00
Kacper Michajłow 0eb5e914d9 ci/win32: add dav1d 2024-09-05 16:29:16 +02:00
nanahi f02b8bc9fd stats.lua: fix text size/alignment for key bindings page
After a subject line, the text style needs to be reset to make
sure that key binding lines have correct size and alignment
while scrolling the page.
2024-09-05 14:06:05 +02:00
norinoriko ecc6cddef0 DOCS/man/options: update defaults for `--hwdec-codecs`
`prores` was added to the whitelist in 629b637406.
2024-09-04 18:46:30 -04:00
bodayw db19dbca5c DOCS/man/options: fix deinterlacing typo 2024-09-04 16:27:53 +02:00
Kacper Michajłow ad7976c33e input: fix use of bstr like null terminated one
It has been changed in one of the iterations of the patch during review,
but bstr doesn't have to be null terminated. Fix it by adding dedicated
node_map helper.

Fixes: 1a27f3c
2024-09-04 03:52:09 +02:00
Kacper Michajłow 1ecfb29932 osdep/io: redefine off_t for Windows build
off_t is long (4 bytes) on Windows, regardless of _FILE_OFFSET_BITS,
which is not supported there.

Fixes: #14790
2024-09-04 03:51:56 +02:00
llyyr a0ebfc3462 sub: remove dead code 2024-09-03 18:31:38 +02:00
llyyr c02aa154ab vo_gpu: restore dovi mapping directly on image_params after init 2024-09-03 17:08:28 +02:00
llyyr 3acd253e89 mp_image: don't restore image params if they're unknown 2024-09-03 17:08:28 +02:00
llyyr fe4ba71962 etc/mpv.conf: update stale comment about mpv config location
We don't support reading mpv.conf without a mpv parent directory anymore
(did we ever?).
2024-09-02 13:51:00 -04:00
Kacper Michajłow 1f33889c03 vo_libmpv: use fallback colorspace for Dolby Vision
Same as 2a72e6cb20 for libmpv.
2024-09-02 04:14:56 +02:00
norinoriko afdbbac81d input.conf: swap the positions of values for `ctrl+h` binding
Allows users to toggle software decoding with a single action if they
are using a value for `hwdec` that is different from `auto-safe`.
2024-09-01 19:42:15 +02:00