Commit Graph

53673 Commits

Author SHA1 Message Date
Guido Cella a0de894d4c console.lua: determine completions with fuzzy search
For example, set vo gn<Tab> will complete to gpu-next.
2024-11-23 10:48:32 +01:00
Kacper Michajłow 2183f771ef vo_gpu_next: fix mp_image colorspace with some hwdecs
Fixes: ef6052c01e
2024-11-23 10:48:22 +01:00
llyyr e2a23e08b8 wayland: don't print same message for fractional and wl_surface scale 2024-11-23 04:42:52 +00:00
Kacper Michajłow 3e10309b62 player/loadfile: prefer non-image when selecting video track
This fixes `ytdl_hook`, which would start playback with the thumbnail
track selected. This issue occurs because the thumbnail track is added
first. If the main track is not marked as default afterward, which it
isn't for single streams, the first track (the image track) would be
selected.

In general, if a non-image track is available, it should be preferred.
2024-11-22 21:14:52 +01:00
Jan Ekström 7f49806cf4 ci/lint-commit-msg: move away from things deprecated in Python 3.9
As normal types started being supported better for type hinting,
their alternatives in the typing module would be deprecated.
2024-11-22 21:50:25 +02:00
Jan Ekström 45a72d6bec github/workflows: switch Ubuntu mingw-w64 build to pkgconf
Ubuntu 24.04's pkg-config is already an almost empty transitional
package that depends on pkgconf, and pkgconf contains the
`/usr/bin/pkg-config` binary.

Thus while we are moving macOS to it, we shall do the same with
this mingw-w64 build.
2024-11-22 21:50:25 +02:00
Jan Ekström 1f0ec5cd02 github/workflows: unlink macOS pkg-config if installed
This works around an issue with recent Github CI runners where
Homebrew is in an intermediate state. This is where old pkg-config
is installed, yet pkg-config as a package has become an alias
for pkgconf, thus causing failures to automatically switch symlinks
from one to the other.

Ref: actions/runner-images#10984
2024-11-22 21:50:25 +02:00
Jan Ekström 1bc7e62e9e github/workflows: switch from pkg-config to pkgconf for macOS
Is now available, and pkg-config as a package has been deprecated.
2024-11-22 21:50:25 +02:00
Guido Cella cf3bc0a722 console.lua: limit the length of selectable items
Giving very long lines to libass freezes mpv and makes the CPU spin
(though it's fine with terminal output). This is often the case
user-data/mpv/ytdl/json-subprocess-result in the property list. So limit
the length of selectable items to 300 characters (not Unicode aware).
This is enough to fill a 1920x1080 window with font_size=16 and Japanese
text.
2024-11-22 19:04:51 +01:00
Guido Cella 5ec569d073 console.lua: strip multiple lines in selectable items
If an item contains newlines, it hides the top items. This is often the
case for sub-ass-extradata and metadata/ytdl_description in the property
list. So keep only the first line.
2024-11-22 19:04:51 +01:00
nanahi 33e297bd8f video/out/wayland_common: initialize offer fd 2024-11-22 11:21:26 +01:00
nanahi 70e02e7b4e video/out/wayland_common: fix dnd with focus follow mouse
Whenever mpv window gains focus, a new data offer is sent for the
selection. However, mpv currently treats it the same as dnd data
offers, which results in wrong handling. One bug which results from
this is when focus follow mouse is enabled, dropping the dnd file
results in the window being focused and selection offer being sent,
freeing the existing dnd offer. This results in dnd being broken
on at least GTK3.

Fix this by separating selection and dnd offer handling. Since there
is no way to know whether an offer introduced by
data_device_handle_data_offer is a selection or dnd offer, make it
pending, and move them once the identity is confirmed.
2024-11-22 11:21:26 +01:00
nanahi eb0c4b91c1 video/out/wayland_common: extract data offer to a struct
The data offers can be either dnd or selection offers.
Add a separate struct for it so that handling of selection
offers can be added.
2024-11-22 11:21:26 +01:00
norinoriko 68d9ed2572 sub/osd: adjust osd margins 2024-11-21 16:14:07 +01:00
Kacper Michajłow 4b11f66eb1 various: use avcodec_get_supported_config() to resolve deprecation warn
See: https://github.com/FFmpeg/FFmpeg/commit/3305767560a6303f474fffa3afb10c500059b455
2024-11-20 20:42:33 +01:00
Kacper Michajłow 23262308d6 vo_gpu_next: restore initial hook param value
If the parameter is removed from the `glsl-shader-opts` list, it should
be restored to initial value.
2024-11-20 20:41:49 +01:00
Kacper Michajłow 012d317a1e vo_gpu_next: clear renderer cache on options update
This ensures that options are applied to current frame, even in paused
state.
2024-11-20 20:41:49 +01:00
Kacper Michajłow ef6052c01e vo_gpu_next: remove colospace overrides
Hacks like that has no place here, mp_image should be tagged correctly,
across the player, gpu-next is not special.
2024-11-20 20:40:05 +01:00
Kacper Michajłow 4e5cc9cf1d video/mp_image: fix vf=format colorspace override for XYZ
If format is RGB but flagged as XYZ it should be used instead.
2024-11-20 20:40:05 +01:00
Kacper Michajłow 638ada18f8 etc/builtin.conf: add osd-box/sub-box/box profiles 2024-11-20 20:39:26 +01:00
der richter 45c1c58680 mac/compat: fix compatibility for deployment targets lower than SDK ver
the swift parts can't be nicely encapsulated in the compat file because
it lags proper target version compile time checks.

Fixes #15292
2024-11-18 19:28:35 +01:00
M Stoeckl 46574d479d console.lua,wayland_common: also detect Wayland if WAYLAND_SOCKET set
While most Wayland compositors provide a socket path indicated by
environment variable WAYLAND_DISPLAY, others may sometimes bequeath a
socket file descriptor specified by WAYLAND_SOCKET.
2024-11-18 16:35:57 +00:00
nanahi 998bdef1d0 DOCS/man/input.rst: add sections to categorize commands
mpv has too many commands and they are unorganized in the
documentation, making it difficult to navigate.

This commit completely reorganizes the commands into several
categories to make the documentation easier to navigate.
The following categories are defined:

- Playback Control: Seeking and stepping.
- Property Manipulation: Changing property values.
- Playlist Manipulation: Playlist navigation and editing.
- Track Manipulation: Track navigation and editing.
- Text Manipulation: Text printing, expansion, escaping.
- Configuration: General configuration and related files.
- OSD: Displaying contents as OSD.
- Input and Keybind: Input configuration and key bindings.
- Execution: Execution of mpv and subprocesses.
- Scripting: Script loading and communication.
- Screenshot: Taking screenshots.
- Filter: Changing filters.
- Miscellaneous: Other commands.
2024-11-18 17:28:24 +01:00
nanahi 8d7fff5a2b DOCS/man/input.rst: make event and hooks sections a level higher
They're not related to commands so they shouldn't be a subsection
of list of commands.
2024-11-18 17:28:24 +01:00
Guido Cella ca38b30de3 DOCS/options: add a Video sync section to group related options 2024-11-18 17:23:08 +01:00
nanahi 9543426889 options: move dvd options to stream_dvdnav
The options and struct are only used in stream_dvdnav.c.
Also use dvd prefix for dvd_conf.
2024-11-18 17:22:02 +01:00
nanahi 354ad7f27d sub/osd_libass: simplify osd bar variable names 2024-11-18 17:22:02 +01:00
nanahi 8612f802dd options: move OSD bar opts to a separate struct
Move them to a suboption so the suboption prefix can be
used.
2024-11-18 17:22:02 +01:00
nanahi e056ad374f options: move mp_sub_filter_opts to sd_ass.c
Also use sub-filter common prefix.
2024-11-18 17:22:02 +01:00
nanahi f3b56c846d options: remove extra spaces 2024-11-18 17:22:02 +01:00
Kacper Michajłow 51f02679d4 common/playlist: don't allocate duplicated playlist_path
If the playlist is loaded directly from a protocol like memory://, the
playlist_path represents the entire playlist. In cases where we have a
large playlist, this results in the entire playlist being duplicated for
each item. For example, if the input size is 300 kB with 10k items, we
end up using 3 GB of memory just to store the playlist_path strings.
2024-11-18 17:14:38 +01:00
Guido Cella 2e31502cb1 console.lua: don't override the offset of opaque boxes
With --osd-border-style=opaque-box and background-box, respect
--osd-shadow-offset.

I am not sure if --osd-shadow-offset should be inherited with
--osd-border-style=outline-and-shadow, especially since it doesn't let
you specify different x and y offsets.
2024-11-18 17:10:19 +01:00
Guido Cella b71ab51996 console.lua: use OSD margins
Now that default OSD margins have been decreased to 15 it is reasonable
to let console.lua inherit them for consistency.
2024-11-18 10:36:43 +01:00
Kacper Michajłow a0d7265ce9 sub/osd/console/stats: use the same 1.65 outline size 2024-11-18 09:50:22 +01:00
Kacper Michajłow fedd34e83c stats.lua: set border size to have similar relative thickness as OSD
It is 6% of font size. Little bit more relativelly to OSD, but stats has
smaller text, so we need to compensate for that.
2024-11-18 09:50:22 +01:00
Kacper Michajłow 8c3a7da619 sub/osd/console: adjust font sizes
The current OSD font size is excessively large, causing most
messages—except for very short ones to overflow horizontally.

I conducted testing across multiple devices of varying screen sizes and
under different scenarios. The adjusted font size strikes a good balance
for readability on non-high-DPI displays, while high-DPI displays should
utilize DPI scaling as needed.

Additionally, I compared the font sizes of subtitles and UI elements
across various VOD platforms, which generally use smaller font in most
cases.

The current sub font size was significantly larger than even PGS
subtitles, which are quite large on their own. Now, they are comparable.

The subtitle font size was chosen based on recommendations from the BBC
Subtitle Guidelines. It is set to 8% of the video height with a
recommended scaling factor of 0.67. Therefore, at 720p (the reference
size for mpv font scaling), the calculation is 8% * 0.67 * 720 = 38.592,
rounded down to 38. This value falls within the recommended scaling
range of x0.5–x1 for desktop PCs/Laptops and TVs (32"–42"). For more
information, see
https://www.bbc.co.uk/accessibility/forproducts/guides/subtitles/#Presentation-font-size.

OSD font size is smaller than font as those elements shouldn't be
distractful and only noticable when the user wants to look at them.

Outline size is set to 5.5% of font size.
2024-11-18 09:50:22 +01:00
Kacper Michajłow e8fd7b8798 meson: define _UCRT_NOISY_NAN to workaround the non-constant NAN define
Windows SDK 10.0.26100.0 defines the NAN macro in a non-constant manner.
This violates the C/C++ standard and breaks the compilation of
initializers with Clang.

See:
https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907
2024-11-17 03:19:17 +01:00
Guido Cella dd5f2069b8 loadfile: move mp_format_track_metadata to misc.c
Move the function added in 3ea8d751f5 to misc.c because command.c is too
big. The circle definitions are also moved to core.h
2024-11-16 16:59:11 +01:00
Guido Cella da82c0428e input/cmd: increase the command length for --input-cmdlist
--input-cmdlist crops playlist-next-playlist, playlist-prev-playlist,
write-watch-later-config and delete-watch-later-config, so increase the
string length to that of the longest command.

Also stop specifying both the minimum and maximum length since they are
the same.
2024-11-16 16:58:38 +01:00
nanahi 1c9d066c9e input: fix memory leak with scalable input and nonscalable commands
With scalable input source, scale_units can be 0, and cmd is not
freed. Fix this by freeing cmd when scale_units is 0.

Fixes: 937128697f
2024-11-16 16:58:21 +01:00
Kacper Michajłow 70aaba71d6 player/command: remove /100 from sub-pos print
It already prints %, so there's no need for '/100'. Also, use the print
helper while at it.

6ea08be59a added a percent sign but didn't
remove '/100', so we ended up with both, which is redundant.
2024-11-14 18:56:04 +01:00
Kacper Michajłow 3772b8e385 meson: disable subprocess command for fuzzing
Allowing arbitrary command execution for the fuzzer is not ideal. While
some testing of this code is valid, unsupervised fuzzing of the input is
not. It may be better to add a dedicated test or fuzz-test for this
case.
2024-11-14 18:55:29 +01:00
Kacper Michajłow b982027b64 fuzzer_options_parser: limit input size to 2048 bytes
To encourage fuzzing to mutate shorter test cases, avoid continuously
adding more elements into a single input.
2024-11-14 18:55:29 +01:00
Guido Cella 1c3f09270f defaults.js: send the right number of arguments to input.get callbacks
Only send how many arguments were actually passed by console.lua instead
of sending extra undefined arguments.
2024-11-14 11:09:08 +01:00
Guido Cella ea6b1119d3 defaults.js: fix the opened event with mp.input.get
The opened event doesn't send any arguments. Don't call
JSON.parse(undefined) in that case because it errors.

Fixes eb4c6be630, fixes #15301.
2024-11-14 11:09:08 +01:00
llyyr c60d8523ed meson: rename meson_options.txt to meson.options
This is preferred name since 1.1.0, and we already require >=1.3.0 so
there's no harm in doing it.
2024-11-13 14:16:48 +00:00
Guido Cella 476ed609ea options: increase the default --image-display-duration
1 second is too short to view images, so increase the default duration
to 5 seconds.
2024-11-13 14:15:16 +00:00
llyyr 43d896657e wayland: cleanup check_for_resize function
xdg_toplevel_resize_edge enum values allow for this to work, e.g.
`TOP | LEFT = TOP_LEFT`

No functional change.
2024-11-11 22:11:23 +00:00
nanahi ca7aeb71ee video/out/gpu/video: fix chroma offset rotation matrix calculation
82231fd74d mentioned that for the "rot"
transform flip=true must be set, which "makes no sense at all".

The reason this is happening is that the rotation matrix calculation
is only valid for the 2D coordinate system where y axis is 90 degrees
counterclockwise from x axis, but the coordinate system of chroma
offset has its origin at top-left so it is the opposite, which results
in the rotation going to the opposite way. Setting flip=true fixes the
rotation direction, but results in a flipped y coordinate.

Fix this by reversing the rotation angle for chroma offset rotation
matrix calculation. This also allows removing some duplicated code.
2024-11-11 02:30:26 +01:00
nanahi 70b202a8f4 video/out/gpu/video: prevent OOB access when larger angles are used 2024-11-11 02:30:26 +01:00