Commit Graph
1211 Commits
Author SHA1 Message Date
Kacper Michajłow 8c6680a868 osdep/w32_register: add a DVD-Audio AutoPlay handler
Register mpv for the PlayDVDAudioOnArrival event, like the existing
CD-Audio/DVD/Blu-ray handlers.
2026-08-26 01:47:41 +02:00
Kate Markson a87a678573 osdep/subprocess-win: terminate environment block
Terminate the block of environment variables with NUL. Previously the block was left unterminated which could cause subprocess spawn failures depending on the array contents after the last item.
2026-08-21 12:45:11 +02:00
nanahi 9281bccfdf osdep/compiler: don't use __has_builtin for __builtin_mul_overflow
The feature test macro is nonstandard and not available on older GCC
version, which causes build failure despite the compiler does support
__builtin_mul_overflow.

Since there are no fallback when __builtin_mul_overflow is not
available, there is no need to check, so simply remove it.
If __builtin_mul_overflow is not supported compilation will still fail
just like currently.
2026-07-06 18:25:12 +02:00
Emmanuel Gil Peyrot 0279c0f07d path-unix: only accept absolute paths
The XDG Base Directory specification says “All paths set in these
environment variables must be absolute. If an implementation encounters
a relative path in any of these variables it should consider the path
invalid and ignore it.”
2026-07-02 17:36:50 +00:00
Kacper Michajłow a40319a514 osdep/compiler: make MP_ASSERT_UNREACHABLE no return
On some platforms assert is continuable, we don't want that, so abort()
just after.
2026-06-27 20:39:35 +02:00
Nicolas F 8c6ad1b002 osdep/compiler: add MP_CKD_MUL
Add a new MP_CKD_MUL macro which does a multiplication with overflow
checking, backed by either the C23 ckd_mul standard function, or the
GCC/Clang __builtin_mul_overflow otherwise.
2026-06-27 18:10:47 +02:00
Misaki Kasumi 2bd9c3229f osdep: fix MP_NO_ASAN definition 2026-06-22 03:52:21 +02:00
Misaki Kasumi 688b2738c6 subprocess-posix: skip macro guard in reset_signals_child 2026-06-17 10:47:16 +02:00
Misaki Kasumi 49b06cc337 subprocess-posix: fix uninitialized stacks in fork path 2026-06-17 10:47:16 +02:00
Misaki Kasumi 6b48326ccf subprocess-posix: avoid using mmap 2026-06-17 10:47:16 +02:00
Misaki Kasumi d849fd60d0 subprocess-posix: use rfork_thread on FreeBSD 2026-06-17 10:47:16 +02:00
Misaki Kasumi de1c73a44b subprocess-posix: handle detach inside spawn_process 2026-06-17 10:47:16 +02:00
Misaki Kasumi 5fb6a76ddf subprocess-posix: use clone when available 2026-06-17 10:47:16 +02:00
Kacper Michajłow 1ad719ff19 osdep/subprocess-posix: restore signal mask on detached fork failure 2026-06-09 11:52:29 +02:00
nanahi 1d82932cce various: use fopen wrapper for cloexec handling 2026-06-04 04:58:16 +02:00
nanahi 1f150567ac osdep/io: fix fdopen mode flag
In both C11 standard and Microsoft documentation, '+' must be placed
immediately after mode, so placing 'b' between them is incorrect.
2026-06-04 04:58:16 +02:00
nanahi f1a42eff01 osdep/io: use mp_fopen on all platforms
Currently, all fopen uses in mpv do not set cloexec flag, resulting
in fd leak whenever mpv creates a process.

This makes mpv use mp_fopen on all platforms, and always set O_CLOEXEC
on the opened fd. This is required because the "e" flag for fopen is
nonstandard and UB in C11, and unsupported on macOS.

This had been done similarly in other projects. e.g.
https://gitlab.com/graphviz/graphviz/-/merge_requests/3797
2026-06-04 04:58:16 +02:00
Chainik 44a9b03f24 vf_vapoursynth: improve backward compatibility
The previous commit to dynamically load VapourSynth R74 would fail to work
for VapourSynth R73 and before on Linux due to load mode RTLD_LOCAL. To
make it work on all VapourSynth version, switch to use RTLD_GLOBAL mode.
2026-05-31 18:16:18 +02:00
Chainik 3650c67b6d Revert "vf_vapoursynth: improve backward compatibility"
This reverts commit 8aabba933b.
2026-05-31 18:16:18 +02:00
nanahi 5e847889b3 osdep/win32/smtc: fix client handle leak 2026-05-01 13:42:57 +02:00
nanahi 675fb1229b input/dnd: move --drag-and-drop handling to dnd client
This unifies --drag-and-drop handling to a single place. All platforms
currently only support normal drop (mapped to "replace") and shift click
drop (mapped to "append").
2026-05-01 13:42:57 +02:00
nanahi 5e0932e785 input: rename mp_event_drop_files to mp_input_drop_files
Move it to input.c. Will be used in next commit.
2026-05-01 13:42:57 +02:00
Crend King 8aabba933b vf_vapoursynth: improve backward compatibility
The previous commit to dynamically load VapourSynth R74 would fail to work
for VapourSynth R73 and before on Linux due to load mode RTLD_LOCAL. To
make it work on all VapourSynth version, switch to use RTLD_GLOBAL mode.

Add library handle closing in drv_vss_uninit for completeness.
2026-04-25 07:14:56 +02:00
Crend King 75b2ccfeb1 vf_vapoursynth: update for VapourSynth R74
VapourSynth R74 changed two things relevant to mpv build process:

1) VSScript no longer has static library to link to, and only support runtime loading.
This is reflected on the new VSScript example in VapourSynth SDK.
2) The VSScript library name is changed from libvapoursynth-script to libvsscript for Linux
and MacOS.

The new VSScript initialization code is modified from their SDK example to utilize
mpv's mechanisms. Build dependency is also updated accordingly.
2026-04-23 01:38:48 +02:00
Kacper Michajłow 17d12f83ad osdep/io: expand relative path only if it contains directory separator
For anything else, respact default load library search logic.
2026-04-17 03:56:13 +02:00
Kacper Michajłow c3231fa1ee osdep/io: use static string for dlopen errors
The dynamic allocation of this strings is completelly pointless. It adds
complexity with mp_exec_once to init aexit() to free the string, which
was leaked anyway, because the structure is thread_local and atexit only
data from the main thread was freed.

Remove all this, and just use static buffer.
2026-04-17 03:56:13 +02:00
NRK aef3793e92 osdep/io: make getenv case insensitive on windows
env vars are case insensitive on windows so getenv should
compare them as such.

Fixes: https://github.com/mpv-player/mpv/pull/17577#issuecomment-4167125610
2026-04-08 20:24:07 +02:00
NRK 1aee4637f2 osdep/io: add mp_dup_cloexec()
will be used in the next commit
2026-03-12 15:58:53 +01:00
NRK 7e9fa0dee4 osdep/io: remove redundant errno setting
according to the docs _get_osfhandle() sets errno to EBADF upon
failure already:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=msvc-170
2026-03-12 15:58:53 +01:00
NRK a2ddcdf67b osdep/io: fix error check
_get_osfhandle returns INVALID_HANDLE_VALUE on failure, not 0.
2026-03-12 15:58:53 +01:00
Kacper Michajłow 97867450ba osdep/w32_register: fix EstimatedSize
Move PathCchRemoveFileSpec after actually getting the file size. It must
have been swapped at some point by accident.

Also use correct unit for the size.

Fixes: #17375
2026-02-05 23:23:38 +01:00
Kacper Michajłow f4db102a2e osdep/language-win: remove use of GetSystemPreferredUILanguages
The system preferred language is the language used during Windows
install. It doesn't have much purpose except that it is the backend
language for core Windows internals. All user facing dialogs and text
should follow the user preferred language, as this is what the user
selected and uses on daily basis.

It makes no sense to include system language in track selection.
2026-01-21 04:39:54 +01:00
Kacper Michajłow a339fe58b5 osdep/language-win: fix use of GetUserPreferredUILanguages()
Commit baf2fd2f28 fixed this for 2nd call
to GetSystemPreferredUILanguages(), but apparently regressed the 1st
call, duh.

To retrieve the size both buffer has to be NULL and size 0.

Memory has a lot of zeros, because it has been working quite
consistently on CI.
2026-01-18 11:09:00 +01:00
llyyr 0035bb7cbd path-unix: check fopen value, and also call fclose 2026-01-04 21:50:04 +01:00
der richter 80155c3dc9 mac/touchbar: remove manual 1 second rate limit of position property
duration and position properties were observed as double which lead to a
lot of updates per second (high granularity). it is recommended to not
update the position of the touchbar too frequently, why we had a manual
1 second rate limit.

instead of manually rate limiting the property, just observe it as int64
which only updates every second. it also causes a bit less pressure for
our core.
2025-12-22 10:19:29 +01:00
der richter dc6886ebb5 mac/remote: remove manual 1 second rate limit of position property
duration and position properties were observed as double which lead to
a lot of updates per second (high granularity). it is recommended to not
update the position of the remote command center to frequently, why we
had a manual 1 second rate limit.

instead of manually rate limiting the property, just observe it as int64
which only updates every second. it also causes a bit less pressure for
our core.
2025-12-22 10:19:29 +01:00
der richter f1ad9dfdf0 mac/event: add MPV_FORMAT_INT64 handler 2025-12-22 10:19:29 +01:00
der richter bf9ddf1db2 mac/type: add Int64 type conversion helper 2025-12-22 10:19:29 +01:00
der richter 83d9de42bc mac/vulkan: log colorspace changes of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know which colorspace is used/mapped to.

log colorspace changes to actually see which colorspace was chosen.
2025-12-08 19:13:32 +01:00
der richter 5cfdbc24d9 mac/vulkan: log pixel format changes of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know which pixel format is used/mapped to.

log pixel format changes to actually see which format was chosen. only
those 9 formats are valid for a CAMetalLayer.
https://developer.apple.com/documentation/quartzcore/cametallayer/pixelformat
2025-12-08 19:13:32 +01:00
Kacper Michajłow 0f5fafdaad osdep/compiler: fix typo in MP_ASSERT_UNREACHABLE 2025-11-15 01:25:37 +01:00
LordMZTE df939d4fe8 osdep/linux-als: support ambient-light on Linux
This implements the ambient-light property on Linux using the sysfs
interface.
2025-10-15 21:59:42 +02:00
Kacper Michajłow 6c047794dd osdep/compiler: use __MINGW_{PRINTF,SCANF}_FORMAT for attribute format
This ensures that we test format string for the actual impl that is
being used. Depending if UCRT is used and if __USE_MINGW_ANSI_STDIO is
defined the implementation capabilities may differ.

Note that we don't explicitly define __USE_MINGW_ANSI_STDIO anymore,
this is defined implicitly in mingw headers, if needed. We don't support
ancient mingw versions that does not define it correctly for c11.
2025-10-05 21:34:29 +02:00
Kacper Michajłow 883db51ad0 osdep/compiler: refactor MP_ASSERT_UNREACHABLE 2025-10-05 21:34:29 +02:00
Kacper Michajłow 4338880560 various: add MP prefix for {PRINTF,SCANF}_ATTRIBUTE 2025-10-05 21:34:29 +02:00
nanahi 9422a6dc52 osdep/terminal-unix: use numpad keycodes
Use the dedicated numpad keycodes for +-*/.
2025-09-29 01:45:37 +02:00
Kacper Michajłow f65a61e488 osdep/w32_register: register url protocols if they don't exist yet
Some protocols may not exist, add them so the mapping to url handler
works correctly. Note that protocols are not removed, only the handler
is. They will remain unassociated, after unregister.

Fixes: #16832
2025-09-27 22:16:36 +02:00
Kacper Michajłow 4499f16215 osdep/w32_register: don't mark io.mpv.url as url protocol 2025-09-27 22:16:36 +02:00
der richter 065af28bc2 mac/dialog: fix build for macOS older than 11
UniformTypeIdentifiers is only available since macOS 11.
added in 6b0e4f7 and #15859.

guard the allowedContentTypes UTType property of the NSOpenPanel and
add a dummy struct UTType and dummy allowedContentTypes property on
macOS versions that don't have those available.
2025-09-15 03:59:32 +02:00
der richter a4d818b4f9 mac/compat: fix building with swift version lower than 5.7
currently we use the withLock function with NSCondition and NSLock,
which are not available on swift versions lower than 5.7. we only added
compatibility fallbacks for NSCondition though. introduced in 1364c80
and #14334.

instead of only adding the fallback to a specific class add it to the
whole protocol all the locking classes use, similar to the actual
implementation.
2025-09-15 03:59:32 +02:00