1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-16 12:17:12 +00:00
Commit Graph

53197 Commits

Author SHA1 Message Date
Niklas Haas
89e608e169 vo_gpu_next: add dynamic hook parameters
Fixes: https://github.com/haasn/libplacebo/issues/230
Fixes: https://github.com/mpv-player/mpv/issues/8206
2024-11-02 21:20:20 +01:00
averne
32bcaf865b osdep/terminal: fix dummy implementation
c2ed2e7 introduced the terminal_set_mouse_input function to various terminal
backends, but overlooked the dummy backend.
This causes linking errors when trying to build on platforms with no terminal,
as vo_kitty and vo_tct are unconditionally enabled and make use of that
function.
2024-11-02 20:05:11 +01:00
Guido Cella
a9d57938b2 .luacheckrc: add_hook is not undocumented
It's a commonly used function so group it with the documented functions.
2024-11-02 14:03:02 +02:00
Guido Cella
5dc4047415 auto_profiles.lua: actually exit when no auto profiles are defined
Unsetting _G.mp_event_loop at the top level quits the script, but not
within callbacks. Use the new exit() function instead. Fixes e2284fba18.

This actually has an edge case since e2284fba18 where you can add auto
profiles only later with load-config-file and the script stays unloaded,
but it's still reasonable to quit if mpv.conf has no conditional
profiles. You could always explicitly set --load-auto-profiles=yes in
this case.
2024-11-02 14:03:02 +02:00
Guido Cella
bb0b9f4cc8 defaults.lua: add an exit() function
Scripts can terminate execution by setting mp.keep_running = false. Add
an exit() function to wrap setting mp.keep_running and properly expose
this feature. It can be used e.g. by a thumbnail script to spawn workers
with load-script and then let them quit.

It is not added to the mp namespace as mp.exit because that would make
it look like it terminates mpv.

This mirrors the exit() function which already exists in js.

The note in javascript.rst about having to remove key bindings before
exit is not kept because they are actually removed automatically since
bf385e1140 (though it was accurate when the JS backend was developed
before upstreaming it).
2024-11-02 14:03:02 +02:00
nanahi
e734f5ae33 video/out/w32_common: don't move window if position isn't set
The geometry output of vo_calc_window_geometry does not have
any information about the current window position. This causes
the window to move when setting geometry even without setting
x/y.

Change it so that the window position is unchanged if x/y are not
set and after startup.
2024-11-02 11:14:57 +01:00
nanahi
512f5e2e82 video/out/w32_common: always move window when setting state
Make sure the window is at the correct position when
fullscreen while geometry is set.

Fixes: e5159de811
2024-11-02 11:14:57 +01:00
Kacper Michajłow
d78c35d360 fuzzers/fuzzer_json: add simple fuzzing for our json code 2024-11-02 05:28:11 +01:00
Kacper Michajłow
207aa647a5 options/m_option: free all list elements when removing them
Elements are not parented to the add list, as they are directly copied
to the target list. Therefore, we need to clean them up manually.

Fixes: 1f5a67d8fa
2024-11-02 04:24:00 +01:00
Kacper Michajłow
2054d872d4 m_property: stop expanding strings after 10 properties during fuzzing
Some properties, like `${decoder-list}`, are resource-intensive to
expand. Prevent fuzzing from generating strings with excessive
expansions to encourage shorter test cases.

Expanding properties on each playback frame for `osd-msg1` can be
demanding. However, in regular use cases, this typically isn’t an issue,
so implementing a caching solution wouldn’t be practical in real
scenarios.

Fixes timeouts on OSS-Fuzz.
2024-11-02 04:24:00 +01:00
Guido Cella
4def28ad0d DOCS/man/input: note that properties can be unavailable on init
It comes up often in IRC and issues that users don't understand why the
path property is initially unavailable, so link the section that
mentions it from the Properties section, and expand on how to get these
properties.
2024-11-02 01:41:11 +01:00
Guido Cella
6085261146 DOCS/man/input: remove duplicate paragraph
This is mentioned again below in Property list and it makes more sense
near the list of properties.
2024-11-02 01:41:11 +01:00
Guido Cella
680e7022ee DOCS/man/input: suggest normalize-path to get absolute paths
Because it is a bit shorter than calling
utils.join_path(working_directory, path), it gives you a canonical path,
and it doesn't concate working-directory before URLs.
2024-11-02 01:41:11 +01:00
Kacper Michajłow
1f5a67d8fa options/m_option: limit string list to 100 per operation for fuzzing 2024-11-02 01:40:41 +01:00
Kacper Michajłow
bc9d982330 encode_lavc: fix memory leak on --ofopts=help
Found by OSS-Fuzz.
2024-11-02 01:40:41 +01:00
Kacper Michajłow
e96bffe7a8 player/loadfile: limit playlist size to 10 for fuzzing
Fixes timeout on huge generated playlists, 10 is enough to test if it
works.
2024-11-02 01:40:41 +01:00
Kacper Michajłow
0a5d656c20 options: disallow log-file when fuzzing
To avoid leaving garbage files behind. It even managed to open log file
itself and stuck in infinite reading loop.
2024-11-02 01:40:41 +01:00
Kacper Michajłow
eb16169b27 demux_playlist: add data:// to self-expanding protocols
Found by OSS-Fuzz.
2024-11-02 01:40:41 +01:00
Kacper Michajłow
de42e11662 demux_edl: disallow nested edl to avoid infinite loop
Found by OSS-Fuzz.
2024-11-02 01:40:41 +01:00
nanahi
1a522b4a72 command: quote input key names in log 2024-11-02 01:39:15 +01:00
nanahi
c5da7beaa6 command: use array index for checking first character 2024-11-02 01:39:15 +01:00
nanahi
081fc7e317 input: fix style 2024-11-02 01:39:15 +01:00
nanahi
1b9d070786 command: fix keybind command with sequence keys
The command is documented to use the same syntax as input.conf, but
it doesn't work with sequence keys because it uses
mp_input_get_key_from_name for checking key names, when it should
use mp_input_get_keys_from_string instead.

Fix this by using the correct function.
2024-11-02 01:39:15 +01:00
nanahi
56e2689894 command: add the ability to set comment for keybind command
This allows the keybind to have a comment field which can be
read from input-bindings, and displayed by e.g. stats.lua.
2024-11-02 01:39:15 +01:00
nanahi
affa953dd4 DOCS/man/input.rst: fix keybind command keyword argument name
It's "cmd" rather than "command".
2024-11-02 01:39:15 +01:00
nanahi
d97ba359d2 input: deduplicate mp_input_bind_key
It's just a copypaste of bind_keys with some params set to
hard coded values, so use bind_keys instead.
2024-11-02 01:39:15 +01:00
llyyr
5b946ac360 player: don't load encoding mode profile twice
Also move the loading of profiles and input section activation in one
place. Leaving this in mp_initialize has the drawback that encoding
section profile will overwrite options set by the user in the command
line, since it's set after the CLI options are parsed and processed.
mp_parse_cfgfiles happens before parsing the CLI, so loading the profile
there is better.
2024-10-31 16:43:25 +01:00
llyyr
e28bfadbea options: remove stale comment about encoding mode being compiled-in
Encoding mode used to be a compile time option, but now it's always
compiled in.
2024-10-31 16:43:25 +01:00
Guido Cella
00e223ccb6 console.lua: refine the hovered item calculation
Calculate the hovered item from the bottom of the screen where the
console is anchored. This is simpler and accurate because it accounts
for the fact that the empty line between the log and the input line
isn't as tall as a full line, for the exact height of an always visible
OSC bottombar, and for the empty top pixels present because the height
isn't an integer multiple of the font size.
2024-10-31 16:40:56 +01:00
Guido Cella
e1680167fd console.lua: factor OSC margins before the bottom margin
OSC margins are relative to the whole height before subtracting the
bottom left margin.
2024-10-31 16:40:56 +01:00
Kacper Michajłow
41cff490ad drm: don't print extra newline on connectors/modes help 2024-10-30 11:49:22 +01:00
Guido Cella
b40241889b console.lua: use math.ceil in determine_hovered_item()
Replace the rounding to calculate the hovered line with ceil which is
what you would expect to work. Rounding worked better before because it
compensated for the errors fixed by the previous 2 commits.
2024-10-29 22:13:40 +01:00
Guido Cella
ce4a804a7d console.lua: factor the bottom margin in line calculations
This is more important now that the margin is bigger due to the scaling
with the window.
2024-10-29 22:13:40 +01:00
Guido Cella
10789fae1f Revert "console.lua: fix the max log lines calculation"
This reverts commit 5e65999eb2.

This was wrong because an empty line doesn't occupy as much height as a
filled line. But update the comment so it is not unclear like before why
1.5 is subtracted.
2024-10-29 22:13:40 +01:00
nanahi
f476c0275b DOCS/man/osc.rst: fix binding documentation
The documentation doesn't agree with the implementation and
commit message (which agree with each other).
2024-10-29 20:36:38 +01:00
nanahi
1b2aed0b5a etc/restore-old-bindings.conf: fix comment description
The file also provides changed key bindings.
2024-10-29 20:36:38 +01:00
nanahi
5a3ac5bfae meson.build: add restore-osc-bindings.conf to conf_files 2024-10-29 20:36:38 +01:00
nanahi
4c93447dbb DOCS: mention restore-osc-bindings.conf 2024-10-29 20:36:38 +01:00
nanahi
e21e1c3180 etc/restore-osc-bindings.conf: add file to restore old osc bindings
The OSC changed to use select.lua for various tasks, resulting in a
significant change in user interaction. This adds a config file
which records OSC behavior changes so that the old behavior can be
restored.
2024-10-29 20:36:38 +01:00
Guido Cella
3986f34e2a stats.lua: calculate sizes like --osd-*-size options
Currently --script-opt=stats-font_size=n is much bigger than
--osd-font-size=n, which can confuse users, so calculate sizes the same
way.

The \fs value to replicate --osd-font-size is
${osd-font-size} * 288 / 720 with --osd-scale-by-window, and
\fs${osd-font-size} * 288 / ${osd-height}
with --osd-scale-by-window=no. This is because
sub/osd_libass.c:update_playres() sets
track->PlayResY = ass->res_y ? ass->res_y : MP_ASS_FONT_PLAYRESY,
where MP_ASS_FONT_PLAYRESY is 288.

This also works with persistent_overlay=yes.

{\fscx100}{\fscy100} would also replicate --osd-font-size with show-text
and with osd-verlay + --osd-scale-by-window, but not with osd-overlay +
--osd-scale-by-window=no.

The default sizes are multiplied by 720/288 = 2.5 to keep them the same
as before.
2024-10-29 20:35:35 +01:00
Wertzui123
daf52f9761 DOCS/contribute.md: fix a typo 2024-10-29 20:25:47 +01:00
Kacper Michajłow
0c5420b412 console.lua: update selected item under the cursor on mouse wheel action 2024-10-29 16:23:21 +01:00
nanahi
98ed972246 video/mp_image: fix original param copy implementation
Fixes: 9b571a7aa7
2024-10-29 16:22:14 +01:00
Kacper Michajłow
059f78b517 ci/msys2: enable sanitizers for clang build 2024-10-29 16:07:17 +01:00
rkscv
8cd69e6de8 DOCS/man/lua: correct example syntax 2024-10-29 12:26:04 +02:00
Kacper Michajłow
466b5530c9 DOCS/man/osc: remove non-existent options
Fixes: a80f535a6d
2024-10-29 00:45:59 +01:00
Guido Cella
934bfd2b7e console.lua: restore the bigger default font size
Fixes aa66f0dced.
2024-10-29 00:13:32 +01:00
Guido Cella
aa66f0dced console.lua: default to a proportional font for select
In the select menu there are no completions to align in a grid, so the
better looking proportional font of --osd-font can be used by default.
It is also easier to read for the visually impaired.

The text width calculation is no longer performed if the console is only
opened through select, it is only performed the first time something is
completed. This avoids having to pass an argument to get_font() to make
it use the monospace font regardless of selectable_items.

Fixes #15176.
2024-10-28 23:30:34 +01:00
Guido Cella
cb8e3ba959 osc.lua: hide immediately without animation for select.lua
Requested by llyyr.
2024-10-28 23:28:50 +01:00
Guido Cella
bf3382b083 console.lua: fix the hovered line calculation without scale with window
If not scaling with the window the hidpi scale needs to be factored into
mouse-pos. Follow up to a670f75679 and a2106396bc.
2024-10-28 23:17:21 +01:00