Commit Graph

51650 Commits

Author SHA1 Message Date
der richter d6fdc0ae74 DOCS: make mentions of macOS consistent
change all mentions and variations of OSX, OS X, MacOSX, MacOS X, etc
consistent. use the official naming macOS.
2024-02-21 20:46:53 +01:00
nanahi 24afc00b8c DOCS/man: document Ctrl+WHEEL_UP/WHEEL_DOWN keybinds
Also remove the existing redundant wordings.
2024-02-21 18:55:43 +00:00
nanahi de4f301891 input.conf: bind Ctrl+WHEEL_UP/DOWN to video-zoom
There are good reasons to bind Ctrl+WHEEL_UP/WHEEL_DOWN to video-zoom:

- They are ubiquitous and familiar key bindings to represent zooming
operations, which are used in all popular web browsers, document viewers,
and document editors.
- Because WHEEL_UP/WHEEL_DOWN are scaled with high-resolution scrolling
input devices like touchpads, this allows smooth zooming.
- This makes "pinch to zoom" with touchpads and touchscreens work out of
box on Windows, since by default applications receive these key inputs
for pinch gesture.
- It had been considered to bind these keys to window-scale instead.
However, this results in horrible UX as the keybinds work only when the
mouse pointer is over the mpv window, and if the window shrinks during
this operation, the window below mpv now receives these keybinds,
resulting in unwanted zooming for that window, which violates the principle
of least surprise.
2024-02-21 18:55:43 +00:00
llyyr 362959ace3 DOCS/mpv: update ancient profiles config example
Hopefully actually useful now. Also updates big-cache to not be smaller
than the current default.
2024-02-20 23:11:39 +01:00
der richter f9197e07ee osxbundle: add optional source path argument 2024-02-20 20:55:12 +01:00
der richter 166f039edb osxbundle: remove old version retrieval fallback 2024-02-20 20:55:12 +01:00
der richter 6b5b4b74b1 osxbundle: bundle vulkan driver and layers
only bundle synchronization2 layer for older vulkan/MoltenVK versions
where it is needed.

Fixes #13232
2024-02-20 20:55:12 +01:00
der richter 0e441525cf vo: make libmpv last in the auto-probing order for cocoa-cb only
this partially reverts commit 7b5a258. back then the only properly
working vo on macOS was cocoa-cb (libmpv). it would always use the
deprecated opengl cocoa backend or no vo at all. because of that libmpv
was moved to the top of the auto-probing order, so the preferred vo
was used on macOS only.

we now have a working vulkan gpu/gpu-next backend on macOS which should
be the new default vo. though disabling the auto-probing again for
libmpv would probably cause the undesired behaviour on macOS that
cocoa-cb would never be auto selected again. especially if not build
with vulkan support or without vulkan driver on macOS, this would lead
to no video output at all. so instead of completely reverting the
mentioned commit, we instead move libmpv to the bottom of the
auto-probing order but only auto select it when mpv was built with
cocoa-cb support. this restores the previous behaviour on all other
platforms besides macOS, but also lets us auto select cocoa-cb if
supported.
2024-02-20 20:42:02 +01:00
llyyr 4a563a6390 encode_lavc: don't use deprecated `avcodec_close`
Deprecated upstream 1cc24d7495
2024-02-19 18:09:58 +01:00
llyyr 6a5a3ec3bf af_lavcac3enc: don't use deprecated `avcodec_close`
Deprecated upstream 1cc24d7495

We need to reallocate the context here because `avcodec_free_context`
also frees the context, and we want to reuse the context with some
reconfig.
2024-02-19 18:09:58 +01:00
Julian Orth 0ef78c1aa5 wayland_common: update pointer serial on pointer_enter 2024-02-18 18:21:02 +00:00
der richter ac275a823d cocoa-cb: lock CGLContext on uninit and manual redraw
this fixes a crash on quit, when a CATransaction from a system owned
thread/event is happening at the same time. locking the context
synchronises these access and prevents the race condition.

the draw operation induced by any display call from the CAOpenGLLayer
doesn't need that lock, since the display function already does lock
that current context.

Fixes #11681
2024-02-18 17:25:05 +01:00
Dudemanguy 3fd840f85d github/workflows: switch back to luajit for macos
Homebrew finally pulled the plug on lua 5.1*, and it is no more. So we
have to change to a different lua package and the only other choice is
luajit (no 5.2 in homebrew). We used to use luajit for the ci, but
649556b2b6 switched it to lua 5.1. As
explained there, luajit 2.0 was horribly bugged and not usuable for mpv
and the build had to do dumb hacks to work around it. I expected 5.1 to
last a bit longer than a couple of years, but luckily it seems like
luajit in homebrew now pulls a luajit 2.1 version (some rolling release
thing or however upstream works). The details don't really matter for
us since 2.1 does not have all the awful issues that 2.0 used to have.
So just switch to luajit again.

*: 57d73df3ba
2024-02-18 00:39:50 +00:00
Dudemanguy bd5b80ba2c vo_gpu_next: fix some lut-related memory leaks 2024-02-17 18:56:20 +00:00
Dudemanguy 85e84f6d92 vo_gpu_next: move gpu-next opts to specific sub option
This matches the general workflow in the codebase. We keep a cache of
these new options and update them if needed.

Fixes #13481 and fixes #11518.
2024-02-17 18:56:20 +00:00
Dudemanguy 073858fcdd vo: remove VOCTRL_SET_EQUALIZER and simplify into UPDATE_VIDEO
Since 03cf150ff3, the only purpose of this
VOCTRL was to signal a redraw to the vo. It actualy could have been
removed in 531868fe0d, but this was
missed. The UPDATE_VIDEO flag is better anyway because it allows us to
handle a wide variety of options scattered around that require the VO to
update itself and redraw. We can remove both of the custom callbacks in
vo.c and only leave the VOCTRL_VO_OPTS_CHANGED one. Additionally, that
commit also introduced vo_set_want_redraw, but this is redundant and not
needed. The VOs that use VOCTRL_UPDATE_RENDER_OPTS already set
vo->want_redraw, and those are the only VOs where these options are
relevant in the first place. So we can remove this as well and just let
the big callback in player/command do everything.
2024-02-17 18:56:20 +00:00
nanahi fb33bb7fc4 wayland_common: drop shape device check when spawning cursor
It's only necessary to check the existance of cursor_shape_manager.
Also drop the pointer check to handle multi-seat since a removed seat
sets the cursor_seat to NULL.
2024-02-17 16:09:41 +00:00
nanahi b441a5dd1f wayland_common: properly determine has_keyboard_input
Track has_keyboard_input per seat and consider mpv having keyboard input
if at least one seat has keyboard input.
2024-02-17 16:09:41 +00:00
nanahi a6ae2e7e60 wayland_common: handle scroll accumulation for each seat
Since it's needed to determine whether an axis event has axis_value120,
do this per seat to avoid interference between seats.
2024-02-17 16:09:41 +00:00
nanahi 04bc6a4a43 wayland_common: handle keyboard state per seat
Avoids modifiers from mulitple seats from interfering with each other
and messing up xkb states.
2024-02-17 16:09:41 +00:00
nanahi b6dcf9ecee wayland_common: set cursor visibility for all seats for voctrl
For VOCTRL_SET_CURSOR_VISIBILITY, set cursors visibility for all seats.
The return is VO_NOTAVAIL is none of the seats have cursor, and
VO_FALSE if setting visibility failed for at least one seat.
2024-02-17 16:09:41 +00:00
nanahi b86768b356 wayland_common: handle removal of seats 2024-02-17 16:09:41 +00:00
nanahi cdca02a34d wayland_common: prevent cursor_seat stale reference
Set it to NULL on vo uninit.
2024-02-17 16:09:41 +00:00
nanahi a593a9ec12 wayland_common: handle cursor_shape_device per seat
The cursor_shape_device is per pointer, which is per seat. Handle it
together with other seat objects. This in turn also handles cursor
visibility per seat.
2024-02-17 16:09:41 +00:00
nanahi 27d973ba34 wayland_common: drop unnecessary xdg_toplevel null check
The vo init already fails if xdg_toplevel creation fails, so these
checks after the vo is initialized is unnecessary.
2024-02-17 16:09:41 +00:00
nanahi 2274311b25 wayland_common: implement multi-seat support
On a multi-seat setup, wl_registry_global advertises wl_seat multiple times,
one for each seat. if wl->seat is already set, the previous value will be
overwritten, preventing it from being freed.

Additionally, if the latter seat doesn't have the capabilities of the
former seat, the keyboard/pointer/touch input devices will be destroyed
because the current wl_seat_capabilities doesn't distinguish between
different seats. This casues keyboard/pointer/touch not working if the
latter seat has no such capabilities.

Fix this by implementing multi-seat support.
This allows receiving inputs from all devices on all seats.
All seat-specific objects (wl_keyboard/pointer/touch, wl_data_device)
are grouped with their respective seats so they can be managed together.

Note that currently inputs from all seats are interleaved with each other
and modify the same global input states.
2024-02-17 16:09:41 +00:00
nanahi 5557eda842 wayland_common: indentation nit 2024-02-17 16:09:41 +00:00
nanahi e0ddc0f69e vulkan/context_win: make --alpha work and runtime changeable
If libplacebo manages to create a vulkan swapchain that allows
alpha composition mode to be controlled by the DWM API,
this makes it runtime changeable.
2024-02-17 16:06:33 +00:00
nanahi 095038b1bc opengl/context_win: make --alpha runtime changeable
Same as d3d11, but since SetPixelFormat can be only called once,
cAlphaBits in PIXELFORMATDESCRIPTOR must be set to make this work.
2024-02-17 16:06:33 +00:00
nanahi 8de67a4af5 d3d11: make --alpha runtime changeable
The DWM compositor transparency API is runtime changeable.
Handle this in update_render_opts.
2024-02-17 16:06:33 +00:00
nanahi 117622cd4a opengl/context_win: make --alpha=yes work
Specify cAlphaBits in PIXELFORMATDESCRIPTOR makes the pixel format
transparent, as is already the case for d3d11. Also makes the
window transparent when --alpha=yes is used.

Works on --vo=gpu and --vo=gpu-next.
2024-02-17 16:06:33 +00:00
nanahi a61026aec3 d3d11: set window to transparent if --alpha=yes is specified
This makes --alpha=yes work with d3d11 and --d3d11-flip=no.
transparent window doesn't work with flip model swapchain by design.
2024-02-17 16:06:33 +00:00
nanahi cef378b0a3 w32_common: add function to control window transparency state
Use the DWM API to enable and disable compositor transparency.
2024-02-17 16:06:33 +00:00
Dudemanguy 965119a2b7 command: add window-id to MPV_EVENT_VIDEO_RECONFIG property change
25b66256d7 originally added this
property, but it did not add it to the property notification. This is
possibly because the window id doesn't appear to change on x11 even when
toggling VOs at runtime. However, windows uses this property and
apparently the id changes there so we should signal updates when
appropriate. Fixes #13495.
2024-02-17 15:41:23 +00:00
nanahi 98005003da DOCS/man: add description of display-names property for wayland
On wayland, depending on the wl_output protocol version used,
the display-names property can have different values. Mention
this in the documentation, like for other platforms.
2024-02-16 23:06:13 +00:00
Dudemanguy c0c32b270e vo_gpu_next: don't add 0 width/height sub bitmaps to pl_overlay
Previously, libplacebo would fail to render the image since mpv was
feeding it bogus bitmaps with 0 width/height. An easy way to encounter
this would be to set sub-scale to 0 with bitmap/image subs.
2024-02-16 22:46:31 +01:00
Jose Maldonado aka Yukiteru 293532057e osdep/threads-posix: fix headers for OpenBSD build
In OpenBSD the compilation fail because osdep/threads-posix.h
need include pthread_np.h
2024-02-15 16:46:12 +00:00
nanahi e19061605f DOCS: document --input-preprocess-wheel option
Document the use cases for enabling or disabling the wheel preprocessing.
Also note that this option has no effect on any filtering already done
by the OS/driver.
2024-02-15 16:44:32 +00:00
nanahi 690dc201ad input: add --input-preprocess-wheel option
This adds --input-preprocess-wheel option, which can be used to control
whether to preprocess received wheel events.

Commit 937128697f added preprocessing of
wheel events to prevent the accidental scrolling of another direction
when one direction is being scrolled for touchpads, which is problematic
with the default wheel bindings where unrelated functions (seeking and
volume) are used for the 2 directions.

However, this behavior is undesirable in the following situations:

- When custom wheel bindings are used so that the 2 directions are used
for closely related actions, such as panning. With preprocessing,
diagonal movement is impossible.
- Since the wheel deadzone was introduced to prevent accidental scrolling
for touchpads, this filtering provides no benefit for high resolution
unidirectional mouse wheels, while causing a regression where scrolling at
least 0.125 units is required to trigger the event, causing input delay.

By adding this option, these two use cases are addressed.
2024-02-15 16:44:32 +00:00
gaesa d8f4749c34 DOCS/lua: clarify `repeatable` and `complex` for `add_key_binding`
The current documentation lacks clarity regarding the interaction
between the `repeatable` and `complex` options. Through an analysis
of the source code (`player/lua/defaults.lua` and
`player/js/defaults.js`), it was observed that the `repeatable` option
is only meaningful when the `complex` option is not enabled.
Additionally, the `complex` option in the existing documentation is
confusing, actually `fn` can be called on key repeat when `complex` is
`true` and `repeatable` is not `true`.

To address these issues, the documentation for the `repeatable` option
was updated to specify that it only applies when the `complex` option is
not set to `true`. Furthermore, the description of the `complex` and
`event` were revised to acknowledge the occurrence of key repeat events.
2024-02-15 16:43:46 +00:00
Kacper Michajłow 024e49010c m_option: fix memory leak in parse_obj_settings_list
Found by fuzzing.
2024-02-15 16:43:37 +00:00
Kacper Michajłow f413e38e42 demux_mkv: don't return null bstr with size specified
Such bstr object are not valid. Also reject empty blocks.

Found by fuzzing.
2024-02-15 16:43:37 +00:00
Kacper Michajłow 5e54a871c5 demux_mkv: error if needed compression settings were not found
Mode 3 is header stripping and we need ContentCompSettings to
reconstruct the data.

Found by fuzzing.
2024-02-15 16:43:37 +00:00
Kacper Michajłow 4419e5c41b demux_mkv: fix memory leak on invalid blocks
It is possible to have data with empty block that contains additions. In
which case the block would not be added and the additions would leak.

Found by fuzzing.
2024-02-15 16:43:37 +00:00
Thomas Weißschuh 5c252715bd ao_pipewire: add support for SPDIF formats 2024-02-15 16:43:25 +00:00
Thomas Weißschuh 790b12da89 ao_pipewire: don't interpret unknown formats
Interpreting data in the wrong sample format has unpredictable results
and may damage hardware and hurt users.
Instead error out.
2024-02-15 16:43:25 +00:00
Dudemanguy 195aa7fd96 DOCS/options: mention that sub-clear-on-seek can now break things
This is technically due to the previous commits that made subtitle
rendering more efficient by eliminating redraws, but working around this
particular edge case is useless. The sub-clear-on-seek option was
originally introduced in d5940fabcd and
specifically is a workaround for completely broken mkv files. There is
no reason to use it otherwise. Because that option disables all
duplicate checking and the previous commits rework subtitle rendering in
the still image case to be dependent on keeping track of packets, the
end result is that you will get the same line rendered multiple times.
However the important case of broken mkv files with duplicate ReadOrder
fields still work just fine with --no-video. So instead of bothering
trying to make this option "work", just clarify that stuff can break
since, again, there's no reason to use it other than as a workaround for
broken files.
2024-02-15 16:43:11 +00:00
Dudemanguy 4e5d996c3a player/sub: attempt to detect animated subtitles
The previous commits optimized sub redrawing on still images/terminal so
mpv wouldn't redraw so much. There is a gap though. It only assumes
static subtitles. Since ASS can be animated, those types of subtitles
will always need redraws so we need to build in specific detection for
this. We need to build a whitelist of events in ASS that are considered
animations and then flag the packet. Additionally, there's a bunch of
annoying bookkeeping that has to be done since packets can be dropped on
seeks and so on.
2024-02-15 16:43:11 +00:00
Dudemanguy 25bba7c811 vo_gpu_next: move the frame->redraw check for blended subtitles
Cosmetic. Since the previous commit eliminated wasteful redraws, nuke
the comment while we're at it.
2024-02-15 16:43:11 +00:00
Dudemanguy 8f043de961 player/sub: avoid wasteful subtitle redraws
This only affects two special cases: printing subtitles to the terminal
and printing subtitles on a still picture. Previously, mpv was very dumb
here and spammed this logic on every single loop. For terminal
subtitles, this isn't as big of a deal, but for the image case this is
pretty bad. The entire VO constantly redrew even when there was no need
to which can be very expensive depending on user settings.

Instead, let's rework sub_read_packets so that it also tells us whether
or not the subtitle packets update in some way in addition to telling us
whether or not to read more. Since we cache all packets thanks to the
previous commit, we can leverage this information to make a guess
whether or not the current subtitle packet is supposed to be visible on
the screen. Because the redraw now only happens when it is needed, the
mp_set_timeout_hack can be removed.
2024-02-15 16:43:11 +00:00