Commit Graph

52898 Commits

Author SHA1 Message Date
sfan5 a0fba7be57
Release 0.39.0 2024-09-23 19:36:41 +02:00
sfan5 5e9e756f53 TOOLS/gen-interface-changes: small usability improvement 2024-09-23 19:20:05 +02:00
Kacper Michajłow 883a45fa3e ci/msys2: disable some features for 32-bit build
See: 1e7737f090
2024-09-23 12:48:10 +02:00
Guido Cella 68ea9fecda console.lua: fix the height calculation with --video-osd=no 2024-09-22 17:31:54 +02:00
Kacper Michajłow 71f2220991 meson: use relative file paths for file2string
This fixes "Generated from" comments to not include local source path in
generated files.
2024-09-21 23:39:10 +02:00
Maxim Biro ff47926d6a ytdl_hook: make path and json available to other scripts
It's useful for user scripts to be able to use the same ytdl binary that
ytdl_hook uses without having to replicate ytdl_hook's process of
searching for the ytdl binary.

Some user scripts might also find it useful to be able to access ytdl's
json output that the ytdl_hook already receives, sparing user scripts
from having to make a duplicate ytdl binary invocation to get the json
output.

Providing just the json output is not enough though, as ytdl doesn't communicate
errors though it -- if an error occurs, ytdl provides no json output and instead
prints to stderr. So without stderr, there is no way for user scripts to figure
out why ytdl has failed: no such username / video id, the channel is not live
yet, etc. Because of that, the entire result of the subprocess call is provided
to the user scripts, containing stdout (json), stderr, ytdl's exit code, etc.
2024-09-21 17:53:01 +02:00
Guido Cella e3eeaec813 select.lua: don't use add_forced_key_binding
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.
2024-09-19 13:57:39 +00:00
llyyr 140196f297 ytdl_hook: fix typo (chapters -> chapter)
Fixes: ec966fb866
2024-09-19 13:55:58 +00:00
Oneric 7431896cd1 DOCS/man/options.rst: further tweak sub-ass-use-video-data description 2024-09-19 13:55:50 +00:00
Guido Cella 284293ceb5 TOOLS/cycle-deinterlace-pullup.lua: fix removing the filter
This has been broken since b56e63e2a9 removed vf del. Replace it with vf
remove. Fixes #14881.
2024-09-19 13:38:16 +00:00
Dudemanguy 21a0fa7abe options: fix missing comma in default watch_later_options values
Missed in 207b1a2c91.

Fixes https://github.com/mpv-player/mpv/pull/14731#issuecomment-2358718766
2024-09-18 10:40:42 -05:00
llyyr 22620af459 workflows/comment: fix workflow syntax
Github doesn't evaluate expressions unless they're inside ${{ }}

See: https://github.com/mpv-player/mpv/actions?query=is%3Afailure+event%3Aworkflow_run
2024-09-17 18:52:35 +02:00
nanahi cae3aee23b Revert "mp_image: don't restore image params if they're unknown"
This results in all image params not being restored even if only one is
unknown. In particular params->color.hdr isn't cleared, causing
overblown color for some samples.

It should be safe to restore even unknown values.
mp_image_params_guess_csp will handle that.

This reverts commit 3acd253e89.
2024-09-16 10:34:14 +02:00
Dudemanguy c0c57be07b f_hwtransfer: filter out unsupported hwuploads from p->fmts
With the previous change, it is possible that the mp_hwdec_ctx contains
a list of known supported hwuploads. Take this into account when adding
to the p->fmts list. We want to be sure to select only something that is
actually possible to use. If the hwdec does not implement
supported_hwupload_formats, then all are assumed to work.
2024-09-16 00:07:36 +00:00
Dudemanguy 6797f54378 hwdec/vaapi: additionally probe hwupload format conversions
This is probably fringe, but I encountered it on my machine. The
hwupload filter happily does conversions all on the GPU side if
possible. Makes sense. However, it turns out that there is a difference
between e.g.yuv420p -> vaapi[bgr0] and a vaapi[yuv420p] -> vaapi[bgr0].
The latter worked without any issues on my hardware, but the first
example fails. To remedy this, we need to also do hardware uploads
during probing against formats and track what actually works (i.e.
vaSurfaceExportHandle). This commit only implements it in vaapi since it
is the only known place where this edge case is relevant. But other
hardware decoding drivers could easily add support later if needed.
2024-09-16 00:07:36 +00:00
Dudemanguy 7a80330be3 wayland: properly use tranche_formats when getting compositor formats
It's a bit roundabout, but we were doing this incorrectly before. The
format table alone isn't good enough because it is possible the the
compositor may advertise different formats for a specific device which
is a subset of the format table. What we need to do is add formats based
on the array in tranche_formats. Note that it is possible for the
compositor to send multiple tranches (was not able to simulate this but
it's allowed by the protocol). For mpv, we only care about the very
first one which is supposed to be the most preferred one. The compositor
can also send the entire chain of events (main device, format_table,
tranches, etc.) all over again. We handle this in the wayland code, but
handling this in mpv's core code isn't done. e.g. say a format in use
was suddenly no longer supported. We ideally should do a full reconfig
in this case, but that gets complicated and is pretty niche so save that
for another day. Multiple GPUs isn't taken into account either. We just
pick the first one. Not strictly correct, but close enough for us.
Fixes #14544.
2024-09-16 00:07:36 +00:00
Dudemanguy 4d09cde8f9 vo_dmabuf_wayland: reject formats not supported by the GPU
The linux-dmabuf protocol gives us the main device being used. Using
that along with some drm code, we can get what drm formats are supported
by the GPU. This is pretty crude as we just check against the first
primary plane we find and hope for the best. Also the protocol can
technically update formats at any time (e.g. if the device changes). We
do update what gets stored in  wl->gpu_formats but the next commit won't
make any attempt to address this hypothetical scenario. It's complicated
and this is better than nothing. In practice, this will only work
against one constant device during VO runtime. Additionally, we can add
this check to ra_compatible_format to filter out additional unsupported
formats.
2024-09-16 00:07:36 +00:00
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