Commit Graph
54009 Commits
Author SHA1 Message Date
Kacper Michajłow 0ab46993d8 video/out/gpu/context: enable debug_extra for Vulkan 2025-04-16 23:58:12 +02:00
llyyr f24611980c sub/osd: add osd-shaper and set it to simple by default
This is a change in default for libass with harfbuzz enabled, previously
it would choose the best available shaper.

Harfbuzz isn't really needed for mpv's OSD and it comes with a
significant performance penalty, so use simple instead
2025-04-16 23:58:02 +02:00
llyyr efba6e7e5a sub/sd_ass: add sub-{glyph-limit,bitmap-max-size} 2025-04-16 23:58:02 +02:00
llyyr fc972d2049 sub/osd: add osd-{glyph-limit,bitmap-max-size} 2025-04-16 23:58:02 +02:00
llyyr ad61018294 sub/osd: add osd-prune-delay 2025-04-16 23:58:02 +02:00
Kacper Michajłow 66c92a1a6c Revert "ci/win32: pin shaderc version to fix build errors"
The symbols were moved around, so it's now possible to link everything
without those libs, which are stub only now.

This reverts commit 94e100e389.
2025-04-16 19:16:26 +02:00
Kacper Michajłow 0fe6ad8afc ci: add Windows Arm builds 2025-04-16 19:16:26 +02:00
Kacper Michajłow d506a18a85 video/out/opengl/common: prevent MemoryBarrier collision
MemoryBarrier definition colides with our gl->MemoryBarrier().

https://learn.microsoft.com/windows/win32/api/winnt/nf-winnt-memorybarrier
2025-04-16 19:16:26 +02:00
llyyr 4697f7cb86 DOCS/man/mpv: document alt+v to toggle secondary sub track visibility
Fixes: 62f225ef9d ("sub/osd: hide secondary subtitles if secondary-sub-visibility is false")
2025-04-15 11:46:37 +02:00
Kacper Michajłow 27c08affb1 vd_lavc: prefer non-copy hwdec before falling back to -copy variant
Now that multiple hwdec APIs are available per platform (Vulkan, vaapi)
we should probe native first and fallback to -copy only after it fails.
2025-04-13 19:04:20 +02:00
nanahi 896b3400f3 clipboard-wayland: read already sent data when the fd is hung up
A "hung up" fd only indicates that the other end of the pipe is closed.
This can happen when the other client has already sent some data into
the pipe and closed its end. This should not be treated as an error,
and reading data should proceed until read() returns 0 or -1.

Premuturely destroying offer in this case breaks getting selection
data. Change it so that the cleanup on error happens after the selection
data is read.

Fixes: d20ded876d
2025-04-13 16:30:58 +02:00
Kacper Michajłow cc02a47a48 vd_lavc: prefer Vulkan hwdec when available
If Vulkan hwdec is exposed by the system, use this as it provides better
compatibility with native Vulkan rendering.

This avoid issues with importing VkImages through DMABUF interop from
nvdec or vaapi on drivers that doesn't support DMABUF.

Try native Vulkan hwdec first which will resolve compatibility issues if
available. If not it will fallback to using vaapi/nvdec like before.
2025-04-13 16:30:20 +02:00
showergum 44816ef8ff console.lua: default prompt to an empty string
Calling input.select() without a prompt argument was failing due to
attempting to concatenate a nil value.

Before mpv 0.40 the prompt defaulted to ">" so this is expected to
work as evident from the example code.
2025-04-12 20:55:34 +02:00
Guido Cella 91337443ad DOCS/man/options: fix link to Conditional auto profiles 2025-04-12 20:32:10 +02:00
Guido Cella 12b3de21c4 DOCS/man/input: remove reference to the removed --clipboard-enable 2025-04-12 20:32:10 +02:00
Guido Cella 150b6d7b90 DOCS: remove references to the removed slave mode 2025-04-12 20:32:10 +02:00
Dudemanguy 8c28e24c89 vo_dmabuf_wayland: set hwdec_type in reconfig based off of imgfmt
The old way of setting it during init isn't really accurate. It's
possible for a VADisplay to exist, but for some other hwdec to be
desired (e.g. like vulkan). It mostly worked OK because vaapi and
drmprime are generally exclusive but to be more correct we can simply
check the imgfmt in reconfig instead to correctly determine the type.
2025-04-12 04:35:36 +00:00
Dudemanguy 2bc3bddfb9 vo_dmabuf_wayland: only load needed hardware decoding drivers
The previous way of loading hardware decoding via image formats actually
loaded more things than needed such as cuda. This is because things like
cuda do actually support IMGFMT_VAAPI so the request would try to probe
it and it would fail. Instead of doing that, we can just specifically
request the only two drivers that we actually care about: vaapi and
drmprime.
2025-04-12 04:35:36 +00:00
Kacper Michajłow 3d5949366c {osd,msg}: use PU{1,2} for escape codes instead of invalid Unicode
Some languages actually require strings to be valid UTF-8, unlike C
which couldn't care less as long as it is NULL terminated.

Change triggered by Python support, but is also useful for Rust and Java.
2025-04-09 18:09:03 +02:00
Dudemanguy 43ce03c519 vo_dmabuf_wayland: don't resize if dst rect is 0
Evidently it is possible for some compositors to trigger an external
resize before the very first initial reconfig. This can't work and will
fail in various ways. Check this case and bail out. Fixes #16202.
2025-04-08 22:15:57 +00:00
Kacper Michajłow 5bc5489e56 video/sws_utils: limit sws-cvs and sws-chs to [-100, 100]
Makes no sense to create filters with some huge offsets.
2025-04-08 22:24:47 +02:00
Kacper Michajłow 1bd6e28780 vd_lavc: limit frame size to 8k when fuzzing
To speed it up and avoid OOMs.
2025-04-08 22:24:47 +02:00
Kacper Michajłow 99d442d299 options/m_option: add missing newline in log 2025-04-08 22:24:47 +02:00
Kacper Michajłow 6f7e1e4359 ci/freebsd: update to 14.2
FreeBSD supports only two latest minor versions, since 14.3 has been
released, packages for 14.1 are not longer available. Bump to 14.2,
since action doesn't have images for 14.3 yet.
2025-04-08 08:51:43 +02:00
VincentVerdynanta 4a0684db33 sd_ass: handle past subs with unknown duration on every decode
Unknown duration subtitle handling must be executed on every decode
call, because we are actually adjusting the duration value of subtitles
that are decoded in the past. It should not only execute when the
newest packet has an unknown duration.
2025-04-08 00:22:54 +00:00
NRK b09e06a920 osdep/threads: prefer using thread_local
C11 uses _Thread_local as the keyword, which thread_local macro
is defined to (inside of <threads.h>, which mpv doesn't use):
https://port70.net/~nsz/c/c11/n1570.html#7.26.1p3

C23 promotes thread_local to a keyword and marks _Thread_local
as obsolete and to be avoided in new code:
https://www.iso-9899.info/n3220.html#6.4.1p3

so just use thread_local directly, which is future-proof while
having a fallback define in osdep/threads.h for pre-C23 cases.
2025-04-06 17:01:33 +02:00
Kacper Michajłow 07571859ac player/scripting: fix race condition when destroying clients
Clients run in detached threads and are waited to signal when they are
finished with self mpv_destroy() call. Problem is that after detached
thread calls this function, mpv consider this client to be done and can
do whatever. One example is when mpv exits and wait for scripts to
finish we got race condition, because mpv (main thread) can exit first
and the detached thread calls ta_free() which crashes, because we may
have already destroyed things that the thread depends on.

I've seen this crash on FreeBSD CI job (libmpv-lifetime test), where the
libmpv.so has been unloaded while the thread was still doing ta_free()

```
==5081==ERROR: AddressSanitizer: SEGV on unknoun address 0x000001111806 (pc 0x000001111806 bp 0x7fffdedf4e40 sp 0x7fffdedf4e08 T40)
==5081==The signal is caused by a READ memory access.
    #0 0x1111806  (<unknown module>)
    #1 0x803cd6900 in ta_free /home/runner/work/mpv/mpv/build/../ta/ta.c:243:5
    #2 0x803a2fc87 in run_script /home/runner/work/mpv/mpv/build/../player/scripting.c:93:5
    #3 0x803a2ffe0 in script_thread /home/runner/work/mpv/mpv/build/../player/scripting.c:99:5
    #4 0x2c451a in asan_thread_start(void*) /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28
    #5 0x80034fb04  (/lib/libthr.so.3+0x10b04)
```

Note the 0x1111806 jump which is completelly bogus.

Fix this by doing mpv_destroy() as a last step in detached threads.
2025-04-02 23:46:11 +02:00
NRK 22f4ff44c5 misc/random: add mp_rand_in_range32()
removes awkward back-and-forth int -> double -> int conversion.
the last step also broke uniformity, though it likely doesn't
matter much in mpv's playlist shuffle context.
2025-04-02 17:28:49 +02:00
NRK b968dec77d misc/random: improve the fallback case
c365e2f7 added av_random_bytes() to avoid multiple
threads/processes getting the same seed. but the fallback case
still suffers from it.

also mix in a function pointer, which hopefully is randomized
per process due to ASLR (20+ years old technology) along with
the stack position which will be different on different threads.
2025-04-02 17:28:49 +02:00
NRK b3d461e3aa misc/random: use av_random_bytes() for the whole seed
splitmix was used since it's recommended by the official xoshiro
site [0] as a "radically different" PRNG to avoid correlation of
similar seeds. av_random_bytes() is cryptographically secure
and so we don't have to worry about that. so just use it to
initialize the whole state.

[0]: https://prng.di.unimi.it/
2025-04-02 17:28:49 +02:00
NRK dd29542f6f misc/random: eliminate mutex
mutex itself was probably more costly than the PRNG itself. and
locking PRNGs is almost universally not recommended. simply add
a state parameter that the caller can hold to avoid locks.
2025-04-02 17:28:49 +02:00
Kacper Michajłow 36ea2354be ci/win32: don't use CMake 4.0
CMake has been updated to 4.0 which breaks compatibility with all
project targeting version < 3.5. See for more user stories:
https://github.com/actions/runner-images/issues/11926

Remove 4.0 from path and use the one from VS installation which is
working for now. Generally we want to use only tools from VS
installation, but unfortunately Windows image provided by GHA have
polluted PATH which already causes issues in the past, that's why we
remove yet another directory from PATH.

The affected project in our case is https://github.com/webmproject/sjpeg
which is build as part of libjxl.
2025-04-02 02:09:36 +02:00
Kacper Michajłow 30869ddb90 ci/build-win32.ps1: update wrap to expose ffmpeg executable
Also list dependencies, they are overriden now in upstream meson.build.

For subtitle selection tests.

See: https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg/-/commit/7601055639e789cdeeff793c48eaaf3186a70aad
2025-04-01 21:27:45 +02:00
Kacper Michajłow baf2fd2f28 osdep/language-win: fix use of GetSystemPreferredUILanguages()
The buffer size were never set to 0, after first call. To retrive the
size both buffer has to be NULL and size 0. Otherwise it fails.

While at it refactor whole thing and use returned count as sanity limit.
2025-04-01 21:27:45 +02:00
Kacper Michajłow cce45aa054 test/libmpv_test_track_selection: fix locale check
The size of the buffer was never set so the Get*PreferredUILanguages()
were just returning ERROR_INSUFFICIENT_BUFFER.

Fix the buffer size and use the returned count as sanity limit.

Fixes the test.
2025-04-01 21:27:45 +02:00
Kacper Michajłow 06a983ef2f test/libmpv_test_track_selection: fix compilation with Windows SDK 2025-04-01 21:27:45 +02:00
Leo Izen 5870c95e89 filters: automatically flip video if displaymatrix indicates so
Currently we check AV_FRAME_DATA_DISPLAYMATRIX for its rotation factor
but not for its flip factor, which could happen with some input files.
This commit adds and autovflip filter, which is applied before the
autorotate filter to flip vertically before rotating. It also changes
the displaymatrix reading code to output to mp_image->params.vflip so
it can be autoinserted as necessary.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-03-31 14:07:47 -04:00
Guido Cella 52a95d91bd positioning.lua: validate that an amount is passed
Instead of crashing, show the correct usage when running pan-x, pan-y or
cursor-centric with script-message, or with script-binding but no
argument.
2025-03-31 12:04:37 +02:00
Guido Cella f0c3d466f9 DOCS/man/osc: fix custom button example formatting
The examples for each button were rendered in the same line.
2025-03-31 12:02:03 +02:00
verygoodlee f837e951af select.lua: simplify the time formatting function
The C version of time formatting function has been exposed to lua,
so why not use it, `osc.lua` and `stats.lua` are already using it.
2025-03-31 11:57:06 +02:00
Tom Grimwood-Taylor a407e13f83 misc/language: add a forced flag to the track add commands 2025-03-31 11:47:52 +02:00
Tom Grimwood-Taylor f608780032 misc/language: parse forced tag from external subtitle tracks
Fixes: mpv-player#16060
2025-03-31 11:47:52 +02:00
Leo Izen 2e215cc6a5 demux/demux_playlist: mark fd:// as self-expanding
The playlist demuxer won't propagate the protocol forward to its entries
if its protocol is on a whitelist, for example data:// or memory:// etc.

This commit adds fd:// to that list because that should not be expected
to work.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-03-31 11:34:57 +02:00
Kacper Michajłow 5ba7ee5137 demux_mpv: add missing URL unescape 2025-03-28 22:40:09 +01:00
Kacper Michajłow 94e100e389 ci/win32: pin shaderc version to fix build errors
See: https://github.com/KhronosGroup/glslang/issues/3914
2025-03-28 19:40:44 +01:00
Kacper Michajłow 26b29fba02 demux_mkv: fix compilation after deprecated definitions removal
See: https://github.com/FFmpeg/FFmpeg/commit/822432769868da325ba03774df1084aa78b9a5a0
2025-03-28 19:40:44 +01:00
sfan5 08939665fe DOCS: clarify some minor points in the release policy 2025-03-28 16:19:48 +01:00
llyyr d20ded876d clipboard-wayland: prevent reading from hung up fd
This causes mpv to use up 100% of a core if there's an offer for a
mime_type that mpv doesn't accept with ext_data_control clipboard
backend.
2025-03-28 16:08:36 +01:00
Dudemanguy 9cca045511 wayland: lrint some width/height calculations 2025-03-28 13:53:08 +00:00
Dudemanguy 9826e96ecc wayland: use logical coordinates when setting the opaque region
Core wayland works in the surface local/logical coordinates so the width
and height values should really be divided by the scale factor.
2025-03-28 13:53:08 +00:00