Commit Graph

52920 Commits

Author SHA1 Message Date
llyyr 127b6a3455 player: remove empty line from --version 2024-07-18 22:49:28 +02:00
Kacper Michajłow ed77616f29 fuzzer: stop player after 5 seconds of playback
Timeouts can happen with various conditions, big, slow to decode files
is one of them. Most of the time those timeouts are not really important
to "fix". While they may show some issues like we currently have with
audio EOF #14427 for ao-null-untimed. Most of the reports are completely
not important and we should focus on other topics.

Ignore the timeouts during file playback, note that this will still
report any timeouts that happen in other conditions.

5 seconds of playback should cover most of interesting mpv code, even
for strange samples.

This will likely be reverted at some point in the future, but let first
stabilize the OSS-Fuzz, without dozens of bogus timeouts.
2024-07-17 22:17:52 +02:00
nanahi 58f3009b80 playloop: move run_command_opts to command_event for playback-restart 2024-07-17 18:28:56 +00:00
nanahi 503a896d1a command: run input commands after idle state is ready
This makes sure that commands like show-text update the osd properly
with --idle=yes.
2024-07-17 18:28:56 +00:00
Kacper Michajłow 481a5c0dc1 workflows/fuzz: run all sanitizers 2024-07-17 20:21:15 +02:00
Dudemanguy e3682f7f2b vo_gpu_next: support --gamma-factor
There's broad agreement that this option will be undeprecated, so just
factor in the multiplier for vo_gpu_next.
2024-07-17 14:09:00 +00:00
sfan5 3ab989e554 ci/mingw: update dependency versions 2024-07-16 23:04:36 +02:00
sfan5 d2e3e6f3bd test/libmpv_lifetime: don't re-define ASAN macro 2024-07-16 23:04:36 +02:00
Kacper Michajłow 607ad8943b player/command: don't return ill-formed node if there is no default val
option-info/<name>/default-value would be initialized with zeroed
object, which is not valid for string typed options, as the would be set
to NULL.

Found by OSS-Fuzz.
2024-07-16 22:59:23 +02:00
Kacper Michajłow 3cc42083aa fuzzer_set_property: reset sstep to 0 to avoid seeking loop
It would seek and keep player open. Not interesting to change this
behaviour, so just skip it for fuzzers.
2024-07-16 22:59:23 +02:00
der richter 05b0b7cf65 test/libmpv_lifetime: activate test on macOS 2024-07-16 11:20:40 +02:00
der richter 8fc557cc6e mac/vulkan: error out on context creation without an NSApplication
if no NSApplication has been initialized, applications using Appkit
functionality are not supposed to work properly or just deadlock
indefinitely. properly error out on macvk context creation in that case.
2024-07-16 11:20:40 +02:00
Kacper Michajłow 4764e41cac demux/ebml: bump ebml size limit to 512 MiB
While the code before 571f9b0f23 had a
typo and it was intended to be 100 MB, there are files that exceed this
limit, like 147 MiB. Increase the limit to 512 MiB which should be more
than enough for valid files.

From quick look ffmpeg limits to 1<<8 bytes, so we should be good with
our new limit.

In theory this limit could be removed, but it is better to play the
file, possibly with skipped some corrupted block of data, instead OOM.

Fixes: 571f9b0f23
2024-07-15 17:38:22 +02:00
Kacper Michajłow 202ecc17af ci: add fuzzing of pull requests for 20 minutes
To increase our testing coverage before merging. This uses already build
corpus and coverage info to test the modified code, if possible.

See: https://google.github.io/oss-fuzz/getting-started/continuous-integration
2024-07-14 01:18:51 +02:00
Kacper Michajłow 0018227b44 player/command: fix M_PROPERTY_KEY_ACTION for filter metadata
tag_property() expect metadata to not be NULL on M_PROPERTY_KEY_ACTION.
M_PROPERTY_GET_TYPE can be skipped only if key is not queried.

Fixes: a05b847879
2024-07-14 01:17:32 +02:00
Kacper Michajłow bbbade7052 DOCS/input: fix filter name without label 2024-07-14 01:17:32 +02:00
Dudemanguy d15660f4ed wayland: avoid potential floating point errors while scaling
Described in more detail in the upstream MR*. mpv naively rounds which
makes us susceptible to the mentioned error. Fix this by keeping
wl->scaling and wl->pending_scaling in the base 120 units. Use the
simple rounding algorithm when needed for calculating widths/heights.
Create a wl->scaling_factor as convenient shorthand for scale / 120
which is what wl->scaling used to previously be.

*: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/309
2024-07-12 20:48:51 +00:00
Kacper Michajłow 0aebcbcc19 player/{command,scripting}: log subprocess execution
Useful for debugging purposes and sanity checks.

Remove unused function while at it.
2024-07-12 22:40:02 +02:00
Kacper Michajłow 024c79a53c demux_mf: don't run glob() on urls
Not intended to be run on urls. Fixes stack-overflow in glob() when
unexpected data is passed.

Found by OSS-Fuzz.
2024-07-12 22:38:18 +02:00
Guido Cella c2fc6503fb demux_mf: support URLs in @listfile and filemask
This allows playing arguments like
mf://https://foo.jpg,https://bar.jpg
and also URLs within @listfiles (files with 1 image per line).

URLs still don't work with globs and printf-formats.
2024-07-12 22:37:34 +02:00
nanahi fea6adbc97 x11_common: handle runtime keepaspect/keepaspect-window change
On X11, aspect ratio constraint is applied on the window manager side,
so whenever keepaspect and keepaspect-window change, mpv should update
the size hint immediately, otherwise the new constraint isn't applied.
2024-07-12 20:19:11 +00:00
Misaki Kasumi f2e7146cb1 sub: add (sub/osd)-border-style; renaming sub options 2024-07-12 20:17:38 +00:00
Kacper Michajłow c0f5d2391b ytdl_hook.lua: fix hook triggering while it shouldn't
Fixes: acbd537dac
Fixes: #14522
2024-07-12 11:11:54 +02:00
Kacper Michajłow f470b63a04 input.conf: add zoom, pan, scale and rotate keybinds for numpad 2024-07-11 21:57:11 +02:00
Kacper Michajłow c505f77dda player/core: add core thread handle to MPContext
This change removes convoluted core thread extraction through dispatch
added in 500ce69a06.

Currently we fully control this thread, create it and join, there is no
reason not to keep the handle of it in the player context.

As a bonus to code simplification this also fixes thread handle leak on
Windows.

Fixes: #14472
2024-07-11 21:55:21 +02:00
Kacper Michajłow 09b25771e8 fuzzer_set_property: set duration to 0.1s
It looks like it is faster than 0.01s.
2024-07-11 21:55:21 +02:00
Kacper Michajłow b3320ac64a test/libmpv_lifetime: add test to test libmpv ability to reinit itself
This test:
- Checks if libmpv can be loaded dynamically.
- Checks for leaks after mpv context destroy.
- Checks if libmpv can be reloads after dlclose()
2024-07-11 21:55:21 +02:00
Kacper Michajłow 6c56a413ab win32: unregister window class on dll detach
Window classes are global per process, but they are associated with the
module that registered them. Documentation is clear that it is the DLL's
responsibility to unregister its own classes:

No window classes registered by a DLL are unregistered when the DLL is
unloaded. A DLL must explicitly unregister its classes when it is
unloaded.

See: https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-registerclassw

Using a window class after the DLL is unloaded would result in access
violation errors. This is not that important for libmpv, where it is
unlikely someone would use the "mpv" window class externally. The real
issue comes from the fact that reloading libmpv would fail to register
the class (as it still exists) and consequently fail to create a window.

This commit fixes the operability of libmpv after reloading it.

Fixes: #11638
2024-07-11 21:55:21 +02:00
Kacper Michajłow d448598588 vo/opengl/context_win: fix crash on init failure
Don't try to access window context if it failed to create.
2024-07-11 21:55:21 +02:00
Kacper Michajłow 9158653982 demux_mkv: ignore duplicated BlockAdditions to avoid memory leak
This can happen only on invalid files.

Found by OSS-Fuzz.
2024-07-11 03:48:25 +02:00
Kacper Michajłow b13642e115 player/loadfile: prevent fuzzers from loading absolute directories
It's waste of time to load external files. And it is not deterministic.

Note we still allow to load single files by name, but it is not a big
deal.
2024-07-11 03:48:25 +02:00
Kacper Michajłow aea5b3dbea player/loadfile: cancel playback cleanly if thread fails to start
Currently it would crash, due to already canceled and freed resources.
2024-07-11 03:48:25 +02:00
Kacper Michajłow 66fdec8a67 demux_edl: don't try to extract dirname from self-expanding protocols
Fixes infinite recursion. Trying to extract dirname from string of
memory://<data> is not really a good idea.

Found by OSS-Fuzz.
2024-07-11 03:48:25 +02:00
llyyr 14571f0f77 vo_dmabuf_wayland: don't use -ve margins in window size calculation
This happens with a positive --video-zoom value. We send invalid
toplevel size and get killed by the compositor.
2024-07-10 19:22:24 +00:00
holdingsllc 18b557c1c7 DOCS/input: fix "does does" typo 2024-07-10 19:16:38 +00:00
llyyr 1fd9389911 ao: don't add buffer length to timeout twice
ao_get_delay already adds this buffer length
2024-07-10 19:32:36 +02:00
llyyr 2559f8874f ao: use the right type for pending samples 2024-07-10 19:32:36 +02:00
Kacper Michajłow 571f9b0f23 demux/ebml: fix ebml size check
There was one zero too many. Change the limit to 128 MiB with more
readable notation.
2024-07-09 20:58:39 +02:00
llyyr daa6068d02 stream_bluray: check fread return value 2024-07-08 23:45:37 +02:00
llyyr f89d0d48bc test/libmpv_encode: check fread return value
Fixes warning with clang
2024-07-08 23:45:37 +02:00
llyyr 6c59b0272b wayland: use wl_list_empty instead of wl_list_length 2024-07-08 13:33:32 +00:00
llyyr 9d7d861202 wayland: bump wayland-protocol requirement to 1.31
And wayland-client/cursor to 1.21

Debian Stable has these
2024-07-08 13:33:32 +00:00
llyyr 539e95730a ao_pipewire: bump minimum libpipewire version to 0.3.57
available on debian stable
2024-07-08 13:33:32 +00:00
Kacper Michajłow acbd537dac ytdl_hook.lua: allow changing try_ytdl_first during runtime
Check value in hook instead of hooking conditionally.
2024-07-07 02:32:48 +02:00
Dudemanguy 00f43e0916 wayland: fix missed int -> double conversion for cursor scaling
Client side cursors have always had some issues with fractional scaling.
However since we changed to using viewporter for cursor scaling, most
(or all?) of the problems can be fixed. Unfortunately, a scaling factor
was being truncated to int instead of kept as a double. This matched the
old behavior with buffer_scale, but it's better to use double so the
viewport is actually set to the correct size. Of course, none of this is
relevant if the compositor is using cursor shape.

Fixes f0a6578259
Fixes #14001
2024-07-06 09:03:40 -05:00
verygoodlee bcc72f97ef stats.lua: active key bindings: identify prefix nonrepeatable
The nonrepeatable prefix was added at commit bc5863a
2024-07-05 16:42:31 +03:00
Guido Cella e07470adc2 console.lua: restore the order of items after clearing the input line
When you type something in select mode and then delete it, table.sort
changes how selectable items are sorted. Restore the order specified by
the mp.input caller in this case.
2024-07-04 22:24:10 +00:00
Guido Cella 97af5c98f4 console.lua: minor tweaks
- Remove the opts comments because they are already in console.rst and
  will become outdated if not updated in both places
- Reuse last_pos in truncate_utf8() instead of recalculating the
  previous character's position
- Clear the OSD earlier when the console is not active
2024-07-04 22:24:10 +00:00
Guido Cella 49afdb9365 console.lua: remove the scale script-opt
This is redundant because you can set font_size and border_size to have
the same effect.
2024-07-04 22:24:10 +00:00
nanahi b09e48e388 player/loadfile: enable streams in order of types when loading file
The previous commit to avoid refresh seeking video streams has an edge
case when enabling tracks when loading files. Since the streams are
initially unselected and then multiple streams are enabled, the detection
only works reliably when video tracks are enabled first.

This makes sure that loading file enables tracks in a predictable order.
2024-07-04 22:23:27 +00:00