Commit Graph

54295 Commits

Author SHA1 Message Date
Kacper Michajłow
4338880560 various: add MP prefix for {PRINTF,SCANF}_ATTRIBUTE 2025-10-05 21:34:29 +02:00
Guido Cella
2f7543f808 DOCS/man/input: document that screenshot-raw works in scripts
Use the same wording as expand-text and similar commands.
2025-10-05 11:50:34 +02:00
Kacper Michajłow
17a3ac4cf2 mp_image: add support for AVAlphaMode 2025-10-04 03:26:57 +02:00
Dudemanguy
e821a360df github/workflows: reduce timeout for BSD builds
Sometimes the VMs that these run in spin forever so it's good to have
some timeout. 30 minutes is way longer than what we need. When these are
successful, they complete in under 10 minutes (especially freebsd which
is very fast). If we're at the 15 minute mark, the VM is stuck spinning
forever so just abort.
2025-10-02 18:20:10 +00:00
Dudemanguy
c946297e38 github/workflows: update cross-platform-actions to v0.29.0 and freebsd
Bigger number better.
2025-10-02 18:20:10 +00:00
Dudemanguy
9b4e8fcb07 test/libmpv_common: fflush stdout and stderr in fail 2025-10-02 15:15:48 +00:00
Dudemanguy
3bbb94077d test/libmpv: use common wrappers for properties and commands
This is mainly for better, more descriptive logging when something goes
wrong and fails. Common operations that manipulate properties and
commands go through shared functions that do better detailed logging.
Also it means we don't need check_api_error around anymore so get rid of
that. libmpv_lifetime is left untouched since that one is a bit special
and works a little differently.
2025-10-02 15:15:48 +00:00
Dudemanguy
e0cf3f8061 test/libmpv_encode: use libmpv_common.h
De-duplicates some code.
2025-10-02 15:15:48 +00:00
Dudemanguy
6179a24741 vo_dmabuf_wayland: actually reuse OSD buffers
c958990833 was supposed to implement this,
but it got forgotten and the placeholder code which just
created/destroyed every buffer for every frame was left. Oops. Finally
fix this a couple of years later.

Fixes #16863.
2025-10-02 00:32:21 +00:00
Kacper Michajłow
05656cdae7 mp_image: assume content has sRGB transfer when is full range
BT.1886 is mostly limited to TV production which is almost exclusively
limited range. sRGB for full range is better guess, if no better
information is available.
2025-09-30 01:07:36 +02:00
Attila Fidan
83fafbfbee cplugin: init pfn_mpv_get_time_ns
Fixes: fcebee9080 ("libmpv: add mpv_time_ns()")
2025-09-29 17:20:03 +02:00
llyyr
7e6f7b3f66 wayland: demote image_description_ready log to trace
this happens on every frame
2025-09-29 10:20:52 +02:00
llyyr
ad3c43f9b6 wayland: log preferred surface feedback details
Useful for debugging
2025-09-29 10:20:52 +02:00
llyyr
7037ff4563 wayland: only unset image description if we couldn't set a new one
set_image_description replaces the old image description, so we don't
need to call unset_image_description unconditionally. Only call it if we
couldn't set an image description.

This helps with the lack of synchronization between VO pageflips and
wayland protocol events mentioned in the previous commit.
2025-09-29 01:47:44 +02:00
llyyr
f0883cdde1 wayland: call pl_color_space_infer before comparing target_params
Calling `pl_color_space_infer` on `wl->target_param` can cause the
`pl_color_space_equal` check to fail on every frame if any values were
changed by `pl_color_space_infer`. This will cause us to believe
target_params get changed on every frame, and we'll end up in a state
where wayland events happen in the following order indefinitely:

  -> wp_color_management_surface_v1#45.set_image_description(...)
  -> wp_color_management_surface_v1#45.unset_image_description()
  -> wl_surface#9.commit()
  -> wp_color_management_surface_v1#45.set_image_description(...)
  -> wp_color_management_surface_v1#45.unset_image_description()
  -> wl_surface#9.commit()

Since image_description is double buffered, we always queue an unset to
the pending state before each commit. As a result, no commit ever
carries a valid image_description.

Taking the sample file in the issue as an example, we end up in this
state because the file has `min_luma == 0` but `pl_color_space_infer`
normalizes this value to `min_luma == 0.000001`. This makes it so that
we store a different `target_param` to `vo_wayland_state` on every frame
than the one received from `vo_get_target_params`. So we end up setting
image description on every frame in this case.

The key problem here is that `set_color_management` isn't blocking the
thread until `set_image_description is called`, so vo->driver->flip_page
is called before this finishes.

This commit fixes the problem by doing any operations that could change
`wl->target_param` first before doing any equality checks to skip
changing to image description pointlessly.

This fixes the problem in the issue that image_description is never set
on such files. The synchronization problem is fixed in a later commit,
because otherwise setting image_description on every frame could have
adverse frame time effects

Fixes: https://github.com/mpv-player/mpv/issues/16825
2025-09-29 01:47:44 +02:00
Attila Fidan
3020439e5a video/out/wayland_common: fix crash when uninit without display
Fixes: 39c9d1acb4 ("video/out/vulkan/context_wayland: implement target_csp for wayland")
2025-09-29 01:45:57 +02:00
Kacper Michajłow
cf393b12ac osc.lua: add indicator for buffering/loading 2025-09-29 01:45:47 +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
db2b4362c7 vo_gpu_next: add --target-colorspace-hint-strict option 2025-09-27 22:16:59 +02:00
Kacper Michajłow
2a85ac806f vo_gpu_next: respect --target-gamut in colorspace hint 2025-09-27 22:16:59 +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
Kacper Michajłow
b4c2471174 options: reduce swapchain-depth to 2 by default
It's enough to not wait for the flip and start with next frame and in
the same time minimized latency which helps display-sync modes, that are
not aware about swapchain depth.
2025-09-27 22:15:13 +02:00
Kacper Michajłow
8f6a4e50a2 Revert "vo: set swapchain-depth to 1 in display sync modes"
Allows to not wait for flip. Instead of forcing depth for display-sync
modes we will reduce default value instead.

This reverts commit d7495e4ea6.
Fixes: #16823
2025-09-27 22:15:13 +02:00
Guido Cella
cabee53ebd context_menu.lua: make gap a percentage of the font_size
Avoids having to update the gap for most users who just want to change
the font size.
2025-09-27 19:26:54 +02:00
Guido Cella
eac9ab275d console.lua: add gap script-opt 2025-09-27 19:26:54 +02:00
Guido Cella
d8123d81bd console.lua: increase the gap between menu items
Make it less cluterred.
2025-09-27 19:26:54 +02:00
nanahi
c1406fa5ec command: fix null dereference for invalid command in input-commands
mp_input_parse_cmd can return NULL. --input-commands=x segfaults with
null dereference. Fix this by adding null check.

Fixes: 533a684381
2025-09-27 18:32:47 +02:00
Dudemanguy
74b47cfcb4 test/libmpv_test_sdh_filter: start test paused and at 1 second
There is some race condition where MPV_EVENT_PROPERTY_CHANGE sometimes
gives us sub-text with an empty string which is unwanted and causes the
test to fail. Avoid this by starting the file at 1 second and paused
which hopefully avoids this. Do some additional checking on the actual
MPV_EVENT_PROPERTY_CHANGE as well to make sure we don't try to read
something we shouldn't.
2025-09-25 16:49:40 +00:00
llyyr
be98b35c89 player/misc: show percentage progress for --stream-dump
Also use format modifiers instead of casting and fix type for `pos`
2025-09-23 18:45:15 +02:00
Kacper Michajłow
ee0f701347 vo: remove "slack" frames from swapchain
Those are controlled by the `--swapchain-depth` option and is already
set to 3 by default. There is no need to add hardcoded hidden frame of
"slack". Users can adjust depth by changing the config.
2025-09-23 01:25:06 +02:00
Kacper Michajłow
d7495e4ea6 vo: set swapchain-depth to 1 in display sync modes
All the math and interpolation assumes immediate presentation of the
frame. VO is driven by VSYNC and it is expected that current frame that
we render will be displayed on current present call, without delay.
2025-09-23 01:25:06 +02:00
Guido Cella
f147b133f0 select.lua: add online documentation menu entry 2025-09-20 18:10:23 +02:00
Guido Cella
7c1a4acdb2 select.lua: add edit-config-file and edit-input-conf
Add script bindings to edit mpv.conf and input.conf, and add them to the
menu. These are useful as shortcuts, but the main motivation is that new
users often ask why they can't find mpv.conf and input.conf, so this
creates them if they don't exist.
2025-09-20 18:10:23 +02:00
ikas
0bbcc91e1b video/out/d3d11: add changing size support for composition mode 2025-09-19 02:26:08 +02:00
der richter
764da9919c ci/mac: add test runner for oldest macOS target
only meant for testing the oldest macOS target we support, currently
10.15, to catch possible usages of features that are not supported and
not properly guarded.

since dependencies are not build for that taget it will lead to a
partially broken build.
2025-09-16 02:47:33 +02:00
der richter
a9cccbcd15 ci/mac: remove unnecessary cc and ccx variables 2025-09-16 02:47:33 +02:00
der richter
56ca37014b ci/mac: pin homebrew for macOS 13 runner to last working version
since macOS 13 is now unsupported and homebrew also dropped support for
it too, the macOS 13 bottle downloads were removed. leading to either
a broken or very long dependency installation (build from source).

to fix, pin the last known working homebrew version for macOS 13 where
the bottle download links weren't removed yet. for this to work we need
to disable (auto) update of homebrew.
2025-09-16 02:38:25 +02:00
ikas
6996c065c8 video/out/d3d11: return unknown color space when use composition 2025-09-16 02:38:01 +02:00
Guido Cella
8406834075 context_menu.lua: add this script
This implements a ASS context menu to be used on platforms other than
Windows.

The select script message will allow selecting an item with a single
click when releasing a mouse button, like in native context menus. This
is mainly useful to cycle pause with one click.
2025-09-15 04:12:57 +02:00
der richter
af4e4fed44 meson: disable swift when cocoa not available or disabled
it doesn't make sense to build the swift parts without cocoa because
the swift bridge would be missing and it's impossible to interact
with the swift parts from obj-c, swift depends on cocoa/appkit/etc, and
the cocoa main function/main loop is missing making anything
cocoa/appkit/GUI crash on use.

like this it is possible to build mpv on macOS without cocoa, it will
fallback to the unix main function and mpv can run in 'headless' mode,
eg you can use it from CLI, it won't spawn any App icon/menu/etc, and
you can use everything that isn't related to cocoa/appkit/GUI like audio
playback. anything other will make mpv segfault, for example sdl2 and
its vo, since it tries to spawn a window.
2025-09-15 03:59:55 +02:00
der richter
b4151d4449 meson: properly add path-mac.c to path_source and don't overwrite it
path-mac.c was not properly set as path_source for macOS. it didn't lead
to any errors because it was added to the normal source files. though
in the case of tests and for certain setups the mac path symbols were
not found.

to fix that properly add path-mac.c to path_source (additional to
path_darwin.c), remove it from the normal source files and don't
overwrite it later with the posix or darwin path.

this was overlooked in 9db8182 and #11374
2025-09-15 03:59:32 +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
der richter
00415f1457 osdep/mac/meson: fallback to swift build for old swift versions
with commit 8d20b72 and PR #15442 we switched to the recommended swiftc
compiler for building our swift code. this lead to some
incompatibilities with swift versions prior to 5.8, where a new linker
was introduced.

work around that problem by using the old swift frontend build for older
swift versions. this can be removed when we remove the support for those
old versions.

Fixes #15591
2025-09-15 03:59:32 +02:00
der richter
5e4a406194 command: fix type mismatch 2025-09-15 03:59:32 +02:00
der richter
300b53de62 ci/mac: use oldest available xcode toolchain for macOS 13 runner
using the oldest xcode toolchain will test some code paths that weren't
previously tested, eg older SDK and swift versions.
2025-09-15 03:59:32 +02:00
cryeprecision
4a5a9a58a7 sub: remove upper limits of margin-x and margin-y 2025-09-15 03:58:50 +02:00
arch1t3cht
eba7a11a2e player/command: do seamless angle change when bluray-angle is changed 2025-09-15 03:52:35 +02:00
arch1t3cht
31bd176357 stream_bluray: add bluray-angle option
1-index angles to be consistent with DVD angles in mpv and with the
1-indexing in other applications like libbluray's example programs.

The three existing calls to bd_get_title_info all only access the
duration, the playlist, and the number of angles, which do not depend on
the passed angle, so they can keep being called with angle 0 for
simplicity.

Documentation taken from before
35e8b6c1e6.

Fixes #5012.
2025-09-15 03:52:35 +02:00