Commit Graph

53599 Commits

Author SHA1 Message Date
Attila Fidan
98627b027d video/out/wayland_common: fix crash with multi-seat drag and drop
If you have two seats connected, both with the pointer capability, and
use two hands to start a drag and drop operation with each pointer, then
move one pointer to the mpv window, then the other, mpv fails the
!wl->dnd_offer->offer assert in device.enter, because it expects that
the compositor wouldn't just call device.enter again before device.leave
or offer.finish.

The data device is per-seat, so this commit makes mpv track the data
device's offers per-seat rather than in vo_wayland_state, which makes
more sense and is easier to reason about when multi-seat is involved.
2025-01-26 16:32:30 +00:00
Kacper Michajłow
3550ec52cd Revert "ci/win32: restrict shaderc version to fix build errors"
This reverts commit ddba159b51.

Follow-up after: 3b586ba6c3
2025-01-25 18:34:28 +01:00
nanahi
f1924988dc various: update license headers
Change MPlayer to mpv and the last sentence like all other files.
2025-01-25 18:33:43 +01:00
sfan5
3b586ba6c3 ci/mingw: update library versions
also moves shaderc to latest git again
2025-01-25 15:39:36 +01:00
Guido Cella
04c328f784 console.lua: use the same blur amount as --osd-blur
I have no idea why, but console's blur is smaller than in OSD messages
and stats (regardless of persistent_overlay). It's smaller regardless of
scale_with_window, or if using 0 PlayRes like stats with
persistent_overlay=yes.

With scale_with_window=yes, multiplying the blur by 2.5 seems to make it
the same. This is probably because 2.5 is 720 / 288, which are the base
height sizes scale from and the OSD's PlayResY. With
scale_with_window=no, we need to multiply by osd_h, which is always 720
with scale_with_window=yes.
2025-01-25 03:14:59 +00:00
Attila Fidan
51dc6286b6 video/out/wayland_common: support IME usage via text-input-v3
This is useful for text input in, for example, console.lua. Each
character in the commit string gets turned into an mpv key press.
Pre-edit strings are not handled, since there's currently no good way to
handle that or make it useful to text input scripts. Like win32, which I
tested in wine, another limitation is that the composition window is
always positioned at the top left of the window, since we cannot get
useful positioning hints from mpv scripts. It allows the composition
window to be within the window and avoids obstructing the console
prompt.

This can be enabled/disabled with --input-ime=<yes|no> (default: yes).
2025-01-25 03:14:44 +00:00
Kacper Michajłow
14520229da github/workflows/lint: add mypy linting
Not everything is typed in our scripts, but this is just to make sure
current code passes linting. More typing can be added in the future.
2025-01-25 02:35:54 +01:00
Kacper Michajłow
e8fa2a7aaa TOOLS/osxbundle: fix inplace argument type 2025-01-25 02:35:54 +01:00
Kacper Michajłow
805793154d TOOLS/macos-sdk-version: check if xcodebuild is defined
Makes mypy happy.
2025-01-25 02:35:54 +01:00
Kacper Michajłow
37b513a760 TOOLS/file2string: use array of tuples to avoid unpacking strings 2025-01-25 02:35:54 +01:00
Kacper Michajłow
da2880fb54 TOOLS/dylib_unhell: check regex search result 2025-01-25 02:35:54 +01:00
Kacper Michajłow
2d5c5030e5 TOOLS/stats-conv: typing fixes
To make mypy happy. PyQtGraph doesn't define types, so ignore those.
PyQt6 has types, but we use only one function from it, so to avoid
installing it, ignore it too.
2025-01-25 02:35:54 +01:00
Kacper Michajłow
59afdf2ef8 TOOLS/gen-mpv-desktop: don't overlap variable with different types 2025-01-25 02:35:54 +01:00
Kacper Michajłow
4cf914d44d TOOLS/gen-interface-changes: fix variable type mismatch 2025-01-25 02:35:54 +01:00
Guido Cella
d87113fdc7 m_option: fix float option values <= 0
FLT_MIN is a small positive number (1.175494e-38), so the check v <
FLT_MIN introduced in 0e7f9c39dc made all 0 and negative float option
values error, e.g. panscan=0 or video-align-y=-1.

Fixes 0e7f9c39dc, fixes #15728.
2025-01-24 15:03:04 +00:00
Dudemanguy
a23b11af5f github/workflows: print meson test log on failure on BSD
A build failure will output its error, but a test failure says nothing
other than what test failed. Print the meson test log as well.
2025-01-24 14:55:03 +00:00
Guido Cella
20375d1133 select.lua: show the ID of editions without title
MKV editions can have no title. Print "Edition" and their IDs instead of
showing an empty selection.
2025-01-24 04:35:36 +00:00
Guido Cella
5bbeabf450 console.lua: sort completions
With the previous commit, this sorts completions with the same score
alphabetically.
2025-01-24 04:35:27 +00:00
Guido Cella
8ae3beeb98 console.lua: preserve the order of items with equal score
table.sort() is unstable, meaning that it randomly reorders items with
the same score, so currently fuzzy_find() checks if the line is empty to
not change the original order of the unsorted items. But actually filled
lines have the same problem: e.g. searching foo with filenames like
foo_{1..99}, they are returned in random order.

To fix this sort by score only when 2 items have different score, else
sort by the original position.
2025-01-24 04:35:27 +00:00
Guido Cella
7ded290e2c console.lua: rename format_table() to format_grid()
Since there is no table header or predetermined columns.
2025-01-24 04:34:49 +00:00
Guido Cella
0c5d966f47 console.lua: always say completions instead of suggestions
Both completions and suggestions were being used inconsistently. Just
always use completions which is much more common.
2025-01-24 04:34:49 +00:00
Guido Cella
a2ce811b28 console.lua: rename update() to render()
It is not clear what update() updates, in fact this rename allows
removing the comment explaining it. render() is clearer and is the same
term used by the OSC.
2025-01-24 04:34:49 +00:00
nanahi
afd5a741c1 m_option: use VAL macro for double type 2025-01-24 04:25:15 +00:00
nanahi
cbe2b0b4fe m_option: fix max/min range comment
The float type is now correctly clamped, so correct the
outdated comment.
2025-01-24 04:25:15 +00:00
nanahi
0e7f9c39dc m_option: correctly clamp OPT_FLOAT values
OPT_FLOAT values currently reuses OPT_DOUBLE handling, but if a
finite double value is produced which is out of the float range,
it results in UB.

If the floating point implementation is IEEE-754, then the value is
converted to infinity and stored in the float. However, this still
does not work as intended, as infinity is rejected for OPT_DOUBLE
unless infinity is explicitly specified as the min/max range.

Fix this by adding another clamping stage after operating the values
as double. Finite double values are clamped between FLT_MIN and
FLT_MAX, and out of range error is signaled when suitable.
2025-01-24 04:25:15 +00:00
nanahi
0903e9fbd4 various: fix range for float options
The range of these options should be capped to FLT_MAX
instead of DBL_MAX.
2025-01-24 04:25:15 +00:00
Guido Cella
df3872e318 loadfile: fix --loop-playlist + --shuffle + --prefetch-playlist
With this combination of options, the playlist is shuffled every time
the last playlist is reached, instead of when restarting from the first
playlist entry. Abort prefetching in this case, as we can't predict
which file to prefetch until the playlist is shuffled when actually
going to the first file again.
2025-01-22 14:01:11 +00:00
Guido Cella
304a620b0b loadfile: return earlier if prefetch already started
There is no need to call mp_next_file() if prefetching already started,
so return earlier.
2025-01-22 14:01:11 +00:00
Guido Cella
e7a253614c loadfile: fix --loop-playlist=N with --prefetch-playlist
With --prefetch-playlist and --loop-playlist, mp_next_file() is called
continously since the last second of playback or when viewing an image,
which decreases --loop-playlist=N to 1.

Fix this by adding a flag to mp_next_file() to specify whether to
decrement --loop-playlist=N. The first playlist entry is still
prefetched when it's the next one, but without decrementing
--loop-playlist=N.
2025-01-22 14:01:11 +00:00
Guido Cella
effa81eb6e console.lua: set a high z in select mode
Give console's overlay a high z only in select mode, since in this case
you want to click it so it should be above other overlays. In particular
console should be above the OSC's box layout with visibility=always when
you show it by clicking its buttons.

Keep using z=0 otherwise when it doesn't handle clicks, to avoid
unintuitive behavior of overlays handling clicks like the OSC being
drawn below console.

Since the legacy mp.set_osd_ass() doesn't accept z, we need to repeat
its caching logic, like 490b3ba007 and 86d24b069b did for the OSC.
2025-01-22 12:55:24 +02:00
Guido Cella
2ecfe3ecf7 Revert "osc.lua: draw box layout below console"
This reverts commit 2dd5bd4cd1.

Instead of drawing the box layout below any other overlay with z >= 0
which may not be wanted, the next commit will increase console's z only
in select mode instead.
2025-01-22 12:55:24 +02:00
llyyr
4c083f130d DOCS/interface-changes: change rst exts to txt
gen-interface-changes.py only looks for .txt files.
2025-01-21 17:44:16 +01:00
Guido Cella
c438732b23 console.lua: improve the hovered item calculation
Currently determine_hovered_item() assumes that each item is
opts.font_size pixels tall, which usually works well. This breaks with
fonts that get drawn taller than that, such as Japanese text, which
makes the calculation inaccurate for the top items and clips the
counter. A couple of users reported that it is inaccurate for them for
the top items even with ASCII characters in track selectors, presumably
because the circles are taken from a different font and make all lines
taller.

To fix this place each selectable item in its own ASS event positioned
like determine_hovered_item() expects.

Unfortunately this breaks --profile=box, so keep placing every item in
one ASS event with it.
2025-01-18 12:52:02 +01:00
Guido Cella
89c42e4481 console.lua: deduplicate y position calculation in update()
This deduplicates the calculation of the y position by assigning it to a
y variable, which will also be used in the next commit. margin_x is also
renamed to x for consistency.
2025-01-18 12:52:02 +01:00
Guido Cella
a06883f79a console.lua: refactor some log code
Rename lines_max to max_lines which is the name used in other functions,
and inline the log_messages variable because its name was confusing.

The math.max(0, lines_max) call was not necessary because console
doesn't crash with 0 or negative max lines.
2025-01-18 12:52:02 +01:00
Attila Fidan
c9412b4721 video/out/wayland_common: ignore clipboard offers w/o wanted MIME type
Some Wayland clients not offering text/plain will send their non-text
data regardless of the MIME type requested in wl_data_offer.receive. We
should just not call receive if they haven't offered a MIME type we
want.
2025-01-18 12:51:05 +01:00
Guido Cella
ca211b5b88 ytdl_hook.lua: fix start and end conditions
Fixes #13358, fixes fcc67cc6c1.
2025-01-10 14:06:16 +01:00
llyyr
f049a1e91c m_option: fix scientific notation timestamp parsing
Fixes: a173b47748
2025-01-09 23:54:59 +01:00
Guido Cella
7a59a12b76 select.lua: select files with watch later files with g-w
Implement selection of files to resume playing from watch later config
files. Requires --write-filename-in-watch-later-config.
2025-01-05 23:21:50 +01:00
Guido Cella
b530b402bf command: add current-watch-later-dir property
It will be used in the next commit.
2025-01-05 23:21:50 +01:00
Guido Cella
0c3c4a315b select.lua: use mp.msg.warn for unavailable messages 2025-01-05 23:21:50 +01:00
Kacper Michajłow
d66047589a ao_pulse: remove unnecessary casts and use the proper print specifier 2025-01-05 22:32:40 +01:00
Guido Cella
31d4515157 osc.lua: extract icon_font and icons variables
Define the icon font and icons in variables instead of scattering them
throughout the code to make it easy to change them in the future, or for
forks to change them. Also put the hex values in comments to easily
compare which icons in the font are unused, and explain how to get the
decimal values of the bytes.

Copied from ModernX.
2025-01-05 22:31:59 +01:00
Guido Cella
ff518ee6f0 DOCS/interface-changes: add slim*bar layouts to interface changes 2025-01-05 22:03:36 +01:00
nanahi
c42b19b806 video/out/gpu/video: allow taking transparent screenshots
Use RGBA format to take transparent screenshots when the video has
an alpha channel.
2025-01-05 21:32:55 +01:00
nanahi
72550aa7df console.lua: complete screenshot-raw format parameter 2025-01-05 21:28:57 +01:00
nanahi
ab47e95197 player/screenshot: support more formats for screenshot-raw command
This adds a format parameter to screenshot-raw command which controls
the format of the returned image data. In addition to the bgr0 format,
this adds support for 3 other formats: bgra, rgba, rgba64.

bgra is used by overlay-add command and several window systems.
rgba and rgba64 are used by several GPU APIs and are the formats
returned by the gpu and gpu-next screenshot code, which avoid the need
for further format conversion (see convert_image function).
rgba64 also adds the ability to acquire high bit depth screenshots
for screenshot-raw command.
2025-01-05 21:28:57 +01:00
nanahi
c1237c1d48 player/screenshot: add high depth and format parameters
Add the ability for screenshot_get_rgb to request high depth and other
formats. Will be used for the next commit.
2025-01-05 21:28:57 +01:00
Guido Cella
8ed672ffc8 osc.lua: add slimbottombar and slimtopbar layouts
Add layouts with only the top line of bottombar to be used with images.
2025-01-05 21:24:02 +01:00
Tim Lodemann
31d1defb7a ao_openal: fix null pointer dereference when creating OpenAL context
When the monitor goes to sleep, the OpenAL context was not properly
handled, resulting in a null pointer dereference and a crash. This
fix ensures that the OpenAL context is created and set correctly,
avoiding crashes under these conditions.

Fixes: #15648
2025-01-05 21:22:35 +01:00