0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
Commit Graph

4491 Commits

Author SHA1 Message Date
Dudemanguy
343a5fd345 player: remove all rpi-specific code
vo_rpi and its related code has pretty much historically been a
disaster in mpv. The build regularly gets broken and since nobody uses
it, it takes months for anyone to notice. There was also that time where
fullscreen was broken for about a year and a half. Also building in waf
was entirely broken for about a couple of years or so due to mysterious
reasons no one ever figured out (meson magically fixed it).

Anyways, once again the build is broken due to rpi being forgotten about
again, but instead of pretending to support this crap. Just drop it all.
Nowadays, mmal hwdec is a relic since these devices are better off using
the v4l2m2m ffmpeg fork instead which actually uses KMS properly. RPI 1
and 2 probably can't do this and will remain broken but oh well blame
Broadcom for being special snowflakes and not using standard APIs (my
rockpro worked out of the box; just saying). RPI 2 is nearly 10 years
old anyways, so I think you can afford a new SBC by now. If we were
nicer, there would be a deprecation period, but this is broken in the
last major release anyway so too late.

Closes #13402.
2024-02-05 17:41:06 +00:00
Dudemanguy
531868fe0d player: ensure runtime updates of certain rendering options
When adding things like brightness or gamma, the video obviously needs a
redraw if paused. This happened to work in the normal case because the
OSD notification triggered a redraw, but if you use no-osd the picture
won't change. Fix this by adding another option flag, UPDATE_VIDEO, and
simply signalling we want a redraw. This gets handled along with the
normal osd redrawing check in the playloop so something like "no-osd add
gamma 1" actually works.
2024-02-05 17:23:47 +00:00
Dan Oscarsson
b23e8b2ffb vo_vdpau: fix timing for nanoseconds
df764bc0c3 and
c82c55b4b9 blindly converted the units for
this VO since neither of us actually have the hardware/setup to test the
VO. Well it was not actually correct (maybe just one was wrong or both
who knows) since vo_vdpau using timing very differently than all the
other VOs and no one reported on it until just now. Anyways, just apply
this random patch from @DanOscarsson which apparently works for him and
call it a day. Fixes #13397.
2024-02-04 10:01:49 -06:00
nanahi
27cb193f0e wayland_common: warn if scrolling will be broken
Since the scroll event handler is moved to wl_pointer_frame, version 5 of
wl_seat is required. Warn that scrolling is broken if the compositor
doesn't support that verison.
2024-02-04 02:14:11 +00:00
nanahi
e0f9cf61b9 wayland_common: add touch listener boilerplate
Required if seat version >=6 is used.
2024-02-04 02:14:11 +00:00
nanahi
b3edb46fd9 wayland_common: prefer axis_value120 if supported
Prefer axis_value120 for high resolution scrolling if supported, which
matches the existing win32 behavior.
2024-02-04 02:14:11 +00:00
nanahi
f95b7146d7 wayland_common: properly handle high resolution scrolling
Commit f54ad8eb05 broke high resolution
scrolling because one logical mouse click is generated for every scroll
event, no matter the magnitude. This makes scrolling on trackpad way
too fast.

Revert the axis scaling change in that commit and clamp the resulting
value between -1 and 1 to make sure mouse wheel scrolling works as
intended on compositors which send a value larger than 10 for these events.
2024-02-04 02:14:11 +00:00
nanahi
aaaadc9d6b x11_common: support --title-bar
Some X11 window managers support controlling the title bar independently
from other window decorations with _MOTIF_WM_HINTS. This allows hiding
the title bar while keeping other decorations like the resizing borders.

Let mpv respect the --title-bar option on X11 so --no-title-bar can hide
the title bar only like on win32.
2024-02-02 11:39:30 +01:00
Dudemanguy
adcc6794b5 wayland: look for "default" cursor as well as "left_ptr"
Some themes are apparently getting rid of "left_ptr" and using the
cursor spec names instead. Check for "default" as well. Fixes #13376.
2024-02-01 15:26:46 +00:00
Kacper Michajłow
e2e75906da io: add mp_save_file
Move from vo_gpu_next.c to io.c and return result.
2024-01-31 15:38:21 +00:00
Kacper Michajłow
69891c4070 vo_gpu_next: save cache to separate files
Save the cache to separate files to avoid loading/saving a huge combined
libplacebo.cache. This approach allows the saving of only new cache
objects and avoids resaving the entire cache, especially even if only a
tiny change was made.

This commit improves the cold start time of mpv and avoids saving data
when it's not necessary.

Number of changes were made:
- each cached object is saved in its own file
- cache files are prefixed with the name of cached object
- cache directory is cleaned on each uninit
    - the least recently used cache files are removed if cumulative cache
      size is above limit
    - files used in the recent 24 hours are not removed to allow changes
      to mpv.conf without worrying about the cache being removed during
      experimentation
- shader cache size limit is set to 128 MiB
- icc cache size limit is set to 1.5 GiB
- cache objects are loaded/saved as needed

This commit eliminates the runtime performance penalty associated with
the size cache. While we continue to maintain the cache limit to prevent
retaining stale objects, mpv now only loads a small subset of files that
are currently required for playback, instead of loading all files.
2024-01-31 15:38:21 +00:00
boogie
d90a5ff17a hwdec_drmprime: add P010 and P210 support 2024-01-28 13:56:58 -08:00
sfan5
c6ccabe585 hwdec_aimagereader: handle lack of JNI gracefully
Hwdec drivers are always loaded so it's rude to abort.
fixes #13367
2024-01-27 22:35:25 +01:00
Kacper Michajłow
dd491c7c61 vo: change vo_frame duration to double
32-bit signed integer can hold ~2.1s stored as nanoseconds. While frame
duration doesn't make sense to be this long, the existing clamp is to
10s. Change type to double, which is consistent with other fields in
vo_frame.
2024-01-27 05:12:36 +00:00
Dudemanguy
c243946338 vo_dmabuf_wayland: scale smarter in hidpi situations
Previously, all scaling was forced to 1 with this vo and all coordinates
were calculated as if the scale was 1. This works since viewport relies
on the compositor completely for scaling so it doesn't really matter if
we don't draw directly to the correct size since the compositor will
just scale the rest for us. This does have some downsides however since
the OSD text might not be drawn at the actual resolution of the final
size of the video.

We can instead handle this by getting rid of the dmabuf_wayland specific
scaling logic and using the same values as everything else. In the
resize in vo_dmabuf_wayland, we just need to adjust the viewport
destination calls so they go to the wayland local coordinates and not
the physical ones. This should ensure that vo_dmabuf_wayland directly
goes to the desired size and the compositor doesn't need to operate on
it after the fact.
2024-01-27 05:12:12 +00:00
Dudemanguy
ded181f642 wayland: don't rescale dimensions if hidpi-window-scale is disabled
If the scaling value changed for some reason, the window geometry would
be recalculated with the new scaling even if this option was disabled.
Properly ignore it.
2024-01-27 05:12:12 +00:00
Dudemanguy
e32554cd57 wayland: drop buffer_scale use for viewporter
The core wayland protocol way of handling scaling is to use the
buffer_scale mechanism. But this sucks in several ways for reasons I
won't list here and fractional scaling rightly avoids this altogether
and uses a buffer_scale of 1 (i.e. not setting it) along with
viewporter. When originally implemented, this was only specifically used
when the fractional scale protocol was available, but we actually can
use it as a full replacement instead. This means that mpv now hard
requires viewporter, but this protocol is supported by everyone and is
one of the few that is actually stable.

How it works is the same regardless of fractional scaling or not. When
the compositor has a scale value not equal to 1, it will always scale
the client by that factor (unless you set buffer_scale). What we do here
is pass a viewporter size that exactly undos the compositor-side scale
(sans a possible rounding error). So what we are left with is just the
exactly physical pixels we want to display. Fixes #13316.
2024-01-27 05:12:12 +00:00
Dudemanguy
99d387bbc8 vo: ensure a dropped frame is always freed
7b8a30fc81 made it possible for a VO to
have direct ownership of frame objects since the it may be beneficial
for the frame to follow the lifecycle of that particular VO instead
(i.e. the wayland compositor for dmabuf-wayland). But when frames are
dropped, this always has to be unconditionally freed since the VO isn't
aware of it. Fixes #13364.
2024-01-26 22:56:50 -06:00
Kacper Michajłow
431759c70c vo_gpu_next: simplify after recent changes 2024-01-22 14:54:55 +00:00
Kacper Michajłow
475f76dc6d csputils: replace more primitives with pl_
We can go deeper, but need to stop somewhere to not reimplement vo_gpu
using libplacebo...
2024-01-22 14:54:55 +00:00
Kacper Michajłow
47be5ad4aa csputils: replace mp_chroma_location with pl_chroma_location 2024-01-22 14:54:55 +00:00
Kacper Michajłow
0ac7a40dac csputils: replace mp_alpha_type with pl_alpha_mode 2024-01-22 14:54:55 +00:00
Kacper Michajłow
66e451f4e6 csputils: replace mp_colorspace with pl_color_space 2024-01-22 14:54:55 +00:00
nanahi
1ea9e51f78 win32: stop waiting for messages if the window is destroyed
GetMessageW will indefinitely block after the window is destroyed.
2024-01-21 17:54:57 +00:00
nanahi
a0ba10b62e command: export current-gpu-context property
This exports `current-gpu-context` property, which is the string
description of the current active GPU context. This allows scripts to
uniquely identify the platform and backend used for --vo=gpu
and --vo=gpu-next.
2024-01-20 17:12:07 +00:00
Guido Cella
07dd577a6b libplacebo: fix out-of-bounds read with --really-quiet
With --really-quiet the message level is -1 which is not in the
msg_lev_to_pl_log enum, so handle it explicitly.
2024-01-20 16:09:54 +00:00
nanahi
146bef059a wayland_common: guard against negative configure sizes
Negative values are nonsense to mpv, and can cause protocol error afterwards,
like xdg_surface::set_window_geometry which doesn't accept negative values.
Treat any negative values as zero (client determines size) for now.
2024-01-19 23:55:52 +00:00
nanahi
9267600792 win32: change to alphanumeric mode on the first keypress
Needed in case the timer solution fails. Note that this will leave the
mode indicator in the language bar showing the original mode until
a key is pressed.
2024-01-15 16:06:06 +00:00
nanahi
758a9658d6 win32: default to alphanumeric input when the IME is first initialized
Some IMEs initialize to composition mode for new windows, which is
undesirable for keyboard control.
Default to alphanumeric input to solve this.
2024-01-15 16:06:06 +00:00
nanahi
7ffd947830 win32: move IME candidate window to video window
By default the IME candidate window appears on the top left corner
of the monitor. Move it to the video window for sane behavior.
2024-01-15 16:06:06 +00:00
nanahi
2b1024fa50 win32: handle WM_UNICHAR
WM_UNICHAR is sent by some 3rd-party IMEs.
2024-01-15 16:06:06 +00:00
nanahi
33e922eabe win32: re-enable IME
The IME is useful for text input. Additionally, Alt+Shift input language
switching doesn't work when IME is disabled even when the languages don't
require IME.

Re-add the VK_PROCESSKEY logic to ensure that IME is handled properly.

Reverts bf6b981367.
2024-01-15 16:06:06 +00:00
llyyr
bd35dc8ce7 wayland: accept active modifiers even if they aren't physically held
We don't care about the physical state of keys, only if they are
effective or not and whether they should affect key processing.
2024-01-13 17:10:52 +00:00
llyyr
02533e5928 wayland: don't ignore key modifiers if they were consumed
According to the xkbcommon docs, `xkb_state_mod_index_is_consumed` is
true when a modifier *may affect* key translation. A key modifier may
be consumed but not be active. See xkb documentation for this function
for further details. This breaks key modifiers in cases where
L_Shift+R_Shift for example is used to change keyboard layout with
`xkb_options grp:shifts_toggle`. Instead, replace it with a simple
check for a valid modifier.
2024-01-13 17:10:52 +00:00
nanahi
4b69164147 x11_common: prefer Xft.dpi for HiDPI scaling
Xft.dpi is much more widely used nowadays by GUI programs compared to
the X11 screen DPI.
This is the best we can get for a vendor-neutral scaling preference
value under X11 in terms of adoption.
If Xft.dpi isn't available, the X11 screen DPI is used as a fallback.
2024-01-10 00:33:05 +01:00
nanahi
a504e696c8 x11_common: allow DPI scale in unit of 0.5
~144 DPI displays are pretty common and neither 1x nor 2x scales are
the right size for it. Allow DPI scale in unit of 0.5 to fix this.

Additionally, add a note about the current behavior of the API used
to get the scale factor.
2024-01-10 00:33:05 +01:00
nanahi
41259db952 vo_gpu_next: respect d3d11 swapchain output format preference
Currently, libplacebo always tries to reconfigure the d3d11 swapchain
to a 10-bit output format because disable_10bit_sdr isn't set to true,
even when an 8-bit format is explicitly requested via
--d3d11-output-format.

Fix this by passing the requested output format preference to libplacebo.
Document that this option may be ignored.
2024-01-06 23:46:12 +01:00
Guido Cella
a16bad4004 vo_sdl: support the focused property 2023-12-29 11:31:18 +01:00
nanahi
26df531b14 win32: add support for --input-cursor-passthrough option
This completes the support for all supported desktop platforms.
2023-12-28 15:45:24 +00:00
sfan5
9565675488 various: use correct PATH_MAX for win32
In commit c09245cdf2
long-path support was enabled for mpv without actually
making sure that there was no code left that used the
old limit (260 Unicode chars) for buffer sizes.
This commit fixes all but one case.
2023-12-27 22:55:56 +01:00
der richter
4d7763e6a6 mac: add support for --input-cursor-passthrough option 2023-12-25 13:59:48 +01:00
der richter
0d47e48437 mac: add support for --auto-window-resize option
Fixes #9325
2023-12-23 01:15:53 +01:00
der richter
fa4ca16f66 mac: update geometry/autofit opts on runtime 2023-12-23 01:15:53 +01:00
Philip Langdale
ef56c0c20a hwdec_drmprime: try and declare support for weird forked ffmpeg formats
As a result of the work I did the explicitly check for formats
supported by the vo in the f_autoconvert logic, I introduced a
regression in the handling of the rpi4_8 and rpi4_10 formats. These
require special handling because they only exist in the rpi forks and
not upstream ffmpeg, which means they don't have stable pix fmt values
that we can use directly.

Previously, we simply didn't declare them as supported, which was ok,
as nothing was really enforcing the list of supported formats, but that
has changed.

As we still can't simply use the pix fmts, I had to do a slightly
ridiculous dance to look them up by name, and if they exist, then
register them as supported.

Good times.
2023-12-15 14:17:19 -08:00
Dudemanguy
f575b3d1bd w32_common: remove executable bit from file
5736737750 mistakenly changed the mode
from 644 to 755. Change it back.
2023-12-15 10:27:44 -06:00
der richter
c661435648 mac: add support for drag-and-drop option 2023-12-15 16:59:52 +01:00
der richter
f805b180d0 mac: add support for window-id property
returns the NSWindow
2023-12-15 09:20:10 +01:00
nanahi
566a96f220 w32_common: rename some camelCase struct member names to snake_case 2023-12-10 16:35:40 +01:00
nanahi
66ebce758f win32: temporarily disable aero shake while dragging hack is active
The dragging hack can cause unwanted aero shake activation.
Prevent this by saving the window arrangement state before dragging,
temporarily disable it while dragging hack is active, and restore to
the original state after dragging ends.
2023-12-10 16:35:40 +01:00
nanahi
5736737750 win32: stop fullscreen window from moving while dragging hack is active
The mouse down handler checks w32->current_fs to determine whether
to begin the dragging hack. Unfortunately, the w32->current_fs value
is stale, because the input is handled asynchronously, and we cannot
wait for an up-to-date value if dragging needs to be kept resonsive.

As a result, when the fullscreen state changes after the dragging
model loop is entered, the opposite value is used, so the window stays
draggable after entering fullscreen, and becomes undraggable after
exiting fullscreen.

With the resonsiveness and model loop constraints, the up-to-date
state must be queried inside WM_MOVING messages which are sent while
dragging. The message handler now checks if the dragging hack is active
while the window is in fullscreen, and overrides the new window position
with the current one, in effect prevents the window from being moved.

The old check is also removed, so the window is now draggable after
exiting fullscreen while dragging hack is active.
2023-12-10 16:35:40 +01:00