Compare commits

...
3069 Commits
Author SHA1 Message Date
Kacper Michajłow 4013a3c9b6 ci/build.yml: add publish job for git prerelease 2026-06-04 19:44:44 +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
NRK 6d5c8591eb osc: reevaluate mouse state after leaving never
currently mouse processing only happens on mouse movement which
causes cases where going from never -> auto does not show the
osc even though the cursor might be in proximity.

move mouse processing code to a function and refresh it when
leaving visibility never to avoid such issues.

Fixes: https://github.com/mpv-player/mpv/pull/17954#discussion_r3286015305
2026-06-04 00:18:55 +02:00
NRK 048c5ec351 osc: fix thumbnails clearing on visibility change
currently hide_bar() bypasses set_visible when visibility was
changed to `never`, this can leave the thumbnail hanging.

instead of scattering disable_thumbnail() calls around, just
call set_visible(false) instead.

Fixes: 9ce79bcaa
2026-06-04 00:18:47 +02:00
NRK 31ee4f99e5 osc: only clear thumbnails when hiding
this currently disables thumbnail even on set_visible(true)
calls which was causing flickering due when scrubbing through
the timeline. only disable thumbnail when hiding the osc.

Fixes: 9ce79bcaa
2026-06-04 00:18:47 +02:00
arch1t3cht 20ec48b717 menu.conf: make quit-watch-later item name more user-friendly
The name "Quit watch later" is hard to understand for users that don't
already know about the quit-watch-later command.

For what it's worth, this does also have some downsides:

1. It makes the context menu even wider, since "Quit watch later" was
   already the longest option.
2. The meaning of the "Open > Watch later" option may now be slightly
   less obvious to users. But this option does not work by default
   anyway, so the user will need to read the manual either way before
   using this option.

But these are fairly minor issues.
2026-06-04 00:16:54 +02:00
verygoodlee 3d709c731c console.lua: take position indicator into account when calculating width
sometimes the position indicator takes up a large portion of the input area, leaving almost no space for input.
2026-06-04 00:16:23 +02:00
Kacper Michajłow bdbeecbc11 demux_lavf: select non-empty edition by default
Some files, that are stripped from programs without edition program
table expose all old programs, that are not usable. Try to select the
one that actually has tracks.

Fixes: https://github.com/mpv-player/mpv/issues/18053#issuecomment-4607524402
2026-06-03 18:56:23 +02:00
Kacper Michajłow 7ae4846c17 player/misc: rate limit taskbar progress update rate
Rate-limit progress-only updates. The win32 backend forwards these to
the shell (explorer.exe), we don't want to spam it too much to avoid
performance issues, when stealing cpu time from the shell thread. In
normal playback, this doesn't update at all, but in live streams the
duration can change, even on every frame.

Fixes: #18053
2026-06-03 18:56:05 +02:00
Kacper Michajłow 448de741f9 DOCS/compile-windows.md: update guide to mention missing pieces 2026-06-03 05:06:14 +02:00
Kacper Michajłow 02273e9d9e ci: fix comment workflow permissions
We are commenting on pull requests.
2026-06-02 12:05:07 +02:00
Kacper Michajłow ad119d9dc9 stream_curl: expose redirect location to lavf
Some demuxers like DASH and HLS, query the location through the
"location" av option, this is how http.c in lavf exposes it. Respect
this interface and expose effective url.

Fixes: https://github.com/mpv-player/mpv/pull/18044
2026-06-02 08:36:21 +02:00
Kacper Michajłow 18d38d4f3e demux: don't mark mid-stream cache ranges as BOF
queue->is_bof is set optimistically after a seek to start, assuming
demuxing began at the start of the file. That is wrong for streams
opened mid-content, which can happen in unfinished event HLS playlists,
which starts at live-edge, but the seekable range in the past is still
valid.

For full support this also require change in lavf [1] to fix the overall
duration of the stream and seeking.

[1] https://code.ffmpeg.org/FFmpeg/FFmpeg/commit/6d98a9a2e8757d6eb616501ade06877389a31597

Fixes: #11990
2026-06-02 08:35:31 +02:00
Kacper Michajłow 1c29507822 ci/msys2: workaround crashing whisper.cpp after unload
When FFmpeg is built with whisper.cpp, the libmpv-lifetime test fails
with `GGML_ASSERT(prev != ggml_uncaught_exception)`. Avoid this by
disabling the problematic backtrace code.
2026-06-02 02:11:07 +02:00
Kacper Michajłow f5d4d9b029 swresample: pass input layout in mpv's order via custom channel order
Drop the swr_set_channel_mapping() + transpose_order() + reorder_in[]
plumbing. Instead, build the swr input channel layout directly from the
mpv chmap as AV_CHANNEL_ORDER_CUSTOM, so the labels in the layout already
match the positions of the channels in the input data.

For all unknown map, we return all UNSPEC, so the swr expands to default
layout for this channel number.
2026-06-01 16:53:48 +02:00
Kacper Michajłow 43a2d9ac0d swresample: remove dead fudge_layout_conversion
Since 9ef614d6a3 this helper has been a no-op. fudge_layout_conversion()
returned the modified uint64_t channel-layout bitmask, but the new
AVChannelLayout path builds out_layout from the unfudged out_lavc and
feeds that to swr.

Even when it was wired up, libswresample handles the BL/BR <-> SL/SR
mapping if needed. SDL/SDR is not currently handled, but I would rather
patch the swr/rematrix.c for those too, instead of having custom glue
here.

Note that SDL/SDR are not that common in-practice.
2026-06-01 16:53:48 +02:00
Kacper Michajłow f239c2dd76 demux_lavf: migrate to AVStreamGroupLayeredVideo 2026-06-01 12:28: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
Ricardo Fonseca 74271a7d80 sub/sd_ass: subtitle timing rounding errors
Use floor(pts * 1000 + 1e-6) instead of llrint() for all timestamp
conversions to avoid floating-point precision errors causing early
subtitle presentation on boundry frames.

Fixes: #17453
Signed-off-by: Ricardo Fonseca <ricardofonseca94321@tecnico.ulisboa.pt>
2026-05-31 03:29:50 +02:00
Kacper Michajłow 13a3e3ad0e stream_curl: log user friendly message when TLS verification fails 2026-05-28 20:14:35 +02:00
Kacper Michajłow ee3d72ce02 options: enable tls-verify by default
We shouldn't default to no verification in current year. User can
opt-out if needed.

Keep it disable for builds without libcurl when libavformat is older
than 63.0.100. This is done to match ffmpeg's timeline for enabling
tls_verify by default in lavf, also to ensure we the default verify
locations will be loaded on such version.
2026-05-28 20:14:35 +02:00
Kacper Michajłow ca89a744c9 stream_curl: tell libcurl to use the native CA store
This is independent of other CA certificate locations set at run time or
build time. Those locations are searched in addition to the native CA
store.
2026-05-28 20:14:35 +02:00
llyyr cce65c722c wayland: map ICtCp coefficients to BT.2100 HLG as well
H.273 defines a single ICtCp matrix coefficients for both BT.2100 PQ and
HLG.
2026-05-27 15:21:19 +02:00
Philip Langdale d05814ceef hwdec_vulkan: fix partial failure edge cases in error paths
This is another file where the slopbot identified a problem, but I was
surprised to see it fix it in a poor way and also miss an adjacement
problem.

`mapper_map` calls `mapper_unmap` with the intention of using it to clean
up partial failure after some planes are wrapped and released while others
are not. But the current code would actually segfault in that situation.

There are two fixes required:

* Ensure `p->vkf` is set by `mapper_map` early so that its available to
  `mapper_unmap` in the error path
* Don't call `vkfc->unlock_frame` in the `mapper_map` error path, as
  this will be called by `mapper_unmap`

Fixes #17977
2026-05-26 18:22:04 -07:00
Philip Langdale 89b95243ef hwdec_cuda: fix partial failure edge cases in error paths
The slopbot spam did find valid issues in the error paths in this code, and as
part of verifying them, I have additional fixes.

* ensure that the return value -1 from `cuda_init()` if `ext_init()` fails
* zero alloc the `ext_vk` and `ext_gl` structs so that we have a known initial
  state
* explicitly initialise the `sem_handle.fd` to -1 to ensure we don't
  accidentally close stdin in the error path. But also don't do this on
  windows as an invalid Handle is 0.
* Don't do a double `cuCtxPopCurrent()` in the `ext_gl` init failure path

Fixes #17976, #17988, #17989
2026-05-26 18:22:04 -07:00
Kacper Michajłow 427e4bf25d stream_curl: support offset/end_offset passed in AVDictionary
lavf's http demuxer exposes initial/final byte offsets as AVOptions.
Some demuxers, like lavf/hls.c assume it is always available, even for
custom IO. We need to use those values for correct demuxing.

Fixes: https://github.com/mpv-player/mpv/pull/17879#issuecomment-4468476976
2026-05-26 19:32:02 +02:00
dependabot[bot] 1ac687d791 ci: bump cross-platform-actions/action from 1.0.0 to 1.1.0
Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-version: 1.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-24 15:59:02 +02:00
llyyr 9e06c3248a ao_pipewire: avoid passing NULL to mp_msg 2026-05-22 17:51:57 +00:00
llyyr 1a78f9fa8e ao_pipewire: avoid deadlock when starting thread loop
loop_start starts a thread which immediately acquires the thread loop
lock. Locking the loop before loop_start can therefore deadlock the
newly created thread during initialization.

Locking the thread loop before loop_start was always incorrect, but
Pipewire commit fb49e0795c28* made the issue visible by switching
pw_thread_loop_lock to the underlying SPA loop lock.

To fix this, we just avoid starting the loop until after we're connected
to the server.

* https://github.com/PipeWire/pipewire/commit/fb49e0795c28c892116b03369785ba86c27c968d
2026-05-22 17:51:57 +00:00
Kacper Michajłow db73857997 ytdl_hook.lua: map ass/srt subtitles 2026-05-21 21:47:45 +02:00
llyyr d521821573 demux_cue: fix audio file lookup inside subdirectory
The FILE field in a CUE sheet may contain a relative path with
subdirectories. It's not clear if this usecase is intended to be
supported, as none of the usual CD/DVD ripping tool generates this type
of FILE field in the CUE sheet. The specification is old and abandoned,
so this will likely never be clarified and it doesn't cost much to
support it so might as well...
2026-05-20 23:22:18 +02:00
Guido Cella 6eaf35866c command: add support for printing sub-lines
show-text ${sub-lines} can be used to print subtitle lines around the
current one and have them hide automatically.
2026-05-20 23:21:49 +02:00
NRK 59c91def55 osc: add back hover-sec in draw-preview
this was initially part of draw-preview but was later moved to a
separate property because it was deemed useful outside of just
thumbnail preview. however this causes bugs when a thumbnailer
observes draw-request and the draw rectangle doesn't change (e.g
due to getting clamped around the border).

add back hover-sec which makes the draw-request more self
contained and removes this footgun.

Fixes: https://github.com/mpv-player/mpv/pull/17518#discussion_r3256017469
2026-05-20 23:17:17 +02:00
Guido Cella 3d111fbf1e demux_libarchive: apply --directory-filter-types to files in archives
Fixes #17931.
2026-05-20 23:15:44 +02:00
Mikael Magnusson 7d603534de msg: don't allow any escapes in --term-title
Unlike --term-playing-msg, the --term-title string is printed in an
escape sequence already. If we print other escapes during this sequence,
it will abort the sequence and dump the rest of the title string as a
visible string to the user, and possibly beep as well, since the title
string can end with a bel character.

Also updates the manpage to remove a comment about win32, since
terminal-win.c does handle OSC title sequences, calling SetConsoleTitleW.
2026-05-20 10:56:08 +02:00
Mikael Magnusson 5f5839aadb video/out/x11_common: set the source indication to 1 in vo_x11_minimize
This was the only call that didn't do this.
2026-05-20 10:55:59 +02:00
Mikael Magnusson c0ef68904d video/out/x11_common: add --focus-on support in X11
Note that when the video params don't change, the check in
player/video.c does not call vo_reconfig2 and the _NET_ACTIVE_WINDOW
message is not sent. As far as I can tell, the same limitation is true
for the macOS implementation, but I can't test that.
2026-05-20 10:55:59 +02:00
Lynne 4c72a03546 video/decode: enable APV hwdec by default
Today, FFmpeg got an APV decoder written in Vulkan compute shaders.
2026-05-20 10:55:48 +02:00
sfan5 1fe37856cb ci: fix comment workflow permissions 2026-05-19 18:54:30 +02:00
Lynne 98c3ae4add vulkan/context: don't activate descriptor buffers after ffmpeg 8.1 2026-05-19 17:35:08 +02:00
Lynne 873a1e8a24 vulkan/context: activate runtime array indexing and non-uniform accesses
We use them everywhere in Vulkan in FFmpeg now.
2026-05-19 17:35:08 +02:00
llyyr a16b333eef meson: bump libcurl minimum version to 7.87.0
CURL_WRITEFUNC_ERROR is only avaialble from 7.87 onwards
2026-05-19 15:55:13 +02:00
sfan5 8fc1a10a44 ci: fix necessary permissions for cleanup_caches and comment
This undoes de5edca29c,
because I failed to read the documentation.
2026-05-18 21:13:09 +02:00
sfan5 de5edca29c ci: clarify that cleanup_caches and comment don't use token permissions 2026-05-18 20:53:29 +02:00
Clinton Phillips 35ae76daad docs/comments: fix more doubled-word typos
Follow-up to #17926, addressing the four additional instances flagged
by @garoto:

- DOCS/man/options.rst: "output size size is limited" -> "output size is limited"
- DOCS/man/input.rst: "Called after after a file" -> "Called after a file"
- video/out/gpu/video.c: "target target that needs to be written" -> "target that needs to be written"
- video/out/x11_common.c: "enable DPMS only we we disabled it before" -> "enable DPMS only if we disabled it before"
  (this one wasn't a pure duplicate — the first "we" was a typo for "if"; the comment now matches the conditional on the line above)
2026-05-18 16:47:14 +02:00
Kacper Michajłow 059bc7025b stream_curl: disable by default on libavformat < 62.15.101 2026-05-16 18:20:42 +02:00
Kacper Michajłow 724b76fe0a stream_curl: add --curl-enabled option 2026-05-16 18:20:42 +02:00
Kacper Michajłow f7e0fd8f0e meson: add curl to summary 2026-05-16 18:20:42 +02:00
Kacper Michajłow 9a9c890e23 stream_curl: use for ftp/ftps
It's significantly more stable than Lavf. Fixes seeking out of cached
ranges. Additionally correctly marks demuxer_is_network for ftp too.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 4dc772c429 stream: don't drop data on stream_read_more
At the initial file open, the buffer may be populated with more data,
than later requested by decoder, but don't drop this data. This fixes
initial open to perform multiple reads of the area, especially for
images that are likelly fully read for probbing already.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 0ae2214a7a ytdl_hook.lua: use the new curl-max-request-size option if needed
This is for stream_curl.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 332764d909 stream_curl: build protocol list based on libcurl state
Allow only subset of supported protocols by libcurl.
2026-05-16 18:20:42 +02:00
Kacper Michajłow b14d8f5ee1 demux_lavf: route nested HTTP opens through the curl backend
Hook AVFormatContext.io_open so HLS/DASH segment fetches and other
nested FFmpeg I/O go through stream_http when libcurl is available.
This lets segments inherit the connection reuse, HTTP/2 multiplexing,
mid-stream resume and conditional compression of the top-level stream.

Falls back to FFmpeg's default I/O for non-HTTP URLs and when the curl
backend is not built in.
2026-05-16 18:20:42 +02:00
Kacper Michajłow f658223abb stream_curl: allow reading cookies not only from a local file 2026-05-16 18:20:42 +02:00
Kacper Michajłow c6833a9307 stream_curl: add libcurl-based stream backend
Introduces stream_http, an internal libcurl-driven backend for http://
and https:// URLs. Runs all transfers on a dedicated curl multi thread
with a producer-side ring buffer, and exposes HTTP/2 multiplexing,
QUIC/HTTP/3 (when libcurl supports it), HSTS and TCP keep-alive.

Should generally be more stable and faster than FFmpeg HTTP/1.1 impl,
additionally connections are kept-alive between files open, so if you
open playlist of network files and navigate through them, it will re-use
the same connection.

Build is gated on the new 'libcurl' meson option (auto). When disabled
or unavailable, mpv silently falls back to FFmpeg's HTTP implementation.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 5936572e1e ci/build-win32.ps1: disable libpsl tests build 2026-05-16 18:20:42 +02:00
sfan5 ea12f8efc8 ci/mingw: add libcurl 2026-05-16 18:20:42 +02:00
Kacper Michajłow f90dfd033f ci: install curl 2026-05-16 18:20:42 +02:00
Kacper Michajłow cdd3f1197f stream: split shared network options into their own sub-options
Will be useful for future commits
2026-05-16 18:20:42 +02:00
Kacper Michajłow 96ade17428 options: fix stream_lavf options struct name 2026-05-16 18:20:42 +02:00
Kacper Michajłow 6017d1fd1c ytdl_hook.lua: write cookies via cookies-file instead of stream-lavf-o
stream-lavf-o[cookies] only feeds the lavf stream backend. Instead of
side-loading it, use core `--cookies-file` option.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 893313e5af stream/cookies: allow reading cookies not only from a local file 2026-05-16 18:20:42 +02:00
Clinton Phillips 779378c248 docs/comments: fix doubled-word typos
Pure typo fixes in user-facing manpages, interface changelog, and
source comments. No behavior change.

- DOCS/man/encode.rst: "copying of the the comment" -> "copying of the comment"
- DOCS/man/options.rst: "visible takes the the menu bar" -> "takes the menu bar"
- DOCS/interface-changes.rst: "rename the the lua-settings/" -> "rename the lua-settings/"
- video/out/present_sync.c: "requires that that caller" -> "requires that the caller"
- player/lua.c: "try to get by by filtering" -> "try to get by filtering"
2026-05-16 05:26:02 +02:00
Kacper Michajłow 4498c0ff81 ci/build-win32.ps1: bump ffmpeg to 8.1 branch 2026-05-15 00:40:17 +02:00
llyyr f4d059b1d9 vd_lavc: disallow hwdec for grouped streams
44a2c33939 tried to do this in a cute way by unsetting the hwdev to
be used for hwdec, but this doesn't prevent -copy variants from being
probed. Instead explicitly disallow it for grouped streams
2026-05-13 22:24:07 +02:00
sfan5 7b70999b62 ci/mingw: cache tar downloads 2026-05-13 20:45:41 +02:00
llyyr 914114a2cf wayland: fix typo 2026-05-13 15:28:29 +00:00
llyyr 02b4f8ca69 wayland: remove stray spaces before function call parenthesis 2026-05-13 15:28:29 +00:00
llyyr 90f63675ce wayland: return bool values for bool type create_input function
Also invert the return value to better match the rest of the file, and
adjust callers accordingly.
2026-05-13 15:28:29 +00:00
llyyr bef4dc37db wayland: convert create_xdg_surface to bool
create_xdg_surface returns success/failure, so use bool instead of int
for its return type. Also invert the return values to better match the
style of the rest of the file, also adjust callers accordingly.
2026-05-13 15:28:29 +00:00
llyyr ff2d112132 wayland: convert create_viewports to bool
create_viewports returns success/failure, so use bool instead of int for
its return type. Also invert the return values to better match the style
of the rest of the file, also adjust callers accordingly.
2026-05-13 15:28:29 +00:00
llyyr e92538b1db wayland: convert spawn_cursor to bool
spawn_cursor returns success/failure, so use bool instead of int for its
return type. Also invert the return values to better match the style of
the rest of the file, also adjust callers accordingly.
2026-05-13 15:28:29 +00:00
llyyr d28bc02393 wayland: convert check_for_resize to bool
Only returns if a resize edge was found
2026-05-13 15:28:29 +00:00
llyyr ae811ddbbb wayland: log current preferred scale, not older stale one 2026-05-13 15:28:29 +00:00
llyyr 6c34c07b36 wayland: null-check before munmap call
munmap(NULL, 0) returns a failure, also this follows project style
2026-05-13 15:28:29 +00:00
llyyr db4506be45 wayland: fix resize edge boundary checks
The `>` checks exclude a pixel, which is asymmetric with the `<` checks.
Use `>=` for the right and bottom resize edge checks, to not skip a
pixel.
2026-05-13 15:28:29 +00:00
llyyr 3a5e05720e wayland: fix condition for tablet tool cursor shape device destroy 2026-05-13 15:28:29 +00:00
llyyr 0be060ed76 wayland: fix mapping for PAL/NTSC primaries
525 lines is NTSC, 625 lines is PAL. Previously we had them reversed.
2026-05-13 15:28:29 +00:00
Kacper Michajłow 37f4edffaf f_output_chain: don't lose EOF frame on filter failures 2026-05-13 15:44:03 +02:00
Guido Cella 631cdd3622 select.lua: preserve empty subtitle lines
Fixes e9fbf49466.
2026-05-13 15:43:38 +02:00
llyyrandGuido Cella 44a2c33939 f_decoder_wrapper: disable non-copy hardware decoding for stream groups
This allows playing tile grid images without manually disabling hardware
decoding. There is no other type of stream group known to support
hardware decoding so far.

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2026-05-13 14:55:48 +02:00
Guido Cella aa57714b63 video: merge the tiles of grid heif and avif images
Fixes #13585.
Fixes #14982.
Fixes #16486.
2026-05-13 14:55:48 +02:00
Kacper Michajłow c3f8acc10f f_decoder_wrapper: add support for N -> 1 stream merging
This allows to spin N decoder of dependent streams, and merge them in
single output using a filter. Currently only lavfi is supported, and
should be set as a string in the stream group definition.

In the future more advance merging can be implemented in place of lavfi,
but the grouping of the streams should be similar.

This will be useful for tile merging or LCEVC style enchantment support.
May even be useful for DV EL, but this is often not a separate track.
2026-05-13 14:02:10 +02:00
Kacper Michajłow 8c76342a52 demux: select all tracks represented by the stream group 2026-05-13 14:02:10 +02:00
Kacper Michajłow 1095d85b51 demux/stheader: add sh_stream_group representing stream group 2026-05-13 14:02:10 +02:00
Kacper Michajłow cdf77d9274 vo_gpu_next: always cache frames in paused state and never interpolate 2026-05-13 11:22:09 +02:00
Kacper Michajłow 0c4ad9adf6 vo_gpu_next: respect interpolation-preserve option for cache flush
Flush cache only if interpolation-preserve is off, or in paused state to
get immediate update.

Fixes unnecessary cache flushes when parameters of external hooks are
updated rapidly.
2026-05-13 11:22:09 +02:00
nanahi 21351a0580 options/m_property: only get m_option info when needed
Micro optimization.
2026-05-12 21:39:34 +02:00
nanahi f98b114d58 options/m_property: use mp_require for log
log cannot be null on write path which is true for multiply and switch.
2026-05-12 21:39:34 +02:00
nanahi ae23198144 options/m_property: simplify m_property_multiply/m_property_switch
M_PROPERTY_GET_CONSTRICTED_TYPE is already acquired, just pass m_option
directly.
2026-05-12 21:39:34 +02:00
nanahi 6320792f1b options/m_property: try to get constricted type in m_property_do
When setting properties via M_PROPERTY_SET_NODE, the property value
is limited by static declared range. However, some properties like
volume handle dynamic M_PROPERTY_GET_CONSTRICTED_TYPE requests and
return runtime determined limits. M_PROPERTY_SET_NODE in this case
does not respect that limit, and allows setting to a value out of
range.

Fix this by always trying to use M_PROPERTY_GET_CONSTRICTED_TYPE
first so that the dynamic limits will be used.
2026-05-12 21:39:34 +02:00
nanahi 27ec68fbd8 options/m_property: add log null check to m_property_multiply
Similar to m_property_switch, cannot be null for write paths.
2026-05-12 21:39:34 +02:00
nanahi 13550bd31d options/m_property: extract m_property_switch to a function
Similar to m_property_multiply.
2026-05-12 21:39:34 +02:00
Kacper Michajłow c411c6ea68 f_decoder_wrapper: output EOF when decoder is unavailable
When decoder is not available or failed to initialize, just signal EOF
and allow player to close, instead of spinning waiting for frame that
will never arrive.
2026-05-12 14:13:05 +02:00
Kacper Michajłow 6bdacac991 player/loadfile: fix stack-overflow on EDL metadata track
demux_edl allocates metadata track with type set to STREAM_TYPE_COUNT,
when counting track types this was not accounted for. Make room for this
"special" type of track. Add asserts while at it, just in case.

Note that other similar uses are gated behind track->selected, and
metadata track will never be marked as one.

This is not exploitable, as it was overriding only one integer value past
the allocated array, so worse thing that could happen is that we
misbehave during track selection or crash.

Side note, OSS-Fuzz was fuzzing this for few years now, and couldn't dig
into this specific case. I've validated that our fuzzer is in fact
reproducing this issue when provided the testcase, which I belive was a
basis for this report.

Fixes: GHSA-qpf4-42gw-f286

This vulnerability was discovered by Claude, Anthropic's AI assistant,
with OSS-Fuzz fuzzing and triaged by Ada Logics manually in
collaboration with Anthropic Research.
2026-05-12 13:09:22 +02:00
Guido Cella 7732c305a5 osc.lua: hide 0 duration
Restore the behavior before 3183ea99.
2026-05-12 00:06:35 +02:00
Guido Cella 8674222927 input.conf: make rotate keybindings repeatable
Needed because --video-rotate is OPT_CHOICE.
2026-05-10 20:46:31 +02:00
Hubert Głuchowski bba7c53a29 sub/sd_sbr: implement get_lines 2026-05-10 00:39:41 +02:00
Hubert Głuchowski a0ff557459 sub/sd_sbr: implement get_text 2026-05-10 00:39:41 +02:00
sfan5 003c5433f6 ci/mingw: switch to zlib-ng
gotta go fast
2026-05-10 00:02:19 +02:00
sfan5 373cfc6924 ci/mingw: refactor tar downloading 2026-05-10 00:02:19 +02:00
nanahi 7b057f66fa DOCS/man/mpv: add usage hint alternative for pseudo-gui profile
This has been deprecated for 9 years since
9eef41dec1.
With the previous commit, this can be replaced by conditional autoprofiles.
Add usage hint to the documentation.
2026-05-09 15:01:09 +02:00
nanahi ed2e55b941 options: make player-operation-mode readable as a property
Make it readable as a property so that scripts and conditional
autoprofiles can customize behavior depending if player is
launched as pseudo gui mode.
2026-05-09 15:01:09 +02:00
llyyr 4414547d62 wayland: use lrint for keepaspect window sizing
Avoid biasing sizes upwards
2026-05-09 14:50:17 +02:00
llyyr 1a1288184a wayland: force redraw on every configure when in toplevel resize state
This fixes stalled/slow resize when there's only an image being
displayed or no output at all. When there's a video playing, the video
implicitly causes a redraw but we need to redraw ourselves when there's
no video.

Fixes: https://github.com/mpv-player/mpv/issues/16744
2026-05-09 14:50:17 +02:00
sfan5 24fbc99701 ci/mingw: some small cleanups and updates
Note: zlib 1.3.2 breaks with -Werror=undef, so we don't update it.
<https://github.com/madler/zlib/issues/1169>
2026-05-09 12:07:53 +02:00
Guido Cella e9fbf49466 select.lua: split multi-line subtitles
Before 77ed8fef88 texts with multiple lines were split to multiple
items, after it only shows the text before any newline.

Split lines again.
2026-05-09 09:56:13 +02:00
Kacper Michajłow e0eb42c303 demux: add --demuxer-hysteresis-bytes
Fixes: https://github.com/mpv-player/mpv/discussions/17888#discussioncomment-16852506
2026-05-08 17:27:13 +02:00
Kacper Michajłow 09900a0ff0 demux/packet_pool: incrementally free old packets on pop
Until now the pool only released its packets on shutdown or when the
cache size was reduced at runtime, so it kept growing across a session.
The amount of packets would be indirectly bound by demuxer cache size,
else the packets are reused. Still over long playback or switching
files, this may give impression of elevated memory usage, or even memory
leak. This was particularly visible with cache-on-disk, where users
reasonably expect RAM usage to stay low.

Pop now keeps the first POOL_HOT_RESERVE packets at the head of the
freelist for fast reuse, and frees up to POOL_GC_BATCH packets from
beyond that on each call. Bulk pushes (e.g. cache reset on file end)
remain no-work policy. The pool drains across subsequent allocations
rather than stalling on a single huge free. Self-balancing without any
size tracking.

This drains the pool in steady state. Note that on file switch we
effectively reuse only ~N / POOL_GC_BATCH packets from the old cache,
because each pop reuses just one packet while freeing up to
POOL_GC_BATCH. That's fine, both free and alloc calls are throttled to
the same per-pop rate, so allocator pressure stays bounded even though
not all packets get reused.
2026-05-08 14:43:36 +02:00
Kacper Michajłow 2c8f449f1e ci/build-win32.ps1: update shaderc patch 2026-05-08 12:06:25 +02:00
Kacper Michajłow 4d944b2fad ytdl_hook.lua: remove track selection hack
This breaks HLS bitrate selection, as it uses track metadata in place of
HLS bitrate, which are most of the time different things.
2026-05-07 18:59:08 +02:00
Kacper Michajłow 8c26c0c1e9 TOOLS/matroska.py: plumb some type hints to make new mypy happy
We don't use strict mode still, so only few are typed.
2026-05-07 14:29:04 +02:00
Kacper Michajłow cfd818bcae ra_gl: fix memory leak 2026-05-05 20:17:24 +02:00
Kacper Michajłow 333857403f test/libmpv_common: wait for all clients and player to be destroyed
mpv_destroy() only detaches the client, while leaving the player alone.
Since this is exit cleanup, we should just wait and quit whole player.
2026-05-03 20:26:40 +02:00
llyyr 948c86d24c player/lua: fix autofree ctx leak on exit() call
Fixes LSAN leak when tests call fail() and exit(1) is called. We have
mpv_destroy set for atexit but data.ctx was null parented, so it had no
parent to be freed by. Parent it to script_ctx instead so it gets
cleaned up by mpv_destroy.

LSAN output:

Direct leak of 400 byte(s) in 5 object(s) allocated from:
    #\0 0x7f4c6c52c01f in malloc (/lib64/libasan.so.8+0x12c01f) (BuildId: db0aa5bf57ed53a5869a3a2cc49051292ceb6390)
    #\1 0x7f4c6b276388 in ta_alloc_size ../ta/ta.c:139
    #\2 0x7f4c6b2bf01f in script_autofree_trampoline ../player/lua.c:1310
    #\3 0x7f4c69373b15  (/lib64/libluajit-5.1.so.2+0xbb15) (BuildId: 182622c63dea3dd74173bbd5a810051a76bcf4d9)
2026-05-03 17:25:17 +02:00
Ivan Shapovalov ce71cd8aeb mp_image: refine check for supported Dolby Vision metadata
Improve the Dolby Vision metadata check to accept RPUs that indicate EL
usage (profiles 4 and 7) if the original bitstream and metadata are
MEL-only, instead of hardcoding a check for disable_residual_flag.

This needs libplacebo commit a4783f89 ("util/libav: do not bail on
MEL-only RPUs w/EL"), or libplacebo API version 359.
2026-05-03 11:49:47 +02:00
Kacper Michajłow 7c25b3e47c vo_gpu_next: fix upload synchronization
And make them actually async when copied from host ptr. The issue was
when we used DR buf upload, which is always async, it was not
synchronized in anyway.

Fixes: #13811
2026-05-03 08:47:34 +02:00
llyyr d8be86067c ao_pulse: fix subscribe_cb using wrong bitmask for event type
PA_SUBSCRIPTION_MASK_SINK is a pa_subscription_mask constant used when
registering with pa_context_subscribe(), not a
pa_subscription_event_type mask. Masking the event type with it would
never match PA_SUBSCRIPTION_EVENT_NEW or PA_SUBSCRIPTION_EVENT_REMOVE,
causing hotplug events to be silently dropped.

Fixes: e01750020d
2026-05-03 06:44:37 +02:00
nanahi 5e847889b3 osdep/win32/smtc: fix client handle leak 2026-05-01 13:42:57 +02:00
nanahi 0ec3015339 player/external_files: remove handling related to update sub exts
This is only used to update the list for player internal sub ext matching.
Since this handling now lives in the dnd client, it can be removed from
core, which also eliminates a global variable.
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 81611b4a4e input/dnd: move built-in drag and drop handling to mpv client
This moves the drag and drop handling to an internal mpv client,
removing the hardcoded handling from core.
2026-05-01 13:42:57 +02:00
nanahi 87ccb6022c command: add dropped-file property
This adds dropped-file property which contains a list of dropped files
and the type of the drop. This allows clients to implement custom drag
and drop handling.
2026-05-01 13:42:57 +02:00
nanahi e12ab84571 input: add --input-builtin-drag-and-drop option
This allows disabling the built-in drag and drop handler, while still
allowing VO to announce dropped files.
2026-05-01 13:42:57 +02:00
nanahi 544a56a148 input: rename notify_touch_update to notify_event_update
Will also be used to notify dnd updates.
2026-05-01 13:42:57 +02:00
nanahi 41fb7f9eb2 command: use string list helper for option-info 2026-05-01 13:42:57 +02:00
nanahi 777401d7de options/m_property: add SUB_PROP_STRING_LIST
Helper used in next commits.
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
Kacper Michajłow cdbe01c3db demux_lavf: add support for stream groups
Currently none of them are fully supported, but at least mark dependent
tracks as such.
2026-05-01 11:44:26 +02:00
Kacper Michajłow c0c7584342 etc/builtin.conf: change gui mode to idle=yes
It is more expected from GUI application to stay open, even after
playback. Additionally this gives user a chance to inspect possible load
failures, while previously mpv would disappear.
2026-05-01 11:42:04 +02:00
Kacper Michajłow dc59f3b399 test/libmpv_test_track_selection: add test for program mappings 2026-05-01 11:41:31 +02:00
Kacper Michajłow bf1a14e541 test/libmpv_common: print property in checks 2026-05-01 11:41:31 +02:00
Kacper Michajłow f5857d3b87 demux_lavf: support multiple program mappings per stream
Each stream can belong to multiple programs, we have to support that.
Previously track could belong only to single program.
2026-05-01 11:41:31 +02:00
Kacper Michajłow 28ce461a84 options/m_option: add m_option_type_prop_array
Add adaptor for arrays of properties, this is not used as real option,
as those are always string list. But as a connector struct for creating
typed node arrays, in (sub)_properties.
2026-05-01 11:41:31 +02:00
Kacper Michajłow eedadc24ae player/command: hide dependent tracks
They are unusable on thier own, and shouldn't be selected by the user.
Those tracks are ment to be used internally.
2026-05-01 10:42:00 +02:00
Kacper Michajłow 0c067f140e test/libmpv_test_track_selection: add test for --flatten-editions 2026-05-01 10:42:00 +02:00
Kacper Michajłow b4a7ea306e demux_{lavf,timeline}: add --flatten-editions
Lavf exposes programs/renditions as a flat track list tagged with
program_id. We respect this metadata and group tracks into their
respective programs, as tracks from different programs may be completely
unrelated to each other.

This commits adds an option to flatten the editions and ignore the
grouping.

Fixes: https://github.com/mpv-player/mpv/issues/17836#issuecomment-4345930205
2026-05-01 10:42:00 +02:00
Kacper Michajłow 44ceaa6498 vo_gpu_next: only flush cache on render options update
No need to reset input queue too.
2026-05-01 10:41:41 +02:00
Kacper Michajłow 8d04be2b85 mp_image: force stride to be multiple of bpp
Vulkan require all sizes in texels, so we have to make our image
multiple of them.

Fixes: #17743
2026-05-01 10:41:28 +02:00
Kacper Michajłow 8aef2c9162 demux_lavf: map comment to stream title
Lavf HLS demmuxer put rendition names into `comment`, this is basically
a title in our usage.
2026-05-01 06:09:27 +02:00
Kacper Michajłow ec03ef7e97 demux_lavf: remove track flags duplication from title
Those flags are already exposed, and users can format it as they wont.
Don't produce some dummy titles.
2026-05-01 06:09:27 +02:00
llyyr a44478d79f vulkan/context: avoid printing incorrect error on vulkan-device fail
M_OPT_INVALID says "option parameter could not be parsed" which is
incorrect for some failures this parser might encounter. Instead print
something that might be useful for the user to debug.

Vulkan instance might fail to create if there's no vulkan drivers that
mpv can see, or devices might fail to enumerate for whatever reason
2026-05-01 06:09:00 +02:00
Kacper Michajłow 48bd97b5bb stream_dvdnav: don't leak times in STREAM_CTRL_GET_CHAPTER_TIME 2026-05-01 05:01:37 +02:00
Kacper Michajłow 4182a1df43 stream_dvdnav: use named definition for return val 2026-05-01 05:01:37 +02:00
Kacper Michajłow 118dda68c1 stream_dvdnav: fix STREAM_CTRL_SET_ANGLE return value
It was flipped and returned ok on error.
2026-05-01 05:01:37 +02:00
Richasy 986dd6387d ao_wasapi: fix retry budget on DEVICE_INVALIDATED
The retry path in wasapi_thread_init() used MP_TIME_US_TO_NS, giving a
total budget of ~15 us before MP_FATAL killed the audio thread. The
resulting log line "Retrying in 1000 ns" makes the unit confusion
obvious.

In practice AUDCLNT_E_DEVICE_INVALIDATED is most often hit right after
the system resumes from sleep, or when the default endpoint changes,
where the audio endpoint typically needs hundreds of milliseconds to
come back. The current budget never covers that window, so the first
playback after wake-up permanently fell back to "no audio" until the
user manually restarted playback.

Switch the retry schedule to milliseconds: start at 1 ms (~one Windows
timer tick, effectively an immediate yield), multiply by 10 each
iteration, and cap at 1 s -- i.e. 1/10/100/1000 ms, 4 retries, ~1.1 s
total. Use MP_TIME_NS_TO_MS for the warning so the unit in the log
matches reality.
2026-05-01 05:01:00 +02:00
Kacper Michajłow 2f58ee36ce demux/packet: refactor demux_packet_add_blockadditional
Make it more extensible for future additions.
2026-05-01 00:38:04 +02:00
Kacper Michajłow 696190d25b demux/packet: add support for LCEVC ITU-T35 payloads 2026-05-01 00:38:04 +02:00
Dudemanguy b1d23bba5e vo_gpu_next: don't spam render queue underrun logs on frame->still
If we are redrawing on a still image (e.g. ass events), then the pl
queue will hit the PL_QUEUE_MORE case which is fine but there's no need
to spam the log here. The information may be useful for when an actual
video is being played, but when a frame is still (e.g. paused or only a
single image) it's just noise.

Fixes #17840.
2026-04-30 15:01:34 +00:00
Kacper Michajłow 5ebe9581d5 demux_{lavf,timeline}: consider audio only HLS when selecting edition
Fixes: #17836
2026-04-29 19:23:42 +02:00
Guido Cella 0a0c63d3e9 ytdl_hook.lua: convert metadata values to string
Fixes https://github.com/mpv-player/mpv/pull/17805#issuecomment-4340090625
2026-04-29 11:32:19 +02:00
kamperemu 8cc65c838e osc.lua: add box width option for box and slimbox layouts
osc.lua: add slimbox width option and preserve width values for box slimbox

docs: update default box and slimbox width values in OSC configuration

docs: add `boxwidth` and `slimboxwidth` script options to osc
2026-04-29 07:22:14 +02:00
Kacper Michajłow 3e3936eee4 player/loadfile: filter tracks without edition when there are matches
When the current edition supplies its own track of a given type
(e.g. yt-dlp muxed editions ship their audio paired with the video),
shared program_id == -1 tracks of that type are filtered out of
both the track list and auto-selection. Editions that don't ship
their own track (DASH video-only editions sharing the audio pool)
continue to see the program-agnostic tracks.
2026-04-29 03:45:05 +02:00
Kacper Michajłow 4730c9179a player/loadfile: remove preferred_program from track selection
It's no longer needed, tracks from different editions are not listed
togheter anymore.
2026-04-29 03:45:05 +02:00
Kacper Michajłow 91b6d8fdd1 demux: enrich edition titles with codec/resolution/bitrate info
Extract the codec descriptor out of mp_format_track_metadata into a
shared demux_append_codec_desc() helper, and use it from a new
demux_compose_edition_title() composer that both demux_timeline.c and
demux_lavf.c call when building editions. Codec block is only added
when the program has exactly one stream of that kind, and fields
already present in the prefix (e.g. WxH from yt-dlp's format label)
are skipped to avoid duplication.
2026-04-29 03:45:05 +02:00
Dudemanguy a42b1b9103 wayland: only update toplevel state values if we have a valid state
We have this annoying situation here during the initial window
configuration where sometimes we have to update certain values and other
times they need to be ignored. 45324ce682
made sure to parse the toplevel state before we checked the initial
compositor values which is correct. But it's not enough because mpv can
have its own initial state (e.g. --fullscreen) and by moving it here it
would get overwritten in the toplevel state check and thus ignored. So
to have our cake and eat it too, we need to only update the internal
state values if we know mpv is in a valid state in the first place. So
either we've set the initial geometry already or the compositor has
given us some specific initial state to work with. Fixes #17819.
2026-04-27 14:39:05 +00:00
Guido Cella 05b327c723 osc.lua: use the cached chapter_list instead or retrieving chapters 2026-04-26 08:56:24 +02:00
Guido Cella ae3189567b select.lua: add select-secondary-subtitle-line
Requested in https://github.com/mpv-player/mpv/pull/17730#issuecomment-4321224996
2026-04-26 08:55:42 +02:00
Kacper Michajłow ed99433277 TOOLS/dylib_unhell.py: simplify the otool output processing
There is no need to pipe things through shell and grep/awk, python is
perfectly fine word processor. This makes it simpler to reason what is
extracted and from where and also makes the script faster as we spawn
only single process directly, not shell with multiple children.
2026-04-26 01:19:27 +02:00
Guido Cella 3183ea9980 osc.lua: always observe duration
Currently the duration observer is toggled in multiple places to not
call request_init unecessarily. It is much simpler to always observe it
and call request_init conditionally in the callback. This also allows
reusing the cached value throughout the OSC.

Note that dividing by 0 is not an error in Lua so there is no need to
check for both 0 and nil.
2026-04-26 00:20:33 +02:00
Guido Cella 9ce79bcaa0 osc.lua: hide thumbnails when setting visibility to never
And also when using script-message osc-hide.
2026-04-25 20:03:10 +02:00
Guido Cella 47a8a47b31 osc.lua: don't write to user-data on every render
Only update hover-sec when there is a big enough change to not spam the
log with -v.
2026-04-25 20:03:10 +02:00
Guido Cella 77ed8fef88 select.lua: use sub-lines instead of forking to ffmpeg
This:

- Removes the dependency of ffmpeg in PATH - useful on Windows, macOS
  (?), Flatpak.
- Will support subrandr.
- Avoids redownloading network subtitles.
- Avoids slow demuxing of large mkvs.
- But no longer returns future lines of embedded subtitles.
- No longer returns embedded lines of regions you seeked beyond without
  playing them.
- Changing sub track drops cached subtitles.
2026-04-25 19:58:52 +02:00
Hubert Głuchowski a0a0a7e4cf sub/dec_sub: de-duplicate overlapping sub lines 2026-04-25 19:58:52 +02:00
Guido Cella 5f02e1b8a2 sub: add sub-lines property
Return all subtitle lines in memory with text, start and end.

I did not name this sub-all so it cannot be misinterpreted as referring
to all subtitle tracks.

Closes #12810.
2026-04-25 19:58:52 +02:00
Kacper Michajłow c662594f05 Revert "player/core: increase number of past_frames to 1000"
100 is enough and avoids mistimed frames to affect long term stats. It
would be good to improve vsync estimation accuracy, but increasing
averaging size alone is not the best solution.

This reverts commit 4e44fe024c.
2026-04-25 08:32:29 +02:00
Kacper Michajłow 4e44fe024c player/core: increase number of past_frames to 1000
This helps with video fps estimation, for containers that doesn't
provide accurate timestamps.
2026-04-25 07:15:37 +02:00
Kacper Michajłow 68b1d10da5 player/video: rewrite display-sync audio drift compensation
The old code had several interacting problems that prevented A/V from
reaching a steady state.

When the A/V difference was large, it applied the maximum allowed
compensation in one step. That was fine for catching up, but the value
was never re-evaluated, so audio speed routinely overshot the target.
Once the difference crossed zero (or re-entered the acceptable range) it
would run a linear regression over recent av_diff samples and snap the
audio speed to the estimated drift. The fatal flaw was that those
samples already included the controller's own compensation: even when
the underlying drift was zero, the controller would "detect" the drift
it had just induced and try to cancel it. Between these rare, sparse
updates audio speed stayed frozen, so in practice the controller was
introducing drift more than it was fixing it. On high fps outputs,
where the vsync range is tight, this degenerated into a ping-pong:
overshoot, snap back, overshoot again, never settling.

The new code replaces the bang-bang direction controller and one-shot
regression with a proportional controller driven by a low-pass-filtered
av_diff. The LP filter (1 s time constant) rejects per-frame vsync
jitter so the compensation no longer chases noise. The target then
decays av_diff exponentially toward zero with a 10 s recovery time.
Adaptive slew caps per-frame motion to the desired correction magnitude,
so large excursions are absorbed quickly while near-equilibrium motion
stays below audibility. The result is a continuous, gentle control loop
that actually reaches steady state and does so without audible
audio-speed modulation.
2026-04-25 07:15:37 +02:00
Kacper Michajłow 382e3e74e8 player/command: add more precision to avsync pretty print
To better see close to zero values, instead of just clamping to 0.
2026-04-25 07:15:37 +02:00
Kacper Michajłow 99b9d9491d player/command: add more precision to av speed correction pretty print
Those values are often very small, but it's still good information to
have how they are changing.

This brings those values closes to old `%+.05f%%` that were used here.
2026-04-25 07:15:37 +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
Andrew Rabert 45324ce682 wayland: parse toplevel states before geometry_configured check
Fix toplevel state being lost before geometry_configured is
configured. Previously, for a KWin rule that set fullscreen (apply
initially or forced) when a --geometry was also specified, mpv would
render at --geometry size even though the compositor was treating it as
fullscreen. This resulted in geometry-sized content anchored to the
top-right without a titlebar. This mismatch of what mpv thinks and what
actually is can also be seen similarly with a KWin rule that sets a
maximize state.

With this change, mpv starts in fullscreen _proper_ (ie --fullscreen).
Exiting fullscreen then results in a window size as specified by the
--geometry.

For the other states this handles, I'm honestly not sure as I wasn't
able to force them. It _should_ be fine based on what I see here and
_logically_ is correct as mpv's state should always match what the
compositor informs it to be.
2026-04-25 04:47:32 +00:00
Guido Cella e046cd0736 context_menu.lua: add background_alpha script-opt
Closes #17807.
2026-04-24 20:19:50 +02:00
Julian Orth 4c9262664c wayland: implement session management
If the compositor supports session management, the mpv window is always
added to a session. The user can manage multiple sessions by using
`--wayland-session=<human-readable-name>`. Human-readable names are
mapped to session ids via files under `~/.local/state/mpv/sessions`. The
file name is computed as a hash of XDG_CURRENT_DESKTOP and the
human-readable name.

If multiple mpv instances are started with the same session name, the
latter mpv instance takes over the session.

Upon session restoration, the mpv window is restored by the compositor
according to its state from the previous session. What that entails is
compositor policy.
2026-04-24 15:36:44 +00:00
Guido Cella 98a6960a3d ytdl_hook.lua: remove outdated comment 2026-04-23 22:06:47 +02:00
Guido Cella b3c46456c5 ytdl_hook.lua: set metadata with use_manifests=yes
With use_manifests=yes EDL is not used so metadata never gets set
through the tags mechanism. Thankfully the metadata property was
recently made writable so use that instead.

The existing metadata variable is inlined to fix linting.

Fixes https://github.com/mpv-player/mpv/pull/17761#issuecomment-4306070651
2026-04-23 22:06:47 +02:00
Kacper Michajłow 9b3565c980 msg: don't filter PU{1,2} we use them internally
Fixes: #17801
Fixes: d4ae20b7a3
2026-04-23 17:13:42 +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
Aly Smith f5939d0b93 ci: ensure winget is available on windows-11-arm
per actions/partner-runner-images#95, manually install and repair winget module in windows-11-arm runner to ensure it is available for following dependency step
2026-04-22 04:15:29 +02:00
alydev d40a29190d demux_playlist: add support for 'strm' playlist
The .strm format consists of a URI or local path as the sole contents
of a text file, this is parsed by software like Emby or Jellyfin to
treat remote streams or paths as if they are in the local filesystem.
This commit adds .strm to mpv's internal list of playlist file formats,
and points it to the handler for .m3u files as they should be
compatible. .strm doesn't need all the features of .m3u/.m3u8, but the
features do not cause issues with the relatively barebones playlist
format of .strm.
2026-04-22 03:23:50 +02:00
Kacper Michajłow 174bcec30e w32_common: support initial --fs and --window-maximized
Don't set maximized window state if we are entering fullscreen too, this
makes restoring later consistent.
2026-04-22 01:56:59 +02:00
Kacper Michajłow 9d526fc138 w32_common: keep client size on window state changes
Not all resizes should reset client size size.

Fixes: #17695
2026-04-22 01:56:59 +02:00
Hubert Głuchowski 7ec11ad67a misc/codepoint_width: handle partially ill-formed UTF-8
Previously the function just bailed on invalid input, this instead makes
it count how many replacement characters would be shown by a terminal
complying with the Unicode specification's recommendation here:
https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G66453

Fixes https://github.com/mpv-player/mpv/pull/17773#issuecomment-4277538534
2026-04-22 00:06:59 +02:00
Guido Cella 35b851e38a DOCS/man/options: remove all_formats=yes warning
Dunno what wm4 was referring to here but all_formats=yes works just fine
and quickly for changing track at runtime. The only issue I see is that
it drops the video cache if you change audio track.
2026-04-21 22:50:12 +02:00
Guido Cella 6b524c4f0e ytdl_hook.lua: default to all_formats=yes
93fe7a5526 fixed the only problem with all_formats=yes, so make it the
default to allow changing tracks of ytdl_hook URLs at runtime without
re-invoking yt-dlp.

Closes #16872.
2026-04-21 22:50:12 +02:00
nanahi 531fe5a43e osc.lua: make window control buttons action customizable
Use bind_mouse_buttons helper. This makes it possible to bind custom
actions, such as right click X button to quit with watch later.
2026-04-21 18:19:18 +02:00
nanahi d9e8e0bdf6 osc.lua: add option to configure skip_forward/backward buttons
This adds _down_command support to bind_mouse_buttons so it can be
used to bind button down actions like mbtn_left_down, and let forward
and backward buttons use bind_mouse_buttons. This makes mouse button
down actions customizable.
2026-04-21 18:19:18 +02:00
nanahi b3e6506d10 osc.lua: fix frame stepping with skip_backward/forward buttons
The event responder must have up, down, or press suffix, but
940ab99055 removed it for frame stepping
function, making it unusable. Fix this by using the down suffix.

Fixes: 940ab99055
2026-04-21 18:19:18 +02:00
Hubert Głuchowski ac3b6044d0 console.lua: use terminal_display_width when picking longest menu item
Previously this function would just count bytes which was very easily
broken by incantations like `Ő̶̧͍̹͔̮̮̦͌̈̌̂́̊͜K͖̮̼̯͖͆͋̓̀̕` which take up 52 bytes while being just
2 normal width characters visually.

`terminal_display_width` correctly counts `Ő̶̧͍̹͔̮̮̦͌̈̌̂́̊͜K͖̮̼̯͖͆͋̓̀̕` as 2 visual characters.

Note: GitHub strips all these in their web UI but there are many Unicode
combining characters after each letter of the `OK`s above that produce
a "cursed" text effect.

Fixes #17772
2026-04-21 18:17:22 +02:00
Hubert Głuchowski c202be1efe player/{lua,javascript}: add mp.utils.terminal_display_width function 2026-04-21 18:17:22 +02:00
Kacper Michajłow 6ab49ac5d7 w32_common: clear window_minimized flag on minimize->maximize
It doesn't send RESTORE in this case, so the state got confused.

Fixes: #17678
2026-04-21 05:51:58 +02:00
Kacper Michajłow e7d3fe8668 vf_d3d11vpp: fix print index value 2026-04-21 05:08:49 +02:00
Guido Cella 5921fe50bb osc.lua: use the cached chapter-list for chapter markers
When 0197729949 added state.chapter_list this call was not updated to
use the cached value, but there is no reason not to use it, especially
now that more cached properties are used.
2026-04-20 21:57:05 +02:00
Guido Cella fb8c933d4d osc.lua: cache observed properties
For properties that were already being observed but still retrieved over
and over, cache their values using the new observe_cached().

osd-dimensions observer said that if cached we may have to worry about
property ordering but it seems to work fine. It is nice to cache it
because it was the property retrieved the most frequently, in 5
different places.
2026-04-20 21:53:57 +02:00
rabbit d4ae20b7a3 msg: sanitize term title and block C1 controls and DEL
Expose the terminal output sanitizer as mp_msg_sanitize() and use it in
term_osd_update_title() to sanitize the property-expanded term-title
string before it reaches mp_msg_set_term_title(). Without this, a
crafted media tag can break out of the OSC-0 sequence via embedded BEL
or ESC bytes when --term-title includes property expansions like
${media-title}.

Extend the sanitizer to cover two gaps:

- UTF-8 encoded C1 controls (U+0080-U+009F, bytes C2 80..C2 9F). xterm
  in UTF-8 mode interprets these codepoints as C1 control functions
  (U+009B as CSI, U+009D as OSC, U+009C as ST), allowing escape
  sequence injection without any ESC or BEL bytes.

- DEL (0x7F), which was not previously filtered.
2026-04-20 21:53:33 +02:00
Kacper Michajłow 4d0666670a vo_gpu_next: don't dither scRGB
scRGB is basically intermediary format, but we don't really know what
would be the real target. And since we send floating-point buffer, we
can just expect the downstream will handle dithering and quantization at
some point.
2026-04-20 21:52:52 +02:00
NRK 7d1a598bdd vo_gpu: support parameters in RPN expressions 2026-04-20 21:52:06 +02:00
NRK d17e32fcfc DOCS/man/options: add missing RPN operators
equal and mod are also supported but were missing in the docs.
2026-04-20 21:52:06 +02:00
Kacper Michajłow 7eb1ef2fe0 video/out/filter_kernels: mark kernel-compatible windows as resizable
Mark every filter window whose libplacebo counterpart is resizable as
resizable in mpv too.

This allows --tscale-radius to be used. Prior to this, vo=gpu
silently ignored the radius override while vo=gpu-next honored it,
producing different output for the same options.
2026-04-20 21:51:34 +02:00
Kacper Michajłow 3f1589cf4c video/out/filter_kernels: fall back to nearest tap when sum is zero
When the effective filter bound (radius * blur) is smaller than the
smallest tap distance, mp_compute_weights produces all-zero weights and
the subsequent normalization divides by zero, producing NaN weights that
render as black. This can happen for resizable filters where the user
picks a radius below 0.5.

Detect sum == 0 and fall back to nearest-neighbor on the closest tap.
2026-04-20 21:51:34 +02:00
Kacper Michajłow 1be21a3186 demux_timeline: prefer editions with default video track
When the EDL marks a video track with flags=default, select the edition
whose video stream carries that flag.
2026-04-20 03:04:25 +02:00
llyyr ac852ab9df demux/packet: fix version check for SMPTE 2094-50 metadata
This enum was added in lavc 62.30.100 in https://github.com/ffmpeg/ffmpeg/commit/7faa6ee2aa01
The doc/APIchanges version listed in that commit is incorrect, it's
actually lavc 62 not lavc 60.

Fixes build failure with ffmpeg between
https://github.com/ffmpeg/ffmpeg/commit/6ba6db4f195c and https://github.com/ffmpeg/ffmpeg/commit/7faa6ee2aa01

Fixes: 76df24f40c ("demux/packet: add support for SMPTE 2094-50 metadata")
2026-04-19 16:11:38 +02:00
Guido Cella 06f4ce75aa defaults.lua: remove mp.use_suspend dead code
This does nothing since f30c5d09f4 (10 years ago).
2026-04-18 23:28:57 +02:00
nanahi 25e9a0c740 player/command: remove inaccurate comment in cmd_mouse 2026-04-18 21:13:46 +02:00
nanahi bceb1eeaf4 Revert "player/command: don't send mouse move event on mouse leave request"
There is no reason to do this, since VOs do report mouse position when
outside of window in some cases.

This reverts commit 3ff7b04790.
2026-04-18 21:13:46 +02:00
nanahi 891273055f DOCS/man/input: fix mouse-pos/hover documentation
The comment about video backends not updating pointer position is only
true if no mouse button is being pressed. If mouse button is pressed on
mpv window and then moves out of window region without releasing the
button, some platforms (win32, Wayland, X11) "capture" the pointer and
still report the coordinates, while some other platforms (SDL) do not.

The value of mouse-pos/hover also differs between platforms in this case.
The value is true on win32 and Wayland, but false on X11.

Fix documentation to address them.
2026-04-18 21:13:46 +02:00
llyyr 8665237a07 wayland: use av_gcd instead of implementing our own gcd function
Adds mp_gcd wrapper for av_gcd and uses it instead.
2026-04-18 17:55:26 +02:00
Guido Cella 8f66c0982f command: log menu-data changes at trace level instead of verbose
Avoid spamming the log.
2026-04-18 17:45:03 +02:00
Guido Cella 0b2c08ba8d osc.lua: show the first selected audio track id with --lavfi-complex
Similar to current-tracks, when the selected audio track is combined
with another one or with an ffmpeg filter, show the first selected track
id instead of "-".

This was requested by a user on IRC.

Also avoid fetching aid and sid on each render.
2026-04-18 17:41:54 +02:00
Kacper Michajłow 76df24f40c demux/packet: add support for SMPTE 2094-50 metadata 2026-04-18 05:38:40 +02:00
Mike Will d0df98f701 command: allow metadata to be set manually 2026-04-18 05:37:38 +02:00
Dudemanguy 4377cce737 wayland: always override surface local coordinates on reconfig
Previous commit fixes the issue when doing state changes but I never
actually tested just normal reconfigs (i.e. advancing a file in a
playlist). Override it in this case too. Fixes #17755.
2026-04-17 21:59:47 +00:00
NRK 09d075f475 osc: define and add support for "preview" api
this adds a "standard" api for ui scripts and thumbnailers to
communicate with each other, based on the simple thumbfast api
[0].

the api works as follows:

* To issue a thumbnail draw command, the UI script will set the
  property `user-data/osc/draw-preview`.
* To clear the thumbnail, the UI script will set the previously
  mentioned property to `nil`.

a more ideal api would make it so that the thumbnailer script
only generates the thumbnail and doesn't need to draw at all.
but such api is vastly more complex [4] and would require a lot
more work and maintenance on mpv's side.

this is a decent enough api that allows arbitrary thumbnailers
and ui scripts to communicate between each other and work
together, while being simple enough that it can be supported
without too much maintenance.

this change has been tested with work with thumbfast [1]. and
for demonstration that this api can be useful outside of osc, it
has also been tested to work on mfpbar's thumbnailer branch [2].

the code to determine thumbnail x,y is based on the osc fork
inside of thumbfast [3].

[0]: https://github.com/po5/thumbfast?tab=readme-ov-file#for-ui-developers-how-to-add-thumbfast-support-to-your-script
[1]: https://github.com/po5/thumbfast/pull/173
[2]: https://codeberg.org/NRK/mpv-toolbox/src/branch/thumbnailer/mfpbar
[3]: https://github.com/po5/thumbfast/tree/vanilla-osc
[4]: https://github.com/mpv-player/mpv/discussions/17654
2026-04-17 20:36:48 +02:00
Guido Cella 8da99f778f osc.lua: set no_video correctly
Fixes f4197a5ce0.
2026-04-17 20:28:42 +02:00
Guido Cella f4197a5ce0 osc.lua: merge the current-tracks/video observer into track-list's
Reuse the new track-list observer callback to check whether there is a
video track.
2026-04-17 20:19:28 +02:00
Kacper Michajłow 6788174641 video/out: use predefined pl_color_space_srgb 2026-04-17 20:16:50 +02:00
Guido Cella 15e5af0868 osc.lua: add observe_cached() helper
This removes code repetition and will make caching more properties
easier.

Some state fields are renamed to have the same name as the property.
2026-04-17 20:05:46 +02:00
NRK c415c662d3 vo_gpu/utils: add gpu_get_auto_param()
deduplicates some code between vo_gpu and vo_gpu_next
2026-04-17 20:03:22 +02:00
NRK 3e0729eb06 vo_gpu: add support for ENUM parameters 2026-04-17 20:03:22 +02:00
NRK a0b6233318 vo_gpu: add support for DEFINE parameters 2026-04-17 20:03:22 +02:00
NRK 0d655fe665 vo_gpu: initial support for tunable parameters
does not support everything supported by gpu-next/libplacebo,
only a subset that was needed to run some user shaders.
2026-04-17 20:03:22 +02:00
NRK 91ceffce42 shader_cache: add gl_sc_uniform_{f,i}_bstr()
this enables callers that already have bstr names to avoid
unnecessary string conversions.
2026-04-17 20:03:22 +02:00
NRK c1a21bb8d9 vo_gpu: skip invalid component overwrite
can occur when a user shader sets a hook texture with more
components than supported. e.g overwriting LUMA with 3
component.

this does create a massive log spam when triggered, but that
seems consistent with the existing resize/realign error case.

Closes: https://github.com/mpv-player/mpv/issues/9863
2026-04-17 20:02:09 +02:00
NRK 1bf50fc71c user_shaders: reject nonsense COMPONENTS values
negative values in specific causes out of bound accesses.
2026-04-17 20:02:09 +02:00
Guido Cella 021b5ccf23 ytdl_hook.lua: set the title in metadata
93fe7a5526 made global_tags work with all_formats=yes, so do like
suggested in 8ea7aa5471 and set the title via tags.

This makes available in ${metadata/title}, even if you set
--force-media-title separately.

--force-media-title is also set when self_redirecting_url is true, but
tags seem not to be set in this case and I don't know where to find such
videos to test. It was originally added to close #5313, but the URL
linked there no longer loads.
2026-04-17 19:56:06 +02:00
Guido Cella aec426a4d8 context_menu.lua: set user-data/mpv/context-menu/open
Closes #17428.
2026-04-17 19:46:12 +02:00
emberfade 179d832738 DOCS/man/vf: fix parameter separator in EBNF 2026-04-17 19:45:48 +02:00
nanahi 57490dd3a6 vo_gpu_next: add image-subs-hdr-peak=video-dynamic/video-static
Subtitles in general have constant brightness, but currently
--image-subs-hdr-peak=video uses detected peak value which is not synced
with scene and undesirable.

Add new modes that allow using static peak metadata or per-scene metadata.
2026-04-17 19:44:15 +02:00
nanahi 7f81e1ec8c vo_gpu_next: fix image subtitle hdr peak
704afb8968 assumed that HDR image
subtitles target SDR white. However, this is incorrect according to
UHD BD spec version 3.2:

> CLUTs of Presentation Graphics streams and Interactive Graphics streams
> are prepared by content author according to dynamic range property of
> the Primary video stream.
> If a Primary video stream is HDR, the Graphics streams have CLUTs
> expressed in BT.2020 color space primaries and ST2084 EOTF.
> If a Primary video stream is SDR, the Graphics streams have CLUTs
> expressed in BT.709 color space primaries and BT.1886 EOTF.

This means that PGS subtitles always have the same colorspace and HDR
dynamic range as the video, so the target peak should also be the same.

This is also supported by the BD-J spec (which displays PGS graphics):

> However the BD-ROM player does not support color space conversion nor
> dynamic range conversion of Java graphics and Background plane when
> mixing with video plane.

The Graphics model spec further states:

> The composited image on the graphics plane is transformed to full color
> and transparency by the CLUT module and then overlaid on the video
> image.

These sentences indicate that BD-ROM players simply overlay the decoded
graphics onto the video without any kind of conversion.

Change the default of image-subs-hdr-peak to 1000 to fix this.
This accommodates most HDR videos with a peak brightness of 1000 nits
and some bad HDR videos with 10000 nits peak brightness due to reencoding
and mixed with unmodified subtitles.
If there are compatibility issues, the option can be manually
set to sdr or video.

Fixes: 704afb8968
2026-04-17 19:44:15 +02:00
bennyyip 74d3c80640 select.lua: add confirmation on "Clear history" 2026-04-17 19:30:27 +02:00
Guido Cella f4dcd295cf demux_edl: support global_tags with delay_open
The delay_open mechanism used by
--script-opt=ytdl_hook-all_formats=yes breaks setting metadata with
global_tags because tl->track_layout is NULL. See adcf51dccd cbb8f534b0
8ea7aa5471.

Fix this by applying tags to the EDL timeline in this case.

Tags must still be applied to tl->track_layout when available for them
to work with local EDL files.
2026-04-17 19:24:47 +02:00
Patricia Bucataru cc8f3bf9fa gpu/utils: fix null pointer arithmetic UB in mp_log_source
strchr() can return NULL when no newline is found. Computing end + 1
before the null check on end is undefined behaviour per C11 6.5.6.
Move the next assignment inside the else branch to avoid the UB.
2026-04-17 19:11:58 +02:00
Guido Cella e0f54adf08 menu.conf: add OSC layout selection
Make this feature discoverable.
2026-04-17 18:34:24 +02:00
Guido Cella e6a338a98a options.lua: stop searching in lua-settings
This has been deprecated for 8 years, since 9eadc068fa, with a visible
warning. Removing it has the benefit of not spamming every log file with
lua-settings searches.
2026-04-17 18:33:35 +02:00
Guido Cella 18f83bc43e osc.lua: make buttons clickable from the horizontal edges
Since changing the width and alignment of buttons shrinks them or messes
up the layout, manually override the hitbox of buttons at the edges.

Fixes #9791.
2026-04-17 18:33:11 +02:00
Kacper Michajłow 7ba2e1d713 osc.lua: reduce floatingalpha a little
Alpha blending is done in gamma light of the target, when the overlay is
drawn. Depending on VO and target format, the alpha value can act quite
differently.

Lower it a little to avoid excessive transparency in some cases. This
should be fixed or workaround in better way, but for now just adjust the
value.
2026-04-17 18:32:29 +02:00
Kacper Michajłow 1068d4adb1 ytdl_hook.lua: tag variants with program_id 2026-04-17 18:30:43 +02:00
Kacper Michajłow cc9610b850 demux_timeline: add support for programs 2026-04-17 18:30:43 +02:00
Kacper Michajłow 6c165fe46e demux_lavf: add support for programs
This adds proper support for MPEG-TS programs and HLS variants. Now
program selection is exposed as editions and tracks are grouped under
such edition. If there are external tracks added, they are available in
all editions.
2026-04-17 18:30:43 +02:00
Kacper Michajłow 8010ea49c9 osc.lua: fix track indexing
track-list/N is not required to match aid/vid. They are encoded as
track-list/N/id.

This fixes changes in 1a558bf5c2 where it
was asumed that track id is the same in track-list, which is not true,
in general sense.
2026-04-17 18:30:43 +02:00
Kacper Michajłow 85bdf63a48 player/command: simplify and fix new-line handling
Remove dead code, make it work also when there is not tracks.
2026-04-17 18:30:43 +02:00
nanahi 1fea31f00c player/external_files: do not log for 0 priority files
They are not considered potential external files.
2026-04-17 04:09:23 +02:00
nanahi f5931117f0 player/external_files: fix --cover-art-whitelist priority
Since cb56c2f888, the priority of
--cover-art-auto and --cover-art-whitelist is unclear. Depending on the
number of elements in --cover-art-whitelist, the priority of
--cover-art-whitelist files can be lower, equal, or higher than
--cover-art-auto matches, creating unpredictable behavior.

Fix this by making --cover-art-whitelist priority always between "fuzzy"
and "all" priority. test_cover_filename now uses bstr_find_in_list0 to
return a negative priority value depending on the position in list.
The "all" priority is set to INT_MIN. Modify filter_subidx to use 0
priority as removal marker, since all files in the external files list
already have non-zero priority.
2026-04-17 04:09:23 +02:00
nanahi d711657833 options/m_option: use bstr_find_in_list0
Removes redundant find_list_bstr function.
2026-04-17 04:09:23 +02:00
nanahi 3d568495fc misc/bstr: move str_in_list to this file
Rename it to bstr_in_list0 and implement it in bstr_find_in_list0.
2026-04-17 04:09:23 +02:00
nanahi ac8d69e6fc misc/bstr: add bstr_find_in_list0 function
This will be used to unify several find in list handlings.
2026-04-17 04:09:23 +02:00
nanahi b20a33287b player/main: don't use atoi
Prevents UB if the value cannot be represented.
2026-04-17 04:09:23 +02:00
nanahi da2739f44f various: don't check if endptr is null for strto[udll]
These functions always set endptr to non-null so there is no need to
check.
2026-04-17 04:09:23 +02:00
nanahi 6260e7236c player/scripting: use strcasecmp for comparing script files
The documentation says that the scripts are loaded in alphabetical order,
which indicates that the case is not sensitive. Use strcasecmp to satisfy
this requirement.
2026-04-17 04:09:23 +02:00
nanahi 2b62f7c861 player/external_files: use natural sort for comparing filenames
Similar to the method used elsewhere in mpv.
2026-04-17 04:09:23 +02:00
nanahi 6b3cb12dac player/external_files: rename subtitle references to external file
These functions are used to load all external files, not only
subtitles.
2026-04-17 04:09:23 +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
Kacper Michajłow c865008e65 mpv-osd-symbols: center fluent icons only vertically
Makes it nicer for speaker icon to not move around on different volume
levels. Also remove scaling, it was not needed.

This required to rewrite the exclamation mark drawing code, made it look
similar to old icon now.
2026-04-16 19:03:47 +02:00
nanahi a9e1ce9c0d DOCS/man/options: fix description for testing with all hwdec methods
The comment is not longer true since auto now means auto-safe.
Change to auto-unsafe which is the setting to use to test all methods.
2026-04-16 17:18:42 +02:00
Kacper Michajłow d20d108d94 vd_lavc: remove Vulkan hwdec from auto-safe selection
It's unstable and unfortunately the situation is not getting better
over time as there are constantly new regressions introduced, which
makes it unsafe for auto selection.

It is also twice as slow as d3d11va on Windows AMD.

See also:
https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21692
https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21704
https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22342
https://github.com/mpv-player/mpv/issues/16782
https://github.com/mpv-player/mpv/issues/17085
https://github.com/mpv-player/mpv/issues/17175
https://github.com/mpv-player/mpv/issues/17370
https://github.com/mpv-player/mpv/issues/17517
https://github.com/mpv-player/mpv/issues/17593
https://github.com/mpv-player/mpv/issues/17688

Those are only issues from recent months, many of which are not fixed.
2026-04-15 19:13:23 +02:00
Thomas Lange 7ac022c834 mpv.metainfo.xml: Update screenshot URL
The previous URL causes a "404 - Not Found" error meanwhile.
2026-04-15 15:19:50 +00:00
dependabot[bot] da4789c2dd ci: bump cross-platform-actions/action from 0.32.0 to 1.0.0
Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 0.32.0 to 1.0.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v0.32.0...v1.0.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-version: 1.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-12 14:57:28 +02:00
NRK 062f4bf047 player: fix leak on client-message send failure
when there's a flood of events causing the event queue to
overflow, the duplicated client-message payload gets dropped
without being released. free it on failure too.

discovered while trying to trigger #10110.
2026-04-11 19:27:44 +02:00
Dudemanguy 3e3048a5aa wayland: override surface local when setting geometry or window scale
If the window is fullscreen or maximized and the user sets some geometry
or window scale, we should apply it when the state transitions back to
windowed mode. This was being missed and the surface local coordinates
were being used.
2026-04-10 14:00:50 +00:00
Dudemanguy fd2215eef4 wayland: override surface local coordinates on reconfigures
We don't want to be using the coordinates from the compositor in this
case since it can't know that the new surface has a totally different
aspect ratio. Also remove the early return so that the state is always
updated regardless if it's determined we need to resize or not.

Fixes #17710.
2026-04-10 14:00:50 +00:00
Kacper Michajłow 75939c2116 wayland_common: use only supported primaries when inferring from raw 2026-04-09 21:21:46 +02:00
Guido Cella ec4d50fd91 context_menu.lua: enable runtime script-opt updates
Fixes #17726.
2026-04-09 13:40:37 +02:00
Guido Cella 266cb79f38 osc.lua: make all the height of bar lines clickable
There is an area between the 2 lines of bottombar and topbar that is not
clickable, e.g. between the menu and play_pause icons. Make it all
clickable so it's easier to click buttons.

This also allows clicking from the bottom in slimbottombar and from the
top in topbottombar.
2026-04-08 20:32:48 +02:00
Guido Cella c9d2f17a98 osc.lua: allow clicking window controls from the top
Window controls are not clickable from the very top of the window, they
have a margin to the top that makes them harder to click. Make them
clickable also from the very top to make them easier to activate.

The close button with the default windowcontrols_alignment=right
specifically is already clickable from the rightmost part of the window.

Partial fix of #9791 (other buttons also need to be updated).
2026-04-08 20:32:48 +02:00
NRK 1bfa18107c DOCS/man/input: add note on env case-sensitivity 2026-04-08 20:24:07 +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 e2180e581e demux_playlist: only autocreate on regular file
trying to autocreate playlist when the file is a fifo breaks
playback. the bug report is a special case of `/dev/fd/*` but
even for named fifos, opening and closing them can cause the
other end to stop writing.

Closes: https://github.com/mpv-player/mpv/issues/17682
2026-04-06 18:50:28 +02:00
nanahi 7ace42f505 ytdl_hook.lua: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi 1839da1d07 select.lua: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi 3b86e32c2b defaults.lua: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi 095d858a19 defaults.js: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi b0f9279824 TOOLS/lua/command-test.lua: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi dbd31fd9d3 DOCS/man: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi 80582efca5 input/cmd: use _name for command name in mpv_command_node
Some commands have named arguments named "name", which conflict with
the "name" entry used to specify command name in mpv_command_node, so
they cannot be used with mpv_command_node.

These commands include:
set, del, change-list, add, cycle, multiply, enable-section,
disable-section, define-section, script-binding, keybind, keypress,
keydown, keyup, apply-profile.

This makes mpv_command_node accept command name as key "_name", so
"name" can be used to specify command arguments. For compatibility,
if "_name" entry does not exist, then "name" is used as fallback.
2026-04-06 18:33:20 +02:00
nanahi b7377ede18 DOCS/man/options: document @ syntax for --input-ipc-server 2026-04-06 18:31:27 +02:00
nanahi b11ae04f37 input/ipc-unix: don't delete file for abstract sockets
If --input-ipc-server path name starts with "@", then "@" is replaced
with a null character, which represents the abstract socket namespace
on Linux. Because abstract sockets have no file system presence, it
should not delete the file with the same name starting with "@".
2026-04-06 18:31:27 +02:00
nanahi c2d9905598 DOCS/man/options: add note about %tX behavior change 2026-04-06 18:30:10 +02:00
nanahi edf6016ecf player/screenshot: support %s date format on all platforms
Previous commit left the common %s format extension unresolved.
This implements the format in a platform independent way so it can be
used on all platforms, including on Windows where strftime does not
support %s.
2026-04-06 18:30:10 +02:00
nanahi 87d359eabf player/screenshot: validate strftime format string
The format specifier is controlled by the user that can be arbitrary
character. Using invalid specifier in strftime is UB. Fix this by only
accepting the specifiers recognized in C11.

Partial compatibility is provided for extension formats k, l, P by
translating them to the closest standard alternative.
2026-04-06 18:30:10 +02:00
nanahi dfef53f94b player/screenshot: fix null dereference when failing to get time
localtime can fail and return NULL, which causes NULL dereference
for strftime.
2026-04-06 18:30:10 +02:00
nanahi e0fe1a45d2 command: fix race in reading pad_buttons_pressed
mp_input_get_tablet_pos stores the address to an array that is protected
by lock, and the content is accessed without acquiring lock.

Fix this by writing the values to an array inside mp_input_get_tablet_pos.

Fixes: 0fbf20f057
2026-04-06 18:28:04 +02:00
nanahi b67a5b4cd8 input: fix out of bound read/write in pad_buttons_pressed
When buttons > MP_MAX_TABLET_PAD_BUTTONS and the value is stored in
ictx->tablet_pad_buttons, the next mp_input_set_tablet_pad_focus call
will cause out of bound write, and mp_property_tablet_pos will cause
out of bound read.

Fix this by limiting ictx->tablet_pad_buttons range.

Fixes: 0fbf20f057
2026-04-06 18:28:04 +02:00
NRK 9251f871b6 options: preparse --shuffle
needed in order to correctly handle --directory-mode=auto

Fixes: https://github.com/mpv-player/mpv/issues/17601
2026-04-06 18:27:27 +02:00
nanahi cf957b4f2a player/command: use m_property_read_sub_validate when suitable
Avoids wasting resources on trivial requests.
2026-04-06 18:26:34 +02:00
nanahi 629205280c player/command: rename to mp_property_list_editions
Use mp prefix like everything else.
2026-04-06 18:26:34 +02:00
nanahi 7f28b8818a player/command: use m_property_read_sub for mouse-pos
Allows reading using sub property syntax.
2026-04-06 18:26:34 +02:00
Kacper Michajłow 9e60ae0fee SECURITY.md: add security policy 2026-04-06 18:24:48 +02:00
Guido Cella b8df71a411 commands.lua: use the new choices field in command-list
Use the choices field added by ae2384bce0 for command arguments instead
of hardcoding them.
2026-04-06 18:24:30 +02:00
NRK 702abfd587 vo_gpu: use actual (not logical) texture dimension
pass_upload_image currently stores the logical dimensions, which
in case of vulkan decoding may not match the physical one (e.g
1088 for 1080p). this mismatch results in glitches when using
polar scalers.

fix this by using the actual texture dimensions for hwdec plane
sizes.

Fixes: https://github.com/mpv-player/mpv/issues/14944
2026-04-06 18:23:54 +02:00
nanahi 9bf9bb50de options/m_option: fix valid format in geometry option help message
/WS format is accepted.
2026-04-06 18:23:25 +02:00
nanahi 94d06bc727 options/m_option: allow /WS geometry parameter usable without XYWH
This allows specifying workspace while using autofit for window size
or leave it as default instead of mandatory geometry in pixels.
2026-04-06 18:23:25 +02:00
nanahi befe1e73a2 video/out/x11_common: fix BadAtom error when getting atom name
When XdndEnter advertises format without using XdndTypeList, some of
the atoms in the 3 fixed items may be None, which causes error in
XGetAtomName. Fix this by not resolving name when atom is None.

Fixes the following error message when dragging file on mpv window:
X11 error: BadAtom (invalid Atom parameter)
2026-04-04 21:36:07 +02:00
Mia Herkt 428edff9c1 Meson: add appropriate install_tag to each target
See https://mesonbuild.com/Installing.html#installation-tags

tl;dr it allows choosing what to install and also provides some
extra metadata for tools operate on Meson projects via its
introspection feature.
2026-04-03 18:45:52 +02:00
Mia Herkt c1f30c9b63 Meson: specify license files
This allows using --licensedir. Meson then also generates and
installs a machine-readable manifest file at that location, which
would include the licenses of subprojects if we had any.
2026-04-03 18:21:19 +02:00
Kacper Michajłow c41ee4b95f vo_gpu_next: remove swdec from upload frame pass description
Users are confused about `-copy` hwdec, which is effectively sw upload,
but let's remove this suffix.

Fixes: https://github.com/mpv-player/mpv/pull/17684#issuecomment-4170637631
2026-04-03 02:02:40 +02:00
Kacper Michajłow 0c883fbe03 w32_common: update DWM corners state in when toggling fullscreen
Fixes: #17653
2026-04-03 00:07:29 +02:00
Guido Cella c961c96afb lua: remove the deprecated error field from end-file
This has been deprecated for 6 years so remove the compatibility code.

This basically reverts 37f441d61b.
2026-04-01 22:10:08 +00:00
Guido Cella 70b8b22c8b command: remove the deprecated time-start property
This has been deprecated for 11 years since 70df1608d6 so remove it. All
it does is return 0.
2026-04-01 22:09:25 +00:00
nanahi 4e6196e1a6 player/command: fix update-clipboard text-primary
It mistakenly updates text instead.
2026-04-02 00:05:27 +02:00
Guido Cella ea40f07d2d DOCS/interface-changes: add newline at end of file 2026-04-01 16:47:26 +02:00
zenodity ae2384bce0 player/command: add default-value/choices arg fields to command-list
Add optional 'default-value' and 'choices' fields where appropriate
for command arguments in the 'command-list' property. Update
documentation to reflect the command-list schema change.

DOCS/interface-changes/command-list: add changes
2026-04-01 16:08:26 +02:00
Kacper Michajłow bed0f49729 osc.lua: show window controls in idle 2026-04-01 16:07:27 +02:00
Kacper Michajłow 39302caae4 osc.lua: use window title for window controls from mpv core 2026-04-01 16:07:27 +02:00
Kacper Michajłow 40db14f85b vo_gpu_next: add few cpu timers 2026-04-01 15:20:11 +02:00
Kacper Michajłow 7757064bdd vo_gpu_next: add sw upload time to stats
Also fix lingering hw map stats.
2026-04-01 15:20:11 +02:00
NRK d79c4ad1e3 player/command: add env property
mainly so that env vars can be accessed from within config files.
2026-03-31 18:44:10 +00:00
NRK 5f45db9d70 DOCS/man/input: document dummy properties
these properties cannot be used directly and require a
sub-property. document this explicitly.
2026-03-31 18:44:10 +00:00
llyyr 552d8fa91e vo_drm: use drmModeDestroyDumbBuffer instead of using the ioctl directly 2026-03-31 18:22:54 +00:00
llyyr 8b2e3bf786 vo_drm: use drmModeMapDumbBuffer instead of using the ioctl directly 2026-03-31 18:22:54 +00:00
llyyr 5bb30a6f6c vo_drm: use drmModeCreateDumbBuffer instead of using the ioctl directly
Also remove `fb->handle = 0` assignment because the framebuffer struct
is already zero initialized.
2026-03-31 18:22:54 +00:00
llyyr 64c4309697 drm_prime: use GEM_CLOSE wrapper instead of using ioctl directly 2026-03-31 18:22:54 +00:00
llyyr 4bed99f6a5 meson: bump minimum libdrm version to 2.4.114
We'll use the dumb buffer helpers added in 2.4.114 and GEM_CLOSE wrapper
added in 2.4.108. This is available on Ubuntu 24.04 and Debian 12.
2026-03-31 18:22:54 +00:00
llyyr c8e3a2ec52 drm_common: change type of framebuffer.size from uint32_t to uint64_t
Matches the defintion in kernel headers.
2026-03-31 18:22:54 +00:00
Guido Cella 9465b30a40 DOCS: remove behavior changes before version 0.38
These are ancient and not useful anymore.

The version notices are kept under:
overlay-add: handled by #17520
end-file's file_error: the notice should be removed when updating error
field like suggested there
time-start: this should just be removed
~/.mpv/: needed to understand why this is used
--aid: needed to understand the following paragraphs
2026-03-30 15:09:38 +00:00
Dudemanguy 2e83b3b61c wayland: don't always use surface local coordinates in toplevel config
Since 1301fdb2ec we try to directly use
surface local coordinates however it is valid for compositors to send us
0s in either the width or height. In that case, it means mpv should
choose its geometry so we should calculate out our own coordinates.
Previously this was incidentally handled, but we should be more explicit
here and set the bool.
2026-03-30 01:01:43 +00:00
llyyr adff00c8aa wayland: don't use surface local coordinates if we haven't received them
vo_wayland_handle_scale may be called from reconfig, even before we get
the first toplevel_configure. In this case, don't use the surface local
coordinates because they will be initialized as 0.
2026-03-30 01:01:43 +00:00
llyyr de118fdb70 m_option: don't allow m_geometry_apply to make a coordinate 0
Same reasoning as the previous commit.
2026-03-30 00:53:18 +00:00
Dudemanguy 9214b44a68 video/out/win_state: don't allow apply_autofit to return 0
There's no way this coordinate can ever work so don't force callers to
waste time checking for it, so just MPMAX at 1. Fixes a crash in certain
cases if you do --autofit=1x1.
2026-03-30 00:53:18 +00:00
Dudemanguy 90985bb826 vo: officially deprecate vo_vaapi
Using vo_vaapi has already been heavily discouraged for years since
years since 5c313f1f59. More importantly,
it's just fundamentally broken on most hardware, serves no real purpose,
and well we shouldn't just ship broken stuff. vo_vaapi largely only ever
worked correctly on some intel hardware. The VO relies on certain API
calls that other vendors never implemented so things like the OSD and
subtitles are just never going to work. This largely has no reason to
exist either. If you're looking for efficient playback, you can use
vo_gpu/vo_gpu_next in dumb mode with vaapi decoding. You can also use
vo_dmabuf_wayland with vaapi as well to avoid even more GPU to CPU
copies and theoretically be even more efficient.
2026-03-30 00:34:31 +00:00
llyyr e9a1f82345 wayland: scale edge pixel threshold by scaling factor 2026-03-30 00:32:51 +00:00
llyyr b824aec50f wayland: document that wayland-edge-pixels-touch only affects CSD 2026-03-30 00:32:51 +00:00
llyyr 51ef7c5960 wayland: use wayland-edge-pixels-pointer for tablet input resize zone
Tablet input is more similar to mouse input than it is to touch input,
so it makes sens to use wayland-edge-pixels-pointer instead. Also
document that it's used for tablet input, previously this was completely
undocumented.
2026-03-30 00:32:51 +00:00
Martin Tournoij 86b30afea0 DOCS/man/options: clarify --directory-filter-types docs
Using "mpv --directory-filter-types= dir" as an "empty" value doesn't
work, because that will create a list where the first value is an empty
string, so get_directory_filter() returns AUTO_NONE instead of AUTO_ANY.

You need to use --directory-filter-types-clr instead, to create a proper
empty list.

I suppose this is kind of obvious in hindsight, but it took me quite
some time and digging through the mpv source to figure this out –
initially I assumed it must be a bug of some sort.

So clarify what "empty list" means.
2026-03-30 00:13:03 +00:00
nanahi e45f86225f demux_playlist: don't get config group again when checking shuffle
The shuffle option is already available as p->mp_opts->shuffle since
44a3a3293f.
There is no reason to get the config group again and free it.
2026-03-30 00:07:45 +00:00
llyyr ef531e19c3 vulkan/context: remove pl_swapchain_resize in set_color
ref: https://code.videolan.org/videolan/libplacebo/-/merge_requests/811
2026-03-29 18:00:48 +02:00
Kacper Michajłow 4f9f1ffaf3 meson: build mpv.com with -Os
LLVM even in freestanding build required memset/memcpy/memmove to be
implemented. We don't use them directly but the calls are generated from
the code, which are later optimized away. Since this suppose to be small
utility application, we can always optimize it.

Fixes: #17664
2026-03-28 23:22:09 +01:00
Dudemanguy 2ad46a3c3c vo_dmabuf_wayland: place video surface on the top
For rounding reasons, we should have the surface with the video on the
top. Rounding subsurfaces is tricky business that we don't need to get
into.
2026-03-27 22:20:34 +00:00
Dudemanguy 1301fdb2ec wayland: directly use surface local coords for viewport when possible
Previously, we calculated out the value for simplicity but there can be
a mismatch due to round where what we calculate as the viewport
width/height is not what surface local coordinates the compositor gave
us. Note that we don't always want to use these values directly (e.g.
whenever we set our own geometry), so some notion of overriding has to
be added.
2026-03-27 22:20:34 +00:00
llyyr 251a2b6f49 wayland: alphabetize static function definition
Also fix some inconsistent indenting while at it
2026-03-27 16:40:41 +00:00
llyyr 63d0beb67c wayland: use designated initializers for protocol listeners
Replace order-dependent struct initialization of Wayland listener
structs with designated initializers.

Besides making it harder to make ordering mistakes while adding or
changing code, also makes it easier to grep for specific events because
our callback functions aren't necessarily named the same as the event
names (e.g. global_remove = registry_handle_remove).
2026-03-27 16:40:41 +00:00
llyyr 4d16b0938d wayland: fix typo in log message 2026-03-27 16:40:41 +00:00
llyyr 065146c9b8 wayland: wrap color mgmt functions in ifdefs instead of their bodies 2026-03-27 16:40:41 +00:00
llyyr 38cf424134 wayland: remove set_img_desc goto from set_color_management
A bit easier to understand perhaps
2026-03-27 16:40:41 +00:00
llyyr 96de78f914 wayland: validate metadata before set_luminance
It's still invalid for max_lum to be less than or equal to min_lum, so
do the check before set_luminances call. Also rename the function
because it does more than just check if it's valid, it also sanitizes
some invalid values.

Also changes the TRC_LINEAR case a bit, because min_luma == 0 isn't
exactly invalid, only min_luma >= max_luma is invalid which is covered
by the sanitize function
2026-03-27 16:40:41 +00:00
llyyr 3cf31bf7a4 wayland: reduce branching when printing log for unsupported prim/tf
Also move scRGB comment inside ifdef
2026-03-27 16:40:41 +00:00
llyyr 56832b2bdb wayland: reduce branching in color-management info_done 2026-03-27 16:40:41 +00:00
Guido Cella 1a545faf28 menu.conf: don't check Hardware decoding with no video track 2026-03-25 13:44:44 +01:00
Kacper Michajłow 793ab6dcb0 options: target-gamut now accepts custom CIE xy primaries
Fixes: #17633
2026-03-25 02:01:03 +01:00
Kacper Michajłow eda0e0b093 w32_common: latch force position until it is actually applied
In case we are in fullscreen, we might not apply it right away.
2026-03-25 01:42:12 +01:00
nanahi ae6728a7c0 misc/io_utils: allow mp_save_to_file writing empty files 2026-03-25 01:41:05 +01:00
Kacper Michajłow ef7bced028 osc.lua: make title wider in floating layout
We don't put anything else on title line, so we don't need reserved
space as with other layouts.
2026-03-24 19:24:49 +01:00
Kacper Michajłow f42480d0cc w32_common: fix Windows 10 workaround for initial window pos
Restores hack from 3d4170b81b to work
again.

Fixes: 7466a9f9f3
2026-03-24 00:50:08 +01:00
Kacper Michajłow e757931859 af_scaletempo: limit options to resonable range
This fixes multiple overflows when passing huge values. Which causes
either invalid memory accesses when memory allocations are wrong size or
huge allocations leading to OOM.

Reported by: Trail of Bits
2026-03-23 23:34:20 +01:00
Kacper Michajłow ed534eb7f5 vo_gpu_next: add stereo osd support
Duplicate OSD/Subtitles for left and right eye.

Fixes: #12462
2026-03-23 23:16:32 +01:00
Kacper Michajłow 7466a9f9f3 video/out/win_state: don't move window when force-window-position=no
When force-window-position=no place window on requested position only on
init (when VO requests `force_pos`), except that keep existing
position on auto resizes.

This applies to both user provided geometry and default center
position.

Fixes: #17588
2026-03-23 15:05:01 +01:00
Kacper Michajłow 5df1681c48 vo_gpu_next: add timer for hwdec frame mapping
With `--d3d11va-zero-copy=no` (default), we do the GPU-GPU copy of the
frame, add this time to the stats.
2026-03-23 15:04:11 +01:00
nanahi 514c8097a9 player/configfiles: use mp_hash_to_bstr 2026-03-23 15:03:38 +01:00
nanahi 1bd29b0ba2 video/out/gpu/lcms: use mp_hash_to_bstr 2026-03-23 15:03:38 +01:00
nanahi b48058e6cb video/out/gpu/shader_cache: use mp_hash_to_bstr 2026-03-23 15:03:38 +01:00
nanahi 58ee11c58a misc/hash: add mp_hash_to_bstr function
This util function uses the generic libavutil hash API to hash any data
with the specified algorithm to a bstr. It deduplicates multiple hash
routines used in mpv.
2026-03-23 15:03:38 +01:00
nanahi 6245d7e92c video/out/opengl/utils: remove redundant imports 2026-03-23 15:03:38 +01:00
Kacper Michajłow 7ec8a7e9b1 vd_lavc: ensure decoder state is valid after reinit
This fixes dynamic hwdec switching, which would often fails, because
hw decoder were feed data without context, which caused decoding errors,
which in turn disabled hwdec.

command.c does queue_seek() after decoder reinit, but it may already be
too late, by the time seek to keyframe finishes.

Fix this, by just discarding the data until we have safe point to start
decoding again. Limit this only for hwdec to avoid formats that may not
have ffmpeg parser and not give us keyframe information and limit to 96
frames, just as safety to not lock the player, but this shouldn't happen
in practice.

This should also fix cases, when media file is cut in a way that would
cause decoding errors at the start.

Fixes: #17484
2026-03-23 13:29:59 +01:00
Kacper Michajłow 9339a68dfb demux_lavf: mark packets with keyframe for wrapped avframes too 2026-03-23 13:29:59 +01:00
llyyr 89febe90c2 wayland: move last_zero_copy to fback_pool 2026-03-23 00:31:35 +01:00
low-batt 75681e5019 mac/window: fix white lines around screen with non-native fullscreen
in macOS 11 Apple changed AppKit to disallow use of the fullscreen
window style by custom full screen implementations, reserving this style
for their own implementation. mpv's custom implementation had to
workaround this by manually applying changes to the window to match the
fullscreen window style.

in macOS 26 Apple made changes to enhance visual depth. This
included making a window's shadow more pronounced. This revealed
the workaround was missing code to remove the window's shadow when in
full screen mode. This was especially visible when the macOS appearance
was set to dark and a dark video was played with --native-fs=no. The
window's shadow under macOS 26 was visible as a very thin white outline
around the screen.

this fix will enhance the workaround in the macOS custom full screen
implementation to toggle NSWindow.hasShadow when entering and exiting
full screen mode under macOS 11+.

Fixes: #17586
2026-03-22 23:27:16 +01:00
Kacper Michajłow c798884163 w32_common: respect C{X,Y}MIN system metrics
Fixes: #8440
2026-03-21 23:31:15 +01:00
Kacper Michajłow a380190a41 w32_common: fix handling of WM_SIZING
Fixes some corner cases when resizing window with keep aspect ratio
enabled. Limit correctly window to working area, also after adjusting
aspect ratio to avoid unexpected resizes and window not staying in
position. Use integer math to have consistent rounding, to avoid window
"drifting".

Fixes: #8728
2026-03-21 23:31:15 +01:00
Kacper Michajłow 6c9105380c w32_common: set max window track size 2026-03-21 23:31:15 +01:00
llyyr 9021c3263a clipboard-{x11,wayland}: replace static const with enum
Fixes gcc build with certain build options
2026-03-21 23:27:04 +01:00
nanahi edc8534d0b misc/io_utils: rename cache
The function is used for various purposes so rename cache to something
generic.
2026-03-21 20:14:09 +01:00
nanahi 8b2ab60ae3 video/out/gpu/shader_cache: use mp_save_to_file 2026-03-21 20:14:09 +01:00
nanahi 20b24a0dbd video/out/gpu/lcms: use mp_save_to_file 2026-03-21 20:14:09 +01:00
nanahi 26fbea0205 player/configfiles: check error before copying mtime
Similar to what is mp_write_watch_later_conf is already doing.
2026-03-21 20:14:09 +01:00
nanahi f5cad5c065 player/configfiles: use mp_save_to_file 2026-03-21 20:14:09 +01:00
nanahi 3a8a908641 menu.conf: use update-clipboard command
This command is now required when the default has no clipboard monitoring.
2026-03-21 16:05:36 +01:00
nanahi 59d7315fe2 console.lua: use update-clipboard command
This command is now required when the default has no clipboard monitoring.
2026-03-21 16:05:36 +01:00
nanahi bf054a8357 input.conf: use update-clipboard command
This command is now required when the default has no clipboard monitoring.
2026-03-21 16:05:36 +01:00
nanahi bc4f5ce2ba clipboard-wayland: notify clipboard updates to update-data waiters 2026-03-21 16:05:36 +01:00
nanahi 7d41ceef05 clipboard-wayland: support update_data 2026-03-21 16:05:36 +01:00
nanahi 8611b4c11e clipboard-wayland: disable automatic content fetching 2026-03-21 16:05:36 +01:00
nanahi 613b7f2a77 clipboard-x11: notify clipboard updates to update-data waiters 2026-03-21 16:05:36 +01:00
nanahi 527500b68a clipboard-x11: support update_data 2026-03-21 16:05:36 +01:00
nanahi dd9f7949a2 clipboard-x11: disable automatic content fetching when not monitoring 2026-03-21 16:05:36 +01:00
nanahi f7f7cf18f3 command: add update-clipboard command
This uses the update_data request for clipboard backends that require it.
When clipboard monitoring is disabled, the backends will no longer
fetch data when it detects data change, and will now only do that when
receiving the update_data request.

The client now needs to run this command to update the clipboard content,
otherwise the property value is outdated.

This makes sure that applications that depend on "paste once" behavior
work correctly.

This command runs in a separate worker thread so that it can be used
as a "blocking" way to update clipboard until the update notification
arrives without blocking the playback core. It accepts a maximum timeout
parameter. This uses the existing mp_cancel mechanism to make sure this
command can be aborted and the worker threads will not stall the player
too much when quitting mpv.

For backends that do not support update_data, this command does nothing.
2026-03-21 16:05:36 +01:00
nanahi 49b2cf66d6 clipboard: make clipboard_ctx persistent
There is no reason to create and destroy this storage. They can be
zeroed instead when destroyed. This simplifies some logic and prepares
for the next commit.
2026-03-21 16:05:36 +01:00
Dudemanguy e84ac3760c Revert "osc.lua: fix window controls showing in fullscreen"
Decoupling fullscreen behavior from the generalized border logic
increases the complexity and also inherently changes the behavior in a
way that is not neccesarily desirable. People in IRC notably were
confused about the window controls not being shown in fullscreen because
of this change. We could default the option to yes, but then there will
likely be people confused as to why they suddenly now have the controls
when it wasn't there previously. The best way to avoid all this is just
undo it. If someone wants special fullscreen behavior with
windowcontrols, this can be done with auto profiles already. There's not
much utility in having a separate option.

This reverts commit 3b66428152.
2026-03-20 14:44:03 +00:00
llyyr 7b1ee864b8 input: only allocate key name if we've printing trace level messages 2026-03-19 20:45:55 +01:00
llyyr 520faac68d input: fix leaking tablet tool key name 2026-03-19 20:45:55 +01:00
llyyr 5f9e1bc7bd wayland: guess best containing primary from raw primaries 2026-03-17 10:49:09 +01:00
llyyr 5a45669663 vo_gpu_next: move get_best_prim_container to csputils
Used in next commit
2026-03-17 10:49:09 +01:00
Kacper Michajłow 3d4170b81b w32_common: force DWMWA_EXTENDED_FRAME_BOUNDS to work on init
DWMWA_EXTENDED_FRAME_BOUNDS is not available before window is shown, so
show it off-screen to get correct values.

Fixes: https://github.com/mpv-player/mpv/pull/16127#issuecomment-4063603866
2026-03-17 10:13:34 +01:00
Kacper Michajłow 53f7c6e9dd w32_common: add missing title bar height calc back
I've lost this piece of code when doing rebases or testing. This is
needed to correctly calc maximized window size.
2026-03-17 10:13:34 +01:00
llyyr b51131dff9 ci/freebsd: bump to FreeBSD 15.0 2026-03-15 18:40:09 +01:00
llyyr a71da301b0 ci/{freebsd,openbsd,linux-old}: clone the latest supported libplacebo 2026-03-15 18:40:09 +01:00
llyyr 022fbd16b9 meson: bump min libplacebo version to v7.360.1
This version contains critical fixes to swapchain selection, correct
mapping of sRGB TRC as well as fix for gpu hangs on anv. Bump the
minimum version because the mpv experience with previous version
shouldn't be endorsed or be considered acceptable by upstream.
2026-03-15 18:40:09 +01:00
Kacper Michajłow d12f2ce19c hwdec_vulkan: guard deprecated AVVulkanDeviceContext.lock/unlock_queue
libavutil deprecated AVVulkanDeviceContext.lock/unlock_queue without
replacement [1]. This prevents us from using queue locking, as those
callback will be removed in lavu. Set those callbacks as long as they
are still present, they will be noop in libplacebo with
`VK_KHR_internally_synchronized_queues`.

It's unclear what will happen to devices that do not support
`VK_KHR_internally_synchronized_queues` when the lock/unlock_queue
callbacks are removed.

[1] https://code.ffmpeg.org/FFmpeg/FFmpeg/commit/c102e89448a06d9920920923a4008fee3db4ea37
2026-03-15 17:45:49 +01:00
llyyr 3945a41872 wayland: fix alpha mode mapping for color-representation
Fixes: ed8954e8cf ("wayland: add support for wp-color-representation-v1")
2026-03-15 17:43:27 +01:00
Rudi Heitbaum 8ace278cbe various: fix Wdiscarded-qualifiers warnings
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-03-15 14:49:00 +01:00
llyyr afef9126ce wayland: don't try to do anything on data_device.motion
The keyword here is "try". mpv attempts to accept data offer on motion,
by using the time as the serial... which doesn't do anything. We already
accept data offers on data_device.enter so this doesn't do anything even
if we used the right serial.

Fixes: 68f9ee7e0b
2026-03-14 15:10:59 +00:00
nanahi a7283a8e89 DOCS/man/mpv: use admonition for slice protocol examples 2026-03-14 16:06:51 +01:00
nanahi 2b2bb95181 DOCS/man/mpv: document archive protocol
This protocol is useful for opening a specified file in an archive
instead of opening the archive as a playlist.
2026-03-14 16:06:51 +01:00
llyyr e96c8ed650 video/vaapi: mark nvidia-vaapi-driver as emulated driver
This should match the vendor string[1] provided in that project, and mpv
will skip using this driver on Nvidia. nvidia-vaapi-driver segfaults
when trying to decode 4:4:4 videos, and there's no reason for Nvidia
users to use this layer in mpv anyway. Use nvdev or vulkan instead.

1: https://github.com/elFarto/nvidia-vaapi-driver/blob/c4e1788b6d554f29adec31f3f8aa984c143c54c1/src/vabackend.c#L2331-L2335
2026-03-14 12:55:40 +01:00
Kacper Michajłow 44f06c6dd0 osc.lua: fix typo
oops...

Fixes: 6bf5a6ca7c
2026-03-13 20:12:53 +01:00
Kacper Michajłow 88e741a019 osc.lua: use fluent icons by default for floating layout
Floating layout is more rounded comparet to square bar layout, so fluent
icons are better match here.
2026-03-13 19:16:47 +01:00
Kacper Michajłow 6bf5a6ca7c osc.lua: add floating layout 2026-03-13 19:16:47 +01:00
Kacper Michajłow 8bf384fe6d osc.lua: add osc-icon_style option 2026-03-13 19:14:39 +01:00
Kacper Michajłow 1d7d6c2719 mpv-osd-symbols: add some Fluent UI System Icons to mpv font
This uses Fluent UI System Icons [1] as a source for icons. The glyps
are generated using `TOOLS/gen-fluent-glyphs.py` script, which downloads
Icon and convert for our mpv font to use. Glyphs are vendored in our
repository to avoid external dependency.

Script could be extended to add more icons/variants easily, currently
only filled version are imported.

[1] https://github.com/microsoft/fluentui-system-icons
2026-03-13 19:14:39 +01:00
Kacper Michajłow fbdaddf968 w32_common: refactor window resizing
Fixes lots of issues with current window resizing and window style
modifications.
2026-03-13 15:13:31 +01:00
Kacper Michajłow df4736df26 win32: remove SC_RESTORE handling
It doesn't seem to be neeeded anymore.
2026-03-13 15:13:31 +01:00
Kacper Michajłow 6be1e3f2b9 win32: don't override fs user option
We don't support other ways of fullscreening.

Fixes: #16119
2026-03-13 15:13:31 +01:00
Kacper Michajłow c804e55dbe win32: change resize window event logs to trace 2026-03-13 15:13:31 +01:00
Kacper Michajłow a34ecb5284 video/out/win_state: allow internal size constraint for window_geometry
Will be useful to limit the size directly based on platform requirement.
2026-03-13 15:13:31 +01:00
Kacper Michajłow 8142c831f0 video/out/win_state: pass opts as argument
Options may be at different state when caller is using it's own cached
copy. This makes opts consistent in usage.
2026-03-13 15:13:31 +01:00
Kacper Michajłow 27b0979b6b osc.lua: set sub_margins to no
Subtitles are complex subsystem, let's leave the choice to move them
with margin on user.
2026-03-13 15:10:21 +01:00
Kacper Michajłow 0f37c2abef osc.lua: use dedicated options to control SUB/OSD offset
There is concern that with certain user options or script the value of
`{sub,osd}-margin-y` value may be persisted or overwrite user option
when it's changed while OSD is visible and offset is applied.

Fix this by using dedicated option.
2026-03-13 15:10:21 +01:00
dependabot[bot] 3a09e793b9 ci: bump actions/cache from 4 to 5
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 17:20:00 +01:00
dependabot[bot] d58b7e03b2 ci: bump actions/upload-artifact from 5 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 17:19:40 +01:00
dependabot[bot] e74ef802c5 ci: bump cross-platform-actions/action from 0.30.0 to 0.32.0
Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 0.30.0 to 0.32.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v0.30.0...v0.32.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-version: 0.32.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 17:18:59 +01:00
Kacper Michajłow d83931aa61 ci: add dependabot to update actions for us 2026-03-12 16:08:15 +01:00
NRK 3cd66d2fd7 command: avoid crashing the player with mmap
mmap in inherently crashy due to the file changing underneath
and requires esoteric SIGBUS handling [0] to use properly.

to reproduce, simply use "overlay-add" from a lua script with
invalid stride set and observe mpv crashing with SIGBUS.

here we're just copying the file content (introduced in
549a9ea) and munmaping it immediately so there's no real need
to be using mmap to begin with. avoid the issue entirely by just
reading the file directly with fseek+fread with optimization for
the common stride case.

one notable difference is that since dup-ed fds share same
offset, the source "fd" that's coming from client will now have
it's offset modified. `pread` could avoid this issue but it's
not supported on windows.

[0]: https://www.sublimetext.com/blog/articles/use-mmap-with-care
2026-03-12 15:58:53 +01: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
Guido Cella ad9374d03e osc.lua: move {audio,sub}_track_count into state 2026-03-12 15:58:21 +01:00
Guido Cella 6da164452a osc.lua: update track state only when track-list changes
There is no need to retrieve track-list on every osc_init().

Also remove the outdated comment.
2026-03-12 15:58:21 +01:00
Sam 11440741cb osc.lua: remove pause_state() 2026-03-12 10:50:11 +01:00
Kacper Michajłow 79bf5d2684 osc.lua: increase deadzoneszie to 0.75
This allows to retain deadzone in the middle of the screen when both top
and bottom bars are enabled. We also doesn't have to show bars that
early before moving mouse down.
2026-03-12 00:02:41 +01:00
Kacper Michajłow 3b66428152 osc.lua: fix window controls showing in fullscreen
If `no-border` or `no-title-bar` was used, window controls would enable
also in fullscreen, this was inconsistent, as window decorations are not
visible ragardless of those options in fullscreen mode.
2026-03-12 00:02:17 +01:00
Guido Cella 44dec05a29 osc.lua: don't retrieve display-fps at startup
There is no advantage since is it never available at startup, so speed
up the startup by not retrieving it.
2026-03-11 14:58:09 +01:00
Kacper Michajłow 24500c5e27 f_decoder_wrapper: fix decoder name/desc allocation parent
Those strings has to be owned by mp_codec_params, not decoder wrapper
priv.

Our assumption is that we set those strings here once on decoder init
and they will not be changes during the life time of the
mp_codec_params, hence why we need to make sure they are not deallocated
too soon, in case they happen to be in use.

Fixes, use after free in some cases, when tracks are deselected.
2026-03-11 00:20:22 +01:00
Kacper Michajłow 7b2feb9429 osc.lua: add osd-margin option
Fixes: #17539
2026-03-10 19:45:03 +01:00
Kacper Michajłow e1e6eb8b6e osc.lua: add sub-margin option 2026-03-10 19:45:03 +01:00
Kacper Michajłow aa8966a50f osc.lua: add dynamic_margins option 2026-03-10 19:45:03 +01:00
Kacper Michajłow d4625c7db6 osc.lua: fix always visibility 2026-03-10 19:45:03 +01:00
Kacper Michajłow 32a690b8bd DOCS/man/osc: fix boxvideo description 2026-03-10 19:45:03 +01:00
Kacper Michajłow 85f9e6f274 vf_d3d11vpp: allow more future/past frames
Apparently some video processors request 15-20 future frames.

Fixes: https://github.com/mpv-player/mpv/pull/17413#issuecomment-4032784635
2026-03-10 18:30:10 +01:00
Kacper Michajłow 88ac54b95d osc.lua: hide osc or wc when leaving its area
Those zones use input sections, but in OSC we allow them to overlap. So,
we might switch to the other section, after which point we won't get
mouse_leave event that would hide the bar for the other section.

This makes hidding/showing WC and OSC more consistent.
2026-03-10 08:56:23 +01:00
Kacper Michajłow 3ff7b04790 player/command: don't send mouse move event on mouse leave request 2026-03-10 08:56:23 +01:00
nanahi 1f430f8ce3 osc.lua: always wipe osc when idle
Prevents osc lingering when entering idle.
2026-03-10 08:31:15 +01:00
sfan5 07c3ff3725 command: reject negative offset for overlay-add 2026-03-09 15:43:32 +01:00
Kacper Michajłow cbecfb4046 wayland_common: add scRGB support 2026-03-09 12:00:33 +01:00
nanahi 19b2215142 include/mpv/client: remove mpv_suspend() reference
Removed in mpv 0.35.0.
2026-03-09 10:34:51 +01:00
Kacper Michajłow 14508544ea wayland_common: keep unaltered hint params for changed check
This avoids trying to set params on every frames, if they were modified
by the set color itself.
2026-03-09 10:18:30 +01:00
Kacper Michajłow be2336fcb3 wayland_common: warn on not supported color representation 2026-03-09 10:18:30 +01:00
Kacper Michajłow 040eb5b656 vo_dmabuf_wayland: add BT.2100 mapping 2026-03-09 10:18:30 +01:00
Kacper Michajłow 218be8d93a vo_dmabuf_wayland: use color parameters prepared in reconfig
Those has Dolby Vision metadata stripped and have all parameters
correctly guessed.
2026-03-09 10:18:30 +01:00
Kacper Michajłow 63f3d1731a video/out/opengl/context_wayland: export preferred colorspace 2026-03-09 10:18:30 +01:00
Kacper Michajłow 012d9baa22 vo_wlshm: use image params after conversion 2026-03-09 10:18:30 +01:00
Julian OrthandKacper Michajłow 96e64b0e70 wayland_common: scale preferred luminances
Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2026-03-09 10:18:30 +01:00
Kacper Michajłow 66dcb2ba7b wayland_common: set luminances
This fixes --target-trc=linear output and makes our output luminance
ranges more explicit.
2026-03-09 10:18:30 +01:00
Kacper Michajłow fe9f917d8e vo_gpu_next: set color directly using Wayland protocol
Wayland color managment is not really flexible to be usable with Vulkan
color spaces, so set it directly.
2026-03-09 10:18:30 +01:00
Kacper Michajłow 2417d17c81 wayland_common: only bind color surface when actually used
This is required, because other modules like Vulkan may need to use it,
and only single color surface is allowed in Wayland.
2026-03-09 10:18:30 +01:00
Kacper Michajłow 4a815734e3 player/playloop: clear demux packet pool on idle
Packet pool is useful to avoid work and additional allocations when
switching files, going to idle should free the pool as those packets may
not be used for some time.

Fixes: #17525
2026-03-09 08:54:53 +01:00
zenodity 147c951a17 DOCS/man/input: add tablet-pos node map schema 2026-03-08 18:02:01 +01:00
nanahi 9bb5a0b705 osc.lua: add audioonlyscreen script option
Allows rendering mpv logo when there is no video, instead of
black screen. osc is still available at the same time for playback
control.
2026-03-08 13:07:37 +01:00
nanahi 937e67e7b1 DOCS/man/input: fix typo 2026-03-08 13:07:37 +01:00
nanahi 276710318f osc.lua: make logo centered 2026-03-08 13:07:37 +01:00
nanahi 107b5bee0a osc.lua: render logo and osc on separate layers
Allows rendering logo and osc at the same time to be used by the next
commit.
2026-03-08 13:07:37 +01:00
nanahi e3f6e5d8ed auto_profiles.lua: evaluate conditional profiles on on_loaded hook
This allows conditional profiles to evaluate on the properties only
available in on_loaded stage before the media is shown to the user.
2026-03-08 13:07:05 +01:00
nanahi ba30c8c175 player/loadfile: add on_loaded hook
Currently, there is no hook which happens when the playback actually
starts. The on_preloaded hook is insufficient for many cases, as many
track information are unavailable at that stage. This makes it impossible
to act on certain track metadata before the media is shown to the user,
so the user will see the media before action for a brief moment before the
properties are notified and options are changed.

This adds the on_loaded hook which allows the mentioned information
available.
2026-03-08 13:07:05 +01:00
Kacper Michajłow 396bf65ec5 select.lua: fix crash on user_profiles sort
The list is filtered, so we need to not use index of the input.

Fixes: Lua error: attempt to compare string with nil
2026-03-08 11:50:08 +01:00
CogentRedTester 429fdcf21d mp.input: allow clients to override console.lua script-opts
This commit allows a table of script-opt overrides to be passed to
`mp.input.get()` and `mp.input.select()`, which console.lua will use
instead of the its own.

To minimise required changes, metatables are used to allow console.lua
to seamlessly fall back on the original script-opts if the client does
not provide an override.
To prevent exceptions, the incoming opts must be of the same type.
2026-03-07 12:31:50 +01:00
Kacper Michajłow a205e95efb ci/win32: change from choco to winget
Chocolatey is unstable recently, let's try winget.
2026-03-07 12:30:51 +01:00
Kacper Michajłow 289bcb9e13 Revert "ci/win32: downgrade meson to 1.9.2"
This reverts commit 95c7599c41.
2026-03-07 12:30:51 +01:00
Kacper Michajłow debfdf9402 ci/win32: pre-generate SPIRV-Tools build-version.in
Work around meson's cmake module not supporting OBJECT_DEPENDS [1],
which broke the build after SPIRV-Tools removed the explicit
spirv-tools-build-version target [2].

[1] https://github.com/mesonbuild/meson/issues/9062
[2] https://github.com/KhronosGroup/SPIRV-Tools/commit/54ad621f6e3fa758c1b80981489fcf0b62d2b752
2026-03-07 12:30:51 +01:00
Kacper Michajłow 9548ec5531 osc.lua: avoid use of goto
For Lua 5.1 compatibility.
2026-03-07 07:28:13 +01:00
Kacper Michajłow f9190e57f9 vo_gpu_next: add scRGB support
Fixes: #17076
2026-03-06 16:17:58 +01:00
Kacper Michajłow 74e8cee80d vo_gpu_next: always clip hdr.prim to container primaries
It may happen that .hdr.prim is set from display properties and exceeds
.primaries. This would make gamut mapping work incorrectly.
2026-03-06 16:17:58 +01:00
llyyr 3b55bc9795 wayland: dispatch queue until image_description_pending flag is cleared
wl_display_roundtrip performs one roundtrip one the queue, but there's
no guarantee that the callback will be invoked within that roundtrip.

Instead of hoping one roundtrip is enough, dispatch the queue until the
pending flag is cleared explicitly.
2026-03-05 19:16:30 +01:00
nanahi 10ed4716a7 etc/restore-old-bindings.conf: add changed bindings
Changed in: 7bfa2cfd3d,
8da6e8ad55
2026-03-05 19:14:55 +01:00
Kacper Michajłow 45019b21bf osc.lua: clean areas autohide
Fixes some corner cases with showing/hiding zones.
2026-03-05 16:34:22 +01:00
Kacper Michajłow eda3b89278 osc.lua: make top/bottom bar show independently on mouse proximity
Controlled by `windowcontrols_independent` opt.
2026-03-05 12:44:11 +01:00
Guido Cella a9ac97a5b0 DOCS/man/lua: remove REPL reference
It is a leftover of the original repl.lua name. Follow up to 9551de6385.
2026-03-04 14:11:16 +01:00
WhitePeter c401ef9c3b screenshot: use mp_strip_ext for %F
Reuse existing functionality, see previous commit introducing above
function.
2026-03-03 03:06:39 +01:00
WhitePeterandGuido Cella 648fc933b1 misc/path_utils: new mp_strip_ext shorthand
There are at least two users of this functionality, the filename/no-ext
property and the screenshot template %F specifier. The latter uses a
buggy private version. So split out what the former does, so it can be
reused.

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2026-03-03 03:06:39 +01:00
WhitePeterandGuido Cella 5dba9c52c0 misc/path_utils: fix mp_splitext bugs
The detection for leading dots was in the wrong place, in case path was
not already a basename. Fixed by acting on basename. Also all leading
dots are now getting skipped, otherwise the root of `path/to/...ext`
could end up as `path/to/..` which in the wrong place/context would mean
directory traversal.

Additionally, since we act on the basename there is no longer a need to
test for trailing path separators. The previous check also did not
account for Windows paths with \ separators.

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2026-03-03 03:06:39 +01:00
WhitePeter 9ecbf5c878 screenshot: remove redundant mkdirp call
There is no reason to create the screenshot dir separately, because the
final path starts with it. So defer creating directories to the last
possible moment with all the information necessary.
2026-03-03 03:06:39 +01:00
WhitePeterandGuido Cella d2877a1cdb screenshot: fix %f with trailing slashes
URLs can end with trailing slashes (/) which in turn results in GNU
basename[1] returning the empty string, i.e. when the filename property
is queried. Instead use the whole path for everything that ends with /.
Subsequent path sanitation takes care of translating invalid path
component chars.

Issue reproduction steps:
```
mpv \
    --screenshot-dir=$HOME/mpv-shots \
    --screenshot-template='%f/%P' \
    https://example.org/video/
```
This would result in %f expanding to '' and thus render
screenshot-template an absolute path which, for some reason, would in
turn take precedence of screenshot-dir and hence result in a
non-writeable path, i.e. `/timestamp.ext`.

With this new approach the resulting path looks like this:
`/home/user/mpv-shots/http:__example.org_video_/timestamp.ext`

[1] https://github.com/mpv-player/mpv/pull/14635#issuecomment-2269456187

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2026-03-03 03:06:39 +01:00
llyyr 35443a74cb vo,vo_dmabuf_wayland: remove vo_wait_on_vo
Not needed after previous commit
2026-03-03 03:01:41 +01:00
llyyr 8012dc88f7 wayland: do a roundtrip to wait for image description creation
Also switch to a different event queue to ensure there are no other
events in the queue.
2026-03-03 03:01:41 +01:00
Kacper Michajłow c55bdc3282 video/out/gpu: signal correctly if set_color is supported
set_color conceptually is a swapchain command, but in Wayland it's
implemented in ra_ctx, so we have one jump of indirection. Having
`set_color` defined for context_vulkan doesn't mean that all ra contexts
support it. Add a bool to mitigate this.

This could be structured differently, but should be fine.

Fixes: #17487
2026-03-02 02:04:36 +01:00
Guido Cella af9c81fa1e DOCS/man/options: don't recommend --sub-justify=left
It is unclear why this should be recommended. If it were recommended it
would be the default. The consensus is that centered justification looks
better.
2026-03-01 08:24:39 +01:00
Guido Cella 05fac7f21e DOCS/man/lua: document remaining input.select() fields
Document more shared fields with input.get().

I originally omitted them because they didn't seem useful for
input.select(), but now opened can be used to override keybindings, and
default_text = "'" can be used to default to exact search (which I do
for history in my build).

closed, default_text and cursor_position may be used to remember the
last input line for the next call.
2026-02-28 22:41:26 +01:00
nanahi fc7f6e0208 osc.lua: fix mouse position init
get_virt_mouse_pos() can return dummy -1, -1 in some cases, for example
when mouse is not considered "in" the area. render() is called
immediately and sets the initial mouse position to -1, -1 when the first
tick happens.

When starting player and mouse is already on the window but not moved,
then move the mouse, the mouse_move handler thinks that the mouse moved
from -1, -1 to the current position, triggering showing even when the
amount moved is less than osc-minmousemove.

Fix this by not letting render() init mouse position if the position is
dummy -1.
2026-02-28 22:39:24 +01:00
Kacper Michajłow 3511e467e7 vo_gpu_next: use typed variable for alpha 2026-02-28 13:32:19 +01:00
Kacper Michajłow 2e8520311c vo_gpu_next: fix rgb range in Wayland hint
Fixes: 9d2da2567c
Fixes: #17479
2026-02-28 13:32:19 +01:00
Dudemanguy bcfc754f03 wayland: invert image_description_processed boolean
Depending on the state being true before advancing through frames works
but it's error prone and leads to various edge cases you have to account
for (e.g. like 339ac9b305). It's better
invert it so that setting color management is the special case that sets
the boolean to true to stall the playloop. The logic can then be
simplified, and the vo_wayland_handle_color call is moved up to be
directly after we create the buffer.
2026-02-28 10:50:38 +01:00
Dudemanguy f864f9a14a wayland: use set_color for vo_wayland_handle_color
Move this out of swap_buffers. This makes it more consistent with what
vo_dmabuf_wayland does.
2026-02-28 10:50:38 +01:00
Dudemanguy baad29c1f4 context_drm_egl: use set_color for handling colorspaces
With this ordering, we ensure that the colorspace is set before the
first atomic commit.
2026-02-28 10:50:38 +01:00
Dudemanguy 9d2da2567c video/out/gpu: add set_color ra_swapchain_fns
Anything related color management gets complex and there is a lot of
platform-specific code that gets called in relation to this. Currently,
this stuff gets called in various places in the render loop which mostly
works but it's prone to "off by 1 frame" errors and also isn't clean.
Introduce this helper to hopefully unify all this kind of stuff under
one umbrella. For integration with vo_gpu_next, this needs to be called
before flip_page and we should stop abusing target_params for this
purpose. The next couple of commits will implement this in two places.
2026-02-28 10:50:38 +01:00
Dudemanguy 2268297ac4 context_drm_egl: use target_csp to signal HDR
For the drm context, we can use the target_csp so vo_gpu_next knows what
colorspace to output to. We just need to be sure the monitor is able to
display bt2020. For now, all we detect on the EDID side is either pq or
hlg so ensure at least one of those works before we send back something
to vo_gpu_next to use for target_csp.
2026-02-28 10:50:38 +01:00
Dudemanguy 7dd06a6c0b video/out/gpu: remove pass_colorspace ra_ctx_fns
This was originally added way back when specifically for drm so it can
play  nice with libplacebo for HDR. This is pretty ugly though and a bit
hacky. There's a better way to integrate this with target_csp. So drop
the pass_colorspace stuff in this commit and we'll change the
implementation in the next commit.
2026-02-28 10:50:38 +01:00
Nicolas F f28cea85c1 ytdl_hook.lua: use the new request_size AVOption when needed
Some sites throttle requests, but throttling can be avoided with many
small range requests. yt-dlp implements a "http_chunk_size" key in its
-J output to inform us of the ideal size.

https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21703 has just been merged,
which allows use the http_chunk_size to greatly speed up how fast
YouTube videos get loaded into the cache by mpv.

Should the FFmpeg that mpv is built against lack the request_size
AVOption, then this will silently not do anything new, so no version
checks are needed.

Specifying multiple_requests=1 like suggested in
https://github.com/mpv-player/mpv/issues/8655#issuecomment-3872689494
does not seem necessary.

Fixes #8655.
Supersedes #15612.

Co-authored-by: Nicolas F <ovdev@fratti.ch>
2026-02-27 20:18:55 +01:00
Kacper Michajłow e54cee1b23 player/command: apply expand-properties modifier also for string lists 2026-02-27 20:18:42 +01:00
Guido Cella 850677c157 input.lua: don't shadow the global type() function
For consistency, also rename type to event in defaults.js.
2026-02-27 18:12:52 +01:00
CogentRedTester a96bbf5c17 mp.input: sanitise client inputs
This commit should remove any unexpected behaviour or crashes
that
may be caused by users passing unexpected values to mp.input functions.

String and numerical options are now explicitly converted to strings and
numbers. Values which should be tables are set to empty tables, and
warning messages are printed to inform the user.
2026-02-27 09:51:14 +01:00
CogentRedTester 4d26c4e42c console.lua: guard against invalid arguments to script-messages
All but one of these guards should never be tripped
if people are using the mp.input
module. However, it could happen if non-lua/js clients were to use the
JSON API directly.

Currently, without these guards, calling these script messages with
incorrect arguments will almost certainly crash `console.lua`, hence
preventing any client from requesting input.

An error message has also been added for each guard to provide some
feedback as to why the arguments were invalid.
2026-02-27 09:51:14 +01:00
Guido Cella 3ec435dbee menu.conf: add a Reload menu item 2026-02-27 09:24:53 +01:00
Guido Cella 06259d1a0b input.conf: bind Ctrl+r to reload the current file
Because how to do this has been asked more than 10 times in #mpv, bind
it by default.
2026-02-27 09:24:53 +01:00
Guido Cella 3b555c349c command: let playlist-play-index current preserve file-local-options
If you set file-local-options/foo at runtime and run playlist-play-index
current or playlist-play-index $current_pos, file-local-options/foo is
reset. Add a flag to make it preserve file-local-options.

The advantage of this change is that it allows binding Ctrl+r set
file-local-options/start ${=time-pos}; playlist-play-index current yes
to reload the current file while preserving all options, independently
of --no-config, --watch-later-options or --reset-on-next-file, and
without writing watch later files to disk. It also preserves
file-local-options set on the CLI unlike loadfile.
2026-02-27 09:21:14 +01:00
CogentRedTester 149e6dc55b commands.lua: return empty completions on early returns
The new async completion handling code expects an empty list of
completions to be returned if no completions should be shown.
2026-02-27 05:29:06 +01:00
NRK d54bad5636 screenshot: percent decode filename if it's a URI
any uri that's fed to mpv should be percent encoded already
(ffmpeg will sometimes do it for you, but it's heuristic is not
foolproof [1]).

but there's no reason for us to leak uri quirks into screenshot
filename, and it's generally not what users want either. so do
the obvious thing and percent decode the filename if it's a uri.

[1]: https://github.com/mpv-player/mpv/issues/17450#issuecomment-3953135707
Fixes: https://github.com/mpv-player/mpv/issues/17450
2026-02-25 17:36:37 +02:00
NRK 41463d6ac8 DOCS/man/mpv: document that URLs should be percent-encoded
most of the time not doing so will still work since ffmpeg has
some heuristics in place to detect if the url is percent encoded
already or not. but these heuristics are not foolproof and so
document this quirk explicitly.
2026-02-25 17:33:03 +02:00
Avi Halachmi (:avih) 92ed2d2ef0 github/issue_template: clarify "latest mpv version"
At the issue templates "tested with the latest version" checkbox, make
that a link to the latest version, revise the text slightly, and add
"or newer".

At the linux issue template, also note that if the distro does not
provide the latest version, then the issue should be reported to them.
2026-02-25 00:28:18 +01:00
CogentRedTester 4bb048c227 console.lua: prevent outdated completions from being selected
This commit flags when console.lua is waiting for completions, and
disables the completion cycle key until up-to-date completions are
received.

While this is happening, completions are not printed when in terminal
output mode. In normal OSD mode, the completions are still printed, but
at reduced opacity. This is to avoid distracting and ugly flickering
from completions being rapidly erased and redrawn.

The completion results are only dimmed after a short (sub-second) delay.
This is to avoid distracting flickers from the opacity
rapidly changing for clients that return completions almost immediately,
e.g., commands.lua.
2026-02-24 20:19:24 +01:00
CogentRedTester 9902e84e20 DOCS/interface-changes: change how mp.input completions are returned 2026-02-24 20:19:24 +01:00
CogentRedTester 5a1700a456 mp.input: avoid displaying outdated completions from the same client
Previously, completion responses from the same client would be displayed
even if the user had since changed the input, as long as a newer
complete event had already been sent. This meant that, if clients took a
sufficiently long time to return completions, then
console.lua would display completions for previous versions of the line
which were no longer valid.

This commit has the client send back the version of the line their
completions apply to, ensuring that `console.lua` displays the
correct completions.
2026-02-24 20:19:24 +01:00
CogentRedTester c568e1539f commands.lua: use new mp.input complete method
Updates to use the new response function passed to
`complete` events to send completions back to `console.lua`. This is to
pre-empt the old return value method being deprecated.
2026-02-24 20:19:24 +01:00
CogentRedTester c72f2add25 mp.input: allow async completions
Previously, it was impossible to generate a list of completions for an
`input.get()` request asynchronously, as the values had to be returned
by the callback function.

This commit provides a way to send completions asynchronously by passing
a second argument to the complete callback; a function which can be
passed the return values to respond to the complete event.
2026-02-24 20:19:24 +01:00
CogentRedTester cf481faa72 DOCS/man/lua: update recommended use of the mp.input opened event
Now cites overriding keybinds as the most notable use of the `opened`
event.
2026-02-24 20:12:57 +01:00
CogentRedTester ae965e7a7e console.lua: remove undocumented dont_bind_up_down option
This undocumented option was used by `stats.lua` to prevent the page
scroll keys from being overridden by `console.lua`. The previous commits
have removed the need for this hack, so it is now safe to remove.
2026-02-24 20:12:57 +01:00
CogentRedTester de0f2f943d stats.lua: correctly override mp.input keybinds
This commit uses the opened event to ensure that the page scroll keys
(`UP`/`DOWN` by default) override the mp.input bindings,
without overriding any other mp.input keys.

This is much safer than the previous method, which required an
undocumented option to be passed to `mp.input`, and was hardcoded to the
default scroll keys.
2026-02-24 20:12:57 +01:00
CogentRedTester 0af0c137bb console.lua: flush keybinds before sending mp.input opened events
This commit uses the undocumented `mp.flush_keybindings()` method
to ensure that all `console.lua` keybinds are set before
sending the `opened` event to `mp.input` clients.

Previously, the keybinds would only be flushed when `console.lua` went
idle. As the `opened` event is sent before this happens, clients
processing the event may end up flushing their own keybinds before this
happens. This makes it unreliable to use the `opened` event to override
keybinds set by `console.lua`; for example, adding different
behaviour to `input.select` when using `Shift+Enter` instead of `Enter`.

This commit allows the `opened` callback to be used to safely override
`console.lua` keybinds.

.luacheckrc: move flush_keybindings to globals
2026-02-24 20:12:57 +01:00
llyyr e09a1d12f2 m_option: also clamp OPT_FLOAT values for float_set
This incorrectly used clamp_double function after 0e7f9c39dc when it
should've always used clamp_float instead. Use clamp_float instead

Fixes: 0e7f9c39dc ("m_option: correctly clamp OPT_FLOAT values")
2026-02-24 19:41:53 +01:00
Kacper Michajłow ae119448b2 m_option: remove duplicated code for float/double range check
The float version was missing "default" case. This fixes options with
M_OPT_DEFAULT_NAN.

Fixes: 0e7f9c3
Fixes: #17436
2026-02-24 19:41:53 +01:00
nanahi 3eb8f9a1de demux_lavf: get codec info from AVCodecParameters
This allows displaying codec info for all tracks without selecting the
track.
2026-02-24 19:36:33 +01:00
nanahi 4e2f3ce4b9 command: add track-list/N/demux-duration property 2026-02-24 19:36:33 +01:00
nanahi ccdb098fb4 stats.lua: add track_info_selected_only script option
Allow displaying info for all tracks rather than only selected tracks.
2026-02-24 19:36:33 +01:00
nanahi e6bd564723 demux_lavf: also make demux-bitrate available for video
Make it available as a property and on stats page 5.
2026-02-24 19:36:33 +01:00
nanahi b62e34d975 stats.lua: display file duration on page 5 2026-02-24 19:36:33 +01:00
nanahi 9ce6da09e6 stats.lua: add format entry to page 5 2026-02-24 19:36:33 +01:00
nanahi c3f11f8b7e stats.lua: rename format to codec on page 5
To be consistent with page 1 usage, where format refers to sample format
and not codec.
2026-02-24 19:36:33 +01:00
zenodity 4620834e36 DOCS/man/input: add/update MPV_FORMAT_NODE map and array pseudo structs 2026-02-23 20:06:02 +01:00
Guido Cella ee9a219600 console.lua: deduplicate code between get-input and handle_cursor_move 2026-02-23 17:40:11 +01:00
zenodity f439c7f62c m_option: fix x:y mode format when printing geometry
Previously, x:y mode geometry strings were incorrectly printed
using the WxH+x+y format.
2026-02-22 22:31:40 +01:00
Kacper Michajłow 250d6056c3 ci/win32: update runners to windows-2025-vs2026 2026-02-21 01:36:35 +01:00
Kacper Michajłow 5159300ba3 ci/win32: use vswhere to find Visual Studio 2026-02-21 01:36:35 +01:00
Simon Bruder 534b2d2ea6 {demux,player}: expose original and commentary track flags
Those flags were added to the Matroska specification together with the
already implemented hearing-impaired and visual-impaired flags.

They allow specifying whether a track is a commentary track or in the
original language without relying on the free-form track name, which
makes consistent tagging and parsing by machines easier.

Ref: https://github.com/ietf-wg-cellar/matroska-specification/pull/447
Ref: https://www.rfc-editor.org/rfc/rfc9559#name-original-flag
Ref: https://www.rfc-editor.org/rfc/rfc9559#name-commentary-flag
2026-02-20 20:31:04 +01:00
Kacper Michajłow f7ad4a5f8f vf_d3d11vpp: set output format for NVIDIA RTX Video HDR
It outputs RGB tone mapped image, set params accordingly.

Fixes: #17265
2026-02-19 19:18:56 +01:00
Kacper Michajłow 43f00135ea vf_d3d11vpp: add dots to logs 2026-02-19 19:18:56 +01:00
Kacper Michajłow 568522e69e vf_d3d11vpp: use ID3D11VideoContext1 interface for setting color space
This allows to use DXGI enums for color spaces, which supports PQ
transfers and so on. Old D3D11_VIDEO_PROCESSOR_COLOR_SPACE is limited
and doesn't support HDR formats.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 825ba4167e hwdec_d3d11va: add support for RGB formats
This will be useful for mapping RGB output from d3d11vpp tone mapping.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 2aba5a7167 ra_d3d11: allow mapping rgba10_a2 format
This is needed for ra_get_imgfmt_desc() which otherwise would not allow
rgba10_a2 format, because it doesn't have all components with the same
size. However it's nativelly supported by d3d11, so we add it to special
formats, same as opengl does.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 18330cb1ed video/img_format: add repack test for new formats 2026-02-19 19:18:56 +01:00
Kacper Michajłow 54976fe147 video/img_format: add IMGFMT definitions for x2bgr10 and rgba16f
Will be useful for mapping hardware frames. We could add more formats
here, but those should be enough to allow RGB processing.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 71bc92a080 video/img_format: move IMGFMT_X2RGB10 from custom range 2026-02-19 19:18:56 +01:00
Kacper Michajłow 7b015a9846 video/img_format: remove custom rgb30 definition
It's supported in ffmpeg since 4.4, no need to keep custom code for it.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 2b4b345a3a video/img_format: rename IMGFMT_RGB30 to IMGFMT_X2RGB10
It's supported in ffmpeg, so let's have naming parity.
2026-02-19 19:18:56 +01:00
Kacper Michajłow af47c1d43b vo_drm: don't define custom IMGFMT values
We should never make such mappings that are not covered by
img_formats.h.
2026-02-19 14:20:56 +01:00
Kacper Michajłow e9a3bf2ad1 vo_drm: use always little endian formats
DRM formats are little endian, unless the format is ORed with
DRM_FORMAT_BIG_ENDIAN.
2026-02-19 14:20:56 +01:00
Kacper Michajłow 73ae34e2d0 vo_drm: fix xbgr2101010 format mapping
Fixes: 6b452788c4
2026-02-19 14:20:56 +01:00
Kacper Michajłow c2c081f49a vf_d3d11vpp: use half-rate for IVTC mode
The optimal way would be to use custom rate based on telecine cadence,
but it's not supported by any driver in practice. So instead, allow
driver to field match and output with duplicated frames, which can be
removed using decimate filter.

Note that in practice all GPU vendors uses single video processor for
all deinterlacing, so IVTC will be done even if mode is not explicitly
selected. At least the field matching part, because correct rate output
is not supported. The main difference is that when selecting more we
output at video frame rate, not field rate.
2026-02-18 18:13:18 +01:00
Kacper Michajłow f571fd73a1 vf_d3d11vpp: print supported custom rates 2026-02-18 18:13:18 +01:00
Kacper Michajłow 2141fa88b3 vf_d3d11vpp: fix deinterlacing
There were multiple issues in API usage, not setting correct
OutputIndex, lying about frame field parity to make it work without
OutputIndex. Not passing reference frames which forced BOB mode always.

Fix all issues and allow forcing BLEND/BOB mode by not passing frames.
Blend mode also sets half rate output. Half rate could be separate
option too, but there is not much gain from it except for debugging
really.

Fixes: #15197
2026-02-18 18:13:18 +01:00
Kacper Michajłow 47ed5785e4 video/filter/refqueue: add mp_refqueue_output_fields 2026-02-18 18:13:18 +01:00
Kacper Michajłow db2352f69a vf_d3d11vpp: update mode selection logging 2026-02-18 18:13:18 +01:00
Kacper Michajłow 626f1344c8 vf_d3d11vpp: rename ivctc to ivtc
This was a typo. Although this changes the user option name, this
filter, especially this option, is so niche that I fix it without a
deprecation period.
2026-02-18 18:13:18 +01:00
Guido Cella aa82213726 select.lua: don't set an empty prompt
Not needed since 44816ef8ff.
2026-02-15 16:36:28 +01:00
Guido Cella 102e693f49 select.lua: sort the track submenu
track-list doesn't necessarily return tracks sorted by type so we need
to sort them ourselves.
2026-02-14 01:07:27 +01:00
llyyr 1a160f9767 Revert "ci/tumbleweed: disable sanitizers for GCC build"
This reverts commit 5b0cfe8849.

Shouldn't be needed after previous commit
2026-02-14 00:43:52 +01:00
llyyr a7523a4afd demux_mf: satisfy gcc ubsan so it doesn't produce bogus warnings
Since we call bstr0 on the string anyway, might as well use it for
printing which implicitly includes a null check that gcc can see so it
doesn't produce the warning as seen in the next commit anymore
2026-02-14 00:43:52 +01:00
Dudemanguy 76a5eba991 player: don't mangle current playlist entry before initialization
Scripts and things using the client API can load up playlists in a
specific order and choose what file to start playing on by using the
loadfile or loadlist commands with the play argument. However if
starting from idle mode, it is possible to send these commands before
all scripts finish initializing. mpv's core then does a prepare_playlist
call on its own for startup which will nuke the current playlist entry
set by the API user and lead to an unexpected item being played. Fix
this by not unconditionally setting pl->current to NULL allow callers to
optionally always overwrite it by getting the first item in the playlist
(e.g. if it's called after startup anywhere else in the code). Other
options like --playlist-start or --shuffle are allowed to win if they
happen to be set.
2026-02-12 04:42:32 +00:00
Dudemanguy 3847a8157f wayland: handle all outputs disappearing without segfaulting
If you switch TTYs while mpv is playing, wlroots compositors will remove
all outputs from the registry. This segfaults when you switch back since
we try to access cleared memory. Rework this so wl->current_output is
given null when appropriate and properly guarded. You still need at
least one output to initially place the surface, but in general they can
all disappear during runtime and it should work. Change the log to
verbose because that becomes just noise in this case (switching TTYs).
The surface entrance event happens later and should get all the proper
parameters.
2026-02-10 00:46:55 +00:00
llyyr f0f9322c57 vo_dmabuf_wayland: only wait for image description if we have a buffer
Waiting for color management from the compositor doesn't make sense in
other cases and this breaks --force-window since the playloop doesn't
advance. Fixes #17391.
2026-02-10 00:35:28 +00:00
Dudemanguy d5bc61596d vo: clear request_redraw in render_frame only if video is playing
27a78276eb almost got it but it should be
an and condition not an or. When we unlock VO to draw the core, the OSD
can update after we flip the page and the player can also pause itself
in that time. That means that we will clear the redraw request but due
to the OSD update it actually needs to draw again. Because the player
paused itself in that time frame, this redraw gets lost and you have the
mismatch. The simplest way to avoid that case is to only clear the
redraw_request while mpv is playing. The paused case will always get
handled later in do_redraw so it does not get missed. The slight
downside is that it's technically possible to do a redundant redraw
(e.g. what if you pause before draw_frame), but this theoretical
inefficiency is deemed not really relevant or important enough to add
more confusing code to avoid. Fixes #17288.
2026-02-09 14:43:46 +00:00
Kacper Michajłow 4fd2600c65 d3d11: support --d3d11-output-format fully for gpu-next 2026-02-08 22:14:18 +01:00
Kacper Michajłow c9c039b7f1 d3d11: set pl_d3d11_swapchain_params.alpha_bits if alpha is needed 2026-02-08 22:14:18 +01:00
llyyr 67886c97dd vulkan: set pl_vulkan_swapchain_params.alpha_bits if alpha needed
We can try to calculate specific amount of bit required in the future,
and also populate color_bits field but for now this should suffice.

Ref: https://code.videolan.org/videolan/libplacebo/-/merge_requests/767
2026-02-08 18:52:56 +01:00
sfan5 60dd40d007 test/img_format: remove dead code 2026-02-08 11:51:26 +01:00
sfan5 e01165d3db test/repack: test draw_bmp at some uneven sizes
intended to discover bugs like f3c1dcf7a1
2026-02-08 11:51:26 +01:00
sfan5 272404533e test: add reference files for ffmpeg 8 2026-02-08 11:51:26 +01:00
Guido Cella 1f686769cd mp.input: deprecate log_error()
This was a mistake. It's too situational and it's not worth complicating
the API and every mp.input client with it. It made some sense before I
implemented input.select() because you could use input.get() to input a
choice and validate it, but in general for input.get() clients it's
better to show an error with input.set_log() instead of adding new lines
to the log everytime. This is what e.g.
https://framagit.org/Midgard/mpv-subber/-/blob/master/subber.lua does.

So this is only marginally useful for REPL scripts that keep adding
lines to the log, and the only such scripts are commands.lua and my
lua-repl.lua. commands.lua never used it and I already removed it from
lua-repl.lua. Cloning all scripts in the wiki reveals that **nobody** is
using log_error(), confirming that it is safe to deprecate.
2026-02-08 11:51:17 +01:00
sfan5 b6512e1f8d wayland_common: improve probing behavior and logging
Any errors when opening the display are now logged.
The WAYLAND_DISPLAY check now also logs and applies only when probing.
This means explicitly setting a wayland `--gpu-context` will always
try to open the display instead of "helpfully" refusing (in some cases).

see also: f6f1721101
2026-02-08 01:56:01 +01:00
Steve Williams 9ccd8899ff sub/draw_bmp: limit memset to available width in last slice
extends f3c1dcf7a1 for all lines not just
the last. This avoid unnecessary write every line and fixes a buffer
overflow for small enough images (for example 78x64).
2026-02-06 11:01:59 +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
Steve Williams 339ac9b305 wayland: set image_description_processed when not using color mgmnt
otherwise wl->image_description_processed will always be false and
the window will not show.
Follows 468d34c9bd.
2026-02-05 16:07:15 +00:00
verygoodlee 70c893988a select.lua: quote and escape string arguments in menu item commands
try to define a `[foo \ "bar"]` profile in mpv.conf, the command
to apply it in context-menu is `apply-profile foo \ "bar"`,
which is obviously incorrect, the correct command should be
`apply-profile "foo \\ \"bar\""`.

for string arguments that may contain spaces or some special
characters, we need to quote and escape them in JSON-style,
fortunately, `utils.format_json` can do this very well.
2026-02-05 16:14:48 +01:00
Guido Cella ea82915ba7 menu.conf: change duplicate hints
Deduplicate:
Op&en and &Editions/Titles
&Quit and &Quit watch later
2026-02-03 21:05:38 +01:00
llyyr db22a4528f vo: reset wait_on_vo if render_frame is called without current_frame
Fixes a deadlock when switching vo before a frame is displayed (e.g.
with auto profiles) where we'd end up in a state where wait_on_vo is set
to true for the first frame and then draw_frame is never called again so
its value never changes even once dmabuf-wayland is ready to advance
frame

Fixes: 468d34c9bd ("vo: allow VOs to request waiting before advancing frames")
2026-02-02 01:04:16 +00:00
verygoodlee 40d2947fa3 DOCS/man/lua: fix the arg of callback function for "mp.register_event" 2026-01-31 16:56:13 +01:00
Guido Cella d6eeff690d select.lua: handle empty lines at the end of the file
Prevent a crash in this case due to lines[i + 1] being nil.
2026-01-31 14:26:04 +01:00
Guido Cella a0f593202a select.lua: handle carriage returns in menu.conf
Fixes https://github.com/mpv-player/mpv/pull/16816#issuecomment-3804029038
2026-01-31 14:26:04 +01:00
Guido Cella 2cef09820d context_menu.lua: apply disabled_color to separators
As per Samillion's suggestion, reduce the contrast between separators
and the background to match other context menus. Using the already
defined disabled_color works for this and seems to be what GTK and Qt
do at a glance.
2026-01-31 13:20:05 +01:00
Dudemanguy ee843f4db7 player/command: fix repeatable frame stepping with the seek argument
730062b510 fixed the problem with mouse
buttons but unfortunately we forgot to include repeated commands in the
condition. This effectively made any variant of "frame-step X seek"
unrepeatable even though it was supposed to be. So just allow those in
add_step_frame too.

Fixes #17348.
2026-01-31 01:20:14 +00:00
Guido Cella 01cb6433c0 select.lua: always observe --osd-playlist-entry
The playlist submenu does not update in this edge case:

- Have a playlist-count > 99 on the first vo-configured. This makes
  playlist() return before observing --osd-playlist-entry.
- Remove playlist entries until the count is < 100
- Change --osd-playlist-entry
- Show the playlist submenu before changing the playlist
2026-01-30 10:53:19 +01:00
verygoodlee c5c8e8a39a console.lua: allow scrolling up the log until only one line remains
Currently, if some log lines have very long text that actually
renders across multiple lines, even if you scroll to the top,
the topmost content will be pushed out of the screen by these
lines and will never be visible.

In STATS page 2/4/5/0, you can scroll down until there is one
line left on the screen, we can keep the scrolling behavior of
the log consistent with it.
2026-01-30 10:53:07 +01:00
Kacper Michajłow 54da0ba070 demux/packet_pool: unref packet early if we can do it without penalty 2026-01-28 18:40:19 +01:00
Kacper Michajłow a1ea4f3aec demux/packet_pool: always return default packet state from pop
This is not functional change, as pop() is only used in packet_create()
which already cleared the packet, but it's better to make it explcit.
2026-01-28 18:40:19 +01:00
Kacper Michajłow 3b17ab5d3b demux/packet: add demux_packet_unref helper 2026-01-28 18:40:19 +01:00
Guido Cella d79172ac3e select.lua: update the playlist submenu after playlist-move
Observing playlist-pos and playlist-count is not enough to update it
after playlist-move, but we can observe any playlist property with type
none to get notified of every MP_EVENT_CHANGE_PLAYLIST, even if the
property has not changed.

This is similar to the
mp.observe_property("vsync-jitter", "none", recorder) hack used by
stats.lua to replicate the deprecated tick event.

Fixes https://github.com/mpv-player/mpv/pull/16816#discussion_r2727498518
2026-01-28 15:21:38 +01:00
Guido Cella d1743b641b menu.conf: change duplicate hints
Deduplicate:
&Properties and Copy &path
C&enter and D&einterlace
&Speed and &Shuffle
2026-01-26 11:47:16 +01:00
Guido Cella eadba4469f menu.conf: add open-chat to the context menu 2026-01-26 11:11:38 +01:00
Guido Cella d7f0efb67b context_menu.lua: make ESC close only submenus when they are open
Fixes https://github.com/mpv-player/mpv/pull/17316#issuecomment-3798278219
2026-01-26 10:50:50 +01:00
Guido Cella 70d3dc58e8 context_menu.lua: activate key hints with caps lock
Fixes https://github.com/mpv-player/mpv/pull/17316#issuecomment-3797615909
2026-01-26 10:32:05 +01:00
Guido Cella 7bfa2cfd3d input.conf: add context menu bindings
Rebind MENU to show the context menu. Shift+F10 is also bound because it
is a standard context menu binding.

MENU is not added to restore-old-bindings.conf because it is uncommon.
2026-01-25 20:56:42 +01:00
Guido Cella f4b37b6455 select.lua: populate the context menu
Make select.lua parse menu.conf on the first vo-configured and fill
menu-data with the properties referenced in menu.conf change. This is
disabled in the libmpv profile.

This is done from select.lua to reuse functions to format the data and
retrieve key bindings.

There is also a script-binding that opens the correct context menu
depending on --load-context-menu.

While the context menu is scrollable, for the playlist it is better to
start from around the current entry rather than from the beginning, and
since menu-data has no way to specify where to start, when there are
more than 25 items playlist items this adds … entries that open the
scrollable console menu when clicked.

input-bindings is parsed to show the shortcuts bound to commands. Since
it is not observable, it just uses the bindings from the first time the
context menu is opened.

Multimedia and numpad keys are also not shown to reduce clutter.

The old Context Menu section of the docs is merged in the more detailed
context_menu.rst to not repeat the same information.
2026-01-25 20:56:42 +01:00
Guido Cella 8f2d69e1cc select.lua: skip key bindings of forced input sections
Avoid showing forced key bindings by modal scripts that temporarily
overwrite keybindings, like console and stats. These have section
input_forced_$scriptName. Unfortunately this skips all keybindings added
with mp.add_forced_key_binding even if you may want to show them.

Also skip the OSC sections "input" and "window-controls"; these sections
are not called input_forced_osc because the OSC uses
mp.enable_key_bindings() directly instead of mp.add_key_binding().

This mainly benefits the shortcuts in the context menu that the next
commit will add, but is also useful select/select-binding.
2026-01-25 20:56:42 +01:00
Guido Cella df7ac1d931 command: add the default-menu property
This property contains the builtin etc/menu.conf, and will be used by
select.lua. It is undocumented because it is for internal usage.
2026-01-25 20:56:42 +01:00
Guido Cella 19adc2d509 menu.conf: add this file
Add a default context menu definition in etc/menu.conf. It will be used
to populate the context menu.

The format is meant to be easily readable with just tabs as separators
and submenus denoted by indentation. It avoids complicating the builtin
input.conf like similar scripts do.

By not defining the shortcut keys in the builtin input.conf, menu
entries won't be associated to wrong shortcuts when the user's
input.conf changes key bindings without redefining the menu. Note that
external scripts don't have this issue.

I used 3+ spaces as separators at first but then realized that since we
have Windows users tabs will look better in editors with proportional
fonts like notepad, though it still won't be perfectly aligned depending
on the font. But I am still not sure what is better.

On a curious note, etc/menu.conf already existed in the past as mplayer
used to have a menu. git log -p etc/menu.conf will show commits from
2002 to 2011.
2026-01-25 20:56:42 +01:00
Guido Cella 7e38052138 input.conf: format some commands more consistently
The formatting of input.conf commands is totally inconsistent. At least
for the commands that will be used in the context menu, make it
consistent. The next commit will define the context menu commands, and
the keys bound to these commands will be shown in the menu only when
they match exactly, so this avoids copy pasting commands with
inconsistent formatting just to make them match.
2026-01-25 20:56:42 +01:00
Kacper Michajłow 6136c01f95 win32/menu: add mnemonic v for mpv sub-menu
`m` is taken by `Move`, use `v` as it's closer to alt+space than `p`.
2026-01-25 15:39:20 +01:00
Guido Cella e99a9168c1 context_menu.lua: implement key hints
When a character in an item's title is preceded by &, underline it and
activate the item when pressing the character.

Cycling between multiple items with the same hint is not supported.

&& escapes & so it works like the Windows context menu.

Hints after &&&, or greater odd numbers of &, are not supported since
Lua patterns don't support {n,m} quantifiers.
2026-01-25 05:21:49 +01:00
Kacper Michajłow dc5145c01d win32/menu: resolve system menu identity crisis
Don't reset system menu state, when menu data is empty, just disable the
items as needed. Fixes erratic behavior of system menu.

Fixes: 861908c70f
Fixes: #17290
2026-01-24 15:55:07 +01:00
Kacper Michajłow 3c09473327 Revert "ci/win32: manually install cmake to fix cpu detection issue"
No longer needed, upstream images has been fixed already.

This reverts commit e612f419f3.
2026-01-24 15:29:17 +01:00
Kacper Michajłow b5abb065a2 wayland_common: remove pl_color_space_infer
Common layer should alter target params anymore, it's on specific VO to
set correct params. Also this should be noop anyway, after
dmabuf_wayland fix in previous commits.
2026-01-24 14:08:08 +01:00
Kacper Michajłow 43824e793b mp_image: call pl_color_space_infer in guess_csp
This will do a little bit more than only setting max_luma. Also will
fallback to bt.709/bt.1886, but that's fine. We would do it anyway
later.

If params goes through guess_csp, they shouldn't have "unknown" fields
anymore.
2026-01-24 14:08:08 +01:00
Kacper Michajłow 9dd598def8 vo_dmabuf_wayland: ensure target params consistency 2026-01-24 14:08:08 +01:00
Filip Hejsek ed83c7c51e select.lua: add dvb_subtitle to the list of image subtitle codecs 2026-01-24 14:07:37 +01:00
Kacper Michajłow 9c6a3c06ec vo_kitty: add missing sequence end on unint
Fixes: #16299
2026-01-24 09:09:44 +01:00
Filip Hejsek 5d6f31f0a8 DOCS/man/options: fix typos and grammar errors 2026-01-24 08:02:28 +01:00
Steve Williams 16d9e12f37 wayland: add identity-rgb format mappings in color-representation 2026-01-24 08:00:07 +01:00
Filip Hejsek 7298ce13b0 test/samples: use mpeg2 codec for video samples
In CI, ffmpeg chooses vp9 by default, which cannot be muxed into mpegts.
2026-01-24 07:54:46 +01:00
Filip Hejsek c2882c3d81 player/loadfile: never autoselect tracks with wrong PID
Currently, we prefer selecting a track that matches the video program
ID, but can fall back on a track with a different program ID when there
is no such track or when no such track matches subs-fallback criteria.

Change this to instead select no track when only tracks with wrong PID
are available. Program ID will now act as a filter, not as a preference,
and only files with either matching or unset PID will be considered for
autoselect.

Also, ignore the program ID of external tracks, as it doesn't make much
sense to compare PIDs from different files.
2026-01-24 07:54:46 +01:00
Filip Hejsek 3e12e6fcff test/libmpv_test_track_selection: add a program ID matching test 2026-01-24 07:54:46 +01:00
Filip Hejsek bdbe40765a test/libmpv_test_track_selection: add a more complex locale test
The purpose of this test is mostly to verify that matching the OS
language is not wrongly prioritized over other things (like the forced
flag, matching the audio language, etc).
2026-01-24 07:54:46 +01:00
Filip Hejsek 79e87fa62d test/libmpv_test_track_selection: add a locale test with forced tracks
This is a copy of the existing locale test, but with forced flag added
to all tracks. The forced flag should not affect language selection in
this case.
2026-01-24 07:54:46 +01:00
Filip Hejsek 8aca078f09 test/libmpv_test_track_selection: add additional multilang test case
The new test case exercises --subs-fallback-forced=always and verifies
that default+forced is preferred over forced.
2026-01-24 07:54:46 +01:00
Filip Hejsek 6bae2c0f53 player/loadfile: simplify how external tracks are excluded
When autoload-files=no, external files are never selected. Simplify the
logic by excluding them up front instead of removing them afterwards.

This doesn't change the outcome of track selection, apart from edge
cases that are already broken because compare_track is not transitive.
2026-01-24 07:54:46 +01:00
Filip Hejsek a6cb319611 player/loadfile: simplify track selection logic
This fixes the problem that a subtitle track that normally wouldn't be
selected if it were the only track available could end up being selected
after a different candidate track was selected first.
2026-01-24 07:54:46 +01:00
Filip Hejsek 82dce233bc player/loadfile: clean up track comparison logic
This brings compare_track closer to implementing a consistent linear
order and fixes many broken edge cases.
2026-01-24 07:54:46 +01:00
Filip Hejsek 8d5fcade02 player/loadfile: remove forced param from compare_track
Use track->forced_select instead. The value would be assigned there
anyway after the track is selected and the field is not used for any
other purpose.
2026-01-24 07:54:46 +01:00
Dudemanguy 731450f883 opengl/context: remove unneeded ra_swapchain_fns redirection
We don't allow backends to override this anymore since
5ae0e0ff9a so we can just set it directly
in ra_swapchain.
2026-01-23 17:04:04 +00:00
Dudemanguy f74adc4243 opengl/context: require swap_buffers param for FenceSync
Commits 8854c74271 and
5ae0e0ff9a eliminated the external
swapchain API that the render backend (vo_libmpv) was previously using.
However, it was missed that this was being used to skip the
gl->FenceSync calls and that logic change was not properly accounted
for. This meant that vo_libmpv would leak fences since
ra_gl_ctx_swap_buffers is never called to clean them up.

Fix this by making sure the ra_ctx_params have swap_buffers defined
before calling gl->FenceSync. All platforms are required to implement
this anyway with the exception of vo_libmpv since it's a funny special
case. Fixes #17217.
2026-01-23 17:04:04 +00:00
Guido Cella dd50a4748e DOCS/man/commands: update an example
Use the new script name instead of relying on the backwards
compatibility script message.
2026-01-23 12:21:11 +01:00
Guido CellaandCogentRedTester cc1e654286 DOCS/man/lua: suggest keep_open for nested mp.input calls
Before 17551b2d43 keep_open was needed to make nested mp.input calls.
Even after that change it is still better to pass it to not show the
console quickly closing and reopening to the user, so recommend it.

Co-authored-by: CogentRedTester <cogent.redtester@outlook.com>
2026-01-23 10:15:04 +01:00
Kacper Michajłow 32a164cc01 DOCS/man/mpv: reference low-latency profile in network example
It makes more sense in this context, than `fast` profile.
2026-01-23 05:18:14 +01:00
Kacper Michajłow 11b2004b91 vo_gpu{,_next}: fix overriding scaling parameters for inherited kernels
If `{d,c}scale` is not specified the scaling kernel is inherited from
`scale`. This made all `{c,d}scale-*` options not work, as they were
silently ignored.

This commits inherits scale options, only if `{c,d}scale` options were
not adjusted in the config.
2026-01-23 05:18:14 +01:00
der richter df51d5500e ci/mac: install ffmpeg-full with homebrew when available
homebrew slimmed down their ffmpeg formula and stripping it off some
essential functionality.
https://github.com/Homebrew/homebrew-core/pull/261303

use ffmpeg-full instead. this is keg only formula and not automatically
symlinked system wide. make sure ffmpeg is not installed in parallel and
install ffmpeg-full system wide.
2026-01-22 09:43:45 +01:00
Kacper Michajłow 6e54aa328d builtin.conf: enable antiringing in high quality profile
General consensus is that ortho scalers antiring while fast is not that
good, let's use it in high-quality profile only.
2026-01-22 00:10:48 +01:00
Guido Cella 7858e1fdaf command: remember the language when reloading tracks
In 5871ba8f3e I took the language from the filename when reloading
tracks noting "that backing up t->lang and restoring it if nt->lang is
NULL would work incorrectly when lang is in the stream and it is removed
before reloading", but actually external tracks don't have language in
the stream, it is set in the container, and reload commands only affect
external tracks. So just back up the language before reloading and then
restore the old language.

This preserves the language after reloading when it is not in the
filename but it was specified manually in an add command, e.g. sub-add
foo.srt '' '' en.

Hearing impaired, forced and default flags were already being set from
their values from before reloading the track, so setting them again from
the filename only caused the same issue that they would get unset if
they were manually added with add commands.

We still don't restore the old language if nt->lang is already set for
the edge case of doing something like sub-add foo.mkv and changing the
foo.mkv's sub track language before reloading.
2026-01-22 00:10:02 +01:00
Guido Cella 2c893e8f30 command: set the language of added tracks from the filename
If you do sub-add foo.en.srt, it doesn't set lang=en.

Fix this by extracting the language from the filename, along with
hearing impaired, forced and default flags.

If a language is explicitly passed to sub-add and related commands, that
takes priority.
2026-01-22 00:10:02 +01:00
Guido Cella 1da08fa332 DOCS/man/options: document that --script is not limited to Lua 2026-01-22 00:08:53 +01:00
CogentRedTester 2aa727bc3d mp.input: send buffer ids with logs to avoid race conditions
This commit modifies the log methods in mp.input to always send the id
of the latest `input.get()` request with log entries.

Previously, the log methods applied to whichever input request happened
to be open when the log message was received. Even when scripts used
these methods correctly, there was the risk of sending a log to the
wrong log buffer if the active input request changed while the log
message was in transit; a race condition.

Now the id of the latest `input.get()` request is sent alongside the log
messages, preventing data races between scripts while also preventing
those logs from being discarded.
2026-01-22 00:04:35 +01:00
CogentRedTester 3ed9b798bb mp.input: avoid rare race condition when supplying completions
It was previously possible for completion messages to be received by a
new input request, if one was created while the message was in transit.

Since it is trivial to avoid this by passing the script name and
existing handle_id value, we may as well do so and guarantee that there
will not be any data races.
2026-01-22 00:04:35 +01:00
CogentRedTester 5d469e6bf5 mp.input: remove race conditions when calling input.terminate()
This commit ensures that `input.terminate()` can only close input
requests made by the same script, and prevents any in-transit events
for old input requests from being processed.

Previously, there was no way to guarantee that the input request being
terminated was the one intended; the asynchronous nature of the API
meant that it was always possible (though unlikely) that another client
may have activated its own input request while the termination request
was in transit.
This commit removes the race condition between different scripts calling
`input.terminate()` by sending the script name alongside the termination
message.

In addition, when a script overwrites one of its own input requests,
there may be incoming events still in transit. Some of these events may
have a decent chance of calling `input.terminate()` if they are
processed (e.g., `submit`). This commit avoids this issue by only
processing `closed` requests once a new `input.get()` request is made.
2026-01-22 00:04:35 +01:00
CogentRedTester 17551b2d43 mp.input: use unique event handlers for input.get requests
This makes changes to mp.input and console.lua so that every input.get
request uses a unique script-message to handle input events.

Previously, making new input.get requests shortly after the termination
of a previous request made by the same script could cause a race
condition where the input handler was closed but the new request
was still being drawn in the UI. This was caused by the `closed` event
for the previous request being received only after the new request was
registered, hence closing the event handler for the new request instead.

In addition, this commit makes the behaviour of calling input.get while
another request is active more consistent. When a new request is
received it overwrites the in-progress request, sending a `closed`
event. However, previously, the `closed` event could not be sent if both
requests came from the same script, as the new request would have
overwritten the event handler. Now, the `closed` event is called
regardless of where the new request comes from.
2026-01-22 00:04:35 +01:00
Dudemanguy 49b6d80e87 player/loadfile: possibly do a reset of sd_ass when turning on video
It's a pretty niche case, but if you start a file with no video with
animated ass subtitles and then turned on the video later, the subtitles
would not actually be rendered animated. This because the subtitles were
already decoded, and we do not do a check for animations expect in the
specific case of an image being played back on the video since the check
can be quite expensive. To fix this edge case, we just need to reset the
ass before doing the track switch in the case where we go from no video
to a track that's an image. SD_CTRL_RESET_SOFT is added as a a sub_ctrl
to accomplish this. Fixes #17268.
2026-01-21 15:18:08 +00:00
Dudemanguy fdb996adbc sd_ass: clear num_packets_animated on every reset
This should be done otherwise it could technically increment forever if
you constant reset.
2026-01-21 15:18:08 +00:00
Mohammad AlSaleh 313beaf241 player: make effective image_display_duration playback_speed aware
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2026-01-21 11:40:20 +01:00
Guido Cella 833e2f254e select.lua: link to mpv's IRC channel in the menu
Add a menu entry that opens mpv's IRC channel so users can quickly ask
support questions.
2026-01-21 11:27:07 +01:00
llyyr 491802918e f_auto_filters: rework --deinterlace=auto option
Before this commit, deinterlace=auto and deinterlace=yes had the same
exact behavior for d3d11 and vaapi, the only difference being that
`auto` would create/destroy the deinterlacing filter on every frame that
changed the deinterlace flag and with `yes`, we left that the
responsibility to determine whether to deinterlace or not to d3d11vpp
and vavpp and the filters were always inserted.

Inserting and removing filters on every frame the interlaced flag changes
is expensive and it will be more efficient to let the deinterlacing
filters handle this distinction instead.

With this change, `yes` works as it should: the filter is inserted
always and deinterlacing is forced regardless of the frame flag. `auto`
will insert the deinterlacing filter only when mpv sees the first
interlaced frame, and the filter will only deinterlace the frames marked
as interlaced. Note that perfect detection of interlaced frames is not
possible, and in such cases the user has to set `yes` manually.

One downside of this change is that we don't know if the filter is
actually deinterlacing or not, we can only guess that if the filter is
inserted and the frame is interlaced then it should be deinterlacing.
It's possible for it to fail for whatever reason, and it's also possible
future changes to ffmpeg (since bwdif implementation lives in ffmpeg),
might make the logic more complicated than this check. However, for now
this is good enough.
2026-01-21 08:40:50 +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
Eugene Noble 868b9aa3ca DOCS/man/libmpv: fix typo 2026-01-21 03:54:27 +01:00
nanahi d6e7fb0597 options/options: add several audio extentions
mp1 - MPEG-1 Audio Layer I
mp2 - MPEG-1 Audio Layer II
mpc - Musepack
tak - Tom's lossless Audio Kompressor
tta - The True Audio
2026-01-20 07:49:17 +01:00
nanahi be5ed3bfd1 vo: wake up core when VO requests redraw
a74a324b98 returned responsibility of video
redraw back to playloop. The playloop is only run if something wakes up
the core.

However, the logic for VO requested redraw only wakes up the core when
in->want_redraw is false, which is only resetted by vo_redraw, called
from the core. This creates a situation where it can never wake up the
core, so redrawing never happens even when VO requests it.

efc44d05ff caused the issue to surface
because it also throttles VO requested redraws, and in some cases results
in the above behavior.

Fix this by always waking up core when the VO requests redraw.
2026-01-20 07:28:55 +01:00
llyyr b7e8fe949d wayland: move info_done variable to vo_wayland
vo_wayland_preferred_description_info is destroyed after info_done, so
obviously we can't store it here. This causes a use-after-free.
Embarrassing mistake

Fixes: 7a7d871d0a
2026-01-18 16:11:37 +00:00
Kacper Michajłow 5f6d5b3b7e ci/msys2: add build with -ftrivial-auto-var-init
Just to catch uninitialized variables early. Build all three                                                                                          unint/zero/pattern to compare the results between them and we don't                                                                                   accidentally depend on implicit initialization in tests.
2026-01-18 12:59:16 +01:00
Kacper Michajłow 5fbd1caee2 ci/msys2: build also clang64 without ASAN
To cross compare results on basic build.
2026-01-18 12:59:16 +01:00
Kacper Michajłow 1db89a546a Revert "ci/build-msys2.sh: disable pdf-build for clangarm64"
This reverts commit 25aa402f1d.
2026-01-18 12:59:16 +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
Dudemanguy 468d34c9bd vo: allow VOs to request waiting before advancing frames
This is essentially for vo_dmabuf_wayland, but there is a race condition
during initialization where we should wait on an event from the
compositor to set the appropriate description for the image (namely for
color management) before flipping the page. Previously, there was an
off-by-one frame difference which resulted in the initial frame not
being appropriately color managed. Fix this by telling the core render
loop that it is not ready for the next frame. This keeps the frame queue
from advancing and allows the backend to process events appropriately
until it signals that it is ready.
2026-01-17 04:58:17 +00:00
Simonas Kazlauskas 1af136bceb ao_pipewire: remove the node.always-process attribute
With `node.always-process` mpv will force pipewire to continuously keep
driving the source node, even when paused, which causes a relatively
significant increase in power consumption due to frequent CPU wakeups.

I have tested mpv with this option disabled, both for music and video,
pausing and seeking around in various ways and could not notice any
problems with this option disabled. And with it disabled pipewire
properly becomes idle a couple seconds after video/audio is paused.

Pipewire documentation suggests that this option is largely useful for
JACK clients, which `mpv` isn't. Using GitHub-wide search it seems like
the other two notable uses of this property are really just SDL and
OpenAL. All other applications I use work well without this property
being set as well.

Note that this change does not affect the output devices differently as
far as I can tell. Both with and without `always-process` pipewire will
suspend the output device after some idle time and in case
`always-process` is enabled, it will redirect `mpv` to `Dummy-Driver`
instead.
2026-01-17 04:55:01 +00:00
fkroener 00774f5b85 DOCS/man/options: fix typo (double "for") 2026-01-16 00:49:36 +01:00
Hubert Głuchowski fa44f67b0b sub/sd_sbr: pass track language to sbr_load_text
The language hint is required for *correct* handling of RTL in srv3 so
provide the best-effort guess from the subtitle track.

Without this hint some RTL paragraphs are going to be wrongly assumed
LTR and reorder incorrectly. Additionally, subrandr may soon start
treating srv3 segments as `inline-block`s which means guessing is not
going to be possible anymore (at least as part of unicode bidi algorithm).
2026-01-16 00:48:55 +01:00
llyyr 7a7d871d0a wayland: move image description info to separate queue
Helps with presentation when compositor tries to ddos applications, for
example when moving the brightness slider on Kwin.
2026-01-15 17:03:18 +00:00
Hubert Głuchowski 2007f5543c sub/sd_sbr: use instanced rendering to avoid blending in software
The instanced API allows a lot of work to be offloaded to the GPU and
makes software rasterization tolerable performance-wise in most cases.

This is similar to sd_ass but there are some substantial differences:
- It uses a BGRA atlas to allow drawing bitmap emoji.
- De-duplicates images internally to significantly reduce atlas size by
  reusing the same atlas image for different instances.
- Exploits bilinear interpolation to further reduce atlas size of some
  primitives. For example this allows reducing background boxes to one
  very stretched pixel.

Bumps subrandr requirement to `v1.1` since this API is not present in
earlier versions.
2026-01-14 01:56:18 +01:00
Hubert Głuchowski 0babb5778b sub/ass_mp: split out packer into a separate file 2026-01-14 01:56:18 +01:00
Dudemanguy 7ce58f7a07 DOCS/contribute.md: address the AI menace
It's the future and well contributions of this nature aren't going to
disappear. Might as well address it in the contribute.md hope that maybe
a would-be vibe coder out there does a slightly better job before
sending anything our way.
2026-01-13 17:00:17 +01:00
Guido Cella bbcd68f8ed demux_playlist: expand tilde placeholders in playlist files
This allows playing something like an m3u containing ~/foo.mp4 or
~~/foo.mp4.

URLs like memory://#EXTM3U\n~/foo.mp4 also work.
2026-01-12 15:10:37 +00:00
Guido Cella 8bbcdec992 Revert "{osc,select}.lua: show playlist entries with trailing /"
This reverts commit ee05804bfa. Only the
select.lua part since osc.lua list formatting was removed.

Since playlist/N/filename is now normalized, it is never going to have
trailing slashes so there is no need to strip them.
2026-01-12 15:10:37 +00:00
Guido Cella fc86b96a8a various: don't normalize playlist filenames again
Since the previous commit normalized playlist filenames when they are
stored, the code normalizing them can be simplified back to how it was
before implementing normalization.
2026-01-12 15:10:37 +00:00
Guido Cella dfb4164097 common/playlist: store normalized playlist filenames
This normalizes the playlist/N/filename sub-property, making it
consistent with path. As a consequence playlist-path and stream-path are
also normalized.

This will allow simplifying the code by not normalizing playlist
filenames in several places, similar to 23b57e9f7f for tracks.
2026-01-12 15:10:37 +00:00
Guido Cella 616149744a misc/path_utils: ensure mp_normalize_path never returns NULL
If the current working directory or the realpath could not be retrieved,
return the path as it was passed to mp_normalize_path() to avoid
guarding the return value. This is also makes it consistent with what
the Windows code was doing.
2026-01-12 15:10:37 +00:00
Guido Cella 2871471f31 demux_playlist: add base paths when adding playlist entries
Currently entries in playlist files like m3u are first added to the
playlist, and then if they were relative paths the playlist file's
dirname is prepended to them.

Change it to directly add entries with the correct path. This will be
needed to normalize playlist entries as soon as they are added, else
normalization would prepend the working directory to entries with
relative paths.

demux_cue, demux_edl and demux_mkv_timeline don't need to be modified to
work with the next commit.
2026-01-12 15:10:37 +00:00
llyyr 363341afea vo: don't set request_redraw on redraw path
We need to acquire in->lock first before setting this flag, but if we
take this path then request_redraw is true already. So fix the data race
by just not re-setting the value.

This fixes data race detected with checking in->request_redraw value in
vo_redraw detected with TSAN
2026-01-12 09:15:45 +01:00
Brad Barden 39d7bbe2bf video/out/drm_common: fix uninitialized var
Add a missing variable initialization. The variable is only conditionally set
later. Then there is a check for a NULL if no CTA block was found, but the
value is instead uninitialized memory. There would then be a segfault when the
pointer is de-referenced.
2026-01-11 18:30:03 -06:00
der richter beddaec5ab mac/view: make our view aware of possible transparent rendering
the default value of isOpaque is false and it was always assumed that
underlaying content needs to be rendered and blended in some way.

make it dependent on the layer's isOpaque property, which theoretically
could increase render performance.
2026-01-11 13:48:58 +01:00
der richter ce694c1eba mac/common: add support for transparent rendering
this adds support for possible transparent rendering by setting the
window and layer background to transparent.

NOTE: atm only possible with libplacebo master.
2026-01-11 13:48:58 +01:00
der richter 9aebe4cb01 mac/vulkan: force proper opaque state on metal layer
MoltenVK sets this to false even when no transparent content is
rendered. this prevents direct-to-display rendering from working.
2026-01-11 13:48:58 +01:00
Kacper Michajłow 9483d6e12f ci: cancel pr jobs after new push
github.head_ref is only defined for pull_request event, so only those
will be grouped, the rest will fallback to unique run_id, so we neither
cancel them or serialize.
2026-01-10 02:48:15 +01:00
Dudemanguy 11c020f526 player/command: refactor loadfile and loadlist commands to use flags
We should have done this ages ago. These commands essentially consist of
a combination of a load action and whether or not playback should be
started. The old `-play` aliases are kept for backwards compatibility.
2026-01-10 01:00:58 +00:00
Kacper Michajłow 3d980d8ecc w32_common: release all input when entering context menu 2026-01-09 20:16:23 +01:00
Kacper Michajłow 2b50cecf86 w32_common: defer context menu update to WM_INITMENU
This avoids issues when menu-data property is updated while context menu
is open.
2026-01-09 20:15:48 +01:00
llyyr 9229d52e75 vo_gpu_next: undo dither-depth=auto meaning 8bpc for SDR when undetected
This commit effectively reverts f914947dda

We don't need this hack anymore
2026-01-09 20:05:37 +01:00
llyyr 81687dbf27 video/out/vulkan/context_wayland: implement color_depth
In f914947dda we implemented a hack to
force 8bpc dithering for SDR playback, because at the time nothing in
the pipeline was doing dithering. mpv would pick 16bpc swapchain, dither
down to 16bpc, then it'd be presented to the user's display as-is and
result in banding. There is no way to detect the real on-the-wire bpc,
so we told users to configure dither-depth manually.

However, it seems most compositors that do color management now handle
10-16bpc input just fine without any banding, so instead implement
color_depth to effectively set dither-depth=auto for compositors that
support expose color_manager and keep the 8bpc hard default for others.

Fixes: https://github.com/mpv-player/mpv/issues/17222
2026-01-09 20:05:37 +01:00
Guido Cella 85bf9f4ff4 console.lua: only clip items between UTF-8 characters
Since with the new horizontal scrolling the end of lines can be visible,
ensure not to clip lines in the middle of UTF-8 characters to not show
mojibake, also adding … to show when items are clipped.

Also replace the existing use of ⋯  with …
2026-01-07 01:09:00 +01:00
Guido Cella a385c0635b console.lua: implement horizontal scroll
Bind Shift+LEFT, Shift+RIGHT, Shift+WHEEL_DOWN, Shift+WHEEL_UP,
WHEEL_LEFT, WHEEL_RIGHT to scroll the menu horizontally.

This lets you see long items that get clipped, like long history entries
and key bindings.
2026-01-07 01:09:00 +01:00
Guido Cella 86466b5745 console.lua: bind Shift+UP and DOWN to scroll the log
We don't know how many log lines wrap, so scrolling the log with page up
and down with wrapped lines would skip lines, and those are also already
bound to history navigation.

This therefore only implements scrolling of one item at a time. While
not perfect because when the item is wrapped it scrolls multiple lines,
it is usable.

The number of log lines kept in memory is increased from 100 to 10000.

Closes https://github.com/mpv-player/mpv/discussions/14718.
2026-01-07 01:08:00 +01:00
verygoodlee 3315ef8f32 console.lua: avoid empty lines at the bottom after resizing window
with `scale_with_window=no` script option, `first_match_to_print`
increases when shrinking the window and no longer decreases when
expanding the window, causing empty lines at the bottom of menu
and a chain reaction of the script crashing due to the mouse wheel
scrolling up.

this commit trys to decrease `first_match_to_print` when its value
is abnormal.

Closes #16682
2026-01-07 01:01:39 +01:00
nanahi 39e5d29879 player/playloop: handle force window in playloop
813c112329 moved force window to option
callback. This happens before the loading of the file has finished
(which is supposed to trigger handle_force_window) so it is too early to
handle certain cases, such as loading of album art failed and therefore
window will never be created because there is no video track.

Adding force window check in playloop to make sure window is always
initialized after file loading is complete.

Fixes: 813c112329
2026-01-07 01:01:11 +01:00
Kacper Michajłow e75a174743 ci/win32: add subrandr
Wrap subrandr build process into meson custom target.

Meson's custom target allow only file output (without path component),
so additionall copy step is added to get the library. Dummy stamp file
is used to connect custom target to dependency, the file is actually not
created, so target will be called each time, but it's fine, because
cargo will resolve it's own dependencies this way and build if needed.

This is glued only for static lib, this is what we need for our CI
script.
2026-01-06 13:58:11 +01:00
Kacper Michajłow 273f1db49e player/loadfile: indent file metadata if it is multiline
And sanitize a bit.
2026-01-06 13:57:21 +01:00
Kacper Michajłow 6c160f1aa8 common/msg: allow only SGR sequence in terminal output
Sanitize the remaining control codes to mitigate malicious files or
scripts that could manipulate the terminal in unintended ways, such as
clearing the screen or changing the terminal title. While the
surface-level impact may seem minimal, control codes can be a vector for
exploiting vulnerabilities in the terminal emulator itself. This can
occur without user interaction, since file tags are displayed by default
in mpv.

Reported by: zefr0x
2026-01-06 13:57:21 +01:00
der richter c63fe8ab95 ci/mac: remove unneeded FFMPEG_SYSROOT pkg-config path
this seems to be a remnant of the very old travis build.
see 56d31ae190
2026-01-06 11:37:14 +01:00
der richter aa0f4e32ba ci/mac: add homebrew libarchive pkg-config path to PKG_CONFIG_PATH
libarchive can't be linked globally because macOS already has an old
outdated version installed.
2026-01-06 11:37:14 +01:00
der richter 5bee8f0f7f ci/mac: add missing libraries for consistency with other platforms
add libbluray, libarchive, libcaca, libcdio-paranoia, libdvdnav,
rubberband and zimg to macOS builds for consistency with other platforms
and detection tests.
2026-01-06 11:37:14 +01:00
der richter b38d22efa8 github/issue_template: add IDs to textarea fields for URL queries
adding IDs to the fields makes them pre-fillable with a URL query.

adds the possibility to procedural generate links to pre-fill specific
data. for example, mpv/library version or platform version data.

possible application, menu entries or CLI output to submit bug reports.
2026-01-06 11:34:16 +01:00
llyyr 0035bb7cbd path-unix: check fopen value, and also call fclose 2026-01-04 21:50:04 +01:00
nanahi a3350e2fbb command: add libplacebo-version property
Similar to other core library dependencies.
2026-01-02 20:04:32 +01:00
Kacper Michajłow 72efbfd009 version.h.in: bump copyright year 2026-01-01 13:26:59 +01:00
Kacper Michajłow f57c5ca422 ci/win32: upload pdb separately
The job id is now in the artifact filename, so we can identify the
matching pdb file.
2025-12-31 02:04:15 +01:00
Kacper Michajłow afa090317b ci: make artifact names more descriptive
Add git hash, job id and avoid double zipping.
2025-12-31 02:04:15 +01:00
Guido Cella 5cc1094ad6 console.lua: remove selected_color and selected_back_color
42660a8c23 renamed selected_color and selected_back_color to
focused_color and focused_back_color. The new names have been in a
release so remove the backwards compatibility check.
2025-12-30 17:03:48 +01:00
m154k1 468e2a8475 vulkan/context: add driver name to --vulkan-device=help
Some platforms (like macOS) may have multiple Vulkan drivers installed,
so the device list can contain devices with the same name.
Adding driver name to the list of devices can help with identification.
2025-12-29 11:24:36 +01:00
Attila Fidan 4ecf7293f5 playloop: unset last_chapter_flag when queueing non-chapter seeks
This fixes a race condition where if a non-chapter seek is queued
immediately after a chapter seek is queued, the chapter property may
become unavailable until a new file is loaded.

If multiple seeks are queued within the same playloop iteration, only
the last seek is executed. Because the chapter seek is never executed,
last_chapter_flag remains set and last_chapter_seek becomes -2, which
causes get_current_chapter to return -2, which makes the chapter
property unavailable.

Unset this (and also last_chapter_seek) immediately rather than
wait for seek execution, like chapter seeks set these immediately.

Fixes: 233f1e46f6 ("playloop: make chapter property more accurate when seeking chapters")
2025-12-28 11:04:47 +01:00
nanahi 4bbf014f09 sub/draw_bmp: fix rgba alpha blending
Wrong formula was used due to copypasting draw_ass_rgba code.

Fixes: c1a961ad78
2025-12-28 11:02:17 +01:00
nanahi a58dd8ac41 video/out/opengl/context_wayland: cleanup vo when egl fails to init
When the "new" API for OpenGL VO backends was created 10 years ago in
df97c30e0e, it was expected that any
"driver" that fails to init to clean up themselves (the "old" API always
called mpgl_uninit() to clean up on failure).

However, when switching Wayland to the "new" API, this was forgotten.
Wayland VO will never be cleaned up when EGL init fails.

With commit a310a65d35, this issue was
exposed when a leftover Wayland context pointer, which results from a
successful Wayland context init but with failed EGL init, triggers an
assertion in the X11 context init code, which expects the pointer to be
NULL.

Fix this by uninit Wayland context when EGL init fails.

Fixes: bd87598af9
2025-12-27 19:53:29 +01:00
Guido Cella d15f34b24e select.lua: preserve empty LRC lines
Subtitle extraction preserves empty lines in LRC subtitles because they
are useful for separating verses and choruses. 036fae317c changed their
sub codec from subrip to text, so update select.lua accordingly.
2025-12-27 15:42:16 +01:00
Guido Cella 52f2c670d5 console.lua: don't error if compute_bounds doesn't return dimensions
compute_bounds doesn't return any field if the rectangle is empty: its
docs say "If set to true, attempt to determine bounds and write them to
the command's result value as x0, x1, y0, y1 rectangle (default:
false). If the rectangle is empty, not known, or somehow degenerate, it
is not set.". So shrinking mpv as much as possible with a menu open
caused a crash.

This doesn't happen on Xorg because of these lines in video/out/x11_common.c:

// Set minimum height/width to 4 to avoid off-by-one errors.
hint->flags |= PMinSize;
hint->min_width = hint->min_height = 4;

nor on macOS because of

minSize = NSSize(width: 160, height: 90)

in video/out/mac/window.swift.

But this is needed on Wayland and Windows.

Fixes #16682 along with the diff posted there.
2025-12-27 15:41:44 +01:00
llyyr c66204b69b screenshot: correctly detect hardware frame
This only ever worked by accident and relied on broken behavior that was
fixed by 9b1d47ece1
2025-12-27 15:41:24 +01:00
Kacper Michajłow c0d989c839 sub/sd_sbr: check runtime version 2025-12-24 19:01:40 +01:00
Kacper Michajłow 5c80b876db ci/msys2: enable subrandr on clang64
Implib issue has been fixed upstream.

See: https://github.com/afishhh/subrandr/commit/d26a1536bd15fb2c3dbf7866b855fe674a7363bb
2025-12-24 13:38:38 +01:00
Hubert Głuchowski 75bb651945 sub/sd_sbr: respect sub-use-margins 2025-12-24 07:00:07 +01:00
Kacper Michajłow 6dff941c71 ci/{win32,mingw64,msys2}: add amf-headers 2025-12-23 07:06:34 +01:00
Kacper Michajłow cb1b6a54f2 video/filter/vf_amf: add AMD Frame Rate Conversion filter
D3D11 only for now. Documentation says that only D3D11 and D3D12 is
supported, but it looks like Vulkan is possible too. But I realized this
after implementing this version. Vulan may be added later.

Fixes: #16613
2025-12-23 07:06:34 +01:00
Kacper Michajłow e72807e7a0 mp_image_pool: set D3D11 BindFlags for all hw frame pools
It's always needed, not only in d3d11vpp.
2025-12-23 07:06:34 +01:00
Hubert Głuchowski 2ed355f51f demux/demux_sbr: re-emit packet after seek 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 8ad5066e43 sub/sd_sbr: mark subtitle packets as animated 2025-12-23 07:01:29 +01:00
Hubert Głuchowski b6d7f4e793 sub/sd_sbr: add logging callback 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 111233dbf2 ci: build with subrandr on Linux 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 454573bc08 ci: build with subrandr on mingw64 and msys2 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 4921c61bff sub/sd_sbr: log errors from subrandr functions 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 2b78ac44a9 demux/demux_sbr: allow configuring probe size 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 557e592511 ytdl_hook: recognize srv3 subtitle format if subrandr is present
This allows YouTube videos played directly from a URL to make use of
subrandr's SRV3 support if it is allowed by an overriden `sub-format`.
2025-12-23 07:01:29 +01:00
Hubert Głuchowski a330318592 player/command: add subrandr-version property
Allows script to detect the presence of subrandr at runtime, useful for
determining whether this mpv instance can play SRV3 subtitles.
2025-12-23 07:01:29 +01:00
Hubert Głuchowski bb97882c9a sub: add subrandr renderer support
subrandr is a subtitle rendering library which aims to render
SRV3 (YouTube) subtitles and WebVTT subtitles accurately.

Currently in mpv WebVTT subs are rendered via ffmpeg conversion to ASS
which throws away a lot of the style and completely disregards
the WebVTT non-region-cue positioning algorithm. Furthermore if
one wants to render some more complex SRV3 subtitles one has to
resort to external converters since it's not even supported by ffmpeg.

However subrandr is able to render SRV3 subtitles natively with support
for the most commonly used features. It can render ruby text without
relying on font metrics during conversion which is obviously fragile,
and it can perform correct scaling using the exact calculations used by
YouTube instead of making up ASS approximations. Similarly it follows
the WebVTT spec for the features of WebVTT that it supports (mostly).

It's not perfect of course and there's still many things it doesn't do
or does wrong but those are things that can be incrementally improved
outside of mpv.
2025-12-23 07:01:29 +01:00
der richter 3effff1c43 DOCS/man/options: update macOS requirements and remove unsupported
our minimum requirement is macOS 10.15. we can remove the mentions of
older versions and their different behaviour or feature inclusions.
2025-12-23 06:58:40 +01:00
Dudemanguy 7369b336df wayland: accept version 7 of xdg-shell
Maybe we could use the constrained states that version 7 adds, but for
now just allow binding to version 7.
2025-12-23 06:58:03 +01:00
Dudemanguy ad740caab0 wayland: accept version 2 of wl_shm
No difference for us.
2025-12-23 06:58:03 +01:00
Dudemanguy 0c44abbd67 wayland: accept version 5 of linux-dmabuf
It makes no difference for us so no reason not to accept it.
2025-12-23 06:58:03 +01:00
Dudemanguy b7ad86f120 wayland: bind to the linux-dmabuf in stable instead
It doesn't really matter, but it's probably more correct to use the
stable version.
2025-12-23 06:58:03 +01:00
Kacper Michajłow 670a266475 ci/build-linux-old: remove custom libplacebo build
Alpine 3.21 has libplacebo 6.338.2, we can use that.
2025-12-22 17:30:05 +00:00
Kacper Michajłow 604b43184f ci/linux-ffmpeg-6-1: add wayland-protocols
Bump Alpine to 3.21. It still on ffmpeg 6.1, but has newer Wayland
components that we want to test.
2025-12-22 17:30:05 +00:00
Kacper Michajłow b95846a28c meson: check wayland-scanner version
At least 1.23 is needed for 1.38 protocols. Also check other Wayland
deps to be 1.23, they are likely bundled at the same version as scanner
anyway.
2025-12-22 17:30:05 +00:00
Kacper Michajłow f011d73d5f wayland_common: suppress unused function warning on older protocols 2025-12-22 17:30:05 +00:00
Dudemanguy 4b6ebd79c8 wayland: guard wp_color_manager_v1_get_version usage
Old wayland protocol versions don't have this.

Fixes https://github.com/mpv-player/mpv-build/issues/261
2025-12-22 17:30:05 +00:00
llyyr 8ba0603ffa wayland: bump wayland-protocols minimum version to 1.38
Debian Stable has 1.44 but we're gated by Ubuntu LTS here.
2025-12-22 15:00:02 +01:00
llyyr 9adeeb02ea wayland: bump libwayland minimum version to 1.22
1.23.1 is available in Debian Stable, which was the last distro holding
us back from doing version bumps
2025-12-22 15:00:02 +01:00
Kacper Michajłow 5820906024 vo: limit manual redraws to estimated display fps 2025-12-22 11:14:58 +01:00
Kacper Michajłow c0433f064e vf_format: deprecate --vf=format=sig-peak 2025-12-22 10:19:38 +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
sfan5 d0e24ab17a Update MPV_VERSION 2025-12-21 20:14:18 +01:00
sfan5 41f6a64506 Release 0.41.0 2025-12-21 20:08:20 +01:00
llyyr 17cfad0b74 wayland: use rendering intent enum instead of magic value 2025-12-21 17:26:08 +00:00
llyyr 51ae55bdc9 wayland: support color-management-v1 version 2 2025-12-21 17:26:08 +00:00
der richter f93df58a8e osxbundle: add new macOS 26 compatible App icon
generated with the Icon Composer project:

actool ./icon.icon \
  --compile ./ \
  --app-icon icon \
  --enable-on-demand-resources NO \
  --development-region en \
  --target-device mac \
  --platform macosx \
  --include-all-app-icons \
  --minimum-deployment-target 10.15 \
  --output-partial-info-plist /dev/null \
  --standalone-icon-behavior all

actool will generate an Assets.car file which is compatible with all the
new Theme variants of macOS 26 (default, dark, monochrome, tinted, etc).
it also generates an old icns file as a fallback, only default style.

since the new Assets.car file can't be used from cocoa directly, without
using private APIs, we still use the icns file when used from CLI.
this also means that from CLI only the default icon is used and the
macOS theming doesn't have any effect.

the macOS theming mechanism only works with the bundle and a Assets.car
file. all icons are generated on the fly depending on the Theme. this
generation has no public API and the mechanism would need to be
replicated by hand. to replicate this behaviour at least three different
icns would need to be generated, tinting needs to be implemented,
several system events need to be subscribed, and this wouldn't guarantee
the same look as the system mechanism. also none of the tools make it
possible to generate macOS 26 compatible icns file, besides for the
default file, since it at least is missing the necessary padding.
2025-12-21 11:48:52 +01:00
Kacper Michajłow efc44d05ff vo: trigger manual redraws at most at slightly over display fps
This is workaround for some windowing platforms that break when they get
too many present requests.

Fixes: #17082
2025-12-21 11:30:31 +01:00
NewUserHa 08dbdd8486 DOCS/man/options: clearify that gpu-next support d3d11va and everything 2025-12-19 19:19:09 +01:00
Niklas Haas 02f47c8825 mp_image: check all components for pl_bit_encoding in mp_image_setfmt
This matches the full logic used in vo_gpu_next.
2025-12-19 18:17:46 +01:00
Kacper Michajłow a310a65d35 vo: put vo states into union
They won't be used together. Could be refactored to put them into priv,
but for now, let's avoid doing bigger refactor.
2025-12-19 18:08:20 +01:00
Kacper Michajłow 93b68d7fe2 meson: remove png icons from win32 resource depend
They are not used, everything is already packed in mpv-icon.ico.
2025-12-19 18:08:20 +01:00
Kacper Michajłow c35e10c2da vo: remove unused configs from context 2025-12-19 18:08:20 +01:00
Julian Orth ae211f7f1b wayland: convert luminance values to libplacebo space
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2025-12-19 18:08:02 +01:00
Guido Cella a58e9e596b Revert "ytdl_hook: add chapters by parsing video's description"
This reverts commit e9c43258b8.

yt-dlp implemented its own parsing to extract chapters from the
descriptions of videos without chapter markers in the player over 3
years ago in https://github.com/yt-dlp/yt-dlp/commit/0fe51254 (the PR is
even inspired by mpv). Actually it was present even earlier in
youtube-dl but was removed for unknown reasons in
https://github.com/ytdl-org/youtube-dl/commit/67299f23d8b1894120e875edf97440de87e22308.
So we can remove our parsing code, as it is dead code that never runs if
yt-dlp's JSON already contains chapters.

And it seems that such videos without chapter markers are rare or
non-existing by now anyway - we can't find any.
https://www.youtube.com/watch?v=1v_4dL8l8pQ is linked from the yt-dlp PR
with the above commit, but now yt-dlp returns the Key moments as
chapters, so it can't be used for testing.

Our parsing was actually worse than yt-dlp's, because #16085 added an
option to disable it to fix the misdetection reported in #16081, but
yt-dlp correctly returns no chapter for that video
(https://www.youtube.com/watch?v=1v_4dL8l8pQ). So this code branch was
only running for misdetections, and by removing it that option is not
needed.
2025-12-19 18:06:14 +01:00
Guido Cella acd3378c9b Revert "ytdl_hook: add option to extract chapters"
This reverts commit df1e71a7cc.

The next commit will make this unused since chapters will only be taken
from yt-dlp's JSON.
2025-12-19 18:06:14 +01:00
Kacper Michajłow 6739fd490b filters/f_decoder_wrapper: reinit decoder on audio-spdif opt change
Fixes: #17072
2025-12-18 13:07:13 +01:00
llyyr 4623a0a7e8 osc.lua: remove flags from disable_key_bindings
disable-section doesn't accept flags, and has no need for it either.

Fixes: c209d4f73b
2025-12-18 13:06:46 +01:00
Kacper Michajłow 122abdfec3 video/out/aspect: don't overflow intermediate values in scaling calc
This fixes calculation of scaling bounds with extreme video zoom levels.

Fixes: https://github.com/mpv-player/mpv/discussions/17123
2025-12-15 01:46:40 +01:00
Kacper Michajłow 5d89f15e97 video/out/gpu/hwdec: load native D3D RA hwdec drivers first
There is no reason to load EGL/VAAPI first as it would fail in default gpu
context/api anyway, on Windows.
2025-12-14 13:42:22 +01:00
llyyr f7be2ee3e9 ao_aaudio: set content type if --audio-set-media-role is enabled 2025-12-13 15:18:12 +01:00
llyyr e99daecbdb ao_audiotrack: set content type if --audio-set-media-role is enabled 2025-12-13 14:46:55 +01:00
llyyr d07e4c7935 ao_pulse: set media.role if --audio-set-media-role enabled 2025-12-13 14:46:55 +01:00
llyyr 1a802b1810 ao_pipewire: avoid setting any media.role by default
This adds option `--audio-set-media-role` to configure whether mpv
should set media roles to supported audio APIs or not. Disabled by
default.

By default, WirePlumber restores the volume of each application to
whatever the last application with the same media role used. This is
completely insane behavior, and I couldn’t find any way for a user to
opt out of it on my end. The `state-stream.lua` script responsible for
this mess only uses media.role if the property is present, so the only
reliable workaround is simply not to set one at all.

This WirePlumber behavior is inherited from PulseAudio, which also
exhibits the same behavior to this day.

This commit also mirrors the same change made to ao_pulse in 2015:
b7325b2f64

See also: https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/489
2025-12-13 14:46:55 +01:00
Kacper Michajłow 95c7599c41 ci/win32: downgrade meson to 1.9.2
1.10.0 fails to build cmake projects.

See: https://github.com/mesonbuild/meson/issues/15360
2025-12-08 22:23:08 +01:00
der richter 3c867c14c0 mac/vulkan: log opaque state (direct-to-display possible) of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know when the layer is opaque and direct-to-display is
possible.

log opaque state.
2025-12-08 19:13:32 +01:00
der richter ae746aa3a7 mac/vulkan: log display sync active state of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know when display sync is activated

log display sync active state.
2025-12-08 19:13:32 +01:00
der richter ac41d5f176 mac/vulkan: log HDR active state of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know when HDR is activated

log HDR active state.
2025-12-08 19:13:32 +01:00
der richter f2d1f2a3c4 mac/vulkan: log EDR changes of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know which EDR data is used/mapped to.

log EDR data changes to actually see which EDR data was chosen.
2025-12-08 19:13:32 +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
nanahi dbd7a905b6 clipboard-x11: request selection at init
XFixesSelectionNotifyEvent does not give an initial notification,
so initial selection needs to be requested manually.
2025-12-04 17:29:57 +01:00
nanahi 1ee207329a clipboard-x11: use separate properties to receive primary and clipboard
Fixes one of the property not being set when a client sets primary and
clipboard at the same time.
2025-12-04 17:29:57 +01:00
Kacper Michajłow 72dbcf119a ci: update some github actions 2025-11-30 17:50:10 +01:00
sfan5 3a4e0fc200 ci/mingw: update dependency versions 2025-11-30 17:21:28 +01:00
sfan5 393b3fc115 ci/mingw: use a mirror instead of ftp.gnu.org
it's apparently constantly down these days...
2025-11-30 17:21:28 +01:00
sfan5 584b368972 demux_playlist: clarify reason for HLS detection
see 0b1c3e8de2
2025-11-30 17:21:28 +01:00
sfan5 2ad27be8be demux_lavf: remove 'bin' format from blacklist
A probing function was implemented in ffmpeg 4.0:
<https://github.com/FFmpeg/FFmpeg/commit/8f6a71f7f13d21614f5140e672976e96dca04af8>
2025-11-30 17:21:28 +01:00
Guido Cella 4614dd6859 etc/mpv.conf: replace the --sharpen example
gpu-next doesn't support --sharpen and it is now the default VO, so
replace it with something that actually works.
2025-11-30 14:21:28 +01:00
nanahi 6756e86384 player/command: fix playlist-remove argument requirement
playlist-remove has a required index argument, as indicated by the
documentation. However, in 332907e1d7
MP_CMD_OPT_ARG was mistakenly added, making it optional.
The effect of not specifying the argument is defaulting the index to 0
and always removing the first element in the playlist, which is not
expected.

Fix this by making the argument required.

Fixes: 332907e1d7
2025-11-30 14:21:09 +01:00
Lynne 69e7341e8a vd_lavc: enable hwdec for DPX by default
Another Vulkan compute codec was merged in FFmpeg, for DPX.
2025-11-30 14:20:52 +01:00
Kacper Michajłow 23f9381b80 mp_image: add ycgco-{re,ro} support
Fixes: #17077
2025-11-28 18:28:06 +01:00
Kacper Michajłow 9a85ae3ee0 m_option: be more resilent to new enum additions
Unfortunately we don't have control over libplacebo and cannot
synchronize such changes, so just return `<unknown>` to be forward
compatible with any possible changed.

Note that this should be updated ASAP to support new values.
2025-11-28 18:28:06 +01:00
llyyr b6c35b55a0 player/video: only set a/v speed factor to 1 when exiting display-sync
Previously this would be called on every frame presented, this only
needs to be called if display sync was active for the last frame but
isn't active anymore.

This hid the bug mentioned in #16947 if VO was active.
2025-11-26 19:18:25 +00:00
llyyr ddd0fc0beb player/command: update speed filters for pitch-correction change too
Fixes #16947 for both audio only files as well as for files with video
which would only accidentally worked. See next commit
2025-11-26 19:18:25 +00:00
Jun Bo Bi 57d9d4eb42 ao/aaudio: implement aaudio backend for android 2025-11-25 20:29:42 +01:00
Jun Bo Bi 24000e3b3f meson: added option to disable audiotrack 2025-11-25 20:29:42 +01:00
Leo Izen 8469605191 video/image_writer: use image->params.repr to determine depth
The previous method used in 2b38b382cf doesn't properly determine the
original depth. We use image->params.repr.bits.color_depth to determine
that now.

Fixes #16398.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-11-23 18:18:36 -05:00
Guido Cella f6c116491a DOCS/man/input: don't discourage hook usage
This paragraph was added 10 years ago in f8dc5db315. Hooks are now
commonly used both in internal (ytdl_hook, auto_profiles) and external
scripts (e.g. https://github.com/mpv-player/mpv/issues?q=mp.add_hook).
They are the only way to handle events synchronously and nobody is just
going to change the API and break all scripts at this point, so remove
the warning.
2025-11-21 14:51:07 +01:00
der richter 1f4cf13e8b meson: print cocoa for feature summary
should be mentioned similar to x11 and wayland.
2025-11-21 14:50:11 +01:00
Kacper Michajłow 52525dceb8 demux: clear packet pool when upper memory limit is lowered
This clears packets from the pool, that would never be reused under new
settings. Note that depending on demuxer state this clears only unused
packets, in some cases demuxer may still hold more packets than the new
limit. Fox example demuxer doesn't forcefully clear forward cache when
reducing the size.

Also keep packet pool, even if current file is not cached, this is
useful for all sorts of things and may be useful for next file.

This act only on user options values, regardless of internal demuxer
caching state, which can vary depending on track type or source.
2025-11-20 20:35:00 +01:00
Guido Cella e6885cb926 misc/path_utils: don't normalize -
This fixes options like --audio-file=- and avoids returning $PWD/- as
path and stream-open-filename when playing from standard input.

It will also allow storing playlist filenames as normalized without
checking for - at the caller.

Fixes 23b57e9f7f.
2025-11-18 20:23:08 +00:00
llyyr accf0cc67e wayland: correct geometry handling for rotated outputs 2025-11-18 20:22:51 +00:00
llyyr 7482608939 wayland: fix condition for setting image description
We need both a color surface and parametric support to attempt to apply
image description, not either one.

Fixes: 0a32f988ba ("wayland: move initial color management setup earlier in the init")
2025-11-17 04:35:32 +00:00
Dudemanguy 0a32f988ba wayland: move initial color management setup earlier in the init
When this was originally implemented, there was a dependency on waiting
for certain events from the compositor so it was placed after the
original roundtrip. Since b3abe3975b
removed the need for most of these conditions, we can more logically
place the creation of the color_surface and color_surface_feedback
earlier in the process and leave the wl_display_roundtrip as the true
final call for the wayland init process.
2025-11-17 01:40:28 +00:00
llyyr 9379c0706d wayland: only print color repr message if we actually set anything 2025-11-16 22:50:14 +00:00
llyyr 0b2cc5a3c1 wayland: remove unused primaries/tf/luminance feature flags 2025-11-16 22:50:14 +00:00
llyyr 16b2a54776 wayland: always use get_preferred instead of get_preferred_parametric
Compositor will probably give us a parametric description anyway, but
mpv can handle icc files if it gives us one so allow compositors to give
us an icc file.
2025-11-16 22:50:14 +00:00
llyyr dff5929733 wayland: assume all image description is parametric until icc_file event
If we used get_preferred_parametric to get this image description, then
it is guaranteed to be parametric. If we used get_preferred to get this
image description, then it may or may not be parametric depending on the
compositor. If we receive an icc_file event, then the image description
is not parametric.
2025-11-16 22:50:14 +00:00
llyyr b3abe3975b wayland: remove icc feature check and simplify handling icc file
The only part of the protocol that is behind this feature is the
create_icc_creator which we don't use. We also seem to confuse the
presence of this feature to mean that the compositor will always give us
non-parametric image descriptions but these two things have no relation
with each other. Remove the feature check and use
`wl->supports_parametric` to decide if we want to use `get_preferred` or
`get_preferred_parametric` instead.

This also removes error messages for when the compositor doesn't support
parametric descriptions or when the compositor doesn't support
icc_v2_v4.

The user needs to set `icc-profile-auto` for the icc_file path to work
properly which isn't ideal but I'm not sure what to do about this and
likely won't make any big changes right before a release.
2025-11-16 22:50:14 +00:00
Kacper Michajłow 701201b13c ci/win32: bump ffmpeg to 8.0 2025-11-15 17:08:47 +01:00
Kacper Michajłow 0f5fafdaad osdep/compiler: fix typo in MP_ASSERT_UNREACHABLE 2025-11-15 01:25:37 +01:00
Kacper Michajłow 83cedd1074 meson: define WINICONV_CONST to strip const from win-iconv 2025-11-15 01:25:37 +01:00
Kacper Michajłow 4489ef54d9 ci/win32: fix aom CRT type to be consistent with the rest of the build 2025-11-15 01:25:37 +01:00
llyyr b2156c7d30 ao_wasapi_utils,command,hwdec_vulkan: remove double semicolons
Cosmetic
2025-11-14 20:44:46 +00:00
Kacper Michajłow a21e47c45d ao_pipewire: fix mapping of wide channels 2025-11-14 21:41:15 +01:00
Kacper Michajłow 867e808f6c ci/openbsd: update to 7.8
Update to cross-platform-actions 0.30.0.
2025-11-14 21:41:07 +01:00
Dudemanguy 8b3698f9fe github/workflows: fix libXpresent installation on freebsd
The x is uppercase now.
2025-11-14 21:36:58 +01:00
Thomas Lange 7815181b19 ao_pipewire: fix copy paste error in channel mapping 2025-11-13 18:57:22 +01:00
nanahi 2e5e2938dd meson.build: print drm for feature summary
Similar to X11 and Wayland, it is a platform with gpu/gpu-next support
and worths to mention.
2025-11-10 08:33:15 +01:00
Kacper Michajłow bbafb74880 vo_gpu_next: limit min_luma to 1000:1 contrast ratio in SDR mode 2025-11-07 02:42:42 +01:00
Kacper Michajłow 9b1d47ece1 mp_image: map hwdec format parameters correctly 2025-11-07 02:15:32 +01:00
der richter 28ef6b780c ci/mac: add macOS 15 intel runner
replacement for the old macOS 13 runner. the last and only intel runner.
2025-11-05 20:20:42 +01:00
der richter 1e8f0185d8 ci/mac: move our test runner to the newest macOS 26 runner 2025-11-05 20:20:42 +01:00
der richter 22bbe3b884 ci/mac: add macOS 26 runner 2025-11-05 20:20:42 +01:00
der richter 337ef24b68 ci/mac: use oldest Xcode version on oldest macOS runner 2025-11-05 20:20:42 +01:00
der richter 768db30557 ci/mac: remove deprecated macOS 13 runner
the macOS 13 runners will be removed on 4th December.
2025-11-05 20:20:42 +01:00
der richter 1b9998a620 osxbundle: make bundle category configurable and default to video
in a13a674363 we set the default category
for the bundle to games, to get certain benefits like better rendering
timing, better bluetooth latency, better threading, etc (bundle only).

though this also prevents low power modes and wrongly categories the app
for spotlight search etc.

set the default category to video and add an option to set the category
to games if one wishes to.
2025-11-05 19:23:26 +01:00
Kacper Michajłow 5b0cfe8849 ci/tumbleweed: disable sanitizers for GCC build
It produces some bogus warnings when UBSAN is enabled:
../demux/demux_mf.c:103:22: error: ‘%s’ directive argument is null [-Werror=format-overflow=]

Which is clearly not possible at this point.
2025-11-04 21:50:06 +01:00
Kacper Michajłow 07622820d8 .lsan_suppressions: remove no longer needed suppression 2025-11-04 21:50:06 +01:00
Kacper Michajłow c3ba7bc0b1 ci: remove -Wno-error=deprecated
No longer needed and will let us spot deprecations sooner.
2025-11-04 21:50:06 +01:00
ckath 8364b122ee TOOLS/lua/autoload.lua: stop initial file from being added twice
this happened right after going to the next file
2025-11-04 20:53:35 +01:00
Kacper Michajłow 04055e5806 video/out/gpu/video: change treat-srgb-as-power22 default to auto
We want to have symmetry on the input and output. Also outputting sRGB
encoded image to gamma 2.2 display is clipping blacks. 2.2 displays are
more common and are reference sRGB display, which is what we should
target.
2025-11-04 20:51:50 +01:00
Kacper Michajłow 25aa402f1d ci/build-msys2.sh: disable pdf-build for clangarm64
See: https://github.com/msys2/MINGW-packages/issues/26007
2025-11-03 14:18:18 +01:00
Alex James 0a606d9e18 osxbundle: read version from version.h
osxbundle.py currently reads the version number from MPV_VERSION, while
Meson first tries git describe before falling back to MPV_VERSION.
Update osxbundle.py to try reading the version number from version.h
before falling back to MPV_VERSION. This ensures that the version number
in the bundle matches the output of mpv --version.
2025-11-01 14:41:18 +01:00
der richter ffd47de51d mac/common: fix window position on multi monitor setups
on multi monitor setups the position of the window was wrongly computed
when the position was forced, eg the calculated rectangle was screen
relative but the function expected absolute coordinates.

this is a regression from 50042f5ee0 and
#15500, where support for --force-window-position was introduced. this
worked in simple one monitor setups and in some cases on multi monitor
setups by sheer coincidence.

calculate the absolute position of the window by taking the screen into
account when needed.

Fixes #16929
2025-11-01 13:57:49 +01:00
Kacper Michajłow d3ec15bca8 stats.lua: remove prefix from display luminance metadata
People are getting confused about "HDR10" part.
2025-10-31 12:53:43 +01:00
Guido Cella 1abd2a05f1 console.lua: don't clip items if OSD dimensions are not initialized
If you open the menu at startup, e.g. with --input-commands, it rarely
clips items completely because OSD dimensions are still 0, or as if they
were 100 because those are the default values before receiving property
notifications. Avoid this.
2025-10-31 12:53:31 +01:00
sfan5 609acc7cf2 meson: warn if building with SDL2
I previously tried to enable sdl2-gamepad by default and the CI turned all red.
In detail:
- SDL_config.h has macros that conflict with ours
- memory leaks caused the tests to fail
- main=SDL_main redefinition broke MSYS builds

The options remain disabled by default, but lets warn our users a bit.
2025-10-31 12:53:04 +01:00
sfan5 8649b64e57 meson: remove redundant sdl2 option
This disables the individual options by default, since they were gated by the parent option before.
2025-10-31 12:53:04 +01:00
llyyr 454d9eb361 wayland: log display luminance values alongside other preferred img desc 2025-10-29 17:37:17 +01:00
llyyr 22c149e615 wayland: replace comment with log message 2025-10-29 17:37:17 +01:00
llyyr 98847f5f0b wayland: log connector name for wl_output in more places
Fixes: b8ab1074eb
2025-10-29 15:37:29 +01:00
Guido Cella e2bd1c6a88 {console/context_menu}.lua: don't apply --osd-blur to menu backgrounds 2025-10-29 15:36:35 +01:00
Kacper Michajłow 0a84c0a204 vo_gpu_next: add workaround for broken linear output in libplacebo
See: https://code.videolan.org/videolan/libplacebo/-/merge_requests/759
2025-10-29 15:36:15 +01:00
Kacper Michajłow 9b4341643f video/out/gpu/video: add --sdr-adjust-gamma 2025-10-29 15:36:15 +01:00
Kacper Michajłow 3e628c8d64 vo_gpu_next: linearize sRGB as a pure 2.2 power function
sRGB reference display is defined a 2.2 gamma device. To preserve the
look of the sRGB as mastered on such device, linearize it as such.

Note that sRGB encoding is piecewise with linear segment, which creates
mismatch to pure power 2.2 function, but this is intended to be viewed
on such display.

See:
IEC 61966-2-1-1999
https://community.acescentral.com/t/srgb-piece-wise-eotf-vs-pure-gamma/4024
https://github.com/KhronosGroup/DataFormat/issues/19
https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/12
https://github.com/dylanraga/win11hdr-srgb-to-gamma2.2-icm
2025-10-29 15:36:15 +01:00
Guido Cella 813c112329 command: react to --force-window changes with no file playing
handle_force_window() is called in play_current_file() and
run_playloop(), so it is never triggered if you do mpv --idle and then
change force-window at runtime. Move the playloop call to the option
callbacks to fix this.

Fixes https://github.com/mpv-player/mpv/discussions/16956.

Giving the UPDATE_VO flag to --force-window would not fix this due to it
having no effect if there's isn't already a window, which prevents the
bug described in 544240c829. It would also reinit the VO unnecessarily
when cycling between force-window yes and immediate.
2025-10-29 15:12:42 +01:00
nanahi 6b01391142 meson.build: add libx11 as x11 clipboard dependency
Should resolve possible link errors.
2025-10-28 13:57:37 +01:00
Kacper Michajłow 532bac0b68 wayland_common: always prefer the PQ transfer for HDR output
Fixes: #16972
2025-10-28 10:38:55 +01:00
sfan5and茶茶 e23e72bd49 vo/context_android: fix surface tearing on resize
It's not clear why this is needed, but it works (on my device).

fixes https://github.com/mpv-android/mpv-android/issues/991

Co-authored-by: 茶茶 <chachakko@outlook.com>
2025-10-27 23:30:04 +01:00
nanahi 1fec44cc6c clipboard: add --clipboard-xwayland option
On Wayland envitonments with Xwayland available but without
ext-data-control-v1, mpv will fall back to the X11 backend instead of
VO backend. This may result in clipboard not working properly between
mpv and native Wayland clients.

Fix this by disabling X11 backend on Wayland envitonments by default
and adding the --clipboard-xwayland option for manual override.
2025-10-27 20:01:47 +01:00
nanahi 0a88720245 .pre-commit-config: add requestor to ignore list 2025-10-27 20:01:47 +01:00
nanahi 7b660a5de9 console.lua: use clipboard property for x11 2025-10-27 20:01:47 +01:00
nanahi 4f03bc1779 clipboard-x11: add x11 clipboard backend
This adds the x11 clipboard backend and native clipboard support to x11.
Clipboard monitoring is supported.
2025-10-27 20:01:47 +01:00
nanahi ce3f11ed55 .github/ISSUE_TEMPLATE: add --msg-time to log file instruction
Logs produced with the terminal output method do not have timestamps
logged by default, unlike --log-file.

Add --msg-time to the instruction to retain this information.
2025-10-27 20:01:25 +01:00
nanahi 8ac52fd1ab various: use mp_sleep_ns 2025-10-27 20:00:59 +01:00
nanahi 8410f3157d TOOLS/lua/test-hooks.lua: drop sleep amount suffix
Not POSIX.
2025-10-27 20:00:59 +01:00
Attila Fidan 2efbb29938 command: fix bluray angle stream detection
Fixes: eba7a11a2e ("player/command: do seamless angle change when bluray-angle is changed")
2025-10-27 20:00:52 +01:00
Lynne f181907aff vd_lavc: add ProRes RAW to the list of default hwdec codecs
Unlike all other codecs, ProRes RAW is pretty much guaranteed to be slow
as hell on the CPU, always having thousands of tiles. And even on a very
slow GPU, a CPU decode won't be anywhere near to usable to make a difference.
2025-10-27 19:52:57 +01:00
Attila Fidan 44685344a5 vo_dmabuf_wayland: request redraw on resize
Fixes panning the video while it's paused and the OSD isn't redrawing.
wayland_common since c25129339d requests
redraw when there is a resize event so there was no issue with xdg
resizing but that isn't applicable to resizing due to panscan options
changing.
2025-10-26 18:34:15 +00:00
arch1t3cht aa2dad035f stream_bluray: do not demux_flush on angle change
A demux_flush can cause corruption and a slight A/V desync, whereas
without it the angle will simply change on the next keyframe, as is
intended for seamless branching. If users want an instant angle change
they can still restart playback and seek to the current position
through Lua.
2025-10-23 11:41:16 +02:00
Kacper Michajłow 99d6d4c1c2 sub/osd_libass: change add_osd_ass_event argument to bstr
This allows to remove one dummy tmp allocation.
2025-10-19 18:35:40 +02:00
Kacper Michajłow 233e89698e video/out/gpu/video: make the target-contrast limit higher
OLEDs report min luminance of 0.0002 nits, while we couldn't set this
with options due to limit. Set limit, so that we cannot exceed the hdr
black value used in libplacebo in worst case scenario of target peak 10
nits.
2025-10-15 22:00:19 +02:00
Kacper Michajłow d204051d93 vo_gpu_next: use reported display contrast value also in SDR mode
It is useful in SDR mode to use correct target-contrast too.
2025-10-15 22:00:19 +02:00
Kacper Michajłow 10c9b3381b options: add mxf to video file extensions list 2025-10-15 22:00:08 +02:00
Kacper Michajłow fdbe06a6bc player/lua: fix UB in integerness check 2025-10-15 21:59:55 +02:00
Kacper Michajłow 339ad7e49e player/javascript: fix mp.set_property_number for integer properties
Fixes: #16911
2025-10-15 21:59:55 +02:00
LordMZTE f9d4e19888 TOOLS/lua/gamma-auto: update on timer when on Linux
The Linux implementation of ambient-light is not observable.
2025-10-15 21:59:42 +02: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
nanahi ad59ff1b4a DOCS/man/input: document command-list contents
Forgotten in 029bb593e7.
2025-10-11 18:32:01 +02:00
Guido Cella 0a53407a48 context_menu.lua: prevent some rare crashes
Fix crashes that won't happen in regular usage:

- If you open the menu with an empty menu-data and use keybindings
- If you open the menu with menu-data only containing hidden items
- If you invoke script-message-to context_menu select with the menu
  closed
2025-10-11 10:32:29 +02:00
Guido Cella 6e8283d377 context_menu.lua: add a missing return
The space key selects the current item so it shouldn't also try to
activate items with titles starting with space.
2025-10-11 10:32:29 +02:00
Guido Cella 67330ba2de select.lua: don't go beyond the max line length
Fixes 7be6095c23.
2025-10-10 08:44:03 +02:00
Kacper Michajłow 2412feaf49 mp_image: use correct scaling for nominal peak
Fixes copy-paste error

Fixes: add2bf50cd
2025-10-10 06:24:17 +02:00
Kacper Michajłow 0fb40b654d stats.lua: split lines to make them shorter
Fixes: 92aeb63479
2025-10-10 06:14:42 +02:00
Kacper Michajłow 43b230b089 stats.lua: skip codec params if they are not available
Fixes: 2fd88ffbae
2025-10-10 06:14:42 +02:00
Kacper Michajłow add2bf50cd mp_image: use pl_color_space_nominal_luma_ex() to set nominal csp peak 2025-10-10 06:14:42 +02:00
Kacper Michajłow 9252ff4ce1 player/playloop: set consistent video parameters in idle mode
Prefer RGBA if available to avoid configuring color conversion that
wouldn't be used anyway. And set sRGB primaries, just for consistency.
2025-10-10 06:14:42 +02:00
rach-md 7be6095c23 select.lua: rename some menus with proper name 2025-10-10 06:14:07 +02:00
Kacper Michajłow b5c538a9c7 vo_gpu_next: add --hdr-reference-white 2025-10-10 06:12:35 +02:00
llyyr 92aeb63479 stats.lua: make video block even when no video track
fixes formatting with `mpv --idle --force-window` with no files loaded
2025-10-10 05:41:56 +02:00
Kacper Michajłow e70bb8802f ci/lint-commit-msg.py: modernize type hint 2025-10-07 22:11:02 +02:00
Kacper Michajłow 3ae5521367 mp_image: keep chroma location consistent for non-subsampled formats
Could also be set to unknown, but let's keep it center, so any fallbacks
in other places wouldn't trigger. In practice it shouldn't be used for
non-subsampled formats.
2025-10-07 18:50:53 +02:00
Kacper Michajłow 7dd035e937 vf_format: add some basic HDR10 metadata
Can be extended if needed.
2025-10-07 07:56:18 +02:00
Kacper Michajłow 96ce2d199d vf_format: add --vf=format=transfer alias 2025-10-07 07:56:18 +02:00
Kacper Michajłow 3c1abdb7bb DOCS/man/vf: add missing st428 in vf_format 2025-10-07 07:56:18 +02:00
Kacper Michajłow 3d39d992d0 av_common: check if position is not negative 2025-10-07 07:55:26 +02:00
Kacper Michajłow a0c4d7b1ca demux/cue: fix crash when there are no tracks 2025-10-07 07:55:26 +02:00
Emmanuel Gil Peyrot 6083cf13f2 wayland: fix displaying non-subsampled formats
Fix regression introduced in 90e3e104d9,
where all non-chroma subsampled formats (e.g. rgb8 or yuv444p) will
trigger a protocol error and get disconnected by the compositor due to
setting the chroma location on the color representation object.

GNOME-Shell 49 will emit this protocol error otherwise:
```
wp_color_representation_surface_v1#54: error 3: Commit contains a color representation with chroma location set and a buffer with a pixel format which is not 4:2:0 subsampled
```

How to reproduce:
- Run gnome-shell 49
- Run `mpv --vo=dmabuf-wayland some-image.png`
2025-10-06 22:00:30 +00:00
Emmanuel Gil Peyrot 4c885905e7 img_format: add a helper to determine if chroma is 4:2:0 subsampled
Only YUV formats which are subsampled once in both width and height will
return true (so for instance NV12 or P010), other formats will return
false.
2025-10-06 22:00:30 +00:00
llyyr 8a9c0fe05d wayland: log color-representation information as well 2025-10-06 21:40:51 +00:00
llyyr 162fa47be1 wayland: log the image description we try to set 2025-10-06 21:40:51 +00:00
llyyr 042bfd9e05 wayland: always set max_cll/max_fall
These have nothing to do with whether the compositor supports
set_mastering_display_primaries protocol feature or not and are always
available
2025-10-06 21:40:51 +00:00
Attila Fidan c2a211ca1c vo_dmabuf_wayland: unset video viewport source when force_window
The video viewport source rectangle is prevented from being set while
force_window, but we should also unset it because it will be set if a
video is played before entering force_window. Fixes out_of_buffer error
from Weston and wlroots in this scenario.
2025-10-06 21:40:36 +00:00
Kacper Michajłow 33f38423b3 vo_gpu_next: add --border-background=blur and --background-blur-radius 2025-10-06 16:27:50 +02:00
nanahi 67378b9c52 commands.lua: update screenshot commands flags 2025-10-06 04:27:13 +02:00
nanahi d89add6eb2 screenshot: add osd and scaled flags to screenshot commands
Currently, screenshot being scaled and the presence of OSD and subtitles
cannot be independently controlled. This adds osd and scaled flags to
screenshot commands that make it possible to e.g. take screenshots with
only OSD without subtitles, or take screenshots at scaled resolution
without OSD or subtitles.

The "window" flag is now an alias of scaled+subtitles+osd, and is kept
for convenience.
2025-10-06 04:27:13 +02:00
llyyr be5e606377 sub: make --sub-fix-timing configurable
Instead of hardcoding the threshold and keep duration in a header,
expose them as options for users to configure and set old hardcoded
values as the new defaults for those options.
2025-10-05 21:35:20 +02:00
Kacper Michajłow df4bd5d1c8 DOCS/man/options: mention --target-gamut in colorspace hint mode
The description was not complete saying only about --target-prim.
2025-10-05 21:35:00 +02:00
Kacper Michajłow 20bf508b9d vo_gpu_next: don't force PQ output for SDR sources if target is unknown
We currently force PQ output when target_csp() is not available, to
preserve compatibility with backends that do not support it and to
enable HDR on them. However, for SDR transfers we can safely skip this
and simply use the source mode instead.

Ultimately, this "force PQ" mode needs to be removed, but target_csp()
is still not implemented for all relevant backends.
2025-10-05 21:35:00 +02:00
Kacper Michajłow 24647365a3 meson: don't define _UCRT_NOISY_NAN
The issue has been fixed in Windows SDK, if you are using affected SDK
version, update or downgrade to the working one.

See: https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907
2025-10-05 21:34:29 +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
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
arch1t3cht e6e7083ce6 options: remove leftover bluray_device field
This was moved to stream_bluray_opts in
8a7704ea89.
2025-09-15 03:52:35 +02:00
arch1t3cht 7b791733ce stream_bluray: show number of angles in title list 2025-09-15 03:52:35 +02:00
Kacper Michajłow 0d03e0565f osdep/win32-console-wrapper: remove stray include 2025-09-15 03:47:35 +02:00
Kacper Michajłow 7ee677c773 meson: add mpv-register and mpv-unregister helpers on Windows
They call `--register` / ``--unregister` for users who don't want to open
console and do it manually, this is one-click solution.
2025-09-15 03:47:35 +02:00
Kacper Michajłow 4f08802ff1 osdep/w32_register: add register/unregister options for Windows
On Linux, we have `mpv.desktop`, and on macOS, we have `osxbundle`, both
of which handle file associations and protocol registration in the
system environment.

On Windows, this information is stored in the registry, so this commit
adds support for it.

It registers the application, supported file types, and supported
protocols, and adds an uninstall entry so users can remove all
registrations via the control panel. Note that this does not remove the
binary itself.

The implementation is fully portable. There are no external installers,
as mpv handles everything automatically. This should improve usability
when moving binaries and so on.

- `mpv --register` registers mpv (see verbose output for a list of actions).
- `mpv --unregister` reverts all changes made during installation.
- `mpv --register-rpath <string>` allows specifying a string to be
  prepended to `PATH` before running mpv. This is useful when using
external dependencies that shouldn't be added globally to `PATH`.
2025-09-15 03:47:35 +02:00
Attila Fidan b9b3106d2f playloop: update window title in handle_force_window
When restarting or changing the VO while on the idle screen and using
force-window, this ensures that the new VO immediately receives a window
title.
2025-09-14 01:27:27 +02:00
nanahi 34b6439dc6 input/keycodes: fix combo key handling for - key
The current handling tries to handle the edge case where the current key
in a combo key is -, but when the current key is not - and the next key
is -, it misdetects - as separator and fails to parse correctly.

Fix this by restricting the handling to situations where the current key
is -.

Fixes: ce2367725e
2025-09-14 01:25:38 +02:00
Jan Ekström d837c43656 {demux_mkv,TOOLS/matroska}: map, expose hearing/visual impaired flags
Were brought up recently in the user channel, and seemed like an
easy enough win. Unfortunately `sh_stream` currently lacks other
fields, so the rest of the flags will be added as the player's
functionality gets extended further.

Ref: https://datatracker.ietf.org/doc/rfc9559/
2025-09-11 19:25:12 +03:00
nanahi 77dee9be2f DOCS/man/options: add usage note for --wid=0 for win32 2025-09-07 18:19:44 +02:00
nanahi 7a5ecf1c06 video/out/w32_common: support --wid=0
Similar to X11, this makes mpv attach to the desktop wallpaper window
(make the system create one if it does not yet exist) as parent,
which makes mpv display as desktop wallpaper behind desktop icons.

Lika an actual wallpaper, mpv will not receive any keyboard or mouse
input in this mode. It can still be controlled through terminal and IPC.
2025-09-07 18:19:44 +02:00
der richter b290781675 mac/title: fix mouse position when snapped to position from title bar
when the window is snapped to a position by dragging the title bar the
corresponding left mouse up event is prevented by the system snap event,
which leads to the window moving state not being reset and no mouse
position changes being reported. which makes UI elements unresponsive.

explicitly subscribe to left mouse up events for the whole app instead
of the mouse events from the title bar and reset the moving state.

Fixes #16732
2025-09-07 13:53:55 +02:00
Guido Cella b9ceaf243d console.lua: don't autoselect the wrong completion
The first completion is automatically inserted when Tab was not pressed,
but this is unwanted when you already typed one of the completions which
is not the first one, move back the cursor and press Enter.

e.g. if the line is "set vid", you place the cursor before "v" and press
Enter, it runs "set ab-loop-avid".

Fix this by aborting when the text in front of the cursor matches one of
the completions.
2025-09-02 21:43:20 +02:00
NotMithical 6269f4ffce ytdl_hook.lua: add support for VP9 profile 2 2025-09-02 21:42:14 +02:00
Guido Cella efb70d7f27 TOOLS/lua/autocrop.lua: don't error if hwdec-current is nil
hwdec-current can be either "no" or nil.

Fixes #16739.
2025-08-29 19:08:29 +02:00
Andarwinux 42fd091e47 osdep/win32/meson: use files() instead current_source_dir()
In reproducible builds, meson.current_source_dir() also leaks absolute paths, so it's better to use files() instead

ref: https://mesonbuild.com/Reference-manual_builtin_meson.html#mesoncurrent_source_dir

> You do not need to use this function!
> When passing files from the current source directory to a function since that is the default. Also, you can use the files() function to refer to files in the current or any other source directory instead of constructing paths manually with meson.current_source_dir().
2025-08-29 19:07:46 +02:00
der richter 0f910ec51c mac/common: render first frame on init if possible
since commit 5010c24 the initial window always shows a black frame
instead of the actual first rendered frame of the video, since the
visibility of the window for the initial render is always false. in the
worst case the first shown frame wasn't the intended first rendered
frame.

to prevent this, initial always allow rendering till the window is shown
or minimised. afterwards it will respect the occlusion state as before.

in the case of slow render pipeline initialisation and no frame being
ready to be rendered, it will still show a black frame.
2025-08-28 15:23:33 +02:00
der richter 78458a55ef mac/common: add support for force-render option 2025-08-28 15:23:33 +02:00
low-batt 9f153e2a20 mac/vulkan: fix frame not displayed when paused
add event handler for when window's occlusion state changes and now
indicates some or all of the window is visible.

handling of the event is needed due to the addition of a visibility
check for rendering that was added in commit 5010c24.

Fixes #16693
2025-08-24 12:58:26 +02:00
Kacper Michajłow 5faec4e6af ci/win32: disable libjxl tests
The need additional dependencies, that we don't need to build.
2025-08-24 01:42:00 +02:00
Kacper Michajłow 0e966ba071 stats.lua: show also min_luma if max_luma is nominal SDR
Useful to see set black point.
2025-08-24 01:21:35 +02:00
Shengyu Qu 90e3e104d9 wayland: add usage of set_chroma_location for wp-color-representation-v1
Previous implementation of wp-color-representation-v1 omitted usage of
set_chroma_location, so add it.

Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
2025-08-23 14:59:40 +00:00
sfan5 80d2a6a7ed ytdl_hook.lua: don't crash if playlist entries don't have an usable URL
see #16717
2025-08-23 15:02:46 +02:00
sfan5 194ce88ac3 player/command: fix missing property update for some hwdec changes
fixes #16710
2025-08-22 08:38:02 +02:00
sfan5 653e241ac3 DOCS/lua: fix mistyped function name 2025-08-22 08:38:02 +02:00
sfan5 521e162420 DOCS/input: clarify value of hwdec-current
This can never be false, or a boolean at all.
2025-08-22 08:38:02 +02:00
nanahi bde63fe092 wayland_common: handle wayland events in VOCTRL_CHECK_EVENTS
VOCTRL_CHECK_EVENTS is used to handle input and redraw events, so it is
necessary to check the input events from the windows system when this is
called. X11 already does this, and win32 does not need to do this since
the input events are processed in the UI thread, not VO thread.

However, this is not done on wayland. On wayland, input events are only
processed in vo_wayland_wait_frame and vo_wayland_wait_events.

If Vulkan gpu api is used, then vo_wayland_wait_frame is only called in
wayland_vk_swap_buffers, and only when using the internal vsync, and not
when fifo protocol is being used.

vo_wayland_wait_events is only called in wait_vo. However, unlike
VOCTRL_CHECK_EVENTS which is sent on every VO render loop, wait_vo is not
called when the VO has a frame to redraw immediately, which can happen
often in display-sync modes. In the worst case, this is never called.

All of the above result in situations where inputs and other wayland
events not being handled in time while not rendering, or rapid rendering
with wayland internal vsync disabled.

Fix this by checking wayland events in VOCTRL_CHECK_EVENTS, similar to X11,
to make sure these events are handled.
2025-08-20 13:34:54 +00:00
Philip Langdale 12a78257a8 vo/vulkan: sync recommended Vulkan 1.x features from ffmpeg
This second set of additional features are ones from extensions that were
incorporated into Vulkan eventually. As we do not require Vulkan to be newer
than 1.2, we must request the 1.3 and 1.4 features via their original
original extensions, while the others can use the core feature structs.

This change assumes that libplacebo can correctly merge features using their
old extensions or using the core feature structs.
2025-08-18 08:44:35 -07:00
Philip Langdale 91e0b6cbda vo/vulkan: sync recommended extensions and features from ffmpeg
Over time, the list of requested extensions and features has diverged from
ffmpeg (libhwcontext_vulkan), and while this isn't guaranteed to cause
problems, as it depends on driver behaviour, it definitely makes it hard to
compare validation errors between the two implementations.

This change requests the extensions/features which have not been incorporated
into any Vulkan version.
2025-08-18 08:44:35 -07:00
Kacper Michajłow 6b96aff174 vo_gpu_next: initialize min_luma correctly
This is also important in non-hint mode and hint SDR mode.

Fixes `--target-contrast=auto`.
2025-08-18 04:47:04 +02:00
Dudemanguy ce7ea3d8ea path-unix: support ~~desktop path expansion
xdg-user-dirs is basically the standard for defining user desktop
directories on linux/bsd. To account for locales and languages, we
basically have to parse the config file (~/.config/user-dirs.dirs)
directly. That or call xdg-user-dir. Either way, it's a little more
complicated than the others, but still doable enough.
2025-08-17 16:58:00 +00:00
Kacper Michajłow 07572dc83c vd_lavc: don't select software output format if hwdec failed
Let us fallback fully to software decoder. There is an issue in ffmpeg
where if we return software format here for hwdec threading context it
will be assumed to be usable, but not accelerated, which would be fine,
but later it causes assertion failure when copying avctx context
between decoding threads in ffmpeg.

Avoid this issue, but returing NONE format after we failed.
2025-08-15 20:24:19 +02:00
Kacper Michajłow dbda70a11c vd_lavc: add --hwdec-threads
No reason to not enable threads if lavc supports them, same as for
software decoding. Might help with pipelining of decoding and filtering.

Performance difference may vary, but in my testing everything is working
as expected and I didn't notice any regressions.

Set to 2 threads by default as conservative value that should resolve
stalling issue, while also not spawn too many cpu threads, which won't
help with hwdec anyway and only can cause too deep queue of hardware
surfaces.

Fixes: #16578
2025-08-15 20:24:19 +02:00
Kacper Michajłow fcb50a77bb vd_lavc: fix AVCodecContext use in get_format callback
When using more than one threads, the callback can be called from
different thread from sibling avctx, we cannot use our main one to query
codec/hw_frames paramters.

Use context provided in callback arg to fix that.
2025-08-15 20:24:19 +02:00
Kacper Michajłow 7653cc8f09 vo_gpu_next: respect ICC profile color space
When ICC profile is applied, use it also in hint to ensure correct
target colorspace configuration. ICC profile takes precedence over
anything else, to make sure libplacebo internally interpret it the same.

Fixes: #16646
2025-08-14 22:32:43 +02:00
Kacper Michajłow 227d958d29 vo_gpu_next: don't use unitialized min_luma in some cases
Also double check if 1e-7 doesn't underflow float.
2025-08-14 22:32:10 +02:00
verygoodlee 4c17803b91 options: delete the duplicated extension "wav" in --audio-exts
fixes: 44a3a3293f
2025-08-14 22:26:34 +02:00
Kacper Michajłow 3132ad62a3 vo_gpu_next: don't hint colorspace when ICC profile is used
We don't know which colorspace the profile were created from. We could
set hint to ICC target colorspace, but it would be ambiguous, because it
doesn't say which colorspace were configured in practice.

Additionally on Wayland with all the color management the client side
ICC correction is not supported, because we cannot set pass-through
mode.

Conceptually we should use VK_COLOR_SPACE_PASS_THROUGH_EXT to get
"direct" access to display response, but while this may work on macOS,
on Wayland it means "don't configure csp", instead of "configure to
pass-through", which means colorspace would have to be configured
externally, which is also not possible, see [1].

You can also see [2] for more discussion on the topic.

For now let's not hint any colospace and leave libplacebo in default
selection. Which restores previous status quo. This can be improved in
future, but for now this fixes use of ICC profiles in default mpv
config.

[1] https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/27
[2] https://github.com/haasn/libplacebo/issues/324

Fixes: #16646
2025-08-13 03:52:10 +02:00
Attila Fidan 211c9cb7c9 stream_libarchive: seek source stream to 0 before probing
If p->mpa = NULL due to an error during a seek or fill_buffer, then when
archive_entry_seek(), if newpos != s->pos, reopen_archive() ->
mp_archive_new() -> mp_archive_probe(), which asserts stream_tell(src)
== 0. This won't be the case if the previous mpa left the source stream
seeked in the middle of the file.

For example, in samples in archives where avformat_find_stream_info
takes a long time, if playback is aborted while the demuxer is doing
that, reading from the source stream will stop working due to cancels
being triggered. When archive_entry_seek() and newpos != s->pos,
reopen_archive() -> mp_archive_new_raw() -> archive_read_open1() fails
and returns with mpa == NULL due to reads not working. Then when another
seek happens, reopen_archive() -> mp_archive_new() -> mp_archive_probe()
-> assertion failed.

One solution is to have reopen_archive return STREAM_ERROR if the stream
is cancelled, since nothing useful can happen in this case. But there
are other situations where p->mpa could become NULL (fatal errors), and
it is supposed to be possible to seek back to a working area of the
archive.

Fixes: https://github.com/mpv-player/mpv/issues/15174
2025-08-12 18:38:50 +02:00
Kacper Michajłow 01b7edcc71 stats.lua: round max-cll to integer
In source-dynamic mode this can be converted from PQ, round it to
integer, same as max-luma already is.
2025-08-09 20:42:17 +02:00
Kacper Michajłow 91b10ffe2c vo_gpu_next: when tone-mapping, set better maxCLL value 2025-08-09 20:42:17 +02:00
llyyr e011596bc3 vo_vdpau: recommend vaapi directly instead of vo in emulated case 2025-08-08 09:48:53 +02:00
llyyr dfc232a44b vo_{vaapi,vdpau}: recommend gpu-next over gpu
Missed in d21b1f159c
2025-08-08 09:48:53 +02:00
Dudemanguy 2b74582fcb Revert "various: remove unneeded option path expansion handling"
Fixes #16573.

This reverts commit 137d5374bd.
2025-08-08 01:07:00 +00:00
Dudemanguy 6a5eb8c229 Reapply "external_files: parse ~ in --{sub,audio}-paths"
This reverts commit 768ad8f035.
2025-08-08 01:07:00 +00:00
Dudemanguy ed7b1aca0b DOCS/interface-changes: add backticks to tls-options
It's what is normally done.
2025-08-08 01:07:00 +00:00
Dudemanguy 26373c5497 Reapply "options: parse tls-related options as path"
This reverts commit 5c4c067ee6.
2025-08-08 01:07:00 +00:00
Dudemanguy 29307c26ba Reapply "various: expand paths for all file/directory related options"
This reverts commit 43fda5442f.
2025-08-08 01:07:00 +00:00
Dudemanguy a664eede96 Revert "test: always build path_source and options/path.c for test_utils"
No longer needed.

This reverts commit afbd3abb20.
2025-08-08 01:07:00 +00:00
Dudemanguy e0d06ecedc Revert "m_option: automatically expand paths for M_OPT_FILE options"
It would be nice to expand all path arguments for free in the option
code, but life isn't so simple. Because of string list options, we have
to expand at parsing time. Because of libmpv, mpv_global has to be
passed around a million places. Even after doing all that, there's still
a drawback where anything defined in builtin.conf (used for setting
default profiles and such) will be unable to correctly resolve paths if
the user uses --config-dir. Nothing currently defined in builtin.conf
would be subject to that and it's not likely that anyone would add
anything that would be, but it's a limitation that can't be changed
because this has to be parsed before the user's command line and before
mpv_global is set. There's also another problem of pretty printing paths
which are now always full paths instead of relative ones. It's not so
nice if the user's home path is something very long. This could be dealt
with by saving an unexpanded path in some field in the opt somewhere and
then doing that for pretty printing but with all this extra
complication, it's questionable if there's really any net gain at the
end of the day. Calling mp_get_user_path on some opt->whatever is a lot
simpler and always works. So this commit goes back to the old model
along with the following reverts/reapplies.

This reverts commit 9b7374ea40.
2025-08-08 01:07:00 +00:00
sfan5 866da80979 vo_gpu_next: fix resetting --glsl-shader-opts
fixes: #16638
2025-08-07 18:35:42 +02:00
Kacper Michajłow c4bc4f6d5b stream_bluray: use bd_get_main_title() to get main title
It uses a more sophisticated heuristic for title selection. It not only
selects the longest title but also considers quality and chapters. Refer
to the libbluray source for details.

No documentation change, "longest" option will still look for the
longest, just may work better now.

Fixes selection of title on some discs.
2025-08-06 18:04:46 +02:00
Kacper Michajłow 9681bda7d5 meson: bump libbluray requirement to 0.5.0
Released 2013-12-21. Will be used for bd_get_main_title().
2025-08-06 18:04:46 +02:00
Kacper Michajłow bdca44773a stream: remove stream_info_bdnav
It was disabled in 3b3170aedb.
2025-08-06 18:04:46 +02:00
Kacper Michajłow b6d8336658 stream_dvdnav: fix --edition when dvd:// is not used directly
When directory is redirected to dvd demuxer, --edition was ignored.
2025-08-06 18:04:46 +02:00
Kacper Michajłow 218561fe69 stream_bluray: fix --edition when bd:// is not used directly
When directory is redirected to bd demuxer, --edition was ignored.
2025-08-06 18:04:46 +02:00
LordMZTE b7c92c77a4 vo_gpu_next: allow unsetting LUTs
This adds support for unsetting a LUT set by the target-lut or image-lut
property by setting the property to an empty string. Previously, this
would cause an attempt to read a file named ''.
2025-08-06 18:04:05 +02:00
Dudemanguy 5b2bcc55db test: add some tests for the sub_sdh_filter 2025-08-06 13:57:38 +00:00
Dudemanguy cc7f9e3ce8 test/libmpv: inline some test-specific helpers in libmpv_common
These functions could be useful for any libmpv test and in fact
check_string was already duplicated in a couple of places. Inline them
in libmpv_common.
2025-08-06 13:57:38 +00:00
Dudemanguy b5c629fd12 filter_sdh: convert --sub-sdh-enclosures to a string list
This lets users specify any possible pair of characters to remote text
from in the SDH filter as opposed to the old way which would
automatically map ( to ) internally.

Additionally, this fixes #16597 because the old implementation relied on
looping over a single string using strlen for matching chars. That
doesn't work because strlen loops over bytes and non-ASCII characters
can have multiple bytes leading to false positives since the bytes could
match. There's various ways to deal with this, but simply using mpv's
internal stringlist type sidesteps that problem.
2025-08-06 13:57:38 +00:00
Kacper Michajłow cc660f8609 fuzzers: set fontconfig sysroot
Allows to specify custom fontconfig sysroot. Useful for fuzzing
environments where we might use specific config, font or the system wide
config is not available.
2025-08-06 03:14:58 +02:00
Andarwinux 0232ff27a8 ci/mingw: add lcms2
fixes #16614
2025-08-06 01:28:18 +02:00
nanahi 9b1a4366e9 DOCS/man/options: document special wid value -1
This value can be used to tell mpv to detach from the existing parent
into its own window.
2025-08-05 19:59:16 +02:00
nanahi 8b0b186147 options: handle runtime wid change
Add UPDATE_VO flag to the --wid option so that the window embedding
can be changed at runtime without needing to reset another UPDATE_VO
option.
2025-08-05 19:59:16 +02:00
heather7283 91b79d961a client: don't take ownership of result if it is not returned
This fixes memory leak that occured when NULL was passed as result.
2025-08-05 18:18:28 +02:00
nanahi 1d71523407 video/out: make ra_fns const 2025-08-05 03:10:33 +02:00
nanahi ce8032a8ca video/out/gpu/context: make context lists const 2025-08-05 03:10:33 +02:00
nanahi c82d9317a3 filters/f_swresample: make fudge_pairs const 2025-08-05 03:10:33 +02:00
Louis Pate 86e12929aa various: fix Wpedantic warnings 2025-08-01 11:56:38 +02:00
Attila Fidan 21e7c36349 demux_libarchive: normalize stream URL path before escaping
Path normalization can introduce pipe characters from the current
working directory when opening relative paths, which will make the
stream split the path and entry name prematurely. Escape the normalized
path, not the other way around.

Fixes: 440f35a26d ("demux_libarchive: normalize the stream url path")
2025-07-31 15:25:52 +02:00
Kacper Michajłow 03cafa10a7 ci: remove custom rust install step from windows-11-arm job
It is available in image itself now.

See: https://github.com/actions/partner-runner-images/issues/77
2025-07-30 19:44:16 +02:00
Guido Cella 71a6535b05 DOCS: fix FILES section title in links 2025-07-30 16:22:18 +00:00
sfan5 a6f3236c3a ytdl_hook.lua: don't pass any format to youtube-dl by default
yt-dlp changed its default format from `bv+ba/b` to `bv*+ba/b`, which we want to follow
since it fixes the behavior with some streaming sites.

The note that "sometimes youtube-dl returns a format that mpv cannot use" was added in
43c13e5ea2 but it's not clear what it refers to.

fixes #16388
2025-07-28 11:22:13 +02:00
sfan5 2168e3d82c ytdl_hook.lua: get rid of outdated youtube-dl hint
It has never worked for yt-dlp anyway and the relevant error messages
already tell people to update.
2025-07-28 11:22:13 +02:00
Kacper Michajłow 9546e0f7f8 vo_gpu_next: allow UINT upload if no other format is supported 2025-07-28 11:22:08 +02:00
nanahi eaf8a3e8cf DOCS/man/options: add hint to list default sub extensions
Similar to other -exts options.
2025-07-27 15:36:12 +02:00
Louis Pate 73c2118710 meson: add -Woverflow to test flags 2025-07-26 20:13:28 +02:00
Louis Pate 1e64262f1f test: fix Woverflow by using uint8_t array 2025-07-26 20:13:28 +02:00
Attila Fidan 7e94d691b5 demux_libarchive: escape '%' in stream URL path
Opening paths that are detected as archives which contain
'%[0-9A-Fa-f][0-9A-Fa-f]' will fail, because such sequence is treated as
a percent-encoded value when the path gets unescaped causing the path to
be mangled. Escape '%' to prevent this from happening.

Fixes: 2b280f4522 ("stream: libarchive wrapper for reading compressed archives")
2025-07-26 20:12:34 +02:00
Guido Cella b47fd2842a command: normalize stream-open-filename
Since 38ad1ed03b path is normalized but stream-open-filename is not,
making the docs where it says that they are the same wrong, so normalize
stream-open-filename too.
2025-07-24 15:10:44 +00:00
nanahi ff1bb2ff4b Revert "clipboard-wayland: flush display after creating data sources"
Not needed anymore. After data sources are created, the next loop
iteration of clipboard_wayland_dispatch_events will immediately start
and flush display.

This reverts commit c399422722.
2025-07-24 00:35:56 +02:00
nanahi d579527576 clipboard-wayland: create data sources in clipboard thread
Currently, it is done in set_data which is called by core.
It was never meant to do so and it is not thread safe when data
sources are created while a seat is being added/removed.

Fix this by passing a message to clipboard thread instead so that
it is done in a thread safe way.
2025-07-24 00:35:56 +02:00
nanahi 05d0971337 clipboard-wayland: add death message
Used to signal clipboard backend uninit.
2025-07-24 00:35:56 +02:00
nanahi c37756c6a1 clipboard-wayland: rename death pipe to message pipe
Will be used in next commits.
2025-07-24 00:35:56 +02:00
Dudemanguy 71b2324621 player/configfiles: stop parenting mp_get_playback_resume_dir to mpctx
There's no reason for the string to live forever for the lifetime of
mpv. We can free it when we're done. Calling the current-watch-later-dir
property could technically grow memory forever previously.
2025-07-22 17:52:41 +00:00
Dudemanguy 137d5374bd various: remove unneeded option path expansion handling
Same reasoning as the previous commits. This is now handled by the
option system so we can remove the redundancy.
2025-07-22 17:52:41 +00:00
Dudemanguy 768ad8f035 Revert "external_files: parse ~ in --{sub,audio}-paths"
The paths loaded here are already expanded so we can simplify.

This reverts commit 1a25f8c9fb.
2025-07-22 17:52:41 +00:00
Dudemanguy 5c4c067ee6 Revert "options: parse tls-related options as path"
Since the core option parsing does this, we no longer need special
handling here.

This reverts commit 43e83dc74b.
2025-07-22 17:52:41 +00:00
Dudemanguy 43fda5442f Revert "various: expand paths for all file/directory related options"
Since the option system now handles all the path expansion
automatically, these recent changes can be reverted for simplicity.

This reverts commit be15be3a83.
2025-07-22 17:52:41 +00:00
Dudemanguy afbd3abb20 test: always build path_source and options/path.c for test_utils
Because the previous commit started using mp_get_user_path in core
m_option files, various tests failed with undefined references due to
these two files not being included. Add them to the common list of
test_utils files.
2025-07-22 17:52:41 +00:00
Dudemanguy 9b7374ea40 m_option: automatically expand paths for M_OPT_FILE options
Unfortunately, I've already done most of the legwork on expanding paths
manually in the code everytime we encounter one of these options, but it
is completely possible to do it during the option parsing/copying. All
option value setting should go through m_config_set_option_raw at some
point, so this is a good target place to put this logic. Additionally,
the M_OPT_FILE flag already exists for any option that is meant to be
have path values as arguments, so we just needed to add an m_option
method to do this. Fundamentally, this is exactly the same as
m_option_copy except that we potentially expand the value string. A new
expand function pointer is now added and we implement it for the two
option types where this is relevant: OPT_STRING and OPT_PATHLIST.
Furthermore, a m_option_copy_and_expand wrapper is added to handle which
function pointer should be used. With this change, this means that all
path values located in any opt->value pointer should automatically be
expanded and users of the value no longer have to manually do this
themselves. Of course, that means that there's now a ton of redundancy
in the code that can be eliminated. That will be cleaned up in the next
commits.
2025-07-22 17:52:41 +00:00
llyyr 9871ed5e38 wayland: leave window geometry unset
The xdg-shell spec states: "If never set, the value is the full bounds
of the surface, including any subsurfaces. This updates dynamically on
every commit. This unset is meant for extremely simple clients"

mpv's window geometry is never anything other than the full bounds of
the surface, including any surfurfaces, so we don't need to set this
ourselves. This was added in 828dd65ef8 to
workaround a Weston bug, and isn't needed anymore.

Tested on wlroots compositors, kwin and weston.
2025-07-22 17:47:23 +00:00
Oliver Freyermuth 7bfc038528 stream_dvb: allow to enforce DVB-S/T for old zap format channels.conf
If a card supports both DVB-T/T2 or DVB-S/S2, channels.conf.{sat,ter}
was always interpreted as DVB-T2 / DVB-S2 before this change.
After this change, using channels.conf.{sat1,ter1} will enforce
interpretation as DVB-S/T.
The superior VDR channel config format is still the recommended solution
for such cards as it allows to specify the delivery system variant per
channel, but enforcing T2/S2 for cards supporting it whenever the zap
format is used does not seem reasonable.
2025-07-22 08:29:21 +02:00
Kacper Michajłow 0ac07305fb vo_gpu_next: override levels even when hinting colorspace
Color levels is not part of signaled colorspace.

Fixes: b91b71a444
Fixes: #16564
2025-07-21 21:03:55 +02:00
Dudemanguy 440f35a26d demux_libarchive: normalize the stream url path
38ad1ed03b was supposed to normalize all
path names, but the path from the libarchive demuxer works differently.
We need to normalize it within the demuxer itself so you get something
like "archive://<absolute path to archive>" in the property.

Fixes #16247.
2025-07-16 13:42:38 +00:00
Dudemanguy 4ee4444b68 options/path: fix a lie in comment
During the original PR, that was true but mp_normalize_path was changed
in 0755edb327 to allow NULL talloc_ctx.
Deleting the comment was forgotten since it was never true when the
commits were merged, so do it now.
2025-07-16 13:42:38 +00:00
Thomas Hebb 036fae317c sub/lavc_conv: prevent corruption after switching WebM WebVTT subs
WebVTT subtitles in WebM require special logic, and we signal that using
the "webvtt-webm" codec name, which is not part of FFmpeg. That worked
fine until commit 94859997b8 ("sub: update codec info") added a call
to mp_codec_info_from_av(), which overwrites our codec name with
FFmpeg's the first time the subtitle decoder is initialized. As a
result, WebM WebVTT subtitles are currently not rendered correctly after
switching subtitle tracks. Fix the issue by resetting the codec name
after calling mp_codec_info_from_av().
2025-07-16 13:41:54 +00:00
Thomas Hebb 6c720f0f49 sub/lavc_conv: remove unneeded strdup
We originally took the codec name as a separate parameter, making this
talloc_strdup() good hygiene. But since commit 73779a8c70
("sub/lavc_conv: take sd context as a parameter for lavc_conv_create"),
we take the name from the sd context, whose other fields we already
reference. So it should be safe just to copy the pointer like we do in
sub/sd_lavc.c.
2025-07-16 13:41:54 +00:00
Kacper Michajłow dd2cccec19 sub/ass_mp: revert some unwanted changes
We want to add padding around the whole bitmap, not within it. Smaller
parts are rendered onto bigger bitmap. Remove leftover padding code.

Fixes: e2fc75434e
2025-07-16 01:49:29 +02:00
Kacper Michajłow 7d3870b7f8 DOCS/man/options: add a note about MAINPRESUB and gpu-next 2025-07-16 00:12:45 +02:00
Kacper Michajłow 2da63bb4eb vo_gpu_next: reduce fp conversions in overlay color
This is cosmetic, shouldn't matter in practice.
2025-07-16 00:12:45 +02:00
Kacper Michajłow 3a7a027f44 vo_gpu_next: add support for blend-subtitles=video
Render subs and video resolution. Important for performance of some
heavy typesetting.
2025-07-16 00:12:45 +02:00
Kacper Michajłow e2fc75434e sub/ass_mp: add missing padding for ass packer
This ensures it is safe to sample packed image with bilinear filtering.
2025-07-16 00:12:45 +02:00
Kacper Michajłow 55043cb5c8 vo_gpu_next: don't do partial updates on hint luminance
This ensures that we don't mix maxCLL if target already has max_luma.
This can be opt-in with mode=source and manual target-peak override. No
need to merge to much things.
2025-07-16 00:09:49 +02:00
Dudemanguy 5c4c27e6b1 m_option: remove unneeded legacy syntax parsing
This code got shuffled around over the years but fundamentally it was
first introduced in 2c22fcd350 to fix a
parsing issue with specifically the af and vf options. Syntax like af*
and vf* used to be valid and this was part of dealing with that case.
Later 50008adf4a completely changed this
and ripped out support for the wildcard behavior. But these few lines to
deal with the special case were never removed. The token splitting has
been unnecessary for years and is confusing, so clean this up and
finally remove it.
2025-07-15 18:06:14 +00:00
Dudemanguy 2763390c15 input/cmd: use m_option_set_node_or_string
Like the previous commit, this has a conditional that matches exactly
what this helper function is supposed to do. For logging reasons, we
can't completely remove the val->format comparison, but it can be
simplified to be cleaner.
2025-07-15 18:06:14 +00:00
Dudemanguy 04ca4fd1ed m_config_frontend: use m_option_set_node_or_string
There is a usage of m_option_parse which exactly mirrors the intention
of the helper function m_option_set_node_or_string. Instead of
duplicating the logic, just call the m_option_set_node_or_string
instead.
2025-07-15 18:06:14 +00:00
Dudemanguy 024628eb4b m_option: change m_option_set_node_or_string to accept bstr directly
It's easier for potential callers of this to convert char to bstr than
vice versa. Internally, the function uses bstr anyway so just eliminate
the conversion and let callers do it. The next commit will add another
caller of this where the bstr param is preferable.
2025-07-15 18:06:14 +00:00
Dudemanguy fdbea0fe66 vo_dmabuf_wayland: don't set HDR metadata on SDR transfers
This probably didn't do anything previously, but technically SDR
transfers could theoretically have HDR metadata and we would set them.
This isn't worth supporting so skip this step for SDR.
2025-07-15 01:22:41 +00:00
Dudemanguy 699054cfd9 vo_dmabuf_wayland: use pl_color_space_infer on HDR transfers
vo_gpu_next already does this. If we have HDR, try to fill out any
missing values before doing validation.
2025-07-15 01:22:41 +00:00
Dudemanguy 8f9a10fd45 vo_dmabuf_wayland: tighten up hdr metadata sanity checking
1a70de259d added some sanity checking to
these values to avoid throwing a protocol error (which are fatal) since
the wayland protocol is very strict about the ranges of these values.
Let's tighten up the checks just a little bit to be on the safe side. If
the min_luma is not less than max_luma, consider this a hard error. We
won't set any hdr metadata at all if this happens. For max_fall and
max_cll, we leave mostly the same as before where the value gets set to
0 if it doesn't pass the wayland protocol specification. For the case
where max_fall is greater than max_cll, consider this invalid and set
both values to 0.
2025-07-15 01:22:41 +00:00
nanahi 86e884bc4a video/out/gpu/video: fix target colorspace for redrawed frames
Fixes oversaturation when pause/redrawn with Windows HDR mode on.
2025-07-15 01:42:21 +02:00
Dudemanguy 1fbf1e1d91 encode: simplify all initial blocking logic for encoding
0ab3184526 introduced most of the stuff
being removed here. The idea is that when doing encoding the core should
wait until everything is initialized. This is true, but the old
implementation is overly complicated and confusing. What we need is for
both the AO to be initialized and the VO to be reconfigured for encoding
to start. Because of the way initialization works, the VO reconfig
always happens first. Changing the order in playloop would of course
break this assumption, but we can trust that nobody would arbitrarily do
that. So all that needs to be done here is that write_video should wait
until the AO is up before pushing frames. And that only applies in
encoding mode and if there is a selected audio stream in the first
place. This is a simple check.

With that in place, all of this extra junk can be dropped. We don't need
special booleans or events for the simple task of making sure the AO and
VO are both up.
2025-07-14 22:09:49 +00:00
Jens Peters ff595049e9 docs: document tablet pad properties 2025-07-14 22:07:24 +00:00
Jens Peters 0fbf20f057 wayland: expose tablet pad buttons to input system
Expose all buttons state to the Client-API for usage in e.g. lua.
2025-07-14 22:07:24 +00:00
Jens Peters 4d12a60be2 docs: document tablet input 2025-07-14 22:07:24 +00:00
Jens Peters db60145c2d wayland: move tablet tool handling to mpv input system
Upgrade tablet input to first class citizen similar like
touch input, but more simple since use case for now is
mouse emulation only.

Keep state for coordinates and in-proximity.
Introduce property for disabling tablet input.
Introduce Client-API property `tablet-pos`.
2025-07-14 22:07:24 +00:00
Jens Peters 43a030452c wayland: add tablet tool handlers for tap, motion and button
Just simple mouse emulation for now.
2025-07-14 22:07:24 +00:00
Jens Peters 992cb27529 wayland: set tablet tool cursors
Always update the pointer cursor and all tablet tool cursors together.
Also ensure a visible cursor on proximity-in.
2025-07-14 22:07:24 +00:00
Jens Peters 7177976dc5 wayland: wire tablet pad group listener
This ensures that tablet pad objects that belong to a group,
thus rings and strips, are all properly destroyed on removal
or shutdown.

Note that event listeners for ring a strip are not added
since we are not (yet) interested in them and they are not
needed for proper destroy.
2025-07-14 22:07:24 +00:00
Jens Peters 549bc390e6 wayland: wire tablet pad listener
This ensures that tablet pad objects are properly destroyed on
removal or shutdown, even if we are not (yet) interested in
tablet pad events.
2025-07-14 22:07:24 +00:00
Jens Peters 0ef3b1d1bc wayland: wire tablet tool listener
Setup tablet tool events, we want to use motion, tip and
button events later.
2025-07-14 22:07:24 +00:00
Jens Peters 785540f7e9 wayland: wire tablet listener
This ensures that tablet objects are properly destroyed on
removal or shutdown, even if we are not really interested
in tablet events.
2025-07-14 22:07:24 +00:00
Jens Peters 48804a24f8 wayland: wire tablet seat listener
Tablets require their own tablet manager and tablet
seats since multiple tablets/pens can be connected to
a single seat. So this is unfortunately a lot of
wiring.
2025-07-14 22:07:24 +00:00
Jens Peters f73586ddd4 wayland: build tablet protocol unconditionally
The tablet protocol is supported in the current winimum
wayland-protocols version, so we can always build this.
Note that this is still the unstable version, once the
minimum required wayland-protocol version is 1.35, the
stable version of protocol can be included.
2025-07-14 22:07:24 +00:00
Kacper Michajłow bd2118026b ci: add rust support 2025-07-12 20:40:04 +02:00
Dudemanguy 08d7d049d1 build: install encoding-profiles.conf into the system data directory
fd4e3af740 originally started installing
it, and we've been doing it ever since then. The value of having all of
these encoding profiles predefined by default is pretty dubious since a
lot of them are pretty old ('MP4 for Nokia N900' being a shining
example) and mpv is not really a good encoding tool anyways. Let's treat
it like the other conf files in etc and install it in the data directory
for reference. If someone really uses these, they can copy the file over
locally to their mpv config directory and it'll still work fine.
2025-07-12 14:01:54 +00:00
llyyr 329c5294aa meson: remove wayland-protocol 1.39 check from top level meson.build
We do this check inside video/out/meson.build, and the subdirectory is
included before this already
2025-07-12 13:59:11 +00:00
llyyr 112f0000cb wayland: use _SINCE_VERSION instead of checking for enum constant
We can't use #ifndef with an enumerator, this would evaluate to always
be true
2025-07-11 21:54:01 -05:00
Kacper Michajłow 88f34229c6 fuzzers/common: stop after 15 events if there is not playback reset
We wait for timeout and stop fuzzing, but if there are events spammed
this timeout never fire, so instead limit the number of events after
playback reset.
2025-07-12 01:57:43 +02:00
Kacper Michajłow 84596abd83 demux_lavf: disable demuxer-lavf-o for fuzzing
This is raw option passed to lavf and can be used to inject complex
filters and so on, avoid this for fuzzing as it more fuzzing ffmpeg side
anyway and causes issues with timeouts for some big processing.
2025-07-12 01:57:43 +02:00
Kacper Michajłow f07dbb3aef demux_edl: limit to 3 parts for fuzzing
There is no need to test huge playlists, 3 elements it enough to test
parsing.
2025-07-12 01:57:43 +02:00
Kacper Michajłow fec62de298 demux: add nested demuxer depth limit
Useful for demux_edl where it is possible to have huge nested tree of
demuxers and they are added recursively, which causes stack overflow in
some cases.

Found by OSS-Fuzz.
2025-07-12 01:57:43 +02:00
llyyr d21b1f159c vo: move vo_gpu_next above vo_gpu in probe order 2025-07-12 01:34:02 +02:00
Kacper Michajłow da538f3f29 d3d11_helpers: add caching of dxgi factory until it's current
Also cache last dxgi output, to avoid enumerating outputs, this is done
on every frame and we want to minimize impact of it.

While at it refactor and split loading libraries.
2025-07-11 21:53:58 +02:00
Kacper Michajłow 0b6feb993b vo_gpu_next: add source-dynamic mode to colorspace hint 2025-07-11 21:53:58 +02:00
Kacper Michajłow 72fe8fe3ea vo_gpu_next: infer best containing primaries for raw primaries 2025-07-11 21:53:58 +02:00
Kacper Michajłow 84c9eafaa9 vo_gpu_next: override target params when pass_colorspace is used
pass_colorspace mode is special and doesn't set parameters on the
swapchain, so don't use swapchain reported parameters.
2025-07-11 21:53:58 +02:00
Kacper Michajłow c5c1477eb4 vo_gpu_next: change --target-colorspace-hint to auto by default
Auto mode will also enable hint for SDR formats if target metadata is
reported by current output context.
2025-07-11 21:53:58 +02:00
Kacper Michajłow ce076de31f vo_gpu_next: add --target-colorspace-hint-mode option
Useful to actually set target display paramters to colorspace hint.
2025-07-11 21:53:58 +02:00
Kacper Michajłow 5b1df3c5d9 command: add video-params/prim-* properies
Available if raw primaries differ than named primaries value.
2025-07-11 21:53:58 +02:00
Kacper Michajłow 8b64a5d937 video/out/vulkan/context_win: add support for getting colorspace 2025-07-11 21:53:58 +02:00
Kacper Michajłow b352fcb90a d3d11_helpers: refactor target colorspace code
Instead of using IDXGISwapChain::GetContainingOutput create new DXGI
interface on each query. This may not be as efficient, but it solves the
issue where metadata is not updated after changing display settings.
DXGI caches parameters on swapchain creation and never updates it.

Also refactor it so it can be used from other contexts.

Note that DXGI is not D3D11, it's mixed in mpv code, may be cleaned in
the future.
2025-07-11 21:53:58 +02:00
Julian Orth 39c9d1acb4 video/out/vulkan/context_wayland: implement target_csp for wayland
This implements target_csp in terms of the preferred color description
of the video surface.
2025-07-11 21:53:58 +02:00
Kacper Michajłow e72bc1fefc video/out/d3d11/context: add missing white point and max fall metadata 2025-07-11 21:53:58 +02:00
Guido Cella f471f8cfa5 DOCS/man/input: only sequence prefixes need to be unbound
Reword this paragraph making it clear that as long as a and a-b are not
bound, the a-b-c binding works even if b is bound.

The 4-key limit for sequences was raised to 16 by a5dbf34094, because
MP_MAX_KEY_DOWN is used for both the number of keys that can be held
down and for the key history size. Just remove the related sentence
since you're never going to need sequences longer than 16 keys.
2025-07-10 11:05:48 +03:00
dyphire 00dbdf122b DOCS/man/options: blend-subtitles affects hdr subtitle peak behavior 2025-07-09 18:59:12 +02:00
Kacper Michajłow 9baadc6cc9 player/loadfile: limit playlist length to 3 for fuzzing
We have 5 seconds limit for file playback, so 10 items it's bit much. 3
should be enough to cover some file switching and so on.
2025-07-09 00:08:37 +02:00
ourfor 7df09125f3 video/out/d3d11: add d3d11 composition mode support 2025-07-07 00:09:08 +02:00
Kacper Michajłow b91b71a444 vo_gpu_next: if colorspace is set on swapchain respect its parameters
If color space hint is enabled respect configured parameters of
swapchain. When color space hint is disabled, override output freely.

This fixes possible fallback or other decisions about output made during
the swapchain color space negotiation.
2025-07-06 18:02:06 +02:00
dyphire 3f6038f6cc select.lua: refactor subtitle parse
Avoid repeated display of the same content at the same subtitle time

Keep blank lines for both lrc and srt formats
2025-07-06 17:18:10 +02:00
dyphire f7707e4dd9 vo_gpu_next: add options to control subtitles peak for HDR output
Users may want to have darker subtitle brightness for HDR viewing

Closed https://github.com/mpv-player/mpv/issues/13680
2025-07-06 16:00:51 +02:00
nanahi b9ed523c36 DOCS/man/options: document target-prim display-p3
This is common in most consumer "wide gamut" displays since everyone
copies Apple.
2025-07-06 15:18:53 +02:00
dyphire cbea6013e4 player/command: add a default flag to the track add commands 2025-07-06 12:52:22 +02:00
dyphire 2d149e007f misc/language: parse default tag from external subtitle tracks 2025-07-06 12:52:22 +02:00
Kacper Michajłow db7bc5949a vo_gpu_next: be smarter about target colorspace selection
When targeting SDR on display with enabled HDR, compositor will have to
convert SDR to HDR transfer before sending this to display. Resulting in
most certainly wrong output.

To avoid this always convert SDR to target transfer function when
hinting, this way, we do the conversion in mpv and not defer it down the
pipeline.

Unfortunately it's not very portable to detect if we have HDR display
output and "guess" if what we send to display will be correctly
interpreted or not. But we do this when we can.

Also don't force target_peak value from auto detection, use value from
libplacebo.
2025-07-05 23:42:00 +02:00
Kacper Michajłow 3c95d65986 Revert "vo_gpu_next: don't set target peak for SDR output transfers"
I clearly meant SDR output on HDR display only, this commit was wrong.

This reverts commit 0470a3062a.
2025-07-05 23:42:00 +02:00
nanahi 11d3ad635f DOCS/interface-changes: add --prefetch-playlist default change 2025-07-05 21:29:37 +02:00
nanahi e7eefcd490 Revert "manpage: clarify that you can prefetch m3u8 urls"
This commit is based on incorrect information, see previous commit.
It also deletes the correct information the prefetch starts when the
current file is fully load.

The commit also misunderstood the comment about m3u8 urls. It refers to
the prefetching of file data inside the m3u8 stream manifest data, which
has nothing to do with mpv playlists when the m3u8 urls are opened as one
stream by ffmpeg.

The original comment was not very clear about this, so add more details
about this.

This reverts commit d4bf179e78.
2025-07-05 21:29:37 +02:00
nanahi c301667515 Revert "options: default to --prefetch-playlist=yes"
The decision was based on incorrect assumption that this option
"only opens a connection to the next file, and the cache of the next
video starts empty", a prequisite of the assumption that this option
has no major drawbacks, including incurring unwanted network traffic.

The assumption can be proven incorrect by testing with networked files
in playlist. With log level set to debug, the following lines are shown
after the next file is prefetched, while monitoring of network traffic
shows constant network traffic after the currect file cache reading
reaches EOF, which triggers prefetching:

[cplayer] Opening done: <url to prefetched file>
[lavf] select track 0
[lavf] select track 1
[lavf] EOF reached.
[ffmpeg] AVIOContext: Statistics: 37139315 bytes read, 0 seeks

It is clear that saying "there is nothing to prefetch after the first
frame" is a complete lie: in fact, it fetches the whole file to the
demuxer cache, according to the demuxer cache settings. And when the next
file plays, it also starts with full cache rather than "an empty cache".

In fact, what this option really does is written in
556e204a11: --prefetch-playlist calls
demux_start_prefetch() which does the same thing as the
--demuxer-cache-wait option:

"Before starting playback, read data until either the end of the file was
reached, or the demuxer cache has reached maximum capacity."

This is exactly what is happening with the testing. This option will indeed
cause large amount of unwanted network traffic - a concern raised in the
discussion concerning this option.

Revert this commit since it's based on incorrect assumption, and subsequent
incorrect conclusions derived from it in the subsequent discussions.

This reverts commit 978b219889.
2025-07-05 21:29:37 +02:00
Kacper Michajłow 5f927c6333 fuzzers: limit input size to 100KiB
While testing larger inputs can be useful for uncovering bugs related to
processing large data or inefficiencies in memory allocation, it also
makes the fuzzing process slower and more fragile.

Beyond the obvious slowdown, there are OOM issues and even in libFuzzer.
Specifically, in fuzzer::InputCorpus::AddToCorpus, after a few hours of
fuzzing, we accumulate so many inputs that memory usage exceeds our
quota. This could be mitigated in other ways, such as dumping data early
or shortening the fuzzing run duration. However, in practice, these huge
inputs are often not very useful.

This change will also encourage the fuzzer to mutate existing data
rather than continually adding more bytes to input, because it give
higher coverage. Which in turn will produce higher quality corpus.

The 100 KiB limit could be reduced further. It's still quite large, let's
see how it performs. I believe even 10 KiB might be sufficient or less.

This issue is especially noticeable in the Matroska fuzzer, because we
add input data there, which is bigger and sets max_len high in fuzzer
itself.

In a perfect world, we wouldn't need to impose such limits, but in
reality, we face constraints in both memory and compute resources.

I'll monitor coverage and fuzzing results after this change and adjust
as needed. Unfortunately, this will discard all existing corpus entries
larger than the limit, but that's expected.
2025-07-05 16:35:00 +02:00
Guido Cella 614e3c4223 console.lua: bind Ctrl+y to copy
Make Ctrl+y copy the input line to the clipboard, or the currently
selected item in the menu.

The vi key to copy is used because Ctrl+c is already bound.

Alternative bindings are:
Ctrl+x to cut, but this also clears the line.
Ctrl+shift+c like in terminals, but this is harder to press, and this
commit works differently from terminals anyway since you don't manually
highlight characters, it just copies the whole line.
Alt+w, the emacs copy binding, but unless you use emacs this is weird
and unfamiliar.
2025-07-05 01:20:02 +02:00
Kacper Michajłow 0470a3062a vo_gpu_next: don't set target peak for SDR output transfers
Also don't use ICC luma value if target is SDR. Basically setting
max_luma for SDR target is not working well with libplacebo, so avoid
this.
2025-07-05 01:18:05 +02:00
nanahi db99bca912 video/out/vo_gpu_next: implement background tile options for gpu-next
These options are already supported in pl_render_params.
2025-07-05 01:17:25 +02:00
nanahi 63defa7708 video/out/gpu/video: add options to control background tile appearance
Add options to control background tile colors and size and vo_gpu
implementation.
This allows a dark mode tile pattern.
2025-07-05 01:17:25 +02:00
Kacper Michajłow 570c5ec849 m_option: add m_opt_choice_str_def
Most users of this function doesn't expect it to return NULL, with
exception of Stereo-3D video mode. Which is a list directly linked to
Matroska specification, and used as value check in demux_mkv and also
when printing format.

There already was a MP_STEREO3D_NAME_DEF macro, so just promote this to
more generic function.

Fixes assert on invalid value found by OSS-Fuzz.
Fixes double evaluation in MP_STEREO3D_NAME_DEF macro.
2025-07-04 15:46:39 +02:00
MarieVelter42 89427a4201 osc.lua: fix volume icon not updating while paused
Volume icon in the OSC did not update when mute toggled or
volume changed while playback was paused and mouse was idle.

This commit adds observers for mute and volume properties to
request_tick(), ensuring OSC updates immediately on mute or
volume changes, even if playback is paused and mouse is idle.
2025-07-04 10:17:04 +02:00
jsaowji 89c3f4d5c1 demux_cue: ignore mcn 2025-07-04 10:16:45 +02:00
nanahi a043624ea6 osc.lua: fix element touch handling
On some compositors, when all touch points disappear the compositors
reset the mouse position, which moves the mouse out of the osc element
trigger area so mouse up events do not happen.

Fix this by tracking the last touch position and use that as the virt
mouse position if the screen is recently touched.
2025-06-29 18:16:54 +02:00
rkscv 5f8d5f8e8b DOCS/man/lua: fix spacing issues 2025-06-29 11:41:44 +02:00
llyyr 591522c38f wayland: check if we have color representation manager first
before using it
2025-06-28 21:30:24 +00:00
Dudemanguy ed8954e8cf wayland: add support for wp-color-representation-v1
This is yet another color-related protocol for wayland. It's pretty
simple compared to the color-management protocol, and there's no real
reason to not advertise the color representation to compositors that
might find it useful.
2025-06-27 23:38:48 +00:00
nanahi 18defc8530 stats.lua: fix append_property exclusions
f676a9ff20 changed some append_property
calls to append, but append does not support the exclusion feature
which results in "HW: no" shown when no hwdec is active when this
was not displayed before.

Fix this by adding option to append_property to use get_property_cached.

Fixes: f676a9ff20
2025-06-20 16:13:14 +02:00
Dudemanguy 494afa4115 test/libmpv_test_track_selection: add a test for regional languages
Relevant for the forced subtitle case where we want a regional audio
language like en-US to match eng language subtitles. The general
matching logic is covered in the language test already.
2025-06-19 20:18:02 +00:00
Dudemanguy 580f2ecbd5 player/loadfile: match audio and subtitle language with mp_match_lang
For matching the audio language with the track subtitle language,
strcasecmp is insufficient since it only allows exact matches and misses
the language regional variant. Fix this by simply using mp_match_lang
instead.

Fixes #16461.
2025-06-19 20:18:02 +00:00
Norgerman e8ade130fa ci/win32: enable libaom 2025-06-12 18:08:32 +02:00
Norgerman e612f419f3 ci/win32: manually install cmake to fix cpu detection issue 2025-06-12 18:08:32 +02:00
Kacper Michajłow 47bc7b2a07 ytdl_hook.lua: add support for HEVC 2025-06-10 17:52:25 +02:00
Roman Bochagov 59d5f774a4 ao_avfoundation: fix memory leak
Fix memory leak in ao_avfoundation caused by audio device switching.

Fixes #16283
2025-06-09 19:31:48 +02:00
Kacper Michajłow a418d21635 github/workflows/lint: exclude font.props from xml check 2025-06-06 10:45:52 +02:00
sfan5 6b178e4f5a misc/path_utils: create folders with 0777 mode
This better matches other Unix tools.
Note that in practice the umask downgrades this to 0755 or 0775, so folders don't actually end up world-readable.
2025-06-02 15:59:05 +02:00
sfan5 9db49973f2 misc/path_utils: check existence first in mp_mkdirp() 2025-06-02 15:59:05 +02:00
sfan5 013e76e1c0 player: create missing folders for watch-history-path
fixes: #16357
2025-06-02 15:59:05 +02:00
sfan5 c4a00b2c85 player: handle unavailable options while writing watch-later file
fixes: #16410
2025-06-02 15:59:05 +02:00
sfan5 7182991bc4 sub/lavc_conv: also log decoder used 2025-06-02 15:59:05 +02:00
sfan5 6c6e81314a DOCS/libmpv: clarify that handle used by cplugin cannot be destroyed 2025-06-02 15:59:05 +02:00
sfan5 0f26d9f1ee sub/sd_lavc: fix condition for probing output type
This fixes decoding with libaribb24.
closes #16384
2025-06-02 15:59:05 +02:00
nanahi 730062b510 command: fix frame step with mouse buttons
c7c09fdb8b made frame step with seek flag
ignore key ups. However, for commands with emit_on_up flag set, which can
happen with mouse buttons, command should only be triggered on key ups.
This results in frame-step command with seek flag triggered on mouse down
instead of mouse up, and frame-back-step command not working with mouse.

Fix this by making sure that step is triggered depending on the emit_on_up
flag.

Fixes: c7c09fdb8b
2025-05-31 10:01:22 +02:00
sfan5 063a9b8c89 sd_lavc: log some useful information 2025-05-31 09:59:54 +02:00
sfan5 c0efee0512 video/image_writer: improve logging of conversions and encoder 2025-05-31 09:59:54 +02:00
sfan5 cf00b07536 various: use MP_ARRAY_SIZE macro 2025-05-31 09:59:54 +02:00
Kacper Michajłow 1d1535ff91 ci/openbsd: bump to 7.7 and remove ffmpeg subproject 2025-05-23 00:13:23 +02:00
Patrick Wang 43e83dc74b options: parse tls-related options as path 2025-05-21 14:43:24 +00:00
Kacper Michajłow 8407df979f sub/osd_libass: don't rerender OSD if not changed
Rendering OSD on every frame draw is quite heavy, even if some of the
rendering parts are cached, it still takes significant amount of time,
depending of payload can take 8-10 ms just to do the text shaping.

Instead render only when we need it.
2025-05-21 09:45:43 +02:00
Kacper Michajłow 817372ac96 demux_lavf: check if context is correctly passed to callbacks by ffmpeg
To catch ffmpeg bugs early, instead of crashing or worse.
2025-05-17 21:33:58 +02:00
Dudemanguy f9ec3d2c25 wayland: allow potential dragging of maximized windows
The locked_size restriction also prevents dragging from working on
maximized and tiled windows. A compositor may choose to restrict this
anyway (esp. tiling window managers), but there's no harm in sending the
request if it supports it. The only thing we really need to block here
is the fullscreen case. Fixes #16338.
2025-05-14 13:49:37 +00:00
Kacper Michajłow 4522929741 ci/win32: revert back ffmpeg to meson-7.1 branch
Also fixes jpegxl build after upstream changes. It wasn't enabled
correctly before.
2025-05-13 20:11:34 +02:00
Attila Fidan c399422722 clipboard-wayland: flush display after creating data sources
The data source requests are prepared inside create_data_sources from a
different thread than the clipboard thread, so it is necessary to flush
here. Otherwise, if mpv is not already managing the current selection,
we'll have to wait until the clipboard thread reenters
clipboard_wayland_dispatch_events for the request to be sent to the
compositor and have the other clients be sent new the new selection,
which may take up to 10 seconds.
2025-05-13 13:41:48 +00:00
Christopher Degawa b3070d1255 build: move check for DXGI_DEBUG_D3D11 down
video/out/gpu/d3d11_helpers.c requires it as well, and it's possible to
have egl-angle-win32 enabled without d3d11.

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
2025-05-09 12:47:44 +02:00
Kacper Michajłow 95c882dddc ci/win32: pin ffmpeg revision to the latest working one
Until this is fixed upstream:
https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg/-/issues/56
2025-05-09 12:44:47 +02:00
xyfish 139591a078 libarchive: try to use utf8 pathname 2025-05-08 00:46:23 +02:00
Ryan Hendrickson 3baf2e1ef8 DOCS/man/options: equivalent -> analogous 2025-05-08 00:45:57 +02:00
Guido Cella d702e5fec8 console.lua: set compute_bounds and hidden at startup
There is no need to set them every time the width is calculated.
2025-05-03 22:45:10 +02:00
Guido Cella 4194522344 console.lua: rename option_color_to_ass to color_option_to_ass
It is more correct English.
2025-05-03 22:45:10 +02:00
sfan5 e663cbc037 vo: move vo_mediacodec_embed to not be the default on Android 2025-05-03 18:13:35 +03:00
Kacper Michajłow 61be670716 ra_d3d11: mark cache_magic as nonstring for GCC 15 2025-04-28 15:54:12 +02:00
Kacper Michajłow cf3e332abb osdep/win32/smtc: workaround GCC 15 bogus template warning
Drop it to warning, even if -Werror is in effect. Interesting part is
that this makes this warning disappear completely. GCC diagnostics at
its finest.
2025-04-28 15:54:12 +02:00
Kacper Michajłow 22aacb4008 misc/language: mark arrays as nonstring for GCC 15
Fixes unterminated-string-initialization warnings.
2025-04-28 15:54:12 +02:00
Kacper Michajłow f8cef99033 demux_lavf: replace deprecated usage of stack allocated AVPackets
sizeof(AVPacket) being part of an ABI is deprecated. This was the last
remaining stack usage, missed in previous related change.

Note that we still use sizeof(AVPacket) and sizeof(AVBufferRef) in
demux_packet_estimate_total_size(). But it's safe, the worse that can
happen is that we underestimate the size on mismatch.

Fixes: cb15bc4324
2025-04-27 16:53:57 +02:00
Kacper Michajłow b72d6aa0e1 demux_lavf: fix unconstrained cache size with wrapped AVFrame packets
Fixes excessive memory usage with avdevice input. After [1] packets
returned from avdevice contains wrapped AVFrame. mpv estimates packet
size to limit how many of them are cached. The size were not correctly
calculated, because packed contained only AVFrame* and not the actual
data in buffer. Fix this by calculating wrapped size and add it to our
size estimation.

[1] https://github.com/FFmpeg/FFmpeg/commit/6ca43a9675d651d7ea47c7ba2fafb1bf831c4d0b
2025-04-27 16:53:57 +02:00
nanahi b47c805fa2 various: remove redundant return
void return type functions don't need a final return statement.
2025-04-27 00:10:31 +02:00
Leo Izen 2b38b382cf video/image_writer: tag bits_per_raw_sample when pixfmt changes
This populates the AVCodecContext->bits_per_raw_sample field value
when the pixel format of the screenshot being written doesn't match the
pixel format of the original video. For example, if the original video
was 10-bit and the screenshot is 16-bit, it populates this field so the
encoder can make use of it.

Currently libjxl and png encoders are known to accept this tag and set
the corresponding metadata (via BitDepthHeader, or sBIT).

This feature is only enabled if screenshot-sw=yes is enabled, because
screenshots from a hardware buffer are always natively at max-depth.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-04-25 05:39:48 -04:00
nanahi f147df1393 wayland: print errno strerror for data offer read/write 2025-04-22 22:07:48 +00:00
nanahi 26cb87a2d7 DOCS/man/input: add documentation for Wayland and macOS clipboard write
Wayland clipboard writing is added. macOS clipboard writing was
already implemented but it was forgotten to update the documentation.
2025-04-22 22:07:48 +00:00
nanahi 788b362d5f clipboard-wayland: support clipboard writing
This adds clipboard writing support for the native Wayland clipboard
backend for the ext-data-control-v1 protocol. Both clipboard and
primary selection are supported.
2025-04-22 22:07:48 +00:00
nanahi 688922ee85 video/out/wayland_common: support clipboard writing
This adds clipboard writing support for the VO clipboard backend
when a Wayland VO is active for the wayland core protocol.
2025-04-22 22:07:48 +00:00
nanahi ccd52142f5 video/out/wayland_common: rename dnd_ddev to data_device
The data device is used for both dnd and clipboard, so change it to
a better name.
2025-04-22 22:07:48 +00:00
nanahi 615ee4d9f5 video/out/wayland_common: save last user input serial
This is required for setting selection for clipboard writing.
2025-04-22 22:07:48 +00:00
llyyr b8ab1074eb wayland: log output user-friendly wl_output name
make and model aren't guaranteed to be available, so print the name as
well. This is usually just the connector name e.g. HDMI-A-1.
2025-04-21 15:33:52 +00:00
llyyr 35a98de55e wayland: log when direct scanout is active
Useful for debugging issues with certain AMD GPUs that have problems
that are only present in zero copy scenarios
2025-04-21 15:33:45 +00:00
Guido Cella 3600c716ea console.lua: fix crash when pressing Ctrl+l
Pressing Ctrl+l with selectable items without having called input.get()
earlier caused a crash.

Fixes a6024b562a.
2025-04-18 12:02:47 +02:00
Kacper Michajłow 94bc7315bd video/zimg: set alpha to ZIMG_ALPHA_STRAIGHT in all cases except premul
Fixes: 6a96b15cf4 ("video/csputils: add missing alpha choice")
Fixes: #16255
2025-04-17 21:50:18 +02:00
Guido Cella 01b51d1f72 options: add cue to --playlist-exts's defaut value 2025-04-17 21:40:04 +02:00
llyyr 0dc24a2301 sub/osd: set osd-shaper to complex by default
I'd rather not argue about which is better so go back to status quo,
users can use the more sensible option of "simple" if it doesn't break
anything (which it won't).

Using simple has benefits of growing memory usage slower and much faster
OSD rendering when complex isn't needed.

Simple breaks rendering complex glyphs like Material font icons

Fixes: https://github.com/tomasklaen/uosc/issues/1086
Fixes: f24611980c ("sub/osd: add osd-shaper and set it to simple by default")
2025-04-17 15:44:15 +02:00
yumcookiez df1e71a7cc ytdl_hook: add option to extract chapters 2025-04-17 00:37:13 +02:00
Guido Cella 498a9bf464 console.lua: center correctly within OSC margins
Center in the middle of the rectangle surrounded by the OSC instead of
in the center of the window.
2025-04-17 00:17:01 +02:00
Guido Cella 4dfe92fa27 console.lua: replace font script-opt with monospace_font
Allow configuring the monospace font without also changing the
proportional font. The proportional font is configured with the standard
--osd-font.
2025-04-17 00:13:19 +02:00
Guido Cella 42660a8c23 console.lua: say focused instead of selected
The selected term was causing confusion e.g. in
https://github.com/mpv-player/mpv/pull/15711#issuecomment-2676060139.
Saying either focused or current makes more sense since the item is not
actually selected until you click or press Enter.
2025-04-17 00:08:16 +02:00
Kacper Michajłow 1f809734b2 options: add ivf to video extensions 2025-04-17 00:07:49 +02:00
Kacper Michajłow ceb949216e options/m_option: assert if choice value is valid
This function should never be called with invalid values. That would
mean some of our internal state is invalid.
2025-04-17 00:07:39 +02:00
Kacper Michajłow 6a96b15cf4 video/csputils: add missing alpha choice 2025-04-17 00:07:39 +02:00
Guido Cella b554d43cde select.lua: display editions when before the first edition
When the first edition is not at the start of the file but after the
current time position, the current-edition property is -1, which
prevented displaying any edition.

Fixes https://github.com/mpv-player/mpv/issues/16073#issuecomment-2787316609
2025-04-17 00:07:22 +02:00
Guido Cella d059f648fa console.lua: repurpose case_sensitive to only affect exact searches
case_sensitive originally only affected Tab completion. It defaulted to
yes outside of Windows just to emulate the bad defaults of bash and zsh
(not fish, which has better defaults and defaults to case-insensitive
completion). This was already silly, but then it affected the fuzzy
autocompletion and case-sensitive fuzzy completion is even more silly.
And since 0b3cc3a167, it accidentally stopped affecting even that,
because the completion via script message never checked for the option.
Nobody even noticed this, meaning that nobody was relying on fuzzy
autocompletion being case-sensitive.

Just make case_sensitive only affect the new exact search, and make it
default to no on all platforms. Though IMO the search could just always
be case-insensitive.
2025-04-17 00:01:27 +02:00
Guido Cella 4cb5f7aa1f console.lua: implement exact matching
Allow matching items exactly instead of fuzzily when prefixing the
search with ' (like in fzf) or with
--script-opt=console-exact_match=yes.

This is mainly useful to filter history entries chronologically.

You can also specify multiple search terms delimited by spaces. But '
makes every term an exact match, unlike fzf where you need to place it
before every word, since we can't hook into fzy's algorithm.

Closes #14587.
2025-04-17 00:01:27 +02:00
Kacper Michajłow bff0d59cbe stats.lua: set plot_{perfdata,vsync_ratio,vsync_jitter} to no
Disables perf graphs from stats.lua. They are relatively expensive to
render, causes a lot of memory to be used for caches which are never
reused because graph is rarely the same. And most importantly those
graphs are not that useful beyond quick visual inspection of jitter.

Can be enable in script-opt if needed. Cache graph is left enabled,
because it shows if cache readhead grows or not nicely.
2025-04-16 23:58:46 +02:00
Kacper Michajłow fd1007260c stats.lua: add stats-plot_cache script-opt
Allows to disable cache graphs on page 3 of stats.lua.

Fixes: #13894
2025-04-16 23:58:46 +02:00
Mike Will d1d2d9a0bb osc.lua: update OSC on playlist position changes
Fixes: 168fb56fe8
2025-04-16 23:58:28 +02:00
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
Kacper Michajłow 38439dd531 threads: remove unused recursive mutex support
After removal of `MP_MUTEX_RECURSIVE` from vdpau.c there are no more
clients of recursive mutex. Remove all the code related to it. This
commit can be reverted if in the future it is needed again. For now
let's not keep dead code.
2025-03-26 19:16:21 +01:00
Lynne 9964104a6e vd_lavc: enable FFv1 hwaccel by default
FFmpeg recently got a hardware accelerated decoder for FFv1.
The decoder has been tested on all major vendors and operating systems.
Intel support is currently disabled as all of their drivers have issues
with buffer device addresses.
Since its a software-defined implementation, internal issues can be fixed
and the overall implementation optimized further.

With that, I think it should be safe to enable it by default.
2025-03-26 18:40:58 +01:00
Kacper Michajłow 74d3c2f0e7 mp_image: set repr.alpha and repr.bits when mapping AVFrame
Fixes invalid colors with gpu-next direct mapping of some formats.
2025-03-26 18:39:40 +01:00
Kacper Michajłow d9f27bd0f1 video/vdpau: change is_preempted bool to atomic
And eliminate recursive lock. This doesn't have to be guarded by mutex,
if for some reason preemption happens while we are handling preemption,
we remember the flag and do the dance gain. This is even nicer than
locking preemption callback.
2025-03-26 18:31:54 +01:00
한승민 513ccb9227 DOCS/interface-changes/kitty-passthrough: option addition notice 2025-03-26 18:25:49 +01:00
한승민 699a0bec42 vo_kitty: use priv as talloc context
- `priv` is used as `talloc_ctx`/`ta_parent` in `bstr_xappend_*` calls.
- `free_bufs` no longer frees `priv->cmd.start`.
- `bstr_*_passthrough` functions have been stripped off the `bstr_x`
  prefix.
2025-03-26 18:25:49 +01:00
한승민 ccad32e961 vo_kitty: remove DCS_GUARD_* macros
The `DCS_GUARD_*` macros have been removed in the favor of actual
functions
2025-03-26 18:25:49 +01:00
한승민 8edabd5644 vo_kitty: do not add trailing NULL byte in payload
In the past `strlen` was used in the write function, which omitted the
trailing NULL byte, however with the addition of `bstr` API the NULL
byte produced by `av_base64_encode` in the output is also written to
stdout, this causes terminals (namely Ghostty) to not display the frame.

There was also an additional edge case where if the entire output is
less than 4096 bytes the finishing escape sequence `\033_Gm=0;` was
never emitted. Adding a check for this after the for loop fixes this
behavior.
2025-03-26 18:25:49 +01:00
한승민 d9dc84c0fc vo_kitty: add auto-multiplexer-passthrough option
Terminal multiplexers like (screen, tmux, ...) do not support the kitty
image protocol (as of yet), to go around this DCS escape sequences are
used (`\ePtmux;...\e\` for tmux, `\eP...\e\` for screen). This option
allows passing thorugh the kitty image escape sequences.

`\033\\` suffixes from `KITTY_ESC_IMG_SHM` and `KITTY_ESC_DELETE_ALL`
have been removed. This makes it easier to wrap the escape sequences in
a DCS control sequence since there will be no `\033` in them to escape
(as multiplexers require escaping the escapes within the DCS data
string). `DCS_GUARD_WRITE` and `DCS_GUARD_APPEND` macros have been added
to wrap escape sequences in DCS control sequence based on the
availability of the `priv->dcs_prefix` property.
2025-03-26 18:25:49 +01:00
한승민 aad5329fd1 vo_kitty: reallocate cmd.start on reconfigure
`priv->cmd.start` is being freed in `reconfig` without being allocated
again this caused a segfault if `flip_page` was called after `reconfig`.
This segfault could be triggered by sending a SIGWINCH (resizing the
terminal).
2025-03-26 18:25:49 +01:00
Dudemanguy 0c3f1c0f6e build: make drm optional again for vo_dmabuf_wayland
We used to deal more directly with drm-specific things, but that has all
since been removed and is known to not be needed. We can relax the build
requirements some more since vo_dmabuf_wayland will simply error out if
no hwdec backend is available at init.
2025-03-26 15:31:08 +01:00
DudemanguyandKacper Michajłow a9dccf22a1 build: use a drm_fourcc header check for vaapi on gl
The underlying interop only needs the DRM fourcc defined in the header.

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2025-03-26 15:31:08 +01:00
Guido Cella e88864aef3 commands.lua: add remember_input script-opt
Allow clearing the input line on close. Fixes #16104.
2025-03-26 14:56:48 +01:00
Guido Cella ba80e447a6 console.lua: use a variadic function 2025-03-26 14:48:37 +01:00
Dudemanguy 1b231b4e57 wayland: accept version 2 of the cursor-shape protocol
The version 2 changes only add some enums which makes zero difference to
us so we can just allow the newer version.
2025-03-26 02:19:44 +00:00
Guido Cella 6ec0d06aa9 console.lua: use double quotes
Make it consistent with other scripts.
2025-03-26 02:53:01 +01:00
nanahi af1ac0f685 playloop: only notify MP_EVENT_INPUT_PROCESSED when needed
MP_EVENT_INPUT_PROCESSED is used to notify mouse and touch position
updates, but it is currently notified for all input commands even when
they have nothing to do with mouse position. This results in unnecessary
acquisition and comparision of mouse and touch positions for all commands.

Optimize this by checking whether the command is marked as requiring the
event notification, and only notify if that is true.
2025-03-26 01:33:21 +01:00
nanahi ca6e26399f input: mark mouse and touch position update in mp_cmd
This makes it possible to distinguish these dummy commands
for position update notification from other commands.
2025-03-26 01:33:21 +01:00
nanahi f676a9ff20 stats.lua: cache some properties
Some properties can take a long time to query, especially those which
require voctrl like current-window-scale and display-names.

Similar to d37521b5ef, make the script
observe these properties and cache the values to avoid querying them
on every refresh. This alleviates the issue when holding down "i" key
for a while and releasing it results in stats being stuck on display
for a long time because of the time required to query there properties.
2025-03-26 01:30:46 +01:00
nanahi e70d67f7ca DOCS/man/options: remove bogus messages about the client API
The messages referred to "no" prefixes like --no-audio not working with
the client API. The language was removed in
b1ee92ad4a.

Remove the messages which are bogus and incorrect now.
2025-03-26 01:29:52 +01:00
Kacper Michajłow f972cb6dc4 meson: disable stack protector for mpv.com
This is a bare runner for mpv.exe. There is no need for a stack
protector here and when it is forced to be added by -fno-stack-protector
it complains about missing symbols, because we don't link any standard
libs here.

Fixes:
undefined symbol: __stack_chk_fail
undefined symbol: __stack_chk_guard

We could define those, but mpv.com wrapper doesn't need it.
2025-03-26 01:28:50 +01:00
sfan5 97cb16d683 RELEASE_NOTES: remove accidental BOM
linting is good and all but does this check really need to fail on every single commit from now on?
2025-03-25 18:39:00 +01:00
sfan5 2da0b49038 Update MPV_VERSION 2025-03-25 18:36:18 +01:00
sfan5 e48ac7ce08 Release 0.40.0 2025-03-25 18:33:27 +01:00
sfan5 425037a16a DOCS: refresh some parts of the release policy 2025-03-25 17:57:53 +01:00
nanahi 01e68e653c m_option: fix string list printing for empty lists
When converting list options to strings and the value is empty, an
empty string is returned. This is true for key value list and object
settings list options. However, for string list options, there is an
edge case: if the list exists but has no element (which can happen
when using change-list command), it behaves as if the property does
not exist and returns "(error)". This causes confusing messages when
toggling glsl-shaders at runtime and seeing "(error)" printed as the
value when all shaders are toggled off, for example.

8461143ed7 attempted to fix it, which
fixed the case for unset string list, but not for a list with no
element.

Fix this by making sure an empty string is returned in this case.
2025-03-25 17:14:01 +01:00
Guido Cella b31c3d80ab commands.lua: prevent infinite logging with debug log level
With -v -v there was an infinite loop of log messages, because every new
logged script message to console triggers a new script message, which
gets logged again.
2025-03-23 22:56:39 +01:00
Christoph Heinrich 958fee6895 ytdl_hook.lua: fix duplicated chapters
Sometimes when opening a YouTube video with chapters, the chapter-list
ended up having all the chapters twice, despite the json from yt-dlp only
containing them once. That must mean that sometimes add_single_video()
runs twice before the chapter_list table gets cleared in the
on_preloaded hook.

This can be avoided by replacing chapter_list with a new table before
adding entries to it.
2025-03-23 22:52:12 +01:00
Kacper Michajłow 8e4493b4a2 Revert "input.conf: bind MBTN_MID to align-to-cursor"
It can be too easy to change the video position without a single way to
undo the change. Also, this is mostly useful for images. Binding can be
brought back in a better way with an image profile or another method
that is more resistant to accidental clicks.

This reverts commit e98d3b62ec.
2025-03-23 22:49:00 +01:00
Kacper Michajłow 903c805a37 vo: don't burn cpu in paused state for untimed VOs
Fixes VO thread busy looping in paused state for untimed VOs.

One example is vo_lavc (encoding mode), used commonly to extract
thumbnail by scripts.

Example command that was affected:
mpv --ovc=rawvideo --of=image2 --ofopts=update=1 --o=test --pause
file.ext

We have to update request_redraw value to not redraw again. This has
been skipped by early exit before.

This also fixes VO_CAP_NORETAIN case.

Fixes: 8798cec7fa
2025-03-23 17:58:19 +01:00
llyyr b22a4da1df demux_lavf: disable extension_picky for hls demuxer globally
Added in https://github.com/FFmpeg/FFmpeg/commit/91d96dc8ddaebe0b6cb393f672085e6bfaf15a31

The user can still turn this on via demuxer-lavf-o=extension_picky=1 if
they want to.

This causes quite a few problems with many HLS sources where the codecs
are not known at probe time for whatever reason. Youtube for instance
transports aac audio inside ".ts" extension urls which are disallowed by
this option.

As an aside, the FFmpeg test is also buggy and leaks a nested
connection for any playlist item that fails the extension check. mpv
catches this and prints "Leaking 1 nested connections (FFmpeg bug)" for
every HLS stream that has at least one stream that fails the extension
check.
2025-03-23 14:48:06 +01:00
llyyr 678419c5f6 video/out/kitty: set display_par when drawing osd 2025-03-22 17:39:16 +01:00
Lynne a55ae5d6cd vulkan/context: enable VK_KHR_video_maintenance2 if supported
VK_KHR_video_maintenance2 was recently merged in FFmpeg. It significantly
speeds up some problematic HEVC samples, as it avoids needing to recreate
sequence parameters on each frame.
It also generally speeds up everything as it avoids needing to ask the
driver to allocate memory for parameters it sends on every frame anyway.
2025-03-21 18:29:05 -07:00
Guido Cella 6171e4800c select.lua: display chapters when before the first chapter
When the first chapter is not at the start of the file but after the
current time position, the chapter property is -1, which prevented
displaying any chapter.

Fixes #16073.
2025-03-19 12:28:44 +01:00
llyyr 8aa7d783d2 wayland: round values instead of implicitly casting float to int
This matches the behavior of mpv's own drm backend when setting hdr
metadata, as well as Mesa's vulkan wsi's behavior when communicating
VK_EXT_hdr_metadata values to the compositor
2025-03-18 17:38:58 +00:00
Kacper Michajłow 76241dd4a6 ci/build-win32.ps1: exit on errors from external commands early
This requires PowerShell 7.4+ to work, but it's fine for our CI.
2025-03-18 12:38:58 +01:00
Dudemanguy 6c42182522 Revert "console.lua: disable cursor autohide while selector is open"
In retrospect, this isn't so great because not neccesarily everyone
would want the mouse to show with the menu and said menu can be
navigated with the keyboard anyway.

This reverts commit a8f5beb5a3.
2025-03-15 05:19:43 +00:00
verygoodlee a8f5beb5a3 console.lua: disable cursor autohide while selector is open
This is an improvement on #15145 .
If the cursor is automatically hidden, users may not know whether
they are clicking on the inside or outside of selectable items,
the result after clicking is unclear to them.
2025-03-14 15:55:55 +00:00
Dudemanguy d9dadf07ae Revert "ao: correctly set state.playing for non-gapless audio after eof"
There's no good explanation, but I can no longer reproduce the issue
described in the commit. The code as is can cause a "File descriptor in
bad state" message when looping or advancing in a playlist because it
jumps a bit too early to the eof part. Perhaps something in alsa somehow
changed, but the non-gapless audio freezing thing doesn't happen
anymore. The audio state correctly updates on play/pause without these
lines. Since this is known to cause problems elsewhere, just revert it
for now. If the alsa problem crops up again in the future, we can
revisit it then.

This reverts commit d33e54250e.
2025-03-13 12:21:38 +01:00
Kacper Michajłow b32cf754e5 opengl/utils: use uintptr_t for arithmetics with possible zero value
Fixes UBSAN warnings, applying non-zero offset to null pointer.
2025-03-13 12:21:16 +01:00
Kacper Michajłow bd3ff140fa hwdec_dxva2dxgi: don't lie about the image format
The conversion is done to DXGI_FORMAT_B8G8R8X8_UNORM, this was tagged
as IMGFMT_RGB0 because vo_gpu didn't understand that B8G8R8X8 needs to be
sampled differently. This is fixed now, so we can tag the image with the
correct format.

Fixes output with dxva2 for gpu-next
(after https://github.com/haasn/libplacebo/commit/bbe63109cba2ef5c7e6aea1c47d5f6994b6dc71c)
and gpu (after previous commit).

Will fail with older libplacebo, but there is no reason to use dxva2
anyway. d3d11va is available on all supported platforms and is bit-exact
unlike dxva2 which always does conversion to 8-bit BGR.

Also note that libplacebo was broken with all BGR inputs up until
recently, and only because it was working the same as vo=gpu, the issue
was canceling out.
2025-03-13 12:21:16 +01:00
Kacper Michajłow 4d08d4d51a vo_gpu: assume not ordered formats are reversed
This is the most common case and in practice we shouldn't use those
formats anyway.

Fixes reading image from bgra8 and bgrx8 formats for example.
2025-03-13 12:21:16 +01:00
Kacper Michajłow d3f03b21b1 hwdec_dxva2dxgi: zero queue_surf on init
Prevents crashes when it fails to init and some fields are left
uninitialized.
2025-03-13 12:21:16 +01:00
Kacper Michajłow 844507a094 ta: add talloc_zero_ptrtype
Convenience macro. I was searching for it few times already, so probably
good to just add it.
2025-03-13 12:21:16 +01:00
verygoodlee ae3420fe66 DOCS/man/input: correct the mode flag of apply-profile command
The default mode actually named `apply` instead of `default`,
it's a mistake that has existed for a long time.
2025-03-12 10:50:32 +01:00
Guido Cella 4c26e7d2ed console.lua: fix crash when pressing Ctrl+c with select
Pressing ctrl+c in select mode crashes if console wasn't opened in
free-form text mode before.

This also makes the type of the history variable clear.

Fixes a6024b562a.
2025-03-10 17:06:02 +01:00
llyyr edf4fdfb1f positioning.lua: clamp values within {-1, 1} for video-align-{x,y}
Otherwise you can move your cursor outside the mpv window while having
align-to-cursor "held" and make the script send illegal values
2025-03-09 12:06:54 +01:00
Kacper Michajłow f751f218bc commands.lua: add cache for often queried constant properties
commands, properties, options, options info, never changes during
runtime, so we can cache them to make the value instantly available.
2025-03-09 11:45:30 +01:00
Kacper MichajłowandGuido Cella d37521b5ef console.lua: cache observed properties to avoid unnecessary fetching
Those properties are already observed and trigger update, remember the
value to avoid re-fetching them.

This fixes delay caused by properties that synchronize GUI thread like
`focused` which takes 30+ ms in certain cases.

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2025-03-09 11:45:30 +01:00
llyyr 4b1315a67f DOCS/man/input: remove stray newline
this breaks the html conversion
2025-03-09 10:56:15 +01:00
Kacper Michajłow d9cf7a3d39 demux_mkv: add A_ATRAC/AT1 support 2025-03-08 21:28:58 +01:00
Kacper Michajłow de52c6276e demux_mkv: set number of samples correctly for The True Audio
14-17	Data length in samples (binary, Little Endian)

This has been validated with sample generated with:
ffmpeg -i $(ffmpeg_fate)/lossless-audio/luckynight-partial.tak -c:a tta lucky.mka

The length is correctly calculated to be 418950 for that sample.

Basically this is a port of https://github.com/FFmpeg/FFmpeg/commit/af248fa1174200acb537a6ab1198bb2fed38e884

Fixes: d53d75e080
2025-03-08 21:28:58 +01:00
Kacper Michajłow a0d164ccaa demux_mkv: add sanity checks for RealAudio packet sizes
This fixes feeding unitialized data in some cases on corrupted/fuzzed
files.
2025-03-08 21:28:58 +01:00
Guido Cella 8385c2b5e8 console.lua: convert cursor_position to number
script-message-to commands type was passing cursor_position as a string,
which caused a crash if you e.g. moved the cursor afterwards. Convert it
to number in console so commands.lua and similar clients don't have to
manually convert it.
2025-03-08 19:09:23 +00:00
Guido Cella 061b83d479 commands.lua: complete filesystem paths for run
Complete file paths after e.g. run mv ${path}. This is similar to how
shells complete file paths for all commands without known completions.
2025-03-08 19:09:23 +00:00
Guido Cella e28c6ceea3 console.lua: default to --osd-font without completions
Currently --osd-font is the default for select, and a monospace font is
the default for free-form text mode. We can also default to the
proportional --osd-font for mp.input.get clients that don't specify
completions and thus don't need alignment, which is most clients.

In builtin scripts, this is the case for filtering stats key bindings.
2025-03-08 19:09:23 +00:00
Guido Cella d738e787a0 console.lua: instantly show completions with the type script message
With script-message-to commands type, instantly show completions if
available. Useful e.g. with loadfile or apply-profile.

This also shows completions if you just close the console with a filled
line and reopen it.
2025-03-08 19:09:23 +00:00
Guido Cella 415078ba2d console.lua: fix the line end position to filter completions
Completions were not being shown if a character in front of the cursor
was not in the completions, e.g. with loadfile '...'
2025-03-08 19:09:23 +00:00
Guido Cella 10bb083ab4 console.lua: don't retrieve --input-ime at startup
This is already retrieved when opening the console.
2025-03-08 19:09:23 +00:00
Guido Cella a839738d1c console.lua: reduce indentation in 2 functions
Nest the shorter blocks instead of the longer ones.
2025-03-08 19:09:23 +00:00
Guido Cella b23bd34921 console.lua: inline log_add()
As it's now used in a single place.
2025-03-08 19:09:23 +00:00
Guido Cella 686eb160e4 console.lua: clear the default item on input.get()
Clear the default item of the last input.select() call to prevent
command history search from highlighting that same default item.
2025-03-08 19:09:23 +00:00
Guido Cella a6024b562a console.lua: declare various variables only in free-form text mode
These are no longer used anywhere in select mode, except for 1 instance
of log_buffers[id].
2025-03-08 19:09:23 +00:00
Guido Cella 6f2ce8aac1 console.lua: don't duplicate the check to add to history 2025-03-08 19:09:23 +00:00
Guido Cella 0b3cc3a167 commands.lua: split this script out of console.lua
It was suggested by CogentRedTester in
https://github.com/mpv-player/mpv/pull/10282#issuecomment-1858727729 and
https://github.com/mpv-player/mpv/pull/10282#issuecomment-1858809580 and
by avih that making running commands an mp.input client is a better
architecture.

A practical advantage is that completions are calculated in a different
thread, which prevents hanging when completing slow/network filesystems.

script-binding console/enable becomes script-binding commands/open,
though the console one is kept as an alias. I took the opportunity to
rename this because open makes more sense for a graphical modal, and it
is the word used in mp.input and user-data.

script-message-to console type becomes script-message-to commands type,
though the console one is kept as an alias. It is also changed to
automatically close on submit without having to append '; keypress ESC'
as you don't need to keep the console open after running prefilled
commands.

Also convert to double quotes like other scripts and rename some
inconsistent functions.
2025-03-08 19:09:23 +00:00
Guido Cella ce6a52d40a console.lua: add history_path field to mp.input.get
This allows saving the history to all mp.input.get clients.

Needed to split running commands out of console.lua.
2025-03-08 19:09:23 +00:00
Guido Cella 05438fc081 console.lua: add autoselect_completion field to mp.input.get
This selects the first completion when pressing Enter when one wasn't
already manually selected.

Needed to split running commands out of console.lua.
2025-03-08 19:09:23 +00:00
Guido Cella 3c175f0114 console.lua: let the complete callback return a character to append
Let the complete callback return the character to append to the selected
completion.

I didn't want to document this because it's specifically meant for
properties and unlikely to be needed by other scripts, but silently
interpreting the 3rd return value can screw you over if you do something
like

return candidates, code:find('[%w_]*$')

I was doing this in my lua-repl script, and find() returns the end
position as the 2rd argument, this becomes the 3rd return value and gets
appended to completions. So you have to do

return candidates, code:find('[%w_]*$'), nil

Needed to split running commands out of console.lua.
2025-03-08 19:09:23 +00:00
Guido Cella c7e62ee28c DOCS/man/lua: update complete docs referencing autocompletion 2025-03-08 19:09:23 +00:00
Jaime Marquínez Ferrándiz 561156217e fish-completion: create the fish completion script
It is an adaptation of the bash completion.
2025-03-08 00:25:45 +01:00
Kacper Michajłow ecc31ecab3 player/command: add attached-picture flags to track add command 2025-03-08 00:21:06 +01:00
Kacper Michajłow 7b9290f620 player/command: add visual-impaired flags to track add command 2025-03-08 00:21:06 +01:00
Kacper Michajłow 3147eca943 player/command: convert flags to OPT_FLAGS for track add commands 2025-03-08 00:21:06 +01:00
Kacper Michajłow 7df3f442ea misc/language: parse hi/sdh/cc tags from external subtitle tracks
This also adds `hearing-impaired` argument to `sub-add` command.

Fixes: #14805
2025-03-08 00:21:06 +01:00
Kacper Michajłow 415b70dc7b misc/mp_assert: important fix forgotten before merge 2025-03-07 22:11:05 +01:00
Kacper Michajłow 91f80b5948 demux_timeline: don't close segments during demuxing
add_tl() when creating virtual_stream list is referencing sh->codec
which is owned by the demuxer. Don't close it to avoid dangling
pointers. The comment is right, but this happens regardless of
delay_open as we can clearly see in the add_tl() function.
2025-03-07 20:32:37 +01:00
Dudemanguy 533a684381 player: only coalesce callbacks from parsed config files
This relaxes what bbac628a1b introduced.
Although it is rare, there may be scripts out there that depend on the
old timing. We'd still like to process config files in a sane manner and
not cause OOMs so keep the general coalescing mechanism in place but use
it selectively. There is one special case with the --input-commands
option. We want this coalesced as well so some special handling needs to
be added for that.
2025-03-07 14:35:52 +00:00
Kacper Michajłow f152674246 stream_edl: allow opening edl only from local resources
edl is complex and prone to errors. Also there is no good reason for
external network playlist to require edl use.
2025-03-07 14:19:15 +01:00
Kacper Michajłow babea3da1f Revert "stream/stream: mark mf:// and edl:// as unsafe protocols"
At least part of it, because there was rebase error in original commit
with unrelated changes.

This reverts commit 9bc3aee6fb.
2025-03-07 14:19:15 +01:00
Kacper Michajłow 45c6077756 stream_mpv: restrict only to network links 2025-03-07 14:19:15 +01:00
sfan5 839aa31b7e player/client: adjust log message for client exit
The old message is too generic and worse could be mistaken
for exit of the entire player.
2025-03-07 09:44:19 +01:00
sfan5 53a6a6821c player/scripting: add logging around script un- and reloading 2025-03-07 09:44:19 +01:00
Dudemanguy 2a49bf11ec vo: replace driver->frame_owner with VO_CAP_FRAMEOWNER 2025-03-07 03:25:51 +00:00
Dudemanguy 8798cec7fa vo: replace driver->untimed with VO_CAP_UNTIMED
There's a weird mix and match of ways to set special things about a VO
so let's consolidate it all to use VO_CAP bits. More importantly this
fixes do_redraw not being properly ignored/skipped in the untimed VO
case. This was intended in 8657b8e1f3 but
later the code got reorganized/moved around to make it no longer a no-op
but we just got lucky and there were not any known problems with the
broken logic until 5338f4ba70.
2025-03-07 03:25:51 +00:00
Kacper Michajłow 2799d8b130 mac/apphub: remove mpv:// protocol handling
It has been moved to the mpv core with additional security
considerations, including filtering unsafe protocols from being opened
via the URL handler.

While we are not aware of any active exploitation, naive protocol
handling could allow the use of niche protocols in FFmpeg, which, in
turn, might load native code. How such native code would be dropped on
the local machine is another question.

This remains theoretical, but it's better to be safe than sorry.

Fixes: 494d408583
2025-03-07 00:15:23 +01:00
Kacper Michajłow 93ea3df0a9 player: add mpv:// protocol
This is useful to run mpv from URL handler. Can be used to start mpv
from you web browser or anything that would trigger url handler for
given protocol. Only safe protocols are allowed.

Current solutions to run mpv in such context are to spawn IPC proxy and
run mpv when requested, but this is in most cases not necessary.

Currently the protocol is added in mpv.desktop. Windows related
registration will follow in future changes.
2025-03-07 00:15:23 +01:00
Kacper Michajłow 9bc3aee6fb stream/stream: mark mf:// and edl:// as unsafe protocols 2025-03-07 00:15:23 +01:00
Kacper Michajłow 27f39811fa etc/mpv.desktop: update safe protocol list 2025-03-07 00:15:23 +01:00
Kacper Michajłow d2e3fd9383 auto_profiles.lua: make profiles apply with higher priority
This increases the priority from 50 (which is neutral) to ensure that
profiles are applied before other scripts.

In general, applying profiles before other scripts makes sense. This was
already the case for external scripts with default priority because they
would load after auto_profiles.

This commit primarily fixes ytdl_hook.lua to respond to profile changes.
In most cases, profile conditions are triggered by external conditions,
not the output from the ytdl hook, so this is fine.

I acknowledge that this will change the order if a script previously had
a priority lower than 50. However, injecting itself before profiles are
evaluated is a very obscure use case, if there is even a valid one.
2025-03-07 00:08:10 +01:00
Kacper Michajłow dddfdf2504 player/sub: avoid indexing arrays with -1 2025-03-06 21:58:38 +01:00
Kacper Michajłow 442e21a69c demux_mkv: add missing invalid value check 2025-03-06 21:58:38 +01:00
Kacper Michajłow d035a63913 stream_dvdnav: cast to int64_t before multiplication
Just to silence static analysis warning. It is assigned to int64_t
anyway.
2025-03-06 21:58:38 +01:00
Kacper Michajłow 41d03dca2a {x11,wayland}_common: convert dead code to static sanity check 2025-03-06 21:58:38 +01:00
Kacper Michajłow dd107a1a39 stream_cdda: cast to int64_t before multiplication
Just to silence static analysis warning. It is assigned to int64_t
anyway.
2025-03-06 21:58:38 +01:00
Kacper Michajłow f7c2af2acd player/command: remove redundant check 2025-03-06 21:58:38 +01:00
Kacper Michajłow 25fa0bd08a player/loadfile: fix history_file leak 2025-03-06 21:58:38 +01:00
Kacper Michajłow 6496de424c player/sub: check order before using it as an index 2025-03-06 21:58:38 +01:00
Kacper Michajłow 401939b6e3 stream_cdda: add sanity checks on track numbers
Makes sure that we return error when end or start track fails to be
found.
2025-03-06 21:58:38 +01:00
der richter e867518bdd osxbundle: add new vulkan loader homebrew path
see https://github.com/Homebrew/homebrew-core/commit/0c6a7238e7c3457af8d2cc7a997a3d2732ab2751
2025-03-06 17:31:17 +01:00
Dudemanguy 9a7c8334c2 build: remove unused dvdread dependency
6229404985 removed libdvdread and it has
not been needed since.
2025-03-05 21:01:26 +00:00
der richter 5010c24edc mac/vulkan: add support for visibility check for rendering 2025-03-05 19:04:04 +01:00
der richter 49b8f39b25 mac/common: fix indentation 2025-03-05 19:04:04 +01:00
Kacper Michajłow 849a6079a8 options/m_config_frontend: use local depth variable for show_profile
To avoid confusion with the stack that is used when loading profile.
2025-03-05 18:05:52 +01:00
Kacper Michajłow 92a7d7f7d4 options/m_config_frontend: fix depth variable
f59ee85a48 changed the profile_depth to
stack, but this one place remained unchanged by mistake.

Fixes: f59ee85a48
Fixes: #16010
2025-03-05 18:05:52 +01:00
Kacper Michajłow 6735d0c7d0 github/workflows: don't install recomended packages with apt 2025-03-05 13:13:47 +01:00
fkroener dd062dea61 DOCS/man/vo: xx-color-management-v4 -> color-management-v1 2025-03-05 12:27:22 +01:00
Kacper Michajłow d1a4af1eda hwdec_d3d11va: align image mapper dimensions to a multiple of 2
This is required for creating a copy texture. Note that alignment is
applied only when making a copy; if mapping the texture directly, the
native texture size is used as-is. The texture itself may be larger
depending on the coded dimensions, but we only copy the "interesting"
part of the image.

Fixes playback of videos with odd dimensions.
2025-03-05 11:42:24 +01:00
Kacper Michajłow 6479dd13ce ytdl_hook.lua: fix boolean comparision
Make sure the `early` variable is boolean. The issue was that if url have
`ytdl://`, find() would return position `1`. This makes `early` also `1`.
And now we try to compare `early == load_fail`, which for `1 == true` is
false, while we expect it to be true. Make sure we compare booleans.

Fixes unnecessary hook processing when using ytdl:// protocol.
2025-03-05 11:13:35 +01:00
Kacper Michajłow ca1f60f099 ci/tumbleweed: enable NDEBUG with gcc build
To increase build diversity.
2025-03-04 20:07:29 +01:00
Kacper Michajłow e44ca1ff21 ci/tumbleweed: enable thin lto for clang build
To increase build diversity.
2025-03-04 20:07:29 +01:00
Kacper Michajłow 450535ba1e tests: use mp_require to allow tests to be run with NDEBUG 2025-03-04 20:07:29 +01:00
Kacper Michajłow 1c49cfdb97 various: use mp_assert macro 2025-03-04 20:07:29 +01:00
Kacper Michajłow c0dbdcf7ad misc/mp_assert: add mp_assert and mp_require macros 2025-03-04 20:07:29 +01:00
Kacper Michajłow 16bbfbf992 osdep/compiler: use C23 attributes if available 2025-03-04 20:07:29 +01:00
Kacper Michajłow 7f1e26831e osdep/compiler: add MP_UNUSED macro 2025-03-04 20:07:29 +01:00
Kacper Michajłow 171c3610a3 osdep/compiler: fix MP_ASSERT_UNREACHABLE macro for clang
Depending on the target, clang may not define `__GNUC__`. One example is
when targeting `x86_64-pc-windows-msvc`.
2025-03-04 20:07:29 +01:00
Kacper Michajłow 6ad1575cf6 common/common: remove assert from MP_HANDLE_OOM
This assert won't give much more information than the abort() itself. We
just want to abort on OOM there is not much to debug here. talloc macros
also doesn't add an assert.
2025-03-04 20:07:29 +01:00
Kacper Michajłow 1582705f27 demux_mkv: add demuxer-mkv-crop-compat option
I don't expect the Matroska specification to be adjusted for this to
work soon, so in the meantime, follow the spec as written and add an
option to support most files in the wild.

I would prefer this to never be an option, but it looks like it's
unavoidable.

Recently, FFmpeg added cropping support for Matroska, so we don’t want
to be the odd one out by doing it differently...

See for more details:
https://github.com/ietf-wg-cellar/matroska-specification/pull/947
https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2389
https://github.com/mpv-player/mpv/pull/13446

Fixes: #15800
2025-03-04 19:33:27 +01:00
Kacper Michajłow 403d57dbf3 Reapply "demux_mkv: PAR should be calculated after applying crop"
This reverts commit 81102b0f6c.
2025-03-04 19:33:27 +01:00
Kacper Michajłow 50cda601ba f_decoder_wrapper: don't wait on self thread progress on reinit
Fixes deadlock when reinit is triggered by the thread itself.

Fixes: #15776
2025-03-04 19:32:56 +01:00
Kacper Michajłow f59ee85a48 options/m_config_frontend: don't allow recursive profile inclusion
It is easy to craft a config file that loads a profile recursively. To
prevent this, not only check the depth of the current inclusion but also
ignore already-seen profile names.
2025-03-04 19:32:17 +01:00
Dudemanguy 0fee7c1b37 command: wait until MPV_EVENT_VIDEO_RECONFIG to pretty print hwdec
It's not actually possible to truly know the hwdec-current value until
after this event is successfully signalled. Add some special handling to
the pretty printing of hwdec to delay it until we get the video reconfig
event in command_event and then do the pretty print there if
appropriate.
2025-03-04 16:37:23 +00:00
Dudemanguy f2ef360444 f_decoder_wrapper: allow VDCTRL_GET_HWDEC to actually fail
a3823ce0e0 made this request a special
case because of all the threading considerations. Unfortunately, the
implementation made it so that VDCTRL_GET_HWDEC always would return
CONTROL_UNKNOWN when using mp_decoder_wrapper_control. This didn't
matter because VDCTRL_GET_HWDEC in vd_lavc would always succeed, but in
reality it shouldn't. It takes some time before we actually know what
the hwdec is and if you query during that time, you'll could get some
bogus value (e.g. during hwdec auto probing). So fix that by returning
false in vd_lavc if hwdec_notified isn't there yet and adjust the
wrapper control logic to take this into account.
2025-03-04 16:37:23 +00:00
Kacper Michajłow 2542a7824c misc/codepoint_width: update tables after clustering fix
Updates tables after https://github.com/microsoft/terminal/commit/0961a77a5aec003e9f79d388f8e7bffb9a550cdb
2025-03-03 23:48:40 +01:00
Kacper Michajłow 13db16d0e4 w32_common: avoid any unsupported VOCTRL to synchronize the GUI thread
We only need to return VO_NOTIMPL for them, there is no need to call mp_dispatch_run()
and wait for the GUI thread to respond.
2025-03-03 23:48:26 +01:00
Kacper Michajłow bc0c148d62 demux_mkv: add support for chroma location
Fixes: #15983
2025-03-03 23:47:52 +01:00
Kacper Michajłow d37405c8f3 common/av_log: make FFmpeg libs ABI mismatch log clearer
And exit, instead of aborting.
2025-03-03 10:44:44 -05:00
Kacper Michajłow 962fb5fde8 common/av_log: show also build version for FFmpeg 2025-03-03 10:44:44 -05:00
nanahi 630a036f64 DOCS/man/input: add details for chapter property documentation
The documentation does not mention that using add/cycle to change
the property is subject to --chapter-seek-threshold option,
and the fact that a chapter number of -1 indicates a playback
position before the start of the first chapter.
2025-03-02 07:14:16 +01:00
nanahi c18d544dae DOCS/man/input: add note for add command repeatability
The change in 007c728ad2 also
applied to the add command.
2025-03-02 07:14:16 +01:00
nanahi c45c15d86b options/m_option: fix REL_TIME_CHAPTER printing
The relative time chapter is 1-based even though it stores
0-based values internally, but the printing doesn't consider
that and gives 0-based value.

Change it to use the same base as setting the value so that it prints
the same value as being set.

Fixes: 877775f84e
2025-03-02 07:14:16 +01:00
Kacper Michajłow 4aa8508708 osdep/subprocess-win: fix inheritance of NUL handles in child processes
When a stream is not set to passthrough and there is no data to read or
write, a handle to the NUL file is created. However, these handles were
not included in the list of inheritable handles for the child process.
This commit ensures they are properly inherited.

Fixes: 83fec9bafb
Fixes: #15982
2025-03-02 07:13:09 +01:00
Dudemanguy ee07dcf4c7 input: add quiet arg to mp_input_set_mouse_pos for wayland
Setting the mouse position always updates the cursor visibility state in
the core, but that's not always desired by the caller. Make it optional.
In practice, this is for wayland. Fixes #15967.
2025-03-01 16:38:06 +00:00
Guido Cella 6a1cbad0c7 console.lua: fix select memory leak
The overlay to calculate the max item width was never removed, so a new
one was added on each select call, adding 5-10 MBs of memory usage on
each menu opened.

Fix this by reusing the same overlay, which is also faster.
2025-03-01 08:01:20 +01:00
Dudemanguy 5338f4ba70 sub/osd: remove bogus osd redraw notification resetting
Added in 56616b0b01. Note that it was
called osd_draw then and not osd_render. Anyways, this line doesn't make
any sense today because vo_gpu_next in fact does not call osd_draw (or
any similar API) after this. Resetting the bool here instead seems to
cause redraws to be missed. For the other handful of VOs that use this,
there is no difference. They all use the mp_draw_sub_overlay call and
the playloop appropriately takes care of the redraw notification value.
Fixes #15963.
2025-02-26 15:04:15 +00:00
Dudemanguy ab4421ec4a vo_gpu_next: use mp_draw_sub_formats const
No need to duplicate this.
2025-02-26 15:04:15 +00:00
Dudemanguy 5ae0e0ff9a opengl/context: remove remnants of the external swapchain API
With the previous commits, all usage of this is gone. We can remove it
for good.
2025-02-25 21:53:05 +00:00
Dudemanguy 6e60667ece context_drm_egl: remove custom fencing
537006965e introduced this while
implementing n-buffering. The changes are all good, but the suspect part
is the implementation of wait_fence/new_fence to specifically bypass
what is done generically in context.c for all other opengl backends. The
commit message says that the reason for this is because "the places we
create and wait for the fences needs to be somewhat different for best
performance". It's certainly plausible that it may have been true then,
but I see no evidence it's true now. Driver code is way different these
days under the hood, and the general vo drm code has been rewritten a
lot since then. The generic fencing in context.c works fine and shows no
difference compared to this custom implementation. Delete it and
simplify.
2025-02-25 21:53:05 +00:00
Dudemanguy 8ed2c98655 vo: signal VOCTRL_REDRAW in a less sensitive spot
Windows works totally differently than the other backends and is
sensitive to synchronization issues since it runs its control on a
separate thread. The spot where this was originally placed was a perfect
storm of causing resize weirdness because it was before the flip and
right after the redraw. Ideally, this is known to the windowing backend
before the flip actually happens so just move this out to before the
do_redraw call. It makes no practical difference for the one user of
this and sidesteps the implementation differences that exist on Windows.
Fixes fc9d1ca182.
2025-02-25 16:18:43 +00:00
SeaHOH 5459b0ff19 stats.lua: use fixed naming for single invocation key bindings
The names of single invocation key bindings for specific pages will be
changed if defines user key bindings, then original invocation fails.

e.g. : when user defines `key_page_4=F4`, then key binding name
`stats/display-page-4-toggle`
becomes
`stats/display-page-F4-toggle`,
and OSC menu `Help` fails.
2025-02-25 08:49:35 +01:00
SeaHOH 883b94841a stats.lua: change key bindings of toggle page as nonrepeatable
Be consistent with behavior of `display-stats-toggle`.
2025-02-25 08:49:35 +01:00
Kacper Michajłow 5a71d4b72a github/issue_template: simplify Windows version command 2025-02-25 05:41:26 +01:00
Kacper Michajłow 51e157aaaf github/issue_template: set the type of the issue 2025-02-25 05:41:26 +01:00
Kacper Michajłow 275b93b256 common/stats: print percentage of elapsed time during sampling time 2025-02-25 05:40:14 +01:00
Kacper Michajłow 6c075b0791 common/stats: add one more digit to stats timing 2025-02-25 05:40:14 +01:00
Kacper Michajłow b313a6ea34 common/stats: move formatting code to one place 2025-02-25 05:40:14 +01:00
Guido Cella 80c9d7d8df console.lua: include more characters in selectable items
300 characters doesn't always fill the window.

Fixes #15944.
2025-02-25 01:29:26 +01:00
Guido Cella 66659a4b15 select.lua: don't quickly close and reopen the menu
Use the new keep_open flag to avoid flicker when opening submenus.
2025-02-24 16:26:58 +01:00
Guido Cella bd9d5e3184 input.lua/defaults.js: unregister input-even again
Partially revert bede44618b. This was removed to allow nested
input.select() calls, but it is better to use the new keep_open flag for
this, because it avoids the flicker of console quickly closing and
reopening.

Unregistering the script message allows garbage collection of variables
defined in the scope that called mp.input, this is useful e.g. if you
were selecting from 10k history entries.
2025-02-24 16:26:58 +01:00
Guido Cella 996c098725 console.lua: add a keep_open flag to mp.input
With input.select this allows building nested submenus without the
flicker of console quickly closing and reopening, and also doing
multiple selections, to e.g. cycle through different values of a
property, or increase a property multiple times.

With input.get this is used to change the default behavior to closing by
default on submit. It was argued by avih that this is more useful, and
indeed Github code search shows that everybody is calling
input.terminate() unconditionally on submit, so the impact of the change
should be low, and restoring the old behavior is as easy as passing
keep_open = true, which is just ignored in older mpv versions.
2025-02-24 16:26:58 +01:00
nanahi 7dd5154971 clipboard: remove --clipboard-enable
Clipboard can be now disabled with --clipboard-backends-clr so
--clipboard-enable is redundant.
2025-02-24 16:23:41 +01:00
nanahi 8368d55282 clipboard: add --clipboard-backends option
This allows specifying a priority list of clipboard backends
to use. This is mostly useful on Linux where multiple clipboard
backends exist.
2025-02-24 16:23:41 +01:00
Kacper Michajłow 57210dfc4b player/loadfile: strip common filename part from external track title
It's most of the time redundant and there is no point to repeat it in
`title`.
2025-02-24 16:18:05 +01:00
Guido Cella 2d15431d11 console.lua: rename handle_enter() to submit()
Because it's also called on left click.
2025-02-24 16:12:53 +01:00
Guido Cella 9551de6385 console.lua: replace repl references
These are leftovers from the original repl.lua name. Also remove some
redundant comments.
2025-02-24 16:12:53 +01:00
Guido Cella 8e72ded1bb console.lua: increase the opacity of the default item background
This needs to strike a fine balance between being visible and having
contrast with the text color and not taking attention away from the
selected item. Make it slightly more opaque to differentiate it more
easily.

Fixes #15711.
2025-02-24 16:12:44 +01:00
Guido Cella d8a79a1ca8 osc.lua: allow wheel bindings for custom buttons 2025-02-24 16:01:05 +01:00
Guido Cella f561efec40 console.lua: cache the command-list 2025-02-24 15:57:07 +01:00
Guido Cella d4dc19a6b4 console.lua: complete multiple flags separated by + 2025-02-24 15:57:07 +01:00
Guido Cella 72bb227bf1 console.lua: highlight matching parts of selectable items
fzy returns which characters matched the search for every item, so use
this to highlight them.

This defaults to a light blue color that is readable with both black and
white (selected) backgrounds.

The returned positions are just bytes, so we can't put ASS tags or
escape sequences around each byte because that would break displaying
multibyte UTF-8 characters. Only put them around sequences of matched
positions, and only when the sequences start and end at actual character
positions.
2025-02-24 15:56:20 +01:00
Guido Cella a5700484be console.lua: separate the log and matching items
The next commit will inject ASS within matching items to highlight
matching positions, which means that the text key of log lines can no
longer be used, and that matching items and log lines diverged enough
that it's simpler to separate them.

As a bonus, we can stop clearing the log and completions when searching
the command history, and restore them after the search.
2025-02-24 15:56:20 +01:00
Guido Cella 978b219889 options: default to --prefetch-playlist=yes
--prefetch-playlist improves performance by starting to read the next
file in the last second or playback or while viewing an image. This is
obviously noticeable with playlists of direct media URLs, but can also
make a difference on local slow hardware, mainly large (in bytes) images
on HDDs. You can easily see the difference with 10+ MB images.

Since e7a253614c and 24db17d10f fixed niche issues, and it's known not
to cause other issues by users using since 2017 who haven't reported
issues, enable it by default to improve performance.

The only flaw is that it doesn't support ytdl-hook URLs, so in Youtube
playlist, it does a web request with ffmpeg that is doomed to fail since
the last second of playback, though this doesn't cause practical
disadvantages.
2025-02-24 15:54:33 +01:00
Guido Cella ba47f8f42a DOCS/options: ease --prefetch-playlist warning
There is no known issue with --prefetch-playlist and file-local-options.
It works just fine with them, and people have been using it since 2017
and haven't reported related issues. So ease the warnings to not scare
users away from using a useful option.

Also when --prefetch-playlist was implemented it also prefetched the
stream cache until 559a400ac3 removed it - see #6753. So if such issues
ever existed, they were fixed by not making it prefill the stream cache.
Now it doesn't do much, it only opens a connection to the next file, and
the cache of the next video starts empty.
2025-02-24 15:54:33 +01:00
Guido Cella e98d3b62ec input.conf: bind MBTN_MID to align-to-cursor 2025-02-24 15:53:34 +01:00
Guido Cella f1f6184025 input.conf: bind Ctrl+left click to drag-to-pan
An alternative is to bind to right click only for images, but since we
will likely bind right click to the context menu once it works on
platforms other than Windows, bind to ctrl+left click to not have to
change it later.
2025-02-24 15:53:34 +01:00
Guido Cella 8da6e8ad55 input.conf: bind Ctrl+wheel to cursor-centric-zoom
Probably not worth adding to etc/restore-old-bindings.conf since it's an
extension of add video-zoom.
2025-02-24 15:53:34 +01:00
Guido Cella 9422a85638 input.conf: make Alt+BS reset --video-align-{x,y}
This is useful because positioning.lua uses video-align.
2025-02-24 15:53:34 +01:00
Guido Cella f0b4f3340f input.conf: make Alt+BS print "video-zoom: 0"
Alt+BS prints "video-pan-y: 0" which seems arbitrary. Make it print
video-zoom: 0 which is the most important property that gets reset.
2025-02-24 15:53:34 +01:00
Guido Cella aa5d37bc8e positioning.lua: add this script
This script provides script bindings to pan videos and images, making
mpv a better image viewer out of the box.

Fixes #3038, fixes #15020.
2025-02-24 15:53:34 +01:00
Guido Cella 64531af454 console.lua: allow persisting the command history 2025-02-24 15:53:22 +01:00
Guido Cella 4efcfb9540 console.lua: preserve font styles in the counter
Fixes https://github.com/Samillion/ModernZ/issues/359
2025-02-24 15:52:20 +01:00
Guido Cella 12ef7077be console.lua: preserve the counter style when searching history
When searching the command history with outline-and-shadow, the counter
should preserve the border, shadow and blur. Only with background-box it
should disable the shadow to not overlap 2 rectangles. While disabling
border and blur is needed with the menu background+outline-and-shadow.
2025-02-24 15:52:20 +01:00
Dudemanguy 1bcc76d7f1 drm: use VOCTRL_REDRAW when flipping buffers
Basically whenever the VO does a redraw, we always have to flip buffers
for vo_drm and drm_egl. The old way of doing this was checking if the
video was paused and if the frame was still. This does work, but what
really needs to be known is simply if the VO is redrawing. Since the
added VOCTRL_REDRAW tells us this, we can shuffle around some logic and
simplify greatly. drm_egl no longer needs its custom override for the
submit_frame step so that can be eliminated along with the vo_gpu_next
hack.

Fixes 0959cdeb03.
2025-02-23 22:01:27 +00:00
Dudemanguy fc9d1ca182 vo: signal VOCTRL_REDRAW to backends
Realistically this is for drm_egl, but instead of overriding
submit_frame, it can use this event instead to know that it should
advance its buffers.
2025-02-23 22:01:27 +00:00
Dudemanguy 0959cdeb03 context_drm_egl: simplify and fix delayed rendering with vo_gpu_next
This backend is a special case where the state of the frame (i.e. is it
still) needs to be taken into account when flipping the page because it
does its own fencing. vo_gpu_next never calls the submit_frame API in
ra_swapchain which meant the drm backend wasn't aware of the state of
the frames and thus couldn't respond. This is a bit weird though because
in vo_gpu we actually want the ra_gl_ctx_submit_frame call after the
custom external drm_egl_submit_frame. But we don't want this in
vo_gpu_next, we only want the state update. Be lazy and just compare the
vo_drivers, but the way this is currently designed feels wrong. Fixes
delayed OSD rendering when you play a still image like an audio
file with cover art.
2025-02-23 18:42:16 +00:00
Dudemanguy 8854c74271 libmpv_gl: remove pointless external_swapchain call
The comment is true, but just passing an empty ra_gl_ctx_params does
exactly the same thing. There's no reason to specifically use the
external_swapchain API.
2025-02-23 18:42:16 +00:00
Dudemanguy 547754f1b9 context_dxinterop: remove unneeded empty external_swapchain 2025-02-23 18:42:16 +00:00
Dudemanguy 9b0336cd7a context_angle: simplify some swapchain stuff
The external swapchain API is weird and not really needed here.
2025-02-23 18:42:16 +00:00
Dudemanguy 8ddc5632fe vo: unify ra_gl_ctx_params and ra_vk_ctx_params into ra_ctx_params
These were separate for some reason which makes no sense and is really
annoying if you want to use something that's in the vk version and not
the gl one or vice versa. As a bonus, these now get to live right above
the ra_swapchain definition which is more convenient.
2025-02-23 18:42:16 +00:00
Dudemanguy b97b13bf24 wayland: don't assert if DND fails while checking the fd
It's not so nice. Print a warning instead.
2025-02-23 17:17:35 +00:00
Dudemanguy 6f6346b149 wayland: preserve the previously set dnd_offer action if it exists
Not all compositors will send another action after the data_device entry
event. We currently assume this which always causes the previously set
action to be overwritten with the default value (-1). The easiest way to
solve this is to simply save the old dnd_offer action value and then
reapply it after we update it to the pending_offer. Fixes #15939.
2025-02-23 17:17:35 +00:00
Kacper Michajłow deb27c091a meson: build libmpv by default
It doesn't cost us anything, we build all source anyway. This makes
usage of mpv as a meson subproject easy, without the need to enable
libmpv.
2025-02-23 01:40:12 +01:00
Kacper Michajłow f1e1a0be85 include: move public headers to own directory
This ensures a clear separation between public and private headers. It
also makes it clear in Meson and prevents the accidental use of private
headers.
2025-02-23 01:40:12 +01:00
Kacper Michajłow d759e26fd0 libmpv: use correct header directory name
libmpv headers are installed to `mpv/`, so why are we pretending it is
`libmpv`?

Fixes documentation, libmpv meson dependency, tests.
2025-02-23 01:40:12 +01:00
Kacper Michajłow 77313f73a2 various: reduce the include scope of some public headers 2025-02-23 01:40:12 +01:00
Guido Cella b848ffad12 select.lua: fix LSP warning
I don't know why I didn't get it before but Lua's LSP now complains with

Compute `"Edition " .. (edition.id + 1)` first. You may need to add
brackets. [ambiguity-1].

Just move the parenthesis to make it happy.
2025-02-22 15:32:27 +01:00
Dudemanguy 448abf1e3b wayland: add icc support using wp-color-management-v1
This makes --icc-auto work on wayland. Closes #8151.
2025-02-21 20:54:25 +00:00
Julian Orth ebe31c912e vo_dmabuf_wayland: remove unnecessary commit
This commit does not take effect until the next video_surface commit
anyway.
2025-02-21 17:23:56 +00:00
Julian Orth 76da05092b vo_dmabuf_wayland: commit surfaces in correct order
osd_surface is a sync sub-surface of video_surface meaning that a commit
of osd_surface will not take effect until the next commit of
video_surface.

Some compositors (wlroots) do not implement sync sub-surface correctly,
meaning that the difference cannot be observed there. But it can easily
be seen on Jay and GNOME:

1. Open an mpv window.
2. Pause the video.
3. Enter the surface with the mouse.

Expected behavior:

1. The OSD shows up immediately.

Actual behavior:

1. Nothing happens for a few seconds.
2. The OSD shows up and immediately fades out.

This is because the fade-out commits cause the initial osd_surface
commit to become effective.
2025-02-21 17:23:56 +00:00
Dudemanguy b90c1bb21b DOCS/man/mpv: remove bogus --cdrom-device mention
Missed in 131973806d
2025-02-21 17:23:45 +00:00
Yozora80 131973806d Revert "stream_{bluray,cdda,dvdnav}: deprecate setting device after schema"
This reverts part of PR #15899 (commit dd6e3a0ece).

"Why is this even useful?": It's very useful for multi-disc playlists. Compare:
`mpv bd:///DISC{1..4}`
`mpv -\{ bd:// --bluray-device=DISC1 -\} -\{ bd:// --bluray-device=DISC2 -\} -\{ bd:// --bluray-device=DISC3 -\} -\{ bd:// --bluray-device=DISC4 -\}`
2025-02-21 15:26:23 +00:00
Guido Cella 41f2bab8c9 console.lua: complete frame-step flags 2025-02-21 15:47:06 +01:00
Guido Cella d840e7846c select.lua: don't add File info to the menu when no file is playing 2025-02-21 15:45:37 +01:00
Guido Cella e32beaa0db input.conf: bind Shift+{HOME,END} to go to the first and last file 2025-02-20 15:54:11 +00:00
Guido Cella 036528d44d input.conf: bind HOME to seek to the beginning 2025-02-20 15:54:11 +00:00
Dudemanguy 4394ca5b6c demux: use a slightly better hack when seeking with dvd/bd
Basically just bits of a9d83eac40 that was
removed and ported to here. Not really smart but it seems like flushing
buffers during seek generally leads to better behavior and avoids some
errors. The additional stream_seek call that was being performed is
definitely bogus (will never work and spams errors). So that is skipped
for bd/dvd. SEEK_FORCE is no longer needed. Instead demux_disc calls
drop_buffers on the slave demuxer (i.e. lavf).
2025-02-20 15:50:25 +00:00
Dudemanguy 25a0c8307d player: add an optional mute flag when framestepping
Need to shuffle some stuff around but it's pretty simple. Mute the
audio stream before the frame step and then unmute it when we're done.
It's exactly the same as the default play mode otherwise.
2025-02-20 15:50:03 +00:00
Dudemanguy 723da77def DOCS/man/mpv: explain how to select and navigate through cdda
It's not exactly obvious and worth mentioning.
2025-02-20 15:49:45 +00:00
Dudemanguy bb3265b9d3 stream_cdda: deprecate undocumented --cdda-span-{a,b} options
You probably wouldn't guess what this does from the name alone, but it
actually selects a range of tracks to play. It's slightly different than
using --start because it confines the range to just that track and you
cannot seek before it. The functionality is useful, but you can
accomplish exactly the same thing with --start and --end. Also the
implementation of the cdda option is weird because starting from a track
after 1 makes it impossible to seek before it. There's no reason to have
this when using the core option is simply better and works fine.
2025-02-20 15:49:45 +00:00
Dudemanguy dd6e3a0ece stream_{bluray,cdda,dvdnav}: deprecate setting device after schema
This is allowed but it's pretty weird. You'd end up typing something
like dvd:////dev/sr0 or cdda:///dev/sr0 (notice the differing amount of
/). Why is this even useful? Just use the matching --cdda-device option.
There's no need to have two ways to do the same thing here.
2025-02-20 15:49:45 +00:00
llyyr c9970b5ba6 ao_pipewire: don't load client-rt.conf properties
Deprecated in https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/24bcacc6195ffbf8e40c9ea1374eb6666252eadc

Fixes: #15914
2025-02-20 15:49:01 +00:00
der richter 9618aa3b21 DOCS/man/options: remove outdated wid embedding docs for cocoa
the old deprecated cocoa backend that supported wid embedding was
removed with fc4db18.
2025-02-20 15:48:44 +00:00
nanahi f9271fbffe DOCS/man/options: fix missing space in hwdec doc
Fixes: d7159e4662
2025-02-19 17:26:39 +00:00
Guido Cella 6df54fa7b1 DOCS/man/options: document that --save-position-on-quit affects loadfile 2025-02-19 18:19:23 +01:00
der richter 76e3e8ae45 mac/dialog: release all input keys when modal steals key input
modal dialogs steal the key/mouse input and possibly eat corresponding
key up events when opening via key binding. this leads to key sequence
ends to not reported and key bindings not being triggered if no key up
event was triggered after closing the modal.
2025-02-19 16:10:25 +01:00
der richter 209521ff7c mac/dialog: remove delayed becomeFirstResponder() workaround
use the proper initialFirstResponder variable
2025-02-19 16:10:25 +01:00
Kacper Michajłow fc2f176764 osdep/io: harden string conversions
We already abort if initial call fails, so there is no reason to not to
the same, even if we fully expect it wouldn't fail at this point.
2025-02-19 02:50:17 +01:00
Kacper Michajłow 2e0ccedfa1 win32-console-wrapper: don't use CRT in runtime wrapper
This is only needed for spawning main mpv process, there is no need to
spin CRT just to call main() and support basic memcpy.

Additionally adjust compilation flags to reduce the size of mpv.com.

This is the small binary using only kernel32 as dependecy now.

Stripped mpv.com built with clang 19.1.7 (x86_64-w64-windows-gnu)

Before:
   text    data     bss     dec     hex filename
   6982    7281       0   14263    37b7 mpv.com

After:
   text    data     bss     dec     hex filename
   1094    2894       0    3988     f94 mpv.com

Depending on compiler and options the size may vary. For example with
-flto and -Wl,-gc-sections it is:
   text    data     bss     dec     hex filename
    833     750       0    1583     62f mpv.com

but gc-sections were rejected as an default option before.

As a bonus add some error checking to this code.
2025-02-19 02:50:17 +01:00
Kacper Michajłow 30ea5da702 win32-console-wrapper: simplify error printing
No need for pointless prefix, print error directly. Don't use CRT
function. This will write only to console, but it's not meant to be
written to file anyway.
2025-02-19 02:50:17 +01:00
nanahi 66a7338027 f_decoder_wrapper: warn when using video-aspect-override of 0 or -1 2025-02-18 23:05:02 +00:00
nanahi ccaa0e3d56 command: print "original" also for aspect ratio of "no" 2025-02-18 23:05:02 +00:00
nanahi 02199aeb3f input.conf: use no instead of -1 for video-aspect-override 2025-02-18 23:05:02 +00:00
nanahi 13f94700d9 f_decoder_wrapper: add --video-aspect-method=ignore
This adds --video-aspect-method=ignore to replace --video-aspect-override=0.
--video-aspect-override=0 and --video-aspect-override=-1 will no longer be
handled specially. For compatibility, 0 is mapped to always use ignore
and -1 is always mapped to always use container.

"no" is now the replacement for --video-aspect-override=-1, which is
internally remapped to -2 to avoid using a deprecated value.
2025-02-18 23:05:02 +00:00
nanahi 4456dc1d1f Revert "m_option: forbid non -1 negative values for video-aspect-override"
This is poorly implemented and will break existing scripts which set
the value directly with double without a string value, like
mp.set_property_native, or if the value is set with add/multiply commands.
Revert this until a better solution is found.

This reverts commit cb91de2a34.
2025-02-18 23:05:02 +00:00
nanahi 704f995c49 Revert "m_option: deprecate setting -1 to --video-aspect-override"
This reverts commit 18257375e4.
2025-02-18 23:05:02 +00:00
nanahi 184ace21a0 DOCS/man/options: fix sub-ass-video-aspect-override documentation
Negative values have never worked for this option since it's clamped
to M_RANGE(0, 10).
2025-02-18 23:05:02 +00:00
nanahi 84ae87bedd DOCS/man/options: use american spelling for "behavior"
For consistency with rest of documentation.
2025-02-18 23:05:02 +00:00
Dudemanguy 1a70de259d wayland: add some sanity checking when setting mastering luminance
Actually found a file in the wild that violated this which is a protocol
error (fatal).
2025-02-18 23:04:54 +00:00
Dudemanguy d26131e158 wayland: cleanup redundancy and global state in color-management
Maybe the xx version was different (probably not), but looking over this
code again it's pretty clear that there is a lot of unneeded
complication. There's no need to keep track of the image description,
creator params, etc. globally. This can all be passed around on the fly.
Also, reset_color_management was redundant because it would execute on
reconfig and also on the first draw after the reconfig. We don't need
both so delete the reconfig path. Collapse the various color functions
into one simple "set_color_management" and let the wayland listeners do
all the object destroying for us.
2025-02-18 23:04:54 +00:00
Dudemanguy 59c4ab5339 vd_lavc: add auto-unsafe and auto-copy-unsafe to the opt help
d7159e4662 added these two new options.
2025-02-18 22:42:19 +00:00
Dudemanguy cd5378e1ef vd_lavc: nuke some mmal remnants
343a5fd345 killed all mmal hardware
decoding, but there was still some junk lying around. There's
IMGFMT_MMAL still, but that's harmless to keep around.
2025-02-18 22:42:19 +00:00
Kacper Michajłow 97e4cd35a5 meson: minor simplification in link flags 2025-02-18 22:31:39 +01:00
Kacper Michajłow ea045b4755 osdep/timer-win32: add missing guards for ARM64
Does anyone compile libmpv for UWP?

Fixes: e908efe0b9
2025-02-18 10:47:03 +01:00
Dudemanguy bfb67c60b2 wayland: unvoid some wayland protocol structs
I started doing this in f594482451 for
protocol objects that were newer than the lowest version, but I can't
remember why (some waf-related reason?). This wasn't even followed for
other PRs merged recently like ext-data-control and color-management.
Anyways, it's not needed and works fine if you're on wayland-protocols
1.31 so stop doing this void weirdness.
2025-02-18 03:56:43 +00:00
Xaver Hugl 6bfbaf6bc6 wayland: update color management protocol to the upstream version 2025-02-17 23:36:02 +00:00
Kacper Michajłow 5e3f8d336d input.conf: add ctrl+p and g-m keybind for menu
Many keyboards doesn't even have MENU key and ctrl+p is common keybind
for command style menus like this one.
2025-02-17 22:54:04 +01:00
Kacper Michajłow 3baa255d47 builtin.conf: set menu corner_radius to 0 in box profile
OSD mesages are floating in exactly the same way as menu, they should be
consistent.
2025-02-17 22:54:04 +01:00
Kacper Michajłow ba31aa72ba console.lua: use the same opacity for menu as for everything else
There was a mistake of using hex (50) instead of decimal (80) it is
converted to %x later on.
2025-02-17 22:54:04 +01:00
Kacper Michajłow e908efe0b9 osdep/threads-win32: add implementation for mp_thread_cpu_time_ns() 2025-02-17 22:50:03 +01:00
Avi Halachmi (:avih) 1c3eecd821 common/stats: improve accuracy of quick timed measurements
Previously stats_time_start first sampled cpu-time and then real-time,
while stats_time_end sampled them in reverse order.

This resulted in real-time delta values being possibly a bit smaller
than the respective cpu-time deltas, which could become meaningful if
the start/end durations are consistently very short and very frequent.

In one test case (measuging the time spent at the event loop of
a script which spins on zero timeouts), this resulted in accumulated
real-time value of ~230ms per second, with a respective cpu-time
values of ~500ms. This should not be possible with single thread load.

Now start and end sample the values at the same order, so that it
balances on average. Each start/end delta now includes overhead of one
of each sample type, and excludes one of each sample type on average.

With the test case above, it's now 490 +-1 ms for both.
(the other 510ms real-time are at the excluded mpv_wait_event calls
and the unmeasured-overhead-parts of stats_time_start/end).
2025-02-17 22:50:03 +01:00
Avi Halachmi (:avih) be68ca94ad common/stats: fix incorrect cpu-time value reset
This fixes a bug where if stats reset happened after stats_time_start
and before stats_time_end, then the next reported cpu-time value of
that measurement was from the thread startup.

The long version:

stats resets the time-accumulated values if more than two seconds
ellapsed since last poll.

The reset keeps the elements, but makes them as if no measurement was
yet taken, so that they don't show up at new reports until a new
measurement is taken.

While the events and (untimed) cpu are reset, the timed-cpu value
was only partially reset - the values are reset but the indication
that the element is empty was not enough for stats_time_end.

So when reset happened between start/end calls, stats_time_end was
entered eventhough it shouldn't have, but with reset cpu-time value
it calculated the time since the thread's startup, hence this bug.

Further polls were ok, because they are of the delta since the
previous poll. But at the next reset it happened again.

Now the cpu-value is reset correctly, which fixes this bug.
2025-02-17 22:50:03 +01:00
Avi Halachmi (:avih) 7162c960e7 common/stats: report: account for ongoing timed-measuremets
stats_time_start and stats_time_end accumulate real-time and cpu-time
between these calls, but the total was only updated on stats_time_end.

This resulted in two issues:
- Inaccurate measured value if a report (read the perf-info property)
  happened between start/end. No biggie because it's OK on average and
  typically each start/end duration is quite smaller than the interval.
- If the start/end duration is bigger than the interval, then one or
  more intervals had a report value (delta) of 0, and then one report
  with a value bigger than the interval - which shouldn't be possible.

This commit effectively does end+start at the report time for ongoing
timed measurements, so that the report accounts for them too.

Doing end+start at the report required two more changes:

Store the element type (VAL_TIME) at stats_time_start rather than at
the end. Otherwise if the report happens after the first start but
before the first end, then the type is not yet set and the element
is skipped at the report (bypassing the end+start).

Store the thread id at the element. start/end measure the cpu-time at
the current thread so they used pthread_self(), but with the report
usually running on a different thread, it needs the thread id for the
measurement. Measuring cpu-time from a different thread is OK, and
already happens with VAL_THREAD_CPU_TIME elements during the report.

While at it, stats_time_end now uses the thread id which was stored on
start instead of using pthread_self(). This also serves as a general
protection against measuring start/end from different threads, which
would yield generally meaningless results anyway. In mpv all the
start/end calls for the same element are at the same thread.
2025-02-17 22:50:03 +01:00
Avi Halachmi (:avih) 40fb226cc2 common/stats: don't report cpu-time on unsupported platforms
On Windows and any other platform where cpu-time is unsuported,
previously the cpu-time was reported as 0, and now it's omitted
(at the perf-info property native value).

Code which process this report, like stats.lua, could not distinguish
between 0 which was due to unsupported platform, and "real" 0 which
indicates zero cpu activity in this poll-period.

In stats.lua this resulted in a whole lot of empty cpu graphs,
including one for every loaded script.

Now cpu-time is excluded from the report on unsupported platforms.
Real-time is obviously still being reported where requested.

Implementation wise, this is slightly hacky, by literally only
excluding the cpu-time nodes from the report itself, while keeping
all the other cpu-tinme code intact.

A more correct solution might be to identify support at compile
(configure) time, and no-op the relevant code if needed.

However, stats.c is already hacky in parts, and there's no real cost
to keeping the code active even if the result is excluded at the
report, and it's also way simpler and less bug prone. So be it.
2025-02-17 22:50:03 +01:00
Dudemanguy ae1ec5e233 DOCS/man: add a separate section for optical drive location
Unless you were compiling on an obscure OS, the default drive location
was never /dev/dvd.
2025-02-17 21:15:42 +00:00
Dudemanguy 8275768bf7 stream_bluray: use DEFAULT_OPTICAL_DRIVE
Unlike the other ones, stream_bluray had no default drive to choose as a
fallback so make it use DEFAULT_OPTICAL_DRIVE.
2025-02-17 21:15:42 +00:00
Dudemanguy 656f0f2dfe build: use the same default optical drive for all disc streams
Amusingly, this was not working correctly for at least a decade. For
all OSes, the default drive is the same except for macOS. It had
"/dev/diskN" as the default dvd drive. Back in the mplayer days, there
was actually dynamic compile time generation (only for mac) that
replaced the N with the actual number*. But this didn't actually work
for all stream types. It seems like it never worked for stream_dvdnav
and was only a stream_dvd (libdvdread) feature. And then later that
stream got removed completely. So at least for macOS users, they had a
fallback device of "/dev/diskN" for certain stream types and for a very
long time.

We can't really do better here, but we should at least pick a default
string that has a chance of working. So /dev/disk1 it is then. With
that, all of the devices become the same so we can combine it all and
use the same default optical drive for both CDs and DVDs. BD will be
added in the next commit. Also /dev/dvd is some antiquated thing that
doesn't really exist anymore. Linux systems will likely still have
/dev/cdrom which has a decent chance of being usable. /dev/dvd probably
won't be there.

*: f215e84339
2025-02-17 21:15:42 +00:00
VortexViking 9506e7298c README: add direct link to user scripts 2025-02-17 21:15:32 +00:00
Dudemanguy 7f00152cd7 DOCS/man/options: fix a typo in the hwdec section
Read this a million times in the PR and still missed it.
2025-02-17 21:14:05 +00:00
Dudemanguy e2f2199522 player: run all update handlers on init
The refactoring in bbac628a1b missed that
the initial update handler didn't immediately run all the triggered
callbacks but would instead delay it until the next playloop. This
subtly breaks things of course like hooks, force window handling, etc.
Ensure that we immediately run all the callbacks like before on startup.

Fixes bbac628a1b
Fixes https://github.com/mpv-player/mpv/pull/15828#issuecomment-2663830477
2025-02-17 21:13:54 +00:00
Kacper Michajłow 1b9ac22e83 player/command: fix flags type in mp_option_run_callback
PR #15457 has not been rebased after merge of #15828 resulting in type
mismatch.

Fixes: f57c0af5f2
2025-02-17 20:08:16 +00:00
Dudemanguy 39b53dd893 wayland_vk: use FIFO if fifo and presentation v2 protocols are available
A very long time annoyance with wayland was compositors indefinitely
blocking our vo thread if the surface gets occluded in some way. We've
worked around this by using mailbox and our own custom vsync function.
Thankfully it looks like people are finally solving this and with these
two protocols it should be possible to guarantee forward progress on
vulkan which means all the workarounds we do shouldn't be needed. So we
can just request fifo in this case as a default since all we want is
standard vsync blocking.
2025-02-17 17:15:00 +00:00
Dudemanguy 319687f387 options: replace --wayland-disable-vsync with --wayland-internal-vsync
With the upcoming fixes to FIFO in wayland, it should be preferable to
use FIFO instead of our own hacky heuristic. This means
--wayland-disable-vsync should become a tristate option with an "auto"
behavior (not implemented in this commit). The semantics have to
slightly change so introduce --wayland-internal-vsync and deprecate
--wayland-disable-vsync.
2025-02-17 17:15:00 +00:00
nanahi 7f4add8ddb options: disable --input-ime by default
Enabling IME by default can cause problems when the player is
expecting keybinds and not text input. Windows IME implementation
mitigates this by switching IME to alphanumeric mode,
but this is impossible on Wayland with the text input protocol.

Disable it by default and add a note to recommend enabling IME only on
demand, like console.lua.
2025-02-17 16:56:47 +00:00
nanahi 052870be9c console.lua: enable/disable IME on demand
This makes console and mp.input users enable IME when text input is
active and restore IME to the previous state when text input is inactive,
to ensure the best IME mode is selected based on input context.
2025-02-17 16:56:47 +00:00
nanahi bebecdf048 video/out/w32_common: support --input-ime
This allows enabling/disabling IME on win32.
2025-02-17 16:56:47 +00:00
Guido CellaandKacper Michajłow f57c0af5f2 various: upgrade option flags to uint64_t
So that more UPDATE flags can be added.

change_flags in m_config_core.h was already uint64_t.

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2025-02-17 16:44:39 +00:00
Guido Cella 49a578faf8 DOCS/man/{mpv,osc}: say menu instead of selector
It's fine to call them menus now that they actually look like ones.
2025-02-17 16:35:27 +00:00
Guido Cella 1329b50098 console.lua: give a different background color to the selected item
The default item also has the same background color but with
transparency.

Also stop bolding selections since inverted black and white backgrounds
should be visible even with color blindness. It was annoying with
proportional fonts because it misalignes similar strings.

As mpv's default text colors are white on black border or background,
--osd-selected-color's default of a bright yellow meant to be used with
a black border becomes unreadable with the inverted white background.

We could default to a dark --osd-selected-color and a a light
--osd-selected-outline-color and use --osd-selected-outline-color as the
selected back color. However in show-text commands having only the
selected item with a different white border doesn't look good.

This therefore adds indipendent selected_color and selected_back_color
script-opts. --osd-selected-color is only used for completions and for
the selected item when searching the command history with
outline-and-shadow.
2025-02-17 16:35:27 +00:00
Guido Cella 5dec4a2464 Revert "console.lua: close with right click"
This reverts commit ad0c29e5ac.

This should be unnecessary now that the menu has a visible horizontal
and vertical hitbox, and was not discoverable anyway. Right click can be
useful even while the console is open to pause or open a context menu.
Requested in
https://github.com/mpv-player/mpv/pull/15145#issuecomment-2428032616.
2025-02-17 16:35:27 +00:00
Guido Cella 24cd11d85c console.lua: always draw a background behind items
Draw a background behind selectable items even with outline-and-shadow.
This makes sense for a menu because you want it to be readable, select
something and move on. It doesn't stay open while watching like OSD
messages and subtitles, so it can cover more of the video. In fact this
was probably the only menu without a background by default. Also the
scrollbar without a background looked weird, and the background shows
the new horizontal hit box.

--osd-outline-color determines the background color with
outline-and-shadow, while --osd-back-color determines the background
color with background-box. Some transparency is added because using pure
black is not recommended because it causes eye strain; alternatively
--osd-outline-color could default to #222222.

Drawing the background ourselves also allows making the corners rounded.

Free-form text mode keeps using only background-box backgrounds if
configured as covering the whole screen while searching stats key
bindings would be bad. Searching history also doesn't add a background
to not change the layout abruptly. When searching history with
background-box, it preserves the alpha component of --osd-back-color.
2025-02-17 16:35:27 +00:00
Guido Cella 7d1d1cfcba console.lua: add a scrollbar
Add a scrollbar to give a visual representation of the size and position
in the items. It is not clickable.

The counter is moved above the scrollbar to free up a line for an
another item, simplify calculations, and prevent the selected item from
jumping from the second to the first line as you type.

In terminal output there is no easy way to draw a scrollbar to the right
due to Unicode widths. This just moves the counter into the prompt.
2025-02-17 16:35:27 +00:00
Guido Cella 4169b1ad1e console.lua: close when clicking outside of items horizontally 2025-02-17 16:35:27 +00:00
Guido Cella d8d2367c24 console.lua: center the select menu in the window
The newly added max width calculation allows positioning the select menu
in the center of the window.

The input line is moved above the items so that the selected item stays
near the input line as you type instead of jumping from top to bottom as
the matches decrease.

Keep aligning to the bottom left to search the command history to not
change the layout abruptly, the same reason the monospace font is kept.
2025-02-17 16:35:27 +00:00
Guido Cella cfb9a9bdb5 console.lua: improve the hovered item calculation with background-box
Follow up to c438732b23 which improved the calculation with the default
outline-and-shadow. We can make the calculation accurate for
background-box too without making semitransparent rectangle backgrounds
overlap by disabling the shadow of selectable items, and drawing a
single rectangle below the items.

We could also calculate the height of each item to make them perfectly
adjacent by rendering each one with compute_bounds, but that takes 15ms
per render even on a new CPU, so 20 lines would take 300ms, which is too
slow.

The rectangle is as wide as the longest item. Even using compute_bounds
once on the longest item on each render() slows it to the point of
making updating the highlight while moving the mouse slower than with
outline-and-shadow, especially on old hardware. So cache the width of
the longest item when opening the console and update it when
osd-dimensions change.

Also increase the items' height to opts.font_size * 1.1 because it looks
better with some margin between the items. It is possible to do it now
because selectable items are drawn in separate ASS events in all border
styles.
2025-02-17 16:35:27 +00:00
Guido Cella 5c49e9b10d console.lua: update the max width calculation
This should not divide by scale_factor() because osd_w is already scaled
pixels.

Also add a TODO to fix --osd-margin-x's scaling.
2025-02-17 16:35:27 +00:00
Dudemanguy 23b57e9f7f player: store external filenames as normalized
Instead of re-normalizing the external filenames of tracks anytime the
property is read, store it normalized in the first place.
2025-02-17 16:33:30 +00:00
bbb651 17a1388300 wayland: support xdg-activation 2025-02-17 16:33:24 +00:00
Dudemanguy bbac628a1b player: coalesce option updates and drop redundant ones
The big option callback in player/command will trigger on every single
update. This is not so great when several heavy option changes are
called in rapid succession and operations are pointlessly repeated. Try
to copy the approach that input commands do and run the actual callbacks
during the playloop. This is not really a smart or sophisticated
mechanism. It also only works for the main option cache. In theory,
other option caches like vo_opts could get spammed too and this makes no
attempt on those. But regardless, this is probably good enough for us.
mp_option_change_callback now tries to group together any new callbacks
with existing unprocessed ones and drop redundant ones whenever
something new arrives.
2025-02-17 16:33:01 +00:00
Dudemanguy 6e7d4bcc2d player: put ipc initialization where it belongs
For some reason, mp_option_change_callback had weird special logic on
init to start the ipc client. This makes no sense. It should just be
started in mp_initialize like all the other clients.
2025-02-17 16:33:01 +00:00
Dudemanguy d7159e4662 vd_lavc: make auto the same as auto-safe and introduce auto-unsafe
Users basically never need --hwdec=auto in reality and sometimes it
bites them unexpectedly (e.g. #15814). Unfortunately the name is kind of
nice sounding and if you don't read the manual closely, you might
inadvertently end up using it. So just make auto the same as auto-safe.
auto-unsafe is introduced to have the old behavior of auto instead. A
similar thing is done with the -copy variants. Try to update the
documentation of this section a little bit and discourage people from
using auto-unsafe because it's kind of dumb.
2025-02-17 16:32:37 +00:00
Dudemanguy 1373cd01be Revert "meson: bump libdrm version to 2.4.109"
No longer needed since the relevant code was removed in the previous
commit.

This reverts commit 32d103c580.
2025-02-17 16:32:25 +00:00
Dudemanguy a181cf6997 wayland: fix implicit modifier selecting mess (again)
Partial revert of the drm stuff added in commits
4d09cde8f9 and
0d7b4d64a5. This was due to my
misunderstanding and simply that my card has some sort of mesa bug. It
appears that YUV sampling is somehow skipped for the implicit modifier
path on radeonsi if the client doesn't use EGL directly (e.g. like
vo_dmabuf_wayland which creates a wl_buffer from dmabfus directly).
Anyways, all of this is just wrong so remove it. All mpv should do is
match format + modifier pairs in the tranches and nothing more.
2025-02-17 16:32:25 +00:00
Dudemanguy 1a96bc4c2c dmabuf_interop_wl: simplify modifier logging 2025-02-17 16:32:25 +00:00
Guido Cella bede44618b {console,input}.lua: allow subsequent mp.input calls
Currently using mp.input while the console is open doesn't do anything.
We can allow using mp.input multiple times in a row by keeping the
console open, and sending a closed event only when the previous calling
script is different from the current one. If it is the same, sending a
closed event would unregister the new input-event listener, so it is
just never sent in this case as there is no sane way to do it. This is
useful e.g. to try out select script bindings in the console, or to
switch to a different mp.input script binding with a key binding without
having to close the current one.

Calling input.select() again within input.select()'s submit handler
needs to be fixed separately because with select the console is
immediately closed on submit (367a6b561a), so input.lua receives submit,
requests a new selection, and receives closed wich unregisters the
handler of the new selection. Just not calling
mp.unregister_script_message("input-event") fixes it; its only purpose
was to allow garbage collection of variables defined in the scope using
mp.input.

Fixes #15795.
2025-02-17 02:32:43 +00:00
Dudemanguy 23e1fb472a options/path: only log mp_get_user_path if the path expands
Having path -> path in the log is kind of useless. If someone happens to
call this on memory://, it will also flood the log with garbage. Only
log it if the path actually gets expanded.
2025-02-16 09:45:14 +00:00
Dudemanguy b8508a5b4d demux_disc: remove obsolete is_dvd checks
6229404985 removed both of these stream
types.
2025-02-16 09:44:15 +00:00
Dudemanguy f8577d1c9b build: remove ta-leak-report option
We already have more than enough options. This doesn't need to exist.
Just use the environment variable if you really want to use this for
some reason.
2025-02-16 09:43:33 +00:00
nanahi 5809d4d1bc etc/restore-osc-bindings.conf: add previously unbound actions
This makes sure that newly added actions do nothing, like before.
2025-02-16 01:01:49 +00:00
Dudemanguy ecd6564251 stream_dvdnav: properly cleanup on error and fix some memory leaks
Also parent priv->filename to priv to simplify the cleanup process.
2025-02-16 00:48:51 +00:00
Dudemanguy f6fa1ae673 stream_bluray: fix some title info leaks
These are both not const and need to be freed after we're done.
2025-02-16 00:48:28 +00:00
Dudemanguy affea09692 stream_blurary: consistently cleanup on error
Sometimes there was an immediate return on error and other times it
destroyed things before returning the error. Make this consistent
whenever something fails while we open. Also remove the destruct
function since it is completely redundant with bluray_stream_close.
2025-02-16 00:48:28 +00:00
Dudemanguy e20e00018a stream_cdda: subtract first sector when calculating chapter times
Sometimes a CD can have non-audio data at the start that is not
playable. libcdio/paranoia is smart enough to already skip this, but our
calculations for when the tracks/chapters start completely fall apart.
The beginning bytes are not valid CD audio so it should just be
subtracted and ignored. This probably doesn't work if a CD somehow has
its audio tracks in a non-continuous manner with non-audio data
in between tracks at random points. There's likely not much we could do
in such a case, and probably nobody has an audio CD like that anyways.

Ref: #8322
2025-02-16 00:48:10 +00:00
nanahi e1bb43cce0 DOCS/man/input: remove extra quotes 2025-02-16 00:48:04 +00:00
nanahi aab3207f81 DOCS/man: document options which are object settings list options
This is already done for other types of list options.
2025-02-16 00:48:04 +00:00
Dudemanguy d9476c1e52 demux_cue: only accept TRACK with AUDIO type
Trying to playback something that is not audio is not so nice.

Ref #8322.
2025-02-16 00:47:43 +00:00
softworkz 46e58b66e6 DOCS/man/input: fix typo 2025-02-16 00:47:36 +00:00
Kacper Michajłow bd1eaf50d6 ci/build-openbsd: don't enable cdda
We hit a -Wstrict-prototypes error which was fixed in the latest release
of libcdio-paranoia but openbsd is too old. We already have coverage of
this in other CIs so remove it.

The same as 04a2450aab, but now cdda is
auto detected, so disable it explicitly.
2025-02-16 00:47:18 +00:00
Kacper Michajłow ea5a542cf3 Revert "build: disable optical media libs by default (DVD/BD/CD)"
There is no good reason to disable it by default.

This reverts commit 77cbb35437.
2025-02-16 00:47:18 +00:00
Dudemanguy 8735974d12 test/libmpv_test_track_selection: add a test for os languages
This test requires that the OS language settings be English so the
--subs-match-os-language option is actually testable. In Linux, this can
be done by just setting LANG and it always will work. For macOS and
Windows, we use the OS APIs to get the languages and let the test
proceed if we find English. Gracefully fail and skip otherwise.
2025-02-16 00:47:13 +00:00
Dudemanguy ef3e6bebe4 language-posix: replace '_' subtag separator with '-'
Internally, mpv uses '-' as a separator for language codes like
specifying the region/variant for the language. However, the posix
environment variables for this separate using a _. Since
5009e13431, support for the _ separator
was dropped which meant that --subs-match-os-language actually didn't
work on linux/bsd at all (mac has its own separate implementation).
Instead of adding _ back to the function, it makes more sense to just
replace _ with - while we parse through the languages since this
implementation of mp_get_user_langs is the only one that separates with
_.
2025-02-16 00:47:13 +00:00
der richter f94b44c8e5 mac/menu: add support for initial directory 2025-02-15 16:22:52 +00:00
der richter ebb0fe68d6 mac/dialog: add support for title, file selection and initial directory 2025-02-15 16:22:52 +00:00
der richter c75779d3b4 mac/swift: move isUrl check to String extension 2025-02-15 16:22:52 +00:00
der richter 6b0e4f7b91 mac/dialog: add file extension filtering for open dialogs
use the configured file extensions from options to filter.
2025-02-15 16:22:52 +00:00
der richter c2106d1894 mac/option: add MPOpts root options 2025-02-15 16:22:52 +00:00
der richter 21732787b8 mac/dialog: move dialog creation into its own class 2025-02-15 16:22:52 +00:00
llyyr 834f99e469 DOCS/man/input: adjust ao-volume documentation to state reality 2025-02-14 22:48:19 +00:00
Kacper Michajłow f8cbe7b6a6 vo_gpu_next: allow to disable error diffusion when changing --dither
error_diffusion was not disabled even if --dither were changed.
2025-02-14 21:13:18 +01:00
Kacper Michajłow 6294e4846d demux/stheader: use atomic types for mp_codec_params names
Notably they are exchanged between demux and decode thread. It's fine
because we know those pointers will be alive as long as avctx is alive.
And only the value may change during decoding in rare situations. Make
those pointers atomic for the sake of it.

It shouldn't change anything, except some codegen.

From https://www.gnu.org/software/libc/manual/html_node/Atomic-Types.html#Atomic-Types:

In practice, you can assume that int is atomic. You can also assume that
pointer types are atomic; that is very convenient. Both of these
assumptions are true on all of the machines that the GNU C Library
supports and on all POSIX systems we know of.
2025-02-14 16:29:47 +01:00
Guido Cella e9c895f135 DOCS/man/options: explain the difference between panscan and zoom
Also suggest checking --panscan docs from its key bindings.
2025-02-14 15:28:41 +01:00
llyyr d766875587 DOCS/man/input: fix required protocol docs for wayland clipboard
We use the ext protocol, not the wlr specific protocol. Moreover,
"zwlr_data_control_manager_v1" is an interface within the protocol, not
the protocol name itself.
2025-02-14 15:22:58 +01:00
Guido Cella 90480f7ea1 DOCS/man/input: document the clock property
Finally document the property added in 953d225368.
2025-02-14 15:21:54 +01:00
Dudemanguy 1b63b33871 player/sub: eliminate redundancy when printing terminal subtitles
track->selected works for the primary and secondary subtitle.
2025-02-14 15:21:35 +01:00
Kacper Michajłow de837aa80b test/libmpv_common: ensure our atexit clean fires before internal ones
This allow to use MPV_LEAK_REPORT and makes exit order more predictable
when debugging.
2025-02-14 15:21:02 +01:00
Kacper Michajłow d739df9ec3 player/loadfile: don't use ta_set_parent directly 2025-02-14 15:21:02 +01:00
Dudemanguy 58f46e7f0b test/libmpv_test_track_selection: add another multilang selection test
Because you can never have too many tests. This covers some scenarios
that the other multilang one doesn't (multiple tracks with the same
language).
2025-02-13 23:22:28 +00:00
Dudemanguy 9e38208951 test/libmpv_test_track_selection: eliminate reloading redundancy
Loading the file and then waiting it for it to be loaded again doesn't
need to be two separate functions. Combine it into a simple
"reload_file" so it's more readable.
2025-02-13 23:22:28 +00:00
Dudemanguy dba53e1b5b test/libmpv_test_track_selection: remove unneeded option resetting
This got refactored so it only loads one file at a time and not
everything in a loop. The option resetting at the end of conditional
branches is pointless.
2025-02-13 23:22:28 +00:00
Dudemanguy f7a681b362 test: add default track selection testing
The amount of options we have that are related track selection is insane
and touching any of this stuff is scary. Add some track selection
testing to the CI to hopefully make it slightly less scary to touch any
of that. Since trying to work in media files from some outside source
would be a pain and need to live in some repo somewhere, it's nicer to
just generate dummy files on the fly with ffmpeg during the ci runs and
use that. Obviously, the actual tests themselves could be even more
thorough (external tracks were not even considered), but this is more
than a good enough start for now.
2025-02-12 15:29:07 +00:00
Dudemanguy 25067e845c test: split libmpv_test into separate files
The big libmpv test file is really actually three different tests shoved
together into one. They do all use fairly similar underlying structures,
so put the shared stuff into an inline header. There's a little bit of
duplication with regards to the main function, but it's cleaner to
separate out the tests.
2025-02-12 15:29:07 +00:00
Dudemanguy d980e950c6 test: group together all the libmpv tests under the libmpv suite 2025-02-12 15:29:07 +00:00
Dudemanguy 2e1f89a0df github/workflows: drop mingw32
Upstream dropped libplacebo* so we're pretty much out of luck here. It's
not worth it to bother building a subproject for just this one.

*: https://github.com/msys2/MINGW-packages/commit/c3a79e8ae9a8e7f2215db210ba3f44d91d7e23b6
2025-02-12 11:15:04 +01:00
sfan5 bfa3e90867 video/out/android: don't assert-fail if WinID is not set
This matches the behavior of every other GPU context and is the only
behavior that makes sense.
2025-02-11 19:19:36 +01:00
Kacper Michajłow f385a6b253 demux_lavf: fix demuxer-lavf-format usage
mpv internally treats all string options/properties with NULL or an empty string the same way. client.h explicitly forbids MPV_FORMAT_STRING from being NULL, but in the C API, it has been working accidentally due to how strings are copied. Nevertheless, none of the APIs allow this; JavaScript, Lua, IPC, and CLI all require strings to be at least empty. We cannot pass NULL.

Furthermore, currently passing NULL causes an assertion failure in the JSON formatter, so it is clearly not intended to be used that way.

Internally, all string options default to NULL, but in this case, they should behave exactly the same as an empty string. Hence, this change is applied to the `demuxer-lavf-format` option.

Note that get_property will never return a NULL value, regardless of the internal value.

Fixes: #15840
2025-02-10 04:29:55 +01:00
Guido Cella 73b84595a8 select.lua: change the --save-watch-history warning text
The current warning was fine when you select history directly, but
giving more information can be useful when you happen to see it by right
clicking the title without prior information.

Fixes https://github.com/mpv-player/mpv/pull/15655#discussion_r1948053973
2025-02-09 23:30:54 +01:00
Kamikadze e4b64fba9c DOCS/man/options: Clarify what --tone-mapping=auto does 2025-02-08 06:16:38 +01:00
Kacper Michajłow f14660b446 Revert "vo_gpu_next: set --target-colorspace-hint to yes by default"
HDR or any color-space pass-through should be opt-in, as we cannot
control the user's compositor or display. Allowing HDR signals to be
pushed by default may lead to surprising results for some users.
Additionally, for an optimal experience, this option should be paired
with the target-peak of the display.

Make the pass-through opt-in and let the user decide if they want or
need it. By default, mpv should render a safe and consistent sRGB
output. mpv's tone mapping is generally of higher quality than any
external solution.

This reverts commit 23843b4aa5.
2025-02-08 06:15:32 +01:00
Kacper Michajłow bc430fdbb8 player/command: don't synthesize property names with a trailing /
This is not only cosmetic, but also avoids dummy get key action with
empty key. While this was allowed previously, I'm bit concerned about
Hyrum's law. But let's be strict about it.

This commit fixes current-tracks property.

Fixes: 95019fc256
2025-02-08 05:45:57 +01:00
Dudemanguy f9b95cb83d command: disallow trailing / in track-list/N/metadata
To have consistency with 95019fc256
2025-02-08 05:44:06 +01:00
Kacper Michajłow 50f3c1c243 player/command: disable input-commands for fuzzing
Updating input-commands string list causes all commands to be rerun.
This happens during load-config-file command, so even with few commands
it is easy to amplify single command to run hundreds of times instead of
one. This causes timeouts and OOMs when specific command for example
reopens current playlist appending an item.

Also avoid even single input-commands, we want to test load-config-file
parsing and input-commands can do loadfile and trigger heavy code
paths. We don't want to mix this. Unfortunately parsing of
input-commands will not be tested.
2025-02-08 05:41:22 +01:00
Kacper Michajłow 95019fc256 m_property: fix playlist property parsing
Disallow silly things like ${playlist//} and trailing slashes
${playlist/0/}.
2025-02-08 02:01:52 +00:00
Guido Cella 3c1ddc411c console.lua: fix completion after command prefixes
I'm not sure when this broke but completions after command prefixes were
not being updated.
2025-02-08 02:01:40 +00:00
Guido Cella a62c559d82 command: show Loop playlist when changing --loop-playlist at runtime
Just "Loop" is a leftover from when --loop-playlist was called --loop.
2025-02-08 02:01:25 +00:00
Dudemanguy 18257375e4 m_option: deprecate setting -1 to --video-aspect-override
It's unfortunate that it is implemented this way since changing it will
take time. This option should *really* be like OPT_CHOICE but with
doubles and not integers. We don't have that though and implementing it
is something for the future. Even if that was done today, this still
couldn't be switched to since setting -1 has been the effective way for
years to undo video-aspect stuff. So the approach is to just add another
special keyword for this and tell people to use that instead. Note that
setting 0 isn't deprecated since M_RANGE(0, 10) is totally fine and
would work in the future if this option type ever gets redone.
2025-02-08 02:01:13 +00:00
Dudemanguy cb91de2a34 m_option: forbid non -1 negative values for video-aspect-override
Setting this to M_RANGE(-1, 10) meant that you could pass fractional
negative values without it being an error. This is, of course, nonsense.
-1 is the only special negative value with a meaning. Error out if we
get anything else by doing some additional parsing before we send it off
to parse_double which will then restrict the range to 0, 10 with these
changes. Note that this approach requires defval to be there which is
not the most extensible thing in the world. But there's literally only
two OPT_ASPECT type options out of the hundreds we have so not a big
deal. Ideally, this type should be OPT_CHOICE but with underlying
doubles but that's too much effort to implement cleanly.
2025-02-08 02:01:13 +00:00
Dudemanguy 16828aa952 command: convert aspect, par, and sar sub-properties to double
These were still set to float. For some common aspect ratios (e.g. like
4:3), the loss of precision is significant. The underlying calculations
are already done with doubles so all that needs to be done is to change
the type of the sub-property.
2025-02-08 02:01:13 +00:00
Kacper Michajłow 17db9bdc50 build: add early exit if git is not found
Also fallback to `--always` only if first `git describe` returned
errors, but were called successfully.
2025-02-06 02:16:51 +01:00
Kacper Michajłow 2596c4d930 github/workflows/lint: show ruff suggested changes 2025-02-06 01:33:09 +01:00
Kacper Michajłow cd439acce2 github/workflows/lint: update astral-sh/ruff-action to v3
This enables GitHub style output, along with other improvements.
2025-02-06 01:33:09 +01:00
Dudemanguy d19bb08bef ci/lint: disable isort checks
The error message is completely incomprehensible and also inconsistent
about whether it wants two newlines or just one after an import.

Consider this python script:

import sys

sys.stdout.write("garbage")

That passes the ruff isort check just fine. But this does not:

import sys

def fake_function():
    sys.stdout.write("garbage")

fake_function()

This will fail. Why? Because there should be two newlines after imports
but only for functions. This is because of PEP8 rules about blank lines,
but this is not explained or referenced anywhere in output from the
lint. You only get a cryptic "Import block is un-sorted or un-formatted"
with some visual that isn't clear in what it's trying to communicate.
Additionally, it seems to go a bit beyond PEP8 and also will fail if you
have too many blank lines (i.e. more than 1) in certain cases if the
succeeding line isn't a function or class definition.

Furthermore consider this example:

import os
import sys
from subprocess import check_output, DEVNULL

This also fails the lint. Why? Because DEVNULL should come before
check_output. Again, the lint doesn't explain this and you're left
guessing what horrible formatting sin you committed.

Considering the amount of time I wasted trying to even understand this
and I still don't, just delete it. How are contributors supposed to
understand what this lint wants when the project's own developers were
confused by it. Please just alphabetically sort your python imports and
don't do "from foo import *".
2025-02-05 23:46:30 +00:00
Kacper Michajłow 05ff82e153 build: use a more user-friendly version string for shallow clones
If the cloned repo is shallow (e.g. like the default github actions
settings), the git describe command won't actually be able to fetch any
tags and will instead just get a hash. The resulting binary version
string will end up being that git hash. While it does tell you the exact
commit, it's not exactly helpful when wanting to know the general
version at a glance. For the case where we do have a git directory but
no available tags, build a version string using the mpv version + the
commit hash.

Fixes #15789.
2025-02-05 23:17:06 +00:00
Dudemanguy 8e97f41849 build: prepend version strings with 'v' for release tarball builds
This was an inconsistency with the git tagging since the meson project
version is just a number.
2025-02-05 23:17:06 +00:00
Kacper Michajłow 28ab3aec6a github/workflows/lint: add umpv to Python linting
It doesn't have extension.
2025-02-05 20:22:01 +01:00
Kacper Michajłow 48f944d21b TOOLS/umpv: add Windows support
While there are native ways to implement this in mpv itself on Windows.
We can also support this script without any problem.
2025-02-05 20:22:01 +01:00
Kacper Michajłow f9a7179f37 TOOLS/umpv: use append-play
It makes more sense to star playback if nothing is playing.
2025-02-05 20:22:01 +01:00
Kacper Michajłow dfbd60f9bb TOOLS/umpv: don't wait for mpv after it is run
We just want to start mpv, there is no need to keep umpv script alive.
2025-02-05 20:22:01 +01:00
Kacper Michajłow b870d1933a TOOLS/umpv: use builtin profile for pseudo gui options 2025-02-05 20:22:01 +01:00
Kacper Michajłow 62847c9f39 TOOLS/umpv: handle the case when mpv disappears during adding files 2025-02-05 20:22:01 +01:00
Kacper Michajłow 7372bc5f12 TOOLS/umpv: minor fixes to style and typing
Add UMPV_SOCKET_DIR for socket base dir selection and fallback to TMPDIR
as last resort.
2025-02-05 20:22:01 +01:00
Dudemanguy 493cc877cf m_option: fix parsing of OP_APPEND for string lists
While parsing through the separators, the OP_APPEND also needs to use 0
for the separator since it is supposed to be unescaped. This was missed
in the code reorganization of d2c409c56b.
Keyvalue lists were unaffected because only OP_DELETE and OP_REMOVE use
this code.
2025-02-05 18:38:46 +00:00
Kacper Michajłow 3717a530ca player/loadfile: we shouldn't unescape inplace
I got mesmerized by the simplicity of the original commit, but in fact
it was not a correct thing to do.

Fixes: c0366cfa42
2025-02-05 18:04:11 +01:00
Kacper Michajłow de4004c61d meson: add disable-packet-pool option
For debugging without a pool, maybe.
2025-02-05 05:09:33 +01:00
Kacper Michajłow 038d66549d demux: reclaim demux_packets to reduce memory allocator pressure
This update introduces a demux_packet_pool, allowing for the reuse of
previously allocated packets when needed.

sizeof(AVPacket) is not a part of the lavc public ABI, which prevents us
to allocate memory in larger blocks. However, we can substantially
decrease the amount of alloc/free operations during playback by reusing
both mpv's demux_packet and AVPacket.

This adjustment addresses the root cause of issue #12076, which,
although resolved upstream, did not fully tackle the persistent problem
of allocating small blocks of aligned memory. This issue largely stems
from the FFmpeg design of the AVPacket API. After this change memory
will no longer be allocated once cache limits is reached.

The demux_packet_pool is shared as a global pool of packets for a given
MPContext.

This change significantly speeds up the demuxer deinitialization,
benefiting file switching scenarios, especially when a large demuxer
cache is used.

See: #12294
See: #12563
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-02-05 05:09:33 +01:00
Nikolai Vavilov c0366cfa42 loadfile: unescape display filenames
This makes OSD more usable when the filename contains non-ASCII characters.
2025-02-05 05:04:33 +01:00
Guido Cella 6f0a077d9b DOCS/man/options: document that --d3d11-flip=no enables transparency 2025-02-05 04:56:01 +01:00
Guido Cella b0364f8761 osc.lua: bind right clicking the title to show history
And move show-text ${path} to middle click. This is more useful than the
replaced show-text ${filename} binding since the left click stats
binding already shows the filename, and it matches how right clicking
other buttons shows menus. Alternatively middle click could also be
bound to select-watch-later.
2025-02-05 04:55:37 +01:00
Leo Izen a7357c221e TOOLS/mpv_identify.sh: handle forward slash in property names
Property names contain '-' characters, which are translated into
underscores because POSIX shell variables cannot contain hyphens.

We should do the same thing for forward slash characters (i.e. '/')
because these also cannot be present in the names of shell variables.

Fixes: #15782
2025-02-05 04:54:04 +01:00
Sami Farin fa9c2a35dd video/out/kitty: make kitty vo ten times faster by avoiding strlen
When playing a video, 55% of CPU used in strlen, callgraph flip_page: ta_talloc_strdup_append ,
ta_talloc_asprintf_append and ta_talloc_strndup_append .

Before the fix: 2 fps when playing 1080p 24 fps video (--vo-kitty-use-shm=no),
24 fps after the fix.

video/out/kitty: move bstr cmd to priv
2025-02-05 04:53:42 +01:00
Dudemanguy 38ad1ed03b command: normalize paths for path and track-list/N/external-filename
It's better for API users to actually get predictable results.
2025-02-01 16:12:03 +00:00
Dudemanguy 02c0b346eb command: simplify find_track_with_url handling
Now that mp_normalize_path can accept NULL and we have a shorthand for
expand + normalize, now is a good chance to simplify this to make it
less awkward.
2025-02-01 16:12:03 +00:00
Dudemanguy 6472e45e8b options/path: add mp_normalize_user_path shorthand
Expanding a path and then normalizing it is probably a common shorthand.
The reason to not incorporate this directly into mp_normalize_path is
because it requires the global struct which is out of scope for
path_utils so use this wrapper instead.
2025-02-01 16:12:03 +00:00
Dudemanguy 956cb2c49f various: simplify mp_normalize_path usage
If a talloc_ctx was being made solely for a onetime usage of getting a
normalized string, we can now just pass NULL instead and free the string
directly to make things easier.
2025-02-01 16:12:03 +00:00
Dudemanguy 0755edb327 misc/path_utils: allow passing NULL to mp_normalize_path
Instead of requiring the caller to pass an appropriate talloc_ctx,
mp_normalize_path will make its own internal allocations and cleanup as
needed.
2025-02-01 16:12:03 +00:00
Guido Cella b2404e16dd console.lua: stop expanding ~/ in file completion
It is not needed to expand ~ in file completion as you type after
62c3aeb9c made commands themselves interpret it. We only need to call
expand-path on the directory before passing it to utils.readdir in order
to find files in it when it contains ~ placeholders. As a bonus this
will now also complete files in directories like ~~/ and ~state/.

This simplifies command completion, and was also the blocker for
splitting running commands out of console.lua, since I didn't know how
to replicate it through mp.input.
2025-02-01 16:11:30 +00:00
Guido Cella 6fb3ac1bc7 Revert "DOCS/man/input: document that shutdown is sent when scripts terminate"
This reverts commit 86383aef95.

shutdown isn't actually sent on exit() but only with internal options,
e.g. set osc no, which isn't relevant for users.
2025-02-01 16:11:18 +00:00
Guido Cella 86383aef95 DOCS/man/input: document that shutdown is sent when scripts terminate
shutdown is not sent only when the player quits, but also when
individual script are unloaded, either by calling exit() or by toggling
options like --osc.

This was already mentioned in javascript.rst so remove it from there.
2025-01-31 06:04:54 +01:00
Guido Cella cada717416 Revert "console.lua: add pause_on_open script-opt"
This reverts commit 850e03d29f.

The previous commit solved this in a more general way. You can do:

[open-console]
profile-cond=p['user-data/mpv/console/open'] and p['current-tracks/video/albumart'] == false
profile-restore=copy
pause

Thankfully pause_on_open was just added and has not been in a release so
we can remove it.
2025-01-31 06:04:54 +01:00
Guido Cella 8669205d92 console.lua: add user-data/mpv/console/open
Fixes #15762.
2025-01-31 06:04:54 +01:00
Guido Cella 17e4cc5397 DOCS/man/input: reorder user-data's docs
user-data/mpv/ytdl was documented out of nowhere instead of together
with user-data/osc.
2025-01-31 06:04:54 +01:00
Dudemanguy 62c3aeb9cb command: expand paths for all commands with path arguments
Follow up to be15be3a83 with the same
reasoning.
2025-01-30 21:57:31 +00:00
Kacper Michajłow caeda81bce ci/lint-commit-msg.py: add .rst from allowed extension skips
All .rst files changes are prefixed with DOCS/ so the ext can be skipped.
2025-01-30 19:34:31 +01:00
Kacper Michajłow cd1e44c40b ci/lint-commit-msg.py: remove .py from allowed extension skips
Allow extension skip only on core files c/cpp/h/m/swift, for the rest
require ext.
2025-01-30 19:34:31 +01:00
Dudemanguy 814316fb2a command: add metadata sub-property for track-list
Requires a little bit of massaging for the key/value access to work
correctly, it's not terribly intrusive all things considered.
2025-01-30 15:24:38 +00:00
Dudemanguy 5c3262628e command: prefix all property functions with mp
This weird inconsistency was annoying.
2025-01-30 15:24:38 +00:00
Dudemanguy d5cb5740cc player: print secondary subtitles on the terminal
Fixes #10118.
2025-01-30 15:20:29 +00:00
llyyr 72d976b3c1 m_option: reallow setting list options to no value to -clr them
d2c409c56b broke setting `--slang=` to
effectively `-clr` the option. Restore the behavior because scripts rely
on it.

Fixes: d2c409c56b
2025-01-29 23:55:43 +00:00
Kacper Michajłow 79e29787de osdep/terminal-unix: fix stop_cont_pipe leak
mpv_create/mpv_destroy would leak those.
2025-01-29 22:27:11 +01:00
Kacper Michajłow 82427df2ad fuzzer_load: don't dup3 fd if it already has a value we want
Unlike dup2, If oldfd equals newfd, then dup3() fails with the EINVAL.

Fixes: 1d352f8527
2025-01-29 22:27:11 +01:00
Dudemanguy 4c3eb16a47 m_option: add -clr to keyvalue list options
Seems to have been omitted by mistake and nobody ever noticed.
2025-01-29 20:45:13 +00:00
Dudemanguy d2c409c56b m_option: reintroduce -del to string list and keyvalue list
b56e63e2a9 removed this because it was
deprecated and not clearly useful. This commit adds this operation back
to string lists and keyvalue lists, but with one important change. It
operates via the actual values and not indexes. So you can use
--foo-del=bar,bar2 to remove bar and bar2 from foo. The difference from
using -remove is that this is subject to escaping rules and has the same
caveats as -add. Note that -del wasn't added back to the object settings
list because you can already remove multiple items with -remove from it.
2025-01-29 20:45:13 +00:00
Dudemanguy 7456816217 m_option: undeprecate list option suffixes with multiple items
Done with 4a084c0df8. The reasoning was
that it was "confusing", but without using -add it is impossible to
append multiple items to a list in a single command and just overall
makes this less powerful. The code works fine. You might find yourself
in escaping hell, but that's on the user to deal with.

Also it's worth noting that -remove with object settings lists can
actually remove multiple items and unlike the other list option types.
2025-01-29 20:45:13 +00:00
Kacper Michajłow 90631b9e90 player/misc: check codec values for overflow
Found by OSS-Fuzz.
2025-01-29 20:15:47 +01:00
Dudemanguy 694817121a command: don't run UPDATE_{AD,VD} if the {ao,vo}_chain doesn't exist
As described in 544240c829, the callbacks
are all run on init so UPDATE_AD and UPDATE_VD both executed. While this
is probably not harmful, it is completely pointless work and results in
extra event notifications being sent. Just skip these if there is no
matching chain.
2025-01-29 15:07:42 +00:00
Dudemanguy 8c4ca44e24 vd_lavc: separate opts to two structs and reorganize
The options in vd_lavc are all related, but they don't all require the
same thing for runtime changes. To avoid having to manually add UPDATE_*
to every single option flag, the options can be split into two separate
structs. The vd_lavc_conf becomes a catch all for all the --vd-lavc
options that require the full UPDATE_VD flag. The rest of the options
are split off into the new hwdec_conf instead. Additionally,
--vd-lavc-software-fallback is renamed to --hwdec-software-fallback and
moved to the hwdec_conf as well. The new name better reflects what it
does and it logically fits with those more. UPDATE_* flags are added on
everything now so these should all now be changeable on runtime.
2025-01-29 15:07:42 +00:00
Dudemanguy 838df2c252 ad_lavc: flag options with UPDATE_AD 2025-01-29 15:07:42 +00:00
Dudemanguy be15be3a83 various: expand paths for all file/directory related options
There's several path-related options that do not handle common shortcuts
(like ~/). Fix this by using mp_get_user_path where appropriate which
expands the path so users get more intuitive behavior. Fixes #15598.
2025-01-29 14:49:06 +00:00
Dudemanguy c7c09fdb8b command: fix spammy events when frame stepping forward with seek
The frame-step command also signals on up events. This is only useful
when using the default "play" mode. For seek mode, it triggers another
frame step which is not what you want. Rearrange the logic so the up
event is ignored for the seek flag. The frames check is also not needed
since add_step_frame already handles it.

Fixes 9661a3839b
2025-01-29 14:48:55 +00:00
Attila Fidan 3544728991 clipboard-wayland: initialize offer fd
Fixes: https://github.com/mpv-player/mpv/issues/15763
2025-01-29 13:19:04 +01:00
Kacper Michajłow 9251411627 vo_kitty: unlink shared memory only on vo close
We don't want to unlink on flip_page().

As a bonus fix leaked mpi image.

Fixes: af384df219
2025-01-29 06:47:35 +01:00
Christoph Heinrich 4fd9893f28 player/command: reinit video decoder when it's options change 2025-01-28 21:16:39 +00:00
Dudemanguy eb612b29f2 DOCS/man/options: correct outdated --ad/--vd documentation
13add62cf0 removed support for the +
syntax for these options.
2025-01-28 15:48:15 +00:00
Dudemanguy 0e03fdf0f7 f_decoder_wrapper: allow changing --ad and --vd at runtime 2025-01-28 15:48:15 +00:00
Dudemanguy 8d665ac2df osc.lua: add visibility_modes script opt
This allows users to choose what visibility modes they want to cycle
through when calling the osc-visibilty cycle script binding.
2025-01-28 15:47:47 +00:00
Dudemanguy fd4aa9b533 osc.lua: deprecate pointless script-messages
1a558bf5c2 effectively aliased the custom
OSC printing to actual mpv properties instead. These only exist for
backwards compatibility which hopefully will get removed one day so
instead deprecate them and warn users of what they should be using.
2025-01-28 15:47:47 +00:00
Dudemanguy f663591acd DOCS/man/osc: document the second arg in some script commands 2025-01-28 15:47:47 +00:00
Kacper Michajłow af384df219 vo_kitty: unlink shared memory on vo close 2025-01-28 07:59:47 +01:00
Kacper Michajłow 1d352f8527 stream_file: allow to open only our fd in case of fuzzing
This ensures that we don't open some other fd, for example when loading
playlist. Also filters out loading any local files.

This also allows to remove custom filtering from fuzzer itself.
2025-01-28 07:59:04 +01:00
Dudemanguy 9661a3839b command: allow frame-step to go through multiple frames and/or seek
Previously, the default behavior of frame-step and frame-back-step is to
play forward 1 frame or seek back 1 frame. We keep this behavior but
introduce additional flags to control the exact behavior of the frame
stepping. The first argument simply specifies how many frames to go
through. The second argument specifies whether to play video to step
through frames or to seek to step through frames. Playing through the
video to step through frames only works going forwards (otherwise it
will always seek). In theory we could use backwards playback for this,
but that can be decided later.

As a minor note, MPSEEK_BACKSTEP is renamed to MPSEEK_FRAMESTEP since
forward seeks can use this as well. Fixes #10128.
2025-01-28 04:20:16 +00:00
Guido Cella 57962e9980 DOCS/man/select: document the menu script-binding
Also remove select/ from the last 2 script bindings.
2025-01-27 21:21:26 +01:00
Guido Cella 1f6bba19d7 osc.lua: add an icon for the miscellaneous menu
Add the generic menu to bar layouts to provide discoverability for the
select menus to users who don't realize you can right click OSC buttons.

There's no space to add it in box layout.
2025-01-27 21:06:50 +01:00
Guido Cella e07c78f2db TOOLS/mpv-osd-symbols.sfdir: add a menu icon
Taken from the last freely licensed version of Symbola and manually
adjusted the number in the glyph file to match the adjacent arrows.

Saving sfdir with fontforge also automatically removed the O flag from 2
existing glyphs. According to
https://fontforge.org/docs/techref/sfdformat.html "O" just meant "the
character was open when last saved", so it doesn't change anything
visible.
2025-01-27 21:06:50 +01:00
Guido Cella 118ef75c27 TOOLS/mpv-osd-symbols.sfdir: document how to add icons 2025-01-27 21:06:50 +01:00
Guido Cella 3e0b3373df select.lua: add a miscellaneous menu 2025-01-27 21:06:50 +01:00
Guido Cella 24db17d10f loadfile: discard prefetched files if demuxer options changed
When using --prefetch-playlist, if demuxer options are changed in the
time window between the start of prefetching and the playback of the
next file, the old values are used. This includes setting demuxer
options in legacy extension auto profiles.

Fix this by setting a flag when demuxer options change and not using the
prefetched data when that flag is true.

UPDATE_DEMUXER is not added to demux.c's options because those already
support updates while playing.
2025-01-27 19:32:52 +00:00
Guido Cella 130128762b command: group flag updates together 2025-01-27 19:32:52 +00:00
Kacper Michajłow 75efb04e08 demux_mkv: limit RealAudio packet size to 128 MiB
It should be more than enough for this and avoids some huge allocations
on broken files. 128 MiB is already huge for audio buffer, but better
than 4 GiB...
2025-01-27 18:54:24 +01:00
Guido Cella 3fdc5338cc DOCS/man/select: add this file
Also update console's documentation.
2025-01-27 18:53:36 +01:00
Guido Cella e2090533cf select.lua: select from the watch history with g-h
Implement selection of the entries in the watch history.

The last entry in the selector deletes the history file.
2025-01-27 18:53:28 +01:00
Guido CellaandKacper Michajłow b75ed73f4f loadfile: optionally save the watch history
The history could be formatted as CSV, but this requires escaping the
separator in the fields and doesn't work with paths and titles with
newlines. Or as JSON, but it is inefficient to reread and rewrite the
whole history on each new file, and doing so overwrites the history with
an empty file when writing without disk space left. So this uses a
hybrid of one JSON object per line to get the best of both worlds. This
is called NDJSON or JSONL.

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2025-01-27 18:53:28 +01:00
Guido CellaandKacper Michajłow a3cc06f754 misc: make json_append() non-static
This will be used to write json with a bstr in the next commit.

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2025-01-27 18:53:28 +01:00
Guido Cella 908dc02eb9 misc: extract mp_find_non_filename_media_title() from command.c
This will be used to write the title in the watch history.
2025-01-27 18:53:28 +01:00
nanahi 27db2e1d50 DOCS/man: add documentation of wayland backend and properties 2025-01-27 18:51:31 +01:00
nanahi ab461e0209 console.lua: use clipboard property for native Wayland backend
This backend does not require the window focus quirk handling,
and also supports primary selection.
2025-01-27 18:51:31 +01:00
nanahi 3be195e616 console.lua: autocomplete clipboard/text-primary property 2025-01-27 18:51:31 +01:00
nanahi 481646da37 command: add current-clipboard-backend property
Useful to know which clipboard backend is active.
2025-01-27 18:51:31 +01:00
nanahi b2165c263a clipboard: add function to get clipboard backend name
Some platforms like Wayland may have support for multiple backends,
so add this function to make it possible to determine the current
active backend.
2025-01-27 18:51:31 +01:00
nanahi 46e2f55338 command: add clipboard/text-primary property
This property contains the text in the primary selection.
2025-01-27 18:51:31 +01:00
nanahi 9f2ac08851 clipboard-wayland: add Wayland clipboard backend
This adds a "native" Wayland clipboard backend based on the
ext-data-control-v1 protocol.
This backend overcomes the limitation of the VO (Wayland core protocol)
backend, and does not require the presence of the VO window to receive clipboard
updates.
This backend also supports primary selection if supported by the compositor.

The backend runs in a separate thread, so clipboard reading
does not stall the player like the VO backend.
2025-01-27 18:51:31 +01:00
nanahi 589e34cebd clipboard-vo: use clipboard parent log context
This adds clipboard backend names to backend-specific logs,
e.g. clipboard/vo.
2025-01-27 18:51:31 +01:00
nanahi dc5c857f7b clipboard: don't store mpv_global context
It's only used for logging, and further creation of log contexts
can use the parenting feature instead, so there is no need to
store it.
2025-01-27 18:51:31 +01:00
Attila Fidan fbf366d124 video/out/wayland_common: create per-seat objects on seat hotplug
This is to allow data device and text input to be used on seats that are
hotplugged after vo init.
2025-01-27 18:51:10 +01:00
Kacper Michajłow a1424d5fe0 demux/ebml: fix ebml_read_length()
Fixes reading EMBL sizes in some files and makes this function readable
while at it.

Would be good to inline mp_log2(), but should be good enough.

Fixes: #15691
2025-01-27 18:50:59 +01:00
verygoodlee 57a8105f1a win32: fix menu click failure caused by excessive menu-data updates
basically a copy of tsl0922/mpv-menu-plugin#77

if you have 200+ menu items and update `menu-data` about 400 times,
clicking menu item will not execute any command, the reason is that the
menu identifier greater than the max value of 16-bit unsigned integer.

1. make menu id always less than 0xF000 as mpv-player/mpv@861908c7 said
2. old menu items are never reused, should delete by DeleteMenu()
   instead of RemoveMenu(), destroys the handle and frees the memory
2025-01-26 22:19:26 +01:00
Kacper Michajłow feef1bc02b ci/linux: enable leak detector
The leak detector has been disabled due to a libass leak that was
causing the test to fail. I initially expected this change to be
temporary until a patch release of libass became available and we could
update it. However, it has been a few months without a release. Instead
of waiting, re-enable the leak detector and add a suppression file for
this specific leak.

Fixes: d6eb85bb1a
2025-01-26 22:18:14 +01:00
nanahi 964017c06c stream_dvb: accept float timeout
Change the --dvbin-timeout type to float so that it
can now be set to less than 1 second.
2025-01-26 22:15:30 +01:00
nanahi c776f5f2c9 various: use mp_poll instead of poll
mp_poll supports higher time resolution than poll, so use it
when the timeout is not 0 or infinite. Also use time conversion
macros.
2025-01-26 22:15:30 +01:00
nanahi 90a84e97f3 misc/dispatch: remove mention of select
mpv code doesn't use select, only poll.
2025-01-26 22:15:30 +01:00
nanahi 88ee25da12 video/out/wayland_common: remove useless flag
POLLHUP is only returned in revents and ignored in events,
so there is no need for it to be here.
2025-01-26 22:15:30 +01:00
Kacper Michajłow d64095bd7e osdep/io: map ftell to int64_t version on win32
Note that all mpv code expects 64-bit offsets already. And we set
_FILE_OFFSET_BITS=64 unconditionally. Also this mirrors lseek() that we
already have wrapped in similar way.
2025-01-26 22:10:00 +01:00
Kacper Michajłow b01e1ab61a osdep/io: add ftruncate for win32
Trivial wrapper around _chsize_s() to return -1 on errors always.
_chsize_s() returns errno value. At the same time errno is set to the
same value.

FILE_WRITE_DATA has to be added in append mode, because _chsize_s()
requires write permissions, not only append. We lose atomic append, but
we follow POSIX here, so that's fine, I guess.
2025-01-26 22:10:00 +01:00
Attila Fidan 98627b027d video/out/wayland_common: fix crash with multi-seat drag and drop
If you have two seats connected, both with the pointer capability, and
use two hands to start a drag and drop operation with each pointer, then
move one pointer to the mpv window, then the other, mpv fails the
!wl->dnd_offer->offer assert in device.enter, because it expects that
the compositor wouldn't just call device.enter again before device.leave
or offer.finish.

The data device is per-seat, so this commit makes mpv track the data
device's offers per-seat rather than in vo_wayland_state, which makes
more sense and is easier to reason about when multi-seat is involved.
2025-01-26 16:32:30 +00:00
Kacper Michajłow 3550ec52cd Revert "ci/win32: restrict shaderc version to fix build errors"
This reverts commit ddba159b51.

Follow-up after: 3b586ba6c3
2025-01-25 18:34:28 +01:00
nanahi f1924988dc various: update license headers
Change MPlayer to mpv and the last sentence like all other files.
2025-01-25 18:33:43 +01:00
sfan5 3b586ba6c3 ci/mingw: update library versions
also moves shaderc to latest git again
2025-01-25 15:39:36 +01:00
Guido Cella 04c328f784 console.lua: use the same blur amount as --osd-blur
I have no idea why, but console's blur is smaller than in OSD messages
and stats (regardless of persistent_overlay). It's smaller regardless of
scale_with_window, or if using 0 PlayRes like stats with
persistent_overlay=yes.

With scale_with_window=yes, multiplying the blur by 2.5 seems to make it
the same. This is probably because 2.5 is 720 / 288, which are the base
height sizes scale from and the OSD's PlayResY. With
scale_with_window=no, we need to multiply by osd_h, which is always 720
with scale_with_window=yes.
2025-01-25 03:14:59 +00:00
Attila Fidan 51dc6286b6 video/out/wayland_common: support IME usage via text-input-v3
This is useful for text input in, for example, console.lua. Each
character in the commit string gets turned into an mpv key press.
Pre-edit strings are not handled, since there's currently no good way to
handle that or make it useful to text input scripts. Like win32, which I
tested in wine, another limitation is that the composition window is
always positioned at the top left of the window, since we cannot get
useful positioning hints from mpv scripts. It allows the composition
window to be within the window and avoids obstructing the console
prompt.

This can be enabled/disabled with --input-ime=<yes|no> (default: yes).
2025-01-25 03:14:44 +00:00
Kacper Michajłow 14520229da github/workflows/lint: add mypy linting
Not everything is typed in our scripts, but this is just to make sure
current code passes linting. More typing can be added in the future.
2025-01-25 02:35:54 +01:00
Kacper Michajłow e8fa2a7aaa TOOLS/osxbundle: fix inplace argument type 2025-01-25 02:35:54 +01:00
Kacper Michajłow 805793154d TOOLS/macos-sdk-version: check if xcodebuild is defined
Makes mypy happy.
2025-01-25 02:35:54 +01:00
Kacper Michajłow 37b513a760 TOOLS/file2string: use array of tuples to avoid unpacking strings 2025-01-25 02:35:54 +01:00
Kacper Michajłow da2880fb54 TOOLS/dylib_unhell: check regex search result 2025-01-25 02:35:54 +01:00
Kacper Michajłow 2d5c5030e5 TOOLS/stats-conv: typing fixes
To make mypy happy. PyQtGraph doesn't define types, so ignore those.
PyQt6 has types, but we use only one function from it, so to avoid
installing it, ignore it too.
2025-01-25 02:35:54 +01:00
Kacper Michajłow 59afdf2ef8 TOOLS/gen-mpv-desktop: don't overlap variable with different types 2025-01-25 02:35:54 +01:00
Kacper Michajłow 4cf914d44d TOOLS/gen-interface-changes: fix variable type mismatch 2025-01-25 02:35:54 +01:00
Guido Cella d87113fdc7 m_option: fix float option values <= 0
FLT_MIN is a small positive number (1.175494e-38), so the check v <
FLT_MIN introduced in 0e7f9c39dc made all 0 and negative float option
values error, e.g. panscan=0 or video-align-y=-1.

Fixes 0e7f9c39dc, fixes #15728.
2025-01-24 15:03:04 +00:00
Dudemanguy a23b11af5f github/workflows: print meson test log on failure on BSD
A build failure will output its error, but a test failure says nothing
other than what test failed. Print the meson test log as well.
2025-01-24 14:55:03 +00:00
Guido Cella 20375d1133 select.lua: show the ID of editions without title
MKV editions can have no title. Print "Edition" and their IDs instead of
showing an empty selection.
2025-01-24 04:35:36 +00:00
Guido Cella 5bbeabf450 console.lua: sort completions
With the previous commit, this sorts completions with the same score
alphabetically.
2025-01-24 04:35:27 +00:00
Guido Cella 8ae3beeb98 console.lua: preserve the order of items with equal score
table.sort() is unstable, meaning that it randomly reorders items with
the same score, so currently fuzzy_find() checks if the line is empty to
not change the original order of the unsorted items. But actually filled
lines have the same problem: e.g. searching foo with filenames like
foo_{1..99}, they are returned in random order.

To fix this sort by score only when 2 items have different score, else
sort by the original position.
2025-01-24 04:35:27 +00:00
Guido Cella 7ded290e2c console.lua: rename format_table() to format_grid()
Since there is no table header or predetermined columns.
2025-01-24 04:34:49 +00:00
Guido Cella 0c5d966f47 console.lua: always say completions instead of suggestions
Both completions and suggestions were being used inconsistently. Just
always use completions which is much more common.
2025-01-24 04:34:49 +00:00
Guido Cella a2ce811b28 console.lua: rename update() to render()
It is not clear what update() updates, in fact this rename allows
removing the comment explaining it. render() is clearer and is the same
term used by the OSC.
2025-01-24 04:34:49 +00:00
nanahi afd5a741c1 m_option: use VAL macro for double type 2025-01-24 04:25:15 +00:00
nanahi cbe2b0b4fe m_option: fix max/min range comment
The float type is now correctly clamped, so correct the
outdated comment.
2025-01-24 04:25:15 +00:00
nanahi 0e7f9c39dc m_option: correctly clamp OPT_FLOAT values
OPT_FLOAT values currently reuses OPT_DOUBLE handling, but if a
finite double value is produced which is out of the float range,
it results in UB.

If the floating point implementation is IEEE-754, then the value is
converted to infinity and stored in the float. However, this still
does not work as intended, as infinity is rejected for OPT_DOUBLE
unless infinity is explicitly specified as the min/max range.

Fix this by adding another clamping stage after operating the values
as double. Finite double values are clamped between FLT_MIN and
FLT_MAX, and out of range error is signaled when suitable.
2025-01-24 04:25:15 +00:00
nanahi 0903e9fbd4 various: fix range for float options
The range of these options should be capped to FLT_MAX
instead of DBL_MAX.
2025-01-24 04:25:15 +00:00
Guido Cella df3872e318 loadfile: fix --loop-playlist + --shuffle + --prefetch-playlist
With this combination of options, the playlist is shuffled every time
the last playlist is reached, instead of when restarting from the first
playlist entry. Abort prefetching in this case, as we can't predict
which file to prefetch until the playlist is shuffled when actually
going to the first file again.
2025-01-22 14:01:11 +00:00
Guido Cella 304a620b0b loadfile: return earlier if prefetch already started
There is no need to call mp_next_file() if prefetching already started,
so return earlier.
2025-01-22 14:01:11 +00:00
Guido Cella e7a253614c loadfile: fix --loop-playlist=N with --prefetch-playlist
With --prefetch-playlist and --loop-playlist, mp_next_file() is called
continously since the last second of playback or when viewing an image,
which decreases --loop-playlist=N to 1.

Fix this by adding a flag to mp_next_file() to specify whether to
decrement --loop-playlist=N. The first playlist entry is still
prefetched when it's the next one, but without decrementing
--loop-playlist=N.
2025-01-22 14:01:11 +00:00
Guido Cella effa81eb6e console.lua: set a high z in select mode
Give console's overlay a high z only in select mode, since in this case
you want to click it so it should be above other overlays. In particular
console should be above the OSC's box layout with visibility=always when
you show it by clicking its buttons.

Keep using z=0 otherwise when it doesn't handle clicks, to avoid
unintuitive behavior of overlays handling clicks like the OSC being
drawn below console.

Since the legacy mp.set_osd_ass() doesn't accept z, we need to repeat
its caching logic, like 490b3ba007 and 86d24b069b did for the OSC.
2025-01-22 12:55:24 +02:00
Guido Cella 2ecfe3ecf7 Revert "osc.lua: draw box layout below console"
This reverts commit 2dd5bd4cd1.

Instead of drawing the box layout below any other overlay with z >= 0
which may not be wanted, the next commit will increase console's z only
in select mode instead.
2025-01-22 12:55:24 +02:00
llyyr 4c083f130d DOCS/interface-changes: change rst exts to txt
gen-interface-changes.py only looks for .txt files.
2025-01-21 17:44:16 +01:00
Guido Cella c438732b23 console.lua: improve the hovered item calculation
Currently determine_hovered_item() assumes that each item is
opts.font_size pixels tall, which usually works well. This breaks with
fonts that get drawn taller than that, such as Japanese text, which
makes the calculation inaccurate for the top items and clips the
counter. A couple of users reported that it is inaccurate for them for
the top items even with ASCII characters in track selectors, presumably
because the circles are taken from a different font and make all lines
taller.

To fix this place each selectable item in its own ASS event positioned
like determine_hovered_item() expects.

Unfortunately this breaks --profile=box, so keep placing every item in
one ASS event with it.
2025-01-18 12:52:02 +01:00
Guido Cella 89c42e4481 console.lua: deduplicate y position calculation in update()
This deduplicates the calculation of the y position by assigning it to a
y variable, which will also be used in the next commit. margin_x is also
renamed to x for consistency.
2025-01-18 12:52:02 +01:00
Guido Cella a06883f79a console.lua: refactor some log code
Rename lines_max to max_lines which is the name used in other functions,
and inline the log_messages variable because its name was confusing.

The math.max(0, lines_max) call was not necessary because console
doesn't crash with 0 or negative max lines.
2025-01-18 12:52:02 +01:00
Attila Fidan c9412b4721 video/out/wayland_common: ignore clipboard offers w/o wanted MIME type
Some Wayland clients not offering text/plain will send their non-text
data regardless of the MIME type requested in wl_data_offer.receive. We
should just not call receive if they haven't offered a MIME type we
want.
2025-01-18 12:51:05 +01:00
Guido Cella ca211b5b88 ytdl_hook.lua: fix start and end conditions
Fixes #13358, fixes fcc67cc6c1.
2025-01-10 14:06:16 +01:00
llyyr f049a1e91c m_option: fix scientific notation timestamp parsing
Fixes: a173b47748
2025-01-09 23:54:59 +01:00
Guido Cella 7a59a12b76 select.lua: select files with watch later files with g-w
Implement selection of files to resume playing from watch later config
files. Requires --write-filename-in-watch-later-config.
2025-01-05 23:21:50 +01:00
Guido Cella b530b402bf command: add current-watch-later-dir property
It will be used in the next commit.
2025-01-05 23:21:50 +01:00
Guido Cella 0c3c4a315b select.lua: use mp.msg.warn for unavailable messages 2025-01-05 23:21:50 +01:00
Kacper Michajłow d66047589a ao_pulse: remove unnecessary casts and use the proper print specifier 2025-01-05 22:32:40 +01:00
Guido Cella 31d4515157 osc.lua: extract icon_font and icons variables
Define the icon font and icons in variables instead of scattering them
throughout the code to make it easy to change them in the future, or for
forks to change them. Also put the hex values in comments to easily
compare which icons in the font are unused, and explain how to get the
decimal values of the bytes.

Copied from ModernX.
2025-01-05 22:31:59 +01:00
Guido Cella ff518ee6f0 DOCS/interface-changes: add slim*bar layouts to interface changes 2025-01-05 22:03:36 +01:00
nanahi c42b19b806 video/out/gpu/video: allow taking transparent screenshots
Use RGBA format to take transparent screenshots when the video has
an alpha channel.
2025-01-05 21:32:55 +01:00
nanahi 72550aa7df console.lua: complete screenshot-raw format parameter 2025-01-05 21:28:57 +01:00
nanahi ab47e95197 player/screenshot: support more formats for screenshot-raw command
This adds a format parameter to screenshot-raw command which controls
the format of the returned image data. In addition to the bgr0 format,
this adds support for 3 other formats: bgra, rgba, rgba64.

bgra is used by overlay-add command and several window systems.
rgba and rgba64 are used by several GPU APIs and are the formats
returned by the gpu and gpu-next screenshot code, which avoid the need
for further format conversion (see convert_image function).
rgba64 also adds the ability to acquire high bit depth screenshots
for screenshot-raw command.
2025-01-05 21:28:57 +01:00
nanahi c1237c1d48 player/screenshot: add high depth and format parameters
Add the ability for screenshot_get_rgb to request high depth and other
formats. Will be used for the next commit.
2025-01-05 21:28:57 +01:00
Guido Cella 8ed672ffc8 osc.lua: add slimbottombar and slimtopbar layouts
Add layouts with only the top line of bottombar to be used with images.
2025-01-05 21:24:02 +01:00
Tim Lodemann 31d1defb7a ao_openal: fix null pointer dereference when creating OpenAL context
When the monitor goes to sleep, the OpenAL context was not properly
handled, resulting in a null pointer dereference and a crash. This
fix ensures that the OpenAL context is created and set correctly,
avoiding crashes under these conditions.

Fixes: #15648
2025-01-05 21:22:35 +01:00
Barnabás Pőcze 55f41fd8fa ao/pulse: only print server protocol after connection
The server's protocol version is not available until a connection is
properly established. Currently the value of `PA_INVALID_INDEX` is printed
due to calling `pa_context_get_server_protocol_version()` before connecting.

Fix this by doing the call after the connection has been set up.

Fixes: f744aadb77 ("ao_pulse: dump library version etc.")
2025-01-05 21:21:52 +01:00
Guido Cella 850e03d29f console.lua: add pause_on_open script-opt
Add a script-opt to pause when console opens and unpause when it closes,
disabled by default.

This is particularly useful for selectors that take several seconds to
open so you don't have to guess when to pause, like the subtitle line
selector with embedded subtitles, or my script which lets you select
which lyrics to download after requesting them with curl.
2025-01-05 21:21:32 +01:00
Kacper Michajłow 44384aad73 github/workflows/lint: add pre-commit hooks
Tests some basic errors in files like trailing white-spaces.
Additionally check the spelling with codespell.
2025-01-05 01:18:28 +01:00
llyyr baecbb12fa sub: add sub-scale-signs
Allows --sub-scale to alow scale typesetting
2025-01-05 01:14:42 +01:00
Guido Cella 996e58a738 stats.lua: only reprint stats on video-reconfig when toggled
Make this behave like the comment says it should, because currently when
you show oneshot stats and change file, stats are printed again and hide
--osd-playing-msg. This happens even if you hide the stats by
show-texting something else and change file before the timer expires.
2025-01-05 00:52:49 +01:00
Guido Cella 2e1bc3cf26 osc.lua: allow adding custom buttons 2025-01-05 00:50:35 +01:00
Guido Cella 9db941ff8f osc.lua: add cache_enabled() helper 2025-01-05 00:50:35 +01:00
Filip Hejsek 0a0ceb7439 vulkan/context_display: implement display fps and resolution info
Implement VOCTRL_GET_DISPLAY_FPS and VOCTRL_GET_DISPLAY_RES by returning
values obtained from Vulkan.

Currently, display fps and resolution info is not available in the
displayvk context. Display fps is needed for display sync to work
properly. The information is also used as the value of a few properties.

This slightly improves parity with the drm context.
2025-01-04 22:40:03 +00:00
Kacper Michajłow 297c8cccf3 ci/win32: bump test timeout to 240 seconds
Avoids timeout of libplacebo/d3d11.c test that takes ~120s on Microsoft
software implementation.
2025-01-04 21:45:25 +01:00
Guido Cella 0d9763872c stats.lua: fix page 2 and 0 layout
Fixes d84e1b3582.
2025-01-04 20:45:31 +01:00
Guido Cella d84e1b3582 stats.lua: inherit --osd-shadow-offset
Unlike font and border sizes, the default stats shadow offset is 0 like
--osd-shadow-offset, so it can be inherited from it by default to not
make users configure it in 2 places.

Since 0 and negative numbers are valid offsets, use infinity as the
placeholder for unconfigured values.
2025-01-04 20:07:49 +01:00
Kacper Michajłow fc6ce44221 github/workflows/lint: remove -lint suffix from lint workflow job names 2025-01-04 20:03:46 +01:00
nanahi 221f54d1f9 DOCS/man/input.rst: mark flags as optional
They are not required but the current documentation only indicates
this to some commands but not for others.
2025-01-04 20:01:25 +01:00
der richter 64aeb4273d mac/app: make const char pointers to const pointers
they were meant to be immutable. imported in swift as mutable pointer,
which leads to errors with the strict concurrency in swift 6.

make the pointers const.
2025-01-04 17:04:21 +01:00
der richter d03ce00127 mac/app: make re-assignment of complex macros const
they were never meant to be mutable and are imported as mutable vars
in swift. that causes errors with the strict concurrency in swift 6.

make them const/lets and immutable.
2025-01-04 17:04:21 +01:00
Guido Cella 2dcf69655a console.lua: complete playlist-play-index none 2025-01-04 16:52:01 +01:00
Guido Cella 6f8d8a38c4 console.lua: apply --osd-selected-color to selected completions 2025-01-04 16:22:20 +01:00
Kacper Michajłow 497310a235 Revert "demux_edl: disallow nested edl to avoid infinite loop"
Apparently there are some scripts that use nested edls instead of
flattening them first, so let's live with this.

This reverts commit de42e11662.
2025-01-04 16:13:07 +01:00
Kacper Michajłow 96da0cbcbd options: remove the player argument from --media-controls
It is now handled internally by the libmpv profile.

Since `player` was the default option, the impact should be minimal, as it
is uncommon to override the default option with the same value.
yes/no args will function the same way as before this commit.
2025-01-04 15:16:40 +01:00
Kacper Michajłow 50d7d33777 LICENSE.{GPL,LGPL}: update to upstream version
Downloaded from:
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt

Non-printable characters stripped from LICENSE.LGPL.
2025-01-04 15:04:38 +01:00
Kacper Michajłow 59d1dc43b9 various: fix typos 2025-01-04 15:59:49 +02:00
Kacper Michajłow efcee92d0e various: remove double new line at the end of file 2025-01-04 15:59:49 +02:00
der richter c1e0e32453 mac/remote: use swift closure instead of obj-c selector bridging
it's unnecessary to use the overhead of an obj-c selector and the
resulting bridging.
2025-01-04 13:33:15 +01:00
Kacper Michajłow 257395de99 ci/build-common: remove executable flag
This file is sourced.
2025-01-03 22:37:03 +01:00
Guido Cella 3f084477ad osc.lua: bind middle clicking play pause to cycle loop-playlist 2025-01-03 21:08:28 +01:00
Misaki Kasumi 06fe665b78 ao_coreaudio: set kAudioOutputUnitProperty_ChannelMap
This fixes #15584
2025-01-03 13:44:00 +01:00
Guido Cella c9a99db26c console.lua: don't set the cursor color
This makes no visible difference, only the border color is visible, as
the border is drawn on top of the regular color.
2025-01-03 13:02:10 +01:00
Guido Cella ab25b3d852 console.lua: inherit --osd-back-color in the cursor
3dcc661de7 made the cursor reset to Default style to not apply the blur,
but \blur0 achieves that without resetting every user style. The cursor
can thus respect the user's --osd-back/shadow-color.
2025-01-03 13:02:10 +01:00
Guido Cella 2ecbe8d83b console.lua: inherit --osd-color in the cursor
Following up 19537a4996, also respect the user-specified color in the
cursor. But the cursor is drawn as a border, so we actually need to use
--osd-color as the border color.
2025-01-03 13:02:10 +01:00
Guido Cella 4e8452aee8 console.lua: inherit --osd-shadow-offset
It was requested in
https://github.com/Samillion/ModernZ/issues/259#issuecomment-2556608926
to make console's shadow offset consistent with --osd-shadow-offset. Not
specifying shadow offsets achieves that. This disables console's shadow
by default but there is no reason console should default to having
shadows but the rest of the OSD shouldn't. Users who want shadows can
enable them in the whole OSD with --osd-shadow-offset. console-specific
shadow_{x,y}_offset script-opts can be added if someone requests them
later.
2025-01-03 12:56:10 +01:00
Guido Cella f21b3f8f06 console.lua: inherit --osd-back-color
The previous commit changed --osd-back/shadow-color to nearly the same
one console was using. This allows unhardcoding it from there and using
--osd-back-color even with --osd-border-style=outline-and-shadow for
consistency with the rest of the OSD.
2025-01-03 12:18:03 +01:00
Guido Cella fab8848d7d sub/osd: default to a semitransparent black back color
By default OSD and subs have no shadow, but if you do set a
--osd/sub-shadow-offset, the current default white shadow color looks
bad around white text with black border. Default to semitransparent
black instead. Use the same color box profiles were using to allow
removing it from there.
2025-01-03 12:18:03 +01:00
Guido Cella 00ff6e5ae2 console.lua: remove useless assignment
The lines in populate_log_with_matches()

if selected_match < first_match_to_print then
    first_match_to_print = selected_match

will set first_match_to_print to 1 even if it is not set here since
handle_edit() sets selected_match = 1.
2025-01-03 11:25:22 +01:00
Guido Cella f3ed94b74d console.lua: focus the default item after emptying the input line
When console is opened with selectable items and a default item, the
default item is placed at the center. But if you type something and then
clear the line, the first item becomes the selected one. Make it select
the default item and place it in the center in this case too.
2025-01-03 11:25:22 +01:00
Kacper Michajłow e01f75e636 version.h.in: bump copyright year 2025-01-03 01:21:15 +01:00
der richter 8af05d4fa1 mac/swift: fix global variables for upcoming swift 6 concurrency
fixes problems with upcoming features DisableOutwardActorInference,
GlobalConcurrency and InferSendableFromCaptures for swift 6 strict
concurrency. enabled with -enable-upcoming-feature flag.
2025-01-02 15:12:28 +01:00
Neko Asakura 50042f5ee0 mac: add support for --force-window-position 2024-12-31 14:49:39 +01:00
der richter 1551cef54e mac/remote: add Quick Look thumbnail as cover fallback
since we load covers/images directly in a our own thread and the quick
look thumbnailing also works asynchronously on its own thread, we need
sync/coordinate both threads. otherwise it would be possible that a
cover from a different file could overwrite the cover of the current
file.

to prevent this every cover generation has a unique timestamp and only
covers for the last cover timestamp will ever be shown.

we are also not interested in icon type thumbnails, since those are just
generic file type icons.

quick look thumbnails can only be generated if quick look can read those
files. files unknown to macOS don't work out of the box and you need to
install a quick look extension for this, "QuickLook Video" for mkv.
2024-12-31 14:44:16 +01:00
Callum Moffat 748fc2b752 ao_audiounit: add --audio-exclusiv support, make non-exclusive default 2024-12-31 13:51:44 +01:00
Guido Cella 11dcd445d9 osd: remove unused constants
OSD_STOP was never used.
OSD_BALANCE is unused since 3d27a0792b.
OSD_PB_* are unused since ef3c0e6eda.
2024-12-31 11:16:45 +01:00
Guido Cella 551cec9d95 DOCS/man/mpv: document that you can deselect the current track
Some users did not realize this is possible.
2024-12-31 11:09:33 +01:00
Guido Cella 4df89532e1 DOCS/man/input: edition-list/N/id is not writable
I added RW to edition-list/N/id in 34f2143e8f because in #8077 it was
assumed that it is writable from the wording of the docs. But what the
docs actually meant is that you can retrieve edition-list/N/id and then
use the retrieved value to set the edition property.

Remove RW and the ambiguous sentence.
2024-12-31 10:37:14 +01:00
Misaki Kasumi e325959980 subprocess: fix reset_signals_child missing last signo 2024-12-31 10:16:50 +01:00
Guido Cella 50a3da73b7 select.lua: fix select-edition crash on non-MKVs
In files other than MKVs edition-list is an empty table, not nil. It is
current-edition that is nil.

However nil still needs to be checked to not crash with mpv --idle.
2024-12-31 10:13:38 +01:00
Kacper Michajłow 1dd0e49f83 stream_file: don't allow to open standard streams during fuzzing
To avoid all sorts of I/O loops.
2024-12-29 20:14:00 +01:00
llyyr 83bb49815c DOCS/man/vo.rst: improve dmabuf-wayland documentation 2024-12-28 19:57:52 +00:00
Kacper Michajłow c5668729be sub/lavc_conv: free avctx correctly on error
Fixes memory leak on error.
2024-12-28 17:52:37 +01:00
Kacper Michajłow 66321465dc m_option: free channels before overriding in parser
Fixes memory leak when --audio-channels option is passed multiple times.
2024-12-28 17:52:37 +01:00
Kacper Michajłow 85b8493aad demux_mkv: cast to u32 before shift to fix int overflow 2024-12-28 17:52:37 +01:00
Dudemanguy 3218e74aaa x11: allow display sync modes to report no visibility
When this was originally implemented, I lazily skipped the optimization
when using display sync because mpv would rip through all the frames
without waiting since there was no blocking. With the previous commits,
we now fall back on the audio sync logic when the window is not visible,
so the extra condition can be removed.
2024-12-28 16:51:28 +00:00
Dudemanguy a2fe5ee900 player/video: fallback to audio sync logic if VO is not visible
The previous commit put all the pieces in place so now this can be
implemented. Scheduling frames is already written with the assumption
that display sync maybe turn on/off at any time. So all that needs to be
done is check if the VO reports that it is not visible. If so, simply
flip mpctx->display_sync_active to false for that frame and skip the
display sync frame handling. It will become true again when the mpv
window comes back into view.
2024-12-28 16:51:28 +00:00
Dudemanguy 91c1b65de0 vo: change draw_frame API to a boolean
x11 and wayland VOs + backends all have logic that skips drawing frames
when the mpv isn't visible for efficiency reasons. This is implemented
in each individual VO, but it is useful for the core to be aware of this
as well. Currently, the display-sync modes on x11 do not try to be
efficient and always render anyways because there is no blocking on the
graphics API level if you skip rendering a frame (wayland works here by
accident). This means mpv would otherwise blaze through frames which is
not what anyone wants. We can instead improve this by implementing the
blocking mechanism in the core and using that when appropriate. This
commit does not implement that yet, but simply switches the draw_frame
to a boolean. Receiving false means that the VO is not drawing frames
and it should be treated as if the surface was hidden.
2024-12-28 16:51:28 +00:00
Guido Cella 753e206d5c zsh-completion: complete av://lavfi:testsrc and av://lavfi:sine
It is annoying to type these over and over.
2024-12-28 16:48:48 +00:00
Kacper Michajłow 7562a798b1 player/osd: use fixed width for vsync-ratio value in status line
Makes status line more stable, without variable width.
2024-12-28 14:33:34 +01:00
Guido Cella 0417218daa console.lua: don't highlight the first completion with mp.input.get
The first completion is highlighted because it is automatically inserted
when pressing Enter, but this isn't the case when the console is used
with mp.input.get, and autoselecting it can be undesirable if you're
entering arbitrary text, unlike with mpv commands where you're usually
choosing from predefined lists. So just don't highlight the first
completion for mp.input clients.
2024-12-28 14:31:44 +01:00
der richter 4dbf81c94c mac/title: use enum for material values instead of generic integers 2024-12-28 14:30:41 +01:00
der richter 4063cdf20b mac/title: use enum for appearance values instead of generic integers 2024-12-28 14:30:41 +01:00
Guido Cella e696b75f57 options: add --playlist-exts
And add playlist to --directory-filter-types' default.

Fixes
https://github.com/mpv-player/mpv/issues/15096#issuecomment-2466695186,
fixes https://github.com/mpv-player/mpv/discussions/15508
2024-12-28 14:24:00 +01:00
Guido Cella 114bdc24f2 options: add --archive-exts
And add archive to --directory-filter-types' default.

Fixes #15550, fixes #15096.
2024-12-28 14:24:00 +01:00
Guido Cella bd150a4d8d console.lua: keep --osd-{,outline}-color's alpha component for styles
There is no need to override this for colored lines.
2024-12-28 14:13:46 +01:00
Guido Cella fcbecbf17e DOCS/man/osc: document that {v,h}align only affect box layouts 2024-12-28 14:09:52 +01:00
Guido Cella 61aa8200ad console.lua: complete clipboard/text 2024-12-28 14:09:07 +01:00
Guido Cella a0f8d27aba input.conf: bind Ctrl+v to play the path in the clipboard 2024-12-28 14:08:32 +01:00
der richter cd9fa6daf0 mac/title: remove old libmpv color setter fallback 2024-12-28 01:46:41 +01:00
der richter 51af3caa77 mac/title: remove old libmpv material setter fallback 2024-12-28 01:46:41 +01:00
der richter 11a9f355c7 mac/title: remove old libmpv appearance setter fallback 2024-12-28 01:46:41 +01:00
Kacper Michajłow bafb054cfc ci/win32: enable tests for dependencies
We build and ship this code, so it makes sense to make sure it is ok.

Tests for FFmpeg, libass and libplacebo are explicitly enabled. The rest
is in default state, so if tests are enabled by default, they will run.
2024-12-27 14:01:36 +01:00
der richter 379c078869 meson: only build libmpv_helper with cocoa-cb 2024-12-26 15:00:57 +01:00
der richter bba198a713 mac: use isBundle function instead of manually checking bundle usage 2024-12-26 15:00:57 +01:00
Kacper Michajłow d9eb9ed844 video/sws_utils: remove unused mp_image_swscale
This has been used before 2c43d2b75a. Now
that we have also zimg support, using swscale directly may not be wanted
depending on the user options.
2024-12-25 18:01:56 +01:00
der richter d389c06646 console.lua: use native clipboard property on macOS 2024-12-24 16:11:45 +01:00
der richter 026f1fb61d clipboard-mac: add macOS clipboard backend 2024-12-24 16:11:45 +01:00
der richter e8ecc7d9d9 osdep/mac/meson.build: dynamically add features to swift build flags
similar to how our config.h is created the feature flags added to the
swift build should be generated from our features array, instead of
manually adding those when needed.

this prevents errors when forgetting to add any needed flags or remove
obsolete ones.
2024-12-24 16:10:52 +01:00
der richter cf01fdddb5 DOCS/ao: add missing documentation for audiounit
was forgotten in initial implementation 8 years ago 3f5b41d.
2024-12-24 16:10:24 +01:00
der richter d82701962f libmpv: deprecate MPV_RENDER_PARAM_AMBIENT_LIGHT render parameter
the equivalent options have been deprecated since mpv 0.35 in ac39661
and 2207236.

also bumping the MPV_CLIENT_API_VERSION to 2.5, since 2.4 was forgotten
in 6f619d5.
2024-12-21 16:15:44 +01:00
der richter e785296a1c cocoa-cb: use new ambient-light property and remove old libmpv usage 2024-12-21 16:15:44 +01:00
der richter e0f82b1a77 gamma-auto.lua: add this script as replacement for --gamma-auto
also mention this replacement for --gamma-auto.
2024-12-21 16:15:44 +01:00
der richter 2b06728df9 command: add ambient-light property
make it observable to make it usable as a replacement for --gamma-auto.
2024-12-21 16:15:44 +01:00
der richter 811062279e vo: change VOCTRL_GET_AMBIENT_LUX from int to double 2024-12-21 16:15:44 +01:00
der richter 568e2c357b DOCS/contribute.md: add guidelines for Swift and Objective-C 2024-12-21 16:13:08 +01:00
Dudemanguy 96bebf0935 x11: simplify --geometry and --auto-window-resize logic
There were a few pitfalls with the way this was previously implemented
because --geometry implicitly depended on --auto-window-resize being
enabled to operate in a few cases. Instead, let's change the logic a bit
so that instead we choose whether or not to reuse the old rc (i.e. don't
resize) and use the wh_valid and xy_valid fields within the m_geometry
struct instead of using x11->geometry_change. This fixes several edge
cases involving setting the position with --geometry when using
--auto-window-resize=no.
2024-12-20 18:03:30 +00:00
nanahi 8ee1aeaf1a DOCS/man: fix Unicode capitalization 2024-12-20 14:54:35 +00:00
nanahi 298c178f1e input.conf: use capital letters instead of shift modifiers
Follow the suggestion of keyname documentation.

Fixes: b4d9980870
2024-12-20 14:54:35 +00:00
nanahi b174d98042 video/out/wayland_common: make all XF86 special keys mappable
Forgotten in 417869f845.
2024-12-20 14:54:35 +00:00
nanahi 1107bdb62e DOCS/man/input.rst: clarify hexadecimal key names
Document the syntax and mention how it can be used as Unicode
codepoints. ASCII range has worked since the feature was inplemented
in 86a87de590 and Unicode range has
worked since a63e880400.

It also works with known special keys if you know the internal values
of keys because there is no filtering in place, but this should not be
encouraged.
2024-12-20 14:54:35 +00:00
nanahi 269e402579 DOCS/man/input.rst: clarify that caps lock affects produced keycode
Because mpv keycodes are whatever the text the keyboard input produces,
caps lock also affects this.
2024-12-20 14:54:35 +00:00
nanahi 4711e40814 DOCS/man/input.rst: clarify shift modifier behavior
When shift modifier is used with text key names, it is usually
silently ignored, except for ASCII key names, which can be
confusing. Document it clearly.
2024-12-20 14:54:35 +00:00
nanahi f8a5df56cc DOCS/man/input.rst: fix grammar 2024-12-20 14:54:35 +00:00
Guido Cella 38c46e4d89 stats.lua: enable runtime script-opt changes
This doesn't work for changing page key script-opts at runtime because
they are used as the indexes of the pages variable, but nothing actually
breaks if you do, it just uses the initial values. This is still useful
for conditionally changing sizes at runtime or for trying out the
osd-box profile by applying it from the console.
2024-12-20 14:54:20 +00:00
Guido Cella 19537a4996 console.lua: inherit --osd-color and --osd-outline-color
Stop overriding the OSD font and outline color in the console input line
and log, except for the lines already in a different color. This allows
configuring the console color and makes it consistent with the rest of
the OSD, like 51bd00c33a did for stats.
2024-12-20 14:54:08 +00:00
Kilian Evang 5354a50f9f DOCS: fix description of subtitle delay adjustment
Modified the man page.

There were two pairs of key bindings that appeared in one order but
the description of what they do appeared in the reverse order. Modified
the description to match the order in which the keys appear.

Note: I have not tested this change.
2024-12-20 14:53:26 +00:00
Guido Cella 661a380fda console.lua: color the default item with --osd-selected-color
Currently if you change --osd-selected-color the preselected item stays
yellow and can't be changed. Since the default item style was just
chosen from the selected color without the bold, also make the default
item follow --osd-selected-color.

Requested in
https://github.com/Samillion/ModernZ/issues/259#issuecomment-2556608926.
2024-12-20 12:43:34 +01:00
norinoriko 566c3ef367 DOCS/man/console.rst: remove outdated issue
This was fixed for win32.

See-Also: https://github.com/mpv-player/mpv/pull/15355
2024-12-20 12:34:32 +01:00
nanahi 1723f8a9d2 sd_ass: fix fix_margins calculation
Saving old playresx method is incorrect after the first
configure after the subtitle is loaded.

Fixes: f862d3b6cd
2024-12-19 19:43:27 +00:00
llyyr 32d103c580 meson: bump libdrm version to 2.4.109
The previous check was incorrect because drmGetDeviceFromDevId is only
available since 2.4.109.

https://gitlab.freedesktop.org/mesa/drm/-/commit/57e0b0552e11b3f04e6d5704c1c7efea5f83ffe4

Fixes: 0d7b4d64a5
2024-12-17 23:30:48 +00:00
Guido Cella a6f93ac81e options: add heic and heif to --image-exts 2024-12-17 23:30:32 +00:00
yk 96fad6a0fc ytdl_hook: pass empty proxy value
an empty value to a commandline option usually means that parameter does
not expect anything, but in case of `--proxy`, yt-dlp use an empty value to
disable proxy setting, the empty value need to be passed to `--proxy`
2024-12-17 22:26:46 +02:00
Guido Cella 2756a780b2 demux_lavf: remove obsolete defines
AV_DISPOSITION_TIMED_THUMBNAILS was added in FFmpeg 3.2 and
AV_DISPOSITION_STILL_IMAGE in FFmpeg 4.1, and we require FFmpeg 6.1.
2024-12-17 20:05:20 +00:00
Guido Cella 7715e2e255 demux_lavf: detect heif/heic as images
Like 565e7d906c did for avif, consider 1-frame HEVC as images, as HEVC
videos have nb_frames 0 or > 1.

Specifically, in the FATE suite:

nb_frames = 0 and are images:
cbf_cr_cb_TUDepth_4_circle.h265 food.hevc hdr10_plus_h265_sample.hevc
hdr_vivid_h265_sample.hevc hevc-monochrome.hevc

nb_frames = 0 and are videos:
mv_nuh_layer_id.bit paired_fields.hevc
paramchange_yuv420p_yuv420p10.hevc pir.hevc

nb_frames > 0:
dv84.mov extradata-reload-multi-stsd.mov multiview.mov
two_first_slice.mp4

As with other video codecs, the hevc images with nb_frames = 0 which are
really frames cut from a video are not detected as images, but you will
only find these files in FATE.
2024-12-17 20:05:12 +00:00
Guido Cella e52f975842 osc.lua: simplify track ID retrival
When track IDs are auto mp.get_property_native() returns "auto", but
mp.get_property_number() returns nil.

Follow up to 1a558bf5c2 and 897c04afe1.
2024-12-13 18:46:53 +01:00
Guido Cella 5e4b825a48 select.lua: abort edition selection when there's only 1
MKVs have 1 edition by default so don't show an empty edition selection
in that case.
2024-12-13 03:46:03 +01:00
Guido Cella dbb3291e8e DOCS/man/osc: sort mouse bindings consistently
Always list in the order left shift+L middle right click.
2024-12-12 21:54:44 +01:00
Guido Cella cac6b663c7 osc.lua: show the full path when right clicking the title
Right clicking playlist arrows already opens the playlist selector so
bind something else to right clicking the title. Make it show the full
path which is useful but not bound anywhere on either the keyboard or
the OSC.
2024-12-12 21:54:44 +01:00
Guido Cella 365a33badd osc.lua: open the playlist selector when right clicking playlist arrows
- It makes more sense to select a playlist entry from the buttons that
  navigate the playlist than from the title
- Provides different bindings for right and middle click
- Mirrors chapter button bindings
2024-12-12 21:54:44 +01:00
Guido Cella f4a35a0264 osc.lua: move title mbtn script-opts below playlist_next's
Sort mbtn script-opts according to how they are shown to the user in bar
layout instead of how they are defined in osc_init().
2024-12-12 20:35:55 +01:00
Guido Cella 53554f521b DOCS/man/osc: update track middle-click action
Fixes 92a98f1ce2.
2024-12-12 17:48:53 +01:00
Kacper Michajłow 5897b66454 demux_mkv: limit EBML size to 64 MiB for fuzzing
OSS-Fuzz is limited to 2GiB of process memory, so allocating 512 MiB is
not working well and causing OOMs.
2024-12-12 01:45:19 +01:00
Kacper Michajłow c14af4ebad options: disable playlist and include for fuzzing
Both of this options reads files, so there is not much to test there and
only creates problems with timeouts when too much is read.
2024-12-12 01:45:19 +01:00
Kacper Michajłow 9c81c67e2a m_property: stop processing after 10 properties even in skip cases
For OSS-Fuzz.

See: 2054d872d4
2024-12-12 01:45:19 +01:00
Dudemanguy d33e54250e ao: correctly set state.playing for non-gapless audio after eof
The problem here is likely ao_alsa specific and has the same symptons as
what the previous commit fixed (audio not playing when the file changes
but the details are a bit different here and the sample rate does not
matter. When using gapless audio (the default), the core player
immediately marks the audio status as EOF after it starts draining and
allows the remaining audio buffers to play while it marches on. This
works fine. When not using gapless audio, it doesn't immediately set EOF
and instead waits for the audio to finish playing before it does
anything else. The problem is that ao_is_playing is always true so the
core waits forever thinking audio is still playing when it actually
isn't.

ao_play_data is what is in charge of setting the mp_pcm_state with it
calling out to the backend for additional help. Unfortunately, this
doesn't work for alsa because it's too dumb to signal the desired states
in this edge case so we have to help it a bit. The main thing to notice
here is that even though we can get EOF from a frame, there can still be
additional valid samples that compe after it. So we can't just
immediately quit after EOF is seen. The approach here is to simply save
if we got eof sometime in the past, wait until we get no more samples,
mark state.playing as false and then jump over to the eof code. This
will set p->playing to false as desired which allows the core code to
set EOF and finally we can go through the reset logic and actually play
audio for the next file.
2024-12-11 17:12:22 +00:00
Dudemanguy a7f6460e7e player/audio: get rid of bogus early return in reinit_audio_filters
There is a condition here that is supposed to wait until the ao is
finished playing before it goes through the rest of this function and
actually starts the reinit of the audio chain. This is not needed
however and actually causes a bug. uninit_audio_out already takes the
gapless audio case into account and drains the audio before preceding.
There is no reason to bail here. Additionally, returning early here
actually breaks ao_alsa. ao_alsa is pretty dumb and not able to cope
with changing samplerates. It explictly needs to stop the PCM and then
start it again for it to work. The old code here ensured the ao would
never reinit itself and then would wait forever trying to play samples
with no actual data. Other AOs (pipewire and pulse) seem to be able to
cope with this and reinit themselves in other ways (didn't look in
detail). This change makes no difference for them. Note that in many
cases, this appeared to work on ALSA because there is a high likelihood
that your default audio device will choose a 48 kHz sampling rate and
thus your entire playlist is resampled to 48 kHz which avoids the
bug.

Fixes #15477.
2024-12-11 17:12:22 +00:00
Toad King 9f6faef60d sd_lavc: match video display aspect ratio on SD video in PGS subtitles
Previous fixes in bcc3d72 make subtitles on videos with non-square pixel
aspect ratios appear incorrect. This can happen on subtitles for SD
Blu-rays where the video resolution is 720x480 but the aspect ratio is
4:3. The scaling still applies when the video frame is cropped with
filters so the previous fix will still work.

Fixes #15415.
2024-12-11 18:11:35 +01:00
Guido Cella 2dd5bd4cd1 osc.lua: draw box layout below console
console is drawn below the OSC. This looks bad only with layout=box
because there is no user-data/osc/margins so it overlaps with it. Fix it
by using z -1 with box layout.

Follow up to 86d24b0 and 9c22d6b.
2024-12-11 17:51:16 +01:00
llyyr 7fffaf8557 vo: update base_vsync even for initial samples
This is still used for caclulating a/v sync and delay remaining even
for initial samples, so we should always update it to the actual vsync
for those initial samples so we have something to work with at least.

And if we receive bogus values, also reset it to 0 along with
prev_vsync.

Not having base_vsync set to _some_ value completely breaks
vsync_skip_detection, and mpv stays stuck in a permanent mistimed state
where every frame is marked as delayed and never recovers from it.
2024-12-11 16:42:13 +01:00
llyyr bd915439d0 vo: use display clock to determine frame_end in display synced case 2024-12-11 16:42:13 +01:00
llyyr 84728fb5e9 vo: extract display synced frame end calculation
into get_display_synced_frame_end. Used in next commit.
2024-12-11 16:42:13 +01:00
Jisu Kim e2014fb309 osc.lua: add option to enable fade-in effect
Introduced a new `fadein` option to control the fade-in effect for the OSC.
The default value is `no`, which disables fade-in. This option allows users
to enable a fade-in effect when the OSC appears. Updated documentation
accordingly.
2024-12-10 22:41:40 +01:00
Guido Cella 8d76ff79a3 console.lua: rename dimension variables
These are easier to read with _ between words. Also screenx/y could be
assumed to be display coordinates, so rename them to osd_w/h. They are
not named osd_width/osd_height to avoid Redefined local LSP warnings
with the ones in the upper scope.
2024-12-10 22:21:31 +01:00
nanahi 65328563e7 command: signal unavailable error when clipboard is unavailable
This allows clients to detect if the clipboard is unavailable,
or an error happened.
2024-12-10 14:20:08 +01:00
nanahi e121c092b4 clipboard-vo: make logging verbose when clipboard is unavailable
It now only warns when the clipboard is implemented but get/set
failed. This is consistent with other properties like current-vo.
2024-12-10 14:20:08 +01:00
nanahi e62503cb39 clipboard: add CLIPBOARD_UNAVAILABLE error code
This makes it possible to distinguish between unavailable
or unsupported, and error.
2024-12-10 14:20:08 +01:00
Guido Cella 7bae5b8d37 console.lua: clear completions before searching history 2024-12-10 14:18:51 +01:00
Guido Cella 7253b6c63d console.lua: remove code repetition to initialize matches 2024-12-10 14:18:51 +01:00
Kacper Michajłow 3df8b0b297 video/out/gpu/video: don't pass big structs by value when not needed 2024-12-10 14:14:09 +01:00
Kacper MichajłowandGuido Cella c00bd46684 m_option: put UPDATE_ flags at the beginning
Update flags are often updated, so make space for expand them. Reorder
all values to make it easier to add new ones, until there is no more
space.

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2024-12-10 13:52:39 +01:00
Guido Cella 5dbaa69138 console.lua: add margin_{x,y} script-opts
Allow configuring the margins from the left bottom indipendently of
--osd-margin-{x,y}.

Fixes #15478.
2024-12-10 13:47:43 +01:00
Kacper Michajłow db70ae6fa2 hwdec_vaapi: don't jump over variable init in try_format_upload 2024-12-10 10:17:34 +01:00
Kacper Michajłow 63e6dfba6e demux_mkv: fix memory leak of codec params
Fixes: 84ee84abb8
2024-12-09 20:46:48 +02:00
Guido Cella 0bb1659cd6 configfiles: refactor mp_get_playback_resume_config_filename()
This avoids duplicating fname when it is a URL.
2024-12-09 19:23:03 +01:00
Guido Cella a5fa862a44 configfiles: don't use the basename of urls
With --ignore-path-in-watch-later-config the basename of files is used
for watch later files, but since 1d640c9887 this was checking the wrong
variable to determine if the file is a URL and thus also taking the
basename of URLs, when URLs should use the full path regardless of this
option.
2024-12-09 19:23:03 +01:00
Guido Cella 94135b1245 console.lua: don't override --osd-bold in completions
Respect the OSD bold style in completions printed after the selected
one.

Fixes #15452.
2024-12-09 19:21:33 +01:00
Kacper Michajłow fe546c1841 w32_common: guard recursive call to mp_dispatch_queue_process
This is already done in WndProc, but the flag was not set if we exited
event loop and were processing mpv dispatch messages in fallback loop.

This fixes the case when Window is destroyed externally or otherwise
event loop fails for whatever reason. Calling vo_w32_uninit does call
DestroyWindow() through dispatch, which in turn calls WndProc, so we
need to guard recursive call.
2024-12-09 19:20:52 +01:00
Kacper Michajłow 4747865fef player/command: continue hook processing on errors
If a hook fails to invoke or a client has been removed during hook
processing, attempt to continue with the next hook if possible.

Before this commit, any failure during hook processing would cause the
hook processing to stop.

This issue can be reproduced when auto_profiles.lua registers an on_load
hook and exits afterward because no profiles are registered. In such a
state, the next hook would fail and not invoke.

There are many scenarios where a hook client may be broken,
unresponsive, or disabled, so it makes sense to continue processing
subsequent hooks.

The regression we observed was caused by e2284fba1 and 5dc404741, which
made auto_profiles.lua register hooks and then exit, leaving stale hooks
registered. However, the root cause is not limited to the
auto_profiles.lua case.

Fixes: #15465
2024-12-09 19:20:38 +01:00
Kacper Michajłow e9af4092e9 player/configfiles: don't loop directory tree if not needed
If we already failed to generate fname, there is no need to try harder.
2024-12-09 19:20:25 +01:00
Kacper Michajłow 04eb51246f options: remove old compatibility definitions
This makes things more readable.
2024-12-09 19:19:50 +01:00
Kacper Michajłow 22bb5c2690 m_option: don't overlap UPDATE and M_OPT constant values
Fixes: e1d30c4c5a
2024-12-09 14:59:08 +01:00
Kacper Michajłow baf528069a osdep/mac/meson.build: remove unused variables 2024-12-09 11:01:07 +01:00
Kacper Michajłow 8eea5902ba options/m_option: restore m_geometry_apply centering ability
This fixes geometry uses where it is expected to be centered. For
example this fixes video-crop option.

Fixes: e01eab4385
Fixes: #15398
2024-12-08 18:14:04 +01:00
Neko Asakura 8d20b72653 meson: use swiftc instead of swift for building 2024-12-07 14:27:16 +01:00
Guido Cella 90a7892545 DOCS/man/mpv: document that g-e selects disc titles
It is hard to discover otherwise.
2024-12-05 11:52:37 +01:00
Jan Ekström 1b1a8a3e4f demux_lavf: simplify replaygain export
* Early exit if there is no useful data in the AVReplayGain
  structure (FFmpeg does check that gain of at least one thing is
  not INT32_MIN, but leaves the peak unchecked so it can be zero).
* Less depth in the if structure.
2024-12-05 01:21:38 +01:00
Jan Ekström 1f86733bb3 demux_lavf: utilize side data getter for replaygain
This simplifies the code, not requiring a loop.

Moves the getter definition somewhat upwards to allow
for its usage in a function that was defined before it.
2024-12-05 01:21:38 +01:00
Misaki Kasumi f75304957a io: support mp_make_wakeup_pipe on Windows 2024-12-05 01:20:31 +01:00
Kacper Michajłow 91f1f4ff43 demux_disc: add playlist filename to edition title if available 2024-12-04 14:51:53 +01:00
Kacper Michajłow e9b5773bf9 stream_bluray: add STREAM_CTRL_GET_TITLE_PLAYLIST 2024-12-04 14:51:53 +01:00
Kacper Michajłow de951c383b demux_disc: expose titles as editions
This allows to select DVD/Blu-Ray title easily. Titles are listed as
editions with their duration and number.

I wanted to include Angles also in this selection, but currently Angles
are not that well supported, so let's stick with titles and leave the
rest for the future changes.

We might migrate to lavf demuxer for DVD/Blu-Ray in the future, the mpv
implementation is rotted anyway.

Fixes #14586
2024-12-04 14:51:53 +01:00
Kacper Michajłow d91eea20be stream_bluray: implement STREAM_CTRL_GET_TITLE_LENGTH 2024-12-04 14:51:53 +01:00
Kacper Michajłow b594fc2d6c github/workflows: replace ruff-action with a maintained one
See: https://github.com/ChartBoost/ruff-action/commit/c413c59d2aa0f58662aec40228cd7c8dfb69cbc1
2024-12-04 14:48:37 +01:00
Guido Cella 78ee714fff console.lua: fix mp.input.get clients that don't specify completions
Actually update the rendered text when typing with an input.get client
that didn't specify a complete callback.

Fixes #15430, fixes 57b73f1af6.
2024-12-03 14:59:53 +01:00
Guido Cella f7e6e30a49 aspect: add --video-recenter
This ignores --video-align-{x,y} when the video is smaller than the
window in the respective direction.

After zooming in, panning and zooming out, this is useful to recenter
the video in the window.

Unlike doing this by observing osd-dimensions in a script, this is done
before rerendering, so you don't see the image being rendered uncentered
for an instant after zooming out, before being rerendered centered.

Also update --video-align docs while at it.

This doesn't work well with --video-pan-{x,y} because you can move the
output rectangle far away from the image, and when zooming out pan is
abruptly reset to the center. It doesn't feel like natural like zooming
out after changing --video-align-{x,y}. So this commit doesn't set pan
to 0. Also this leaves a way to move scaled images within the window
even with --video-recenter.
2024-12-02 22:31:14 +01:00
Guido Cella 43f4568816 select.lua: select editions 2024-12-02 21:44:18 +01:00
Jan Ekström 17e62fcc61 demux/stheader: update lav_codecpar's comment
Was already being utilized by demux_raw, and now also created in
demux_mkv.
2024-12-02 21:03:21 +01:00
Jan Ekström 84ee84abb8 demux_mkv: propagate global stream side data via codecpar
The first AVPacket method has been deprecated in FFmpeg, and only
the HEVC decoder would read this information from there. The native
AV1 decoder as well as the libdav1d wrapper only support the newer
propagation method via codec context's side data. {ad,sd,vd}_lavc
call mp_set_avctx_codec_headers which copies the side data from
codecpar to codec context, so no changes are required on the
receiving end.
2024-12-02 21:03:21 +01:00
Jan Ekström ba37142ba4 demux_lavf: stop global stream side data injection to AVPacket
This process has been deprecated since avformat 60.15.100 and
since avcodec 60.30.101 AV_PKT_DATA_DOVI_CONF has been read from
AVCodecContext's coded_side_data. Additionally, the HEVC decoder
is the only one which currently reads this side data from packets,
the native AV1 decoder as well as the libdav1d wrapper instead only
support the newer propagation method via codec context's side data.

How this currently is supposed to propagate is:
* demux_lavf copies the codec parameters into sh_stream's lav_codecpar.
* {ad,sd,vd}_lavc call mp_set_avctx_codec_headers that calls
  avcodec_parameters_to_context, which then sets global side data
  to the codec context.

As this logic is already in place, so no additional changes are required
for things to work and the deprecated function call can just be
cleaned up.

Ref: FFmpeg/FFmpeg@5432d2aaca
Ref: FFmpeg/FFmpeg@804be7f9e3
Ref: FFmpeg/FFmpeg@12e5116872
2024-12-02 21:03:21 +01:00
Guido Cella 063410fa04 console.lua: don't reinsert the next characters on complete
This avoids inserting the characters in front of the cursor again when
completing to text already in front of the cursor.

This is important after 2f271a92de made Enter automatically insert the
first completion.
2024-12-02 20:57:01 +01:00
Guido Cella 9d67fc28e2 console.lua: don't complete DLLs on Windows
run completion on Windows is slow because system32 contains thousands of
DLLs, so filter executables with an extension in PATHEXT.
2024-12-02 20:56:49 +01:00
Guido Cella 3053797e3c defaults.lua: remove outdated comment
A client's input sections are destroyed along with it since bf385e1140.
2024-12-02 20:51:24 +01:00
Guido Cella 1f1c30146c console.lua: complete executables after run 2024-12-01 19:28:22 +01:00
Guido Cella 43ff1c1af6 console.lua: complete filter labels for {a,v}f-command 2024-12-01 19:28:22 +01:00
Guido Cella 15e7a1184a console.lua: complete command flags 2024-12-01 19:28:22 +01:00
Guido Cella 220de247b8 console.lua: remove code repetition in complete() 2024-12-01 19:28:22 +01:00
der richter 11186374a0 mac/option: explicitly include and define type of global init variable
the mpv_global struct is a public struct defined in common/global.h. in
the case that this header is included directly or indirectly into our
swift bridging header, code that uses that struct as an OpaquePointer
will fail to build, because swift would now be aware of its actual type.

preemptively include the header and properly define the type to prevent
such errors in the future.

i also checked all other usages of OpaquePointers and this is the only
case where this is relevant.

See e1d30c4 and 4ff9f50 as reference
2024-12-01 19:25:37 +01:00
nanahi 0114281627 DOCS/man/mpv.rst: add documentation for the numpad +/- key bindings 2024-12-01 18:55:50 +01:00
nanahi 8c6ad1dc81 etc/input.conf: add KP_PLUS/KP_SUBTRACT key bindings
Same as d06f3d39cb.
2024-12-01 18:55:50 +01:00
Guido Cella c8d9f37b27 command: fix --osd-selected{,-outline}-color
Using 3 %x in a row can produce colors like 0ff0 which are interpreted
incorrectly, so ensure each colors has 2 digits.
2024-12-01 18:54:50 +01:00
llyyr 744cd70640 DOCS/options.rst: specify that gpu-sw only works with OpenGL/Vulkan 2024-12-01 12:22:15 +01:00
llyyr 1a03d6ab84 vulkan/context: propagate --gpu-sw on vulkan contexts 2024-12-01 12:22:15 +01:00
Kacper Michajłow d673356990 common: ensure MP_HANDLE_OOM is used only on pointers
To make it clear it should be used for memory allocation and not generic
error checking.
2024-11-30 17:08:42 +02:00
Kacper Michajłow 7b114d7d54 ad_lavc: remove unnecesary variable 2024-11-30 17:08:42 +02:00
der richter 7e519397a1 options: note that --gamma-auto is only implemented on vo=gpu 2024-11-30 02:32:39 +01:00
der richter dec0d02f9f vo_gpu: undeprecate --gamma-factor
deprecated since 0.35 in ac39661 and 2207236.
2024-11-30 02:32:39 +01:00
moi15moi a283f66ede sd_ass: add application/x-font-otf to font_mimetypes 2024-11-28 17:35:22 +01:00
Kacper Michajłow 6ea2cd72ec vf_format: fix format=dolbyvision=no metadata stripping
If p->colormatrix is 0 if not set by user, so it would always override
_orig parameters with Dolby Vision ones and restore that erroneously.

Fixes: e2365bfece
2024-11-28 17:33:31 +01:00
Kacper Michajłow 4ff9f50b6b player/clipboard/clipboard: don't include global.h in header
This header should not be included except when really needed.

Fixes: e1d30c4c5a
2024-11-28 00:45:27 +01:00
nanahi 7899a28699 defaults.js: support custom arg in mp.add_key_binding() 2024-11-27 20:40:41 +01:00
nanahi 06670298b3 defaults.lua: support custom arg in mp.add_key_binding()
The information is available in the table.
2024-11-27 20:40:41 +01:00
nanahi 0874f81b31 command: add custom arg for script-binding
This allows passing arbitrary information in the script-binding
command. The content is available as a new message argument.
2024-11-27 20:40:41 +01:00
nanahi aeb637b33b DOCS/man/input.rst: document that WHEEL_* are scalable
This documents the scalable keys (currently WHEEL_*) and notes
how the keys work with scalable commands. Mention touch pad
as a common source of scalable input source.
2024-11-27 20:40:41 +01:00
nanahi 0d6c979220 DOCS/man/input.rst: document the scalable commands 2024-11-27 20:40:41 +01:00
nanahi 62e434ac7f input/cmd: add comment for scalable and is_ignore 2024-11-27 20:40:41 +01:00
nanahi 5fd4bfb4a0 defaults.js: support scalable mp.add_key_binding() 2024-11-27 20:40:41 +01:00
nanahi e3e22de2ca defaults.lua: support scalable mp.add_key_binding()
For complex key bindings, the table now contains a new member
of the current key scale. mp.add_key_binding() now accepts the
scalable flag to make the binding scalable.
2024-11-27 20:40:41 +01:00
nanahi 34571e7882 command: make script-binding command scalable
script-binding command is currently not scalable, so script
registered key bindings also cannot be scalable, unlink input.conf
bindings.

This makes script-binding command scalable so that it's possible to
define scalable key bindings in scripts. It now calls script-message
command with an extra argument with the scale of the key.
2024-11-27 20:40:41 +01:00
nanahi b97e3b9e4b DOCS: add clipboard documentations 2024-11-27 20:31:41 +01:00
nanahi 510d634b5b console.lua: use native clipboard property on win32 and wayland
Since native clipboard is implemented on win32 and wayland,
use the clipboard property instead.

This fixes the problems with commandline implementations of clipboard:
- On win32, the powershell implementation is complex, and it can take
  several seconds to run for the first time.
- On wayland, it requires wl-paste to be installed, which isn't always
  available. It also works poorly on GNOME.
2024-11-27 20:31:41 +01:00
nanahi d9f30cc079 video/out/wayland_common: support clipboard monitoring
Works by notifying property update when clipboard content is
updated.
2024-11-27 20:31:41 +01:00
nanahi 593d437dae command: notify-property command
Since VOCTRL is not suitable for frequent data query
(see 477a0f8318 for details),
it's not suitable to be used by the VO clipboard backend.
Instead, since the VO does the clipboard monitoring by itself,
it can notify the player when the clipboard is updated.

This adds an internal notify-property command so that VOs
can notify player when the clipboard is updated, so that clipboard
monitoring works.
2024-11-27 20:31:41 +01:00
nanahi 625900687e clipboard-win: implement clipboard monitoring
This uses GetClipboardSequenceNumber() to detect clipboard
content changes. Clipboard Format Listener is a better way to
do this according to MS docs, but sequence number works and
the listener requires creating a dedicated thread and HWND
for monitoring, so I will save it for a later time.
2024-11-27 20:31:41 +01:00
nanahi 1d36f7be05 clipboard: add clipboard monitoring API
This adds a clipboard monitoring API for backends which use polling
to monitor clipboard updates. --clipboard-monitor option can turn
clipboard monitoring on and off at runtime.
2024-11-27 20:31:41 +01:00
nanahi dcde47e15b clipboard-win: add Windows clipboard backend
This adds a Windows clipboard backend. This doesn't depend on
VO, so it can be used even when no video window is created.
2024-11-27 20:31:41 +01:00
nanahi d47ce38e20 video/out/wayland_common: implement VOCTRL_GET_CLIPBOARD
This adds support for VOCTRL_GET_CLIPBOARD which makes the VO
clipboard backend be able to get clipboard content for Wayland.
2024-11-27 20:31:41 +01:00
nanahi b93d3046e2 video/out/wayland_common: implement clipboard support
Clipboard contents are available as selection data offers under
Wayland. The offer can become invalid at any time, so request the
text format content immediately when an offer is received,
and cache the content for later use.
2024-11-27 20:31:41 +01:00
nanahi fa3a167347 video/out/wayland_common: generalize check_fd 2024-11-27 20:31:41 +01:00
nanahi 23b8fb3d9c clipboard-vo: implement VO clipboard backend
This adds a generic VO clipboard backend based on VOCTRLs
to get and set clipboard data.
2024-11-27 20:31:41 +01:00
nanahi 240ebd6ad3 vo: add VOCTRL_GET/SET_CLIPBOARD
This adds VOCTRLs needed for VO-based clipboard backend.
2024-11-27 20:31:41 +01:00
nanahi 6e848a0b3c command: add clipboard property
This adds clipboard property which uses the clipboard
API to get and set clipboard contents. Currently only
clipboard text is implemented, but this can be extended in
the future to cover primary selection and other formats.
2024-11-27 20:31:41 +01:00
nanahi e1d30c4c5a clipboard: add clipboard API
This adds a clipboard API with multiple backend and format support.
--clipboard-enable option can be toggled at runtime to turn native
clipboard on and off.
2024-11-27 20:31:41 +01:00
llyyr af82f7cf29 DOCS/interface-changes: specify that new additions have to be listed
This has been happening for a while now apparently, so change it to
accurately reflect reality. I chose the next release as the point to
formally make this change, because I was under the impression that we
didn't have to list new options so I never did it and there may be
others like that too.
2024-11-27 20:28:51 +01:00
Kacper Michajłow 15ea3728a5 osc.lua: show file and track info on title left-click 2024-11-27 20:26:06 +01:00
Kacper Michajłow 92a98f1ce2 osc.lua: cycle sub/audio down on shift+L-click / middle-click 2024-11-27 20:26:06 +01:00
Kacper Michajłow 62db90634e osc.lua: cycle sub/audio on left-click, select on right-click 2024-11-27 20:26:06 +01:00
der richter 639ef09807 mac: implement VOCTRL_BEGIN_DRAGGING
this removes the old isMovableByWindowBackground mechanism with the
newer performDrag(with:) function.
2024-11-27 18:48:47 +01:00
Guido Cella f7e2a8c1cc bstr: add bstr_xappend0 2024-11-27 15:37:42 +01:00
Guido Cella b9e6030053 command: highlight selected list items with color
Instead of printing circles in show-text ${playlist}, ${chapter-list}
and ${edition-list}, introduce --osd-selected-color and
--osd-selected-outline-color to reduce clutter, make the selected item
easier to differentiate, and have visual consistency with select.lua.

The defaults are taken from the style of the selected item in the
console. These new options are also used there, replacing the hardcoded
styles. Due to being user-configurable, selected item styles are changed
to take priority over default item styles.

The default selected style is yellow and bold. The bold (hardcoded)
allows differentiating the selected item with color blindness. There is
also a separate --osd-selected-outline-color option defaulting to black,
since without it if the user changes --osd-outline-color yellow text
becomes unreadable without a black border. --osd-selected-back-color is
omitted for now.

Text and background colors are inverted for the selected item in the
terminal. This is hardcoded, adding an option is overkill.

A disadvantage of this commit is that if you run print-text ${playlist}
with a VO, the selected style ASS is printed to the terminal (but ASS
printed in the console is interpreted). This commit avoids printing the
reset ASS sequence for non-selected items to reduce clutter in this
case.
2024-11-27 15:37:42 +01:00
Guido Cella d54a45d075 console.lua: enable runtime updates of script-opts 2024-11-27 15:32:10 +01:00
Kacper Michajłow ad1fb9f448 player/loadfile: prefer independent track when selecting track
Dependent tracks are supposed to be processed further and not directly
used.

For example, an HEIF tiled image tracks are meant to be stitched into a
full image before being displayed and requires special handling.

Another example would be MPEG-TS audio track tagged with mix_type=0.
Which means that the audio stream is a dependent stream and is intended
to be mixed or combined with a separate complete and independent audio
stream by the receiver.

In either case we should not directly select such tracks.
2024-11-26 11:42:48 +01:00
Kacper Michajłow 81db3446fa DOCS/man/options: mention sub-box/osd-box/box profiles 2024-11-25 17:29:47 +01:00
Guido Cella 86bbe997ce console.lua: don't append spaces after completion
After pressing Tab a space is usually appended after the suggestion, and
with the new autocompletion you have to enter a space again before
seeing the completions for the next token even when there is only 1
matching completion. Just don't append spaces and let the user manually
type 1 space after completion, which is more intuitive.
2024-11-25 16:43:14 +01:00
Guido Cella 8464ba471a console.lua: highlight the first completion in the terminal
Follow up to a0d416e94b.
2024-11-24 13:28:58 +01:00
Guido Cella e549bf0dec console.lua: update completions after moving the cursor
...and after navigating the history.

I thought of making the new function accept the new cursor position and
set it, but it would not be clear that you're only supposed to call it
when handle_edit() is not already called.
2024-11-24 12:19:45 +01:00
Kacper Michajłow 5730c631fd player/video: update dynamic hdr params 2024-11-24 11:32:12 +01:00
Guido Cella a0d416e94b console.lua: highlight the first completion suggestion before cycling
2f271a92de made it so that the first completion suggestion is
automatically selected when pressing Enter, if none was manually
selected. So automatically highlight the first completion in yellow to
show this.
2024-11-24 11:23:04 +01:00
Guido Cella 40724f81e1 console.lua: save commands in history after autocompletion
2f271a92de made it so that the first completion suggestion is
automatically selected when pressing enter, but that was done after
saving the command in the history. Save it to the history after
expanding it, so re-running the previous command actually works, e.g.
save "set vo gpu-next" instead of "set vo gn".
2024-11-24 11:23:04 +01:00
Kacper Michajłow 96d2c044fc mp_image: always force RGB formats to full-range RGB
It turns out mpv doesn't tag at all when doing conversions, so we just
re-tag here and hope for the best. This should be improved, but there
are many different code paths when conversion can happen, so for now
revert to previous behavior.

Fixes: 4e5cc9cf1d
2024-11-24 11:22:46 +01:00
Dudemanguy c089aaafbe wayland: always recalculate scaling if wl->current_output is not set
If we lose the current output for any reason (unplug, turns off, etc.)
and then later it comes back, mpv should always recalculate all the
scaling stuff. The optimization to avoid needless scaling calculations
didn't consider this case and would always exit since the scaling is the
same. So just check wl->current_output's existence as well.

Fixes #15361.
2024-11-24 05:19:09 +00:00
Arcitec 2d813de6b6 DOCS/man/mpv: improve path docs and clarify config-dir path behavior
The previous documentation was pretty scary and misleading, and was
also outdated in several sections.

It was also difficult to understand some of the paragraphs.

The path documentation has now been overhauled to be much easier
to understand and to document the latest mpv behavior.
2024-11-23 22:17:30 +01:00
Guido Cella 200065cc2f options: rename --sub-ass-hinting to --sub-hinting
Because it also affects plain text subtitles.
2024-11-23 22:17:21 +01:00
Guido Cella d1c2ee1c82 options: rename --sub-ass-shaper to --sub-shaper
Because it also affects plain text subtitles.
2024-11-23 22:17:21 +01:00
Guido Cella 3291254263 options: rename --sub-ass-line-spacing to --sub-line-spacing
Because it also affects plain text subtitles.
2024-11-23 22:17:21 +01:00
Kacper Michajłow 4908a632d3 vo_gpu_next: use display values in target-contrast=auto 2024-11-23 22:16:44 +01:00
Kacper Michajłow 2c2ac3cb36 vo_gpu_next: add target-colorspace-hint=auto 2024-11-23 22:16:44 +01:00
Kacper Michajłow d53dae1fd6 video/out/gpu/context: add target_csp callback to ra_swapchain
This allows to get target display parameters.
2024-11-23 22:16:44 +01:00
Guido Cella 2f271a92de console.lua: expand the first completion on Enter
If you run a command without manually selecting a completion, select the
first one. e.g. set vo gn runs set vo gpu-next.
2024-11-23 10:48:32 +01:00
Guido Cella 57a6f12ed3 console.lua: dont crash when typing a command prefix
Typing a command prefix crashes console because first_useful_token is
nil. This already happened before implementing autocompletion if you did
no-osd<Tab>, but autocompletion made it evident.
2024-11-23 10:48:32 +01:00
Guido Cella 57b73f1af6 console.lua: show completions as you type
Show available completion suggestions as you type without having to
press Tab.

This is fast even on a 2011 CPU, so we can get away with doing this in
the same thread that draws the console. The one case where it could make
the console hang is file completion of network drives, but in general it
is convenient for loadfile.

mp.input.get clients also get a request to complete on each character
typed, but those run in a different thread so performance is always
fine, and completions were already rejected if the input line or cursor
changed after the request. If I ever make running mpv commands an
mp.input client in the future, command completion will also benefit from
running in a different thread.
2024-11-23 10:48:32 +01:00
Guido Cella 2e265f33e3 console.lua: complete fewer properties
10k properties makes the console hang and the CPU fan spin with live
fuzzy filtering, so print fewer sub-properties. These are rarely useful
anyway.
2024-11-23 10:48:32 +01:00
Guido Cella a0de894d4c console.lua: determine completions with fuzzy search
For example, set vo gn<Tab> will complete to gpu-next.
2024-11-23 10:48:32 +01:00
Kacper Michajłow 2183f771ef vo_gpu_next: fix mp_image colorspace with some hwdecs
Fixes: ef6052c01e
2024-11-23 10:48:22 +01:00
llyyr e2a23e08b8 wayland: don't print same message for fractional and wl_surface scale 2024-11-23 04:42:52 +00:00
Kacper Michajłow 3e10309b62 player/loadfile: prefer non-image when selecting video track
This fixes `ytdl_hook`, which would start playback with the thumbnail
track selected. This issue occurs because the thumbnail track is added
first. If the main track is not marked as default afterward, which it
isn't for single streams, the first track (the image track) would be
selected.

In general, if a non-image track is available, it should be preferred.
2024-11-22 21:14:52 +01:00
Jan Ekström 7f49806cf4 ci/lint-commit-msg: move away from things deprecated in Python 3.9
As normal types started being supported better for type hinting,
their alternatives in the typing module would be deprecated.
2024-11-22 21:50:25 +02:00
Jan Ekström 45a72d6bec github/workflows: switch Ubuntu mingw-w64 build to pkgconf
Ubuntu 24.04's pkg-config is already an almost empty transitional
package that depends on pkgconf, and pkgconf contains the
`/usr/bin/pkg-config` binary.

Thus while we are moving macOS to it, we shall do the same with
this mingw-w64 build.
2024-11-22 21:50:25 +02:00
Jan Ekström 1f0ec5cd02 github/workflows: unlink macOS pkg-config if installed
This works around an issue with recent Github CI runners where
Homebrew is in an intermediate state. This is where old pkg-config
is installed, yet pkg-config as a package has become an alias
for pkgconf, thus causing failures to automatically switch symlinks
from one to the other.

Ref: actions/runner-images#10984
2024-11-22 21:50:25 +02:00
Jan Ekström 1bc7e62e9e github/workflows: switch from pkg-config to pkgconf for macOS
Is now available, and pkg-config as a package has been deprecated.
2024-11-22 21:50:25 +02:00
Guido Cella cf3bc0a722 console.lua: limit the length of selectable items
Giving very long lines to libass freezes mpv and makes the CPU spin
(though it's fine with terminal output). This is often the case
user-data/mpv/ytdl/json-subprocess-result in the property list. So limit
the length of selectable items to 300 characters (not Unicode aware).
This is enough to fill a 1920x1080 window with font_size=16 and Japanese
text.
2024-11-22 19:04:51 +01:00
Guido Cella 5ec569d073 console.lua: strip multiple lines in selectable items
If an item contains newlines, it hides the top items. This is often the
case for sub-ass-extradata and metadata/ytdl_description in the property
list. So keep only the first line.
2024-11-22 19:04:51 +01:00
nanahi 33e297bd8f video/out/wayland_common: initialize offer fd 2024-11-22 11:21:26 +01:00
nanahi 70e02e7b4e video/out/wayland_common: fix dnd with focus follow mouse
Whenever mpv window gains focus, a new data offer is sent for the
selection. However, mpv currently treats it the same as dnd data
offers, which results in wrong handling. One bug which results from
this is when focus follow mouse is enabled, dropping the dnd file
results in the window being focused and selection offer being sent,
freeing the existing dnd offer. This results in dnd being broken
on at least GTK3.

Fix this by separating selection and dnd offer handling. Since there
is no way to know whether an offer introduced by
data_device_handle_data_offer is a selection or dnd offer, make it
pending, and move them once the identity is confirmed.
2024-11-22 11:21:26 +01:00
nanahi eb0c4b91c1 video/out/wayland_common: extract data offer to a struct
The data offers can be either dnd or selection offers.
Add a separate struct for it so that handling of selection
offers can be added.
2024-11-22 11:21:26 +01:00
norinoriko 68d9ed2572 sub/osd: adjust osd margins 2024-11-21 16:14:07 +01:00
Kacper Michajłow 4b11f66eb1 various: use avcodec_get_supported_config() to resolve deprecation warn
See: https://github.com/FFmpeg/FFmpeg/commit/3305767560a6303f474fffa3afb10c500059b455
2024-11-20 20:42:33 +01:00
Kacper Michajłow 23262308d6 vo_gpu_next: restore initial hook param value
If the parameter is removed from the `glsl-shader-opts` list, it should
be restored to initial value.
2024-11-20 20:41:49 +01:00
Kacper Michajłow 012d317a1e vo_gpu_next: clear renderer cache on options update
This ensures that options are applied to current frame, even in paused
state.
2024-11-20 20:41:49 +01:00
Kacper Michajłow ef6052c01e vo_gpu_next: remove colospace overrides
Hacks like that has no place here, mp_image should be tagged correctly,
across the player, gpu-next is not special.
2024-11-20 20:40:05 +01:00
Kacper Michajłow 4e5cc9cf1d video/mp_image: fix vf=format colorspace override for XYZ
If format is RGB but flagged as XYZ it should be used instead.
2024-11-20 20:40:05 +01:00
Kacper Michajłow 638ada18f8 etc/builtin.conf: add osd-box/sub-box/box profiles 2024-11-20 20:39:26 +01:00
der richter 45c1c58680 mac/compat: fix compatibility for deployment targets lower than SDK ver
the swift parts can't be nicely encapsulated in the compat file because
it lags proper target version compile time checks.

Fixes #15292
2024-11-18 19:28:35 +01:00
M Stoeckl 46574d479d console.lua,wayland_common: also detect Wayland if WAYLAND_SOCKET set
While most Wayland compositors provide a socket path indicated by
environment variable WAYLAND_DISPLAY, others may sometimes bequeath a
socket file descriptor specified by WAYLAND_SOCKET.
2024-11-18 16:35:57 +00:00
nanahi 998bdef1d0 DOCS/man/input.rst: add sections to categorize commands
mpv has too many commands and they are unorganized in the
documentation, making it difficult to navigate.

This commit completely reorganizes the commands into several
categories to make the documentation easier to navigate.
The following categories are defined:

- Playback Control: Seeking and stepping.
- Property Manipulation: Changing property values.
- Playlist Manipulation: Playlist navigation and editing.
- Track Manipulation: Track navigation and editing.
- Text Manipulation: Text printing, expansion, escaping.
- Configuration: General configuration and related files.
- OSD: Displaying contents as OSD.
- Input and Keybind: Input configuration and key bindings.
- Execution: Execution of mpv and subprocesses.
- Scripting: Script loading and communication.
- Screenshot: Taking screenshots.
- Filter: Changing filters.
- Miscellaneous: Other commands.
2024-11-18 17:28:24 +01:00
nanahi 8d7fff5a2b DOCS/man/input.rst: make event and hooks sections a level higher
They're not related to commands so they shouldn't be a subsection
of list of commands.
2024-11-18 17:28:24 +01:00
Guido Cella ca38b30de3 DOCS/options: add a Video sync section to group related options 2024-11-18 17:23:08 +01:00
nanahi 9543426889 options: move dvd options to stream_dvdnav
The options and struct are only used in stream_dvdnav.c.
Also use dvd prefix for dvd_conf.
2024-11-18 17:22:02 +01:00
nanahi 354ad7f27d sub/osd_libass: simplify osd bar variable names 2024-11-18 17:22:02 +01:00
nanahi 8612f802dd options: move OSD bar opts to a separate struct
Move them to a suboption so the suboption prefix can be
used.
2024-11-18 17:22:02 +01:00
nanahi e056ad374f options: move mp_sub_filter_opts to sd_ass.c
Also use sub-filter common prefix.
2024-11-18 17:22:02 +01:00
nanahi f3b56c846d options: remove extra spaces 2024-11-18 17:22:02 +01:00
Kacper Michajłow 51f02679d4 common/playlist: don't allocate duplicated playlist_path
If the playlist is loaded directly from a protocol like memory://, the
playlist_path represents the entire playlist. In cases where we have a
large playlist, this results in the entire playlist being duplicated for
each item. For example, if the input size is 300 kB with 10k items, we
end up using 3 GB of memory just to store the playlist_path strings.
2024-11-18 17:14:38 +01:00
Guido Cella 2e31502cb1 console.lua: don't override the offset of opaque boxes
With --osd-border-style=opaque-box and background-box, respect
--osd-shadow-offset.

I am not sure if --osd-shadow-offset should be inherited with
--osd-border-style=outline-and-shadow, especially since it doesn't let
you specify different x and y offsets.
2024-11-18 17:10:19 +01:00
Guido Cella b71ab51996 console.lua: use OSD margins
Now that default OSD margins have been decreased to 15 it is reasonable
to let console.lua inherit them for consistency.
2024-11-18 10:36:43 +01:00
Kacper Michajłow a0d7265ce9 sub/osd/console/stats: use the same 1.65 outline size 2024-11-18 09:50:22 +01:00
Kacper Michajłow fedd34e83c stats.lua: set border size to have similar relative thickness as OSD
It is 6% of font size. Little bit more relativelly to OSD, but stats has
smaller text, so we need to compensate for that.
2024-11-18 09:50:22 +01:00
Kacper Michajłow 8c3a7da619 sub/osd/console: adjust font sizes
The current OSD font size is excessively large, causing most
messages—except for very short ones to overflow horizontally.

I conducted testing across multiple devices of varying screen sizes and
under different scenarios. The adjusted font size strikes a good balance
for readability on non-high-DPI displays, while high-DPI displays should
utilize DPI scaling as needed.

Additionally, I compared the font sizes of subtitles and UI elements
across various VOD platforms, which generally use smaller font in most
cases.

The current sub font size was significantly larger than even PGS
subtitles, which are quite large on their own. Now, they are comparable.

The subtitle font size was chosen based on recommendations from the BBC
Subtitle Guidelines. It is set to 8% of the video height with a
recommended scaling factor of 0.67. Therefore, at 720p (the reference
size for mpv font scaling), the calculation is 8% * 0.67 * 720 = 38.592,
rounded down to 38. This value falls within the recommended scaling
range of x0.5–x1 for desktop PCs/Laptops and TVs (32"–42"). For more
information, see
https://www.bbc.co.uk/accessibility/forproducts/guides/subtitles/#Presentation-font-size.

OSD font size is smaller than font as those elements shouldn't be
distractful and only noticable when the user wants to look at them.

Outline size is set to 5.5% of font size.
2024-11-18 09:50:22 +01:00
Kacper Michajłow e8fd7b8798 meson: define _UCRT_NOISY_NAN to workaround the non-constant NAN define
Windows SDK 10.0.26100.0 defines the NAN macro in a non-constant manner.
This violates the C/C++ standard and breaks the compilation of
initializers with Clang.

See:
https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907
2024-11-17 03:19:17 +01:00
Guido Cella dd5f2069b8 loadfile: move mp_format_track_metadata to misc.c
Move the function added in 3ea8d751f5 to misc.c because command.c is too
big. The circle definitions are also moved to core.h
2024-11-16 16:59:11 +01:00
Guido Cella da82c0428e input/cmd: increase the command length for --input-cmdlist
--input-cmdlist crops playlist-next-playlist, playlist-prev-playlist,
write-watch-later-config and delete-watch-later-config, so increase the
string length to that of the longest command.

Also stop specifying both the minimum and maximum length since they are
the same.
2024-11-16 16:58:38 +01:00
nanahi 1c9d066c9e input: fix memory leak with scalable input and nonscalable commands
With scalable input source, scale_units can be 0, and cmd is not
freed. Fix this by freeing cmd when scale_units is 0.

Fixes: 937128697f
2024-11-16 16:58:21 +01:00
Kacper Michajłow 70aaba71d6 player/command: remove /100 from sub-pos print
It already prints %, so there's no need for '/100'. Also, use the print
helper while at it.

6ea08be59a added a percent sign but didn't
remove '/100', so we ended up with both, which is redundant.
2024-11-14 18:56:04 +01:00
Kacper Michajłow 3772b8e385 meson: disable subprocess command for fuzzing
Allowing arbitrary command execution for the fuzzer is not ideal. While
some testing of this code is valid, unsupervised fuzzing of the input is
not. It may be better to add a dedicated test or fuzz-test for this
case.
2024-11-14 18:55:29 +01:00
Kacper Michajłow b982027b64 fuzzer_options_parser: limit input size to 2048 bytes
To encourage fuzzing to mutate shorter test cases, avoid continuously
adding more elements into a single input.
2024-11-14 18:55:29 +01:00
Guido Cella 1c3f09270f defaults.js: send the right number of arguments to input.get callbacks
Only send how many arguments were actually passed by console.lua instead
of sending extra undefined arguments.
2024-11-14 11:09:08 +01:00
Guido Cella ea6b1119d3 defaults.js: fix the opened event with mp.input.get
The opened event doesn't send any arguments. Don't call
JSON.parse(undefined) in that case because it errors.

Fixes eb4c6be630, fixes #15301.
2024-11-14 11:09:08 +01:00
llyyr c60d8523ed meson: rename meson_options.txt to meson.options
This is preferred name since 1.1.0, and we already require >=1.3.0 so
there's no harm in doing it.
2024-11-13 14:16:48 +00:00
Guido Cella 476ed609ea options: increase the default --image-display-duration
1 second is too short to view images, so increase the default duration
to 5 seconds.
2024-11-13 14:15:16 +00:00
llyyr 43d896657e wayland: cleanup check_for_resize function
xdg_toplevel_resize_edge enum values allow for this to work, e.g.
`TOP | LEFT = TOP_LEFT`

No functional change.
2024-11-11 22:11:23 +00:00
nanahi ca7aeb71ee video/out/gpu/video: fix chroma offset rotation matrix calculation
82231fd74d mentioned that for the "rot"
transform flip=true must be set, which "makes no sense at all".

The reason this is happening is that the rotation matrix calculation
is only valid for the 2D coordinate system where y axis is 90 degrees
counterclockwise from x axis, but the coordinate system of chroma
offset has its origin at top-left so it is the opposite, which results
in the rotation going to the opposite way. Setting flip=true fixes the
rotation direction, but results in a flipped y coordinate.

Fix this by reversing the rotation angle for chroma offset rotation
matrix calculation. This also allows removing some duplicated code.
2024-11-11 02:30:26 +01:00
nanahi 70b202a8f4 video/out/gpu/video: prevent OOB access when larger angles are used 2024-11-11 02:30:26 +01:00
Guido Cella d66ed2d8be sub/osd_libass: don't blur the osd-bar
High --osd-blur values break the osd-bar by not drawing the filled
portion, and even low values just make it look worse, so don't apply
--osd-blur to the osd-bar.
2024-11-09 12:44:05 +01:00
Guido Cella 06ab9622e6 DOCS/man/input.rst: remove input commands subject to change heading
Most of the commands list here are several years old and we will
probably never change them. And it is already stated in the description
of individual commands if they are deprecated or subject to change.

Furthermore, it is easy to add new commands at the end of this section
by accident. I added load-config-file and load-input-conf here without
realizing it's a separate section, and I assume this was also the case
for begin-vo-dragging.
2024-11-08 15:26:52 +01:00
Olivier Perret 3bbc770b14 options: add .qoi to the list of image extensions 2024-11-08 10:01:28 +01:00
Kacper Michajłow ddba159b51 ci/win32: restrict shaderc version to fix build errors
The same as 87826224a2.
2024-11-08 09:59:29 +01:00
sfan5 87826224a2 ci/mingw: restrict shaderc version to fix build errors
https://github.com/KhronosGroup/glslang/issues/3787 was fixed already
but shaderc uses pinned revisions, so let's just downgrade.
2024-11-07 22:39:38 +01:00
davince 46fe3cded0 ao_audiotrack: make audiotrack jni multi-instance and multi-thread safe
The detailed issue is here:
#15212

problem: Since The AudioTrack is not an mpv instance level but a global object, it cannot support multiple mpv instances at the same time. For example, if you create two instances and then destroy one of them, the other instance may crash.

Add jni usage count to fix this.
2024-11-06 18:54:50 +01:00
nanahi f8db474090 .github/ISSUE_TEMPLATE: ask for last known working version
Currently it asks which version introduced the problem, but
users are unlikely to know if they don't update and test every
single version released, and this field is rarely filled in
practice by non-developers.

On the other hand, it's much easier to recall the last working
version that they have used before.

So ask for the last known working version, which is useful
information for developers to narrow down bisecting range.
Also ask when did the issue start in general since the issue
can be caused by system or driver updates.
2024-11-06 18:00:42 +01:00
nanahi 1818c423da .github/ISSUE_TEMPLATE: unify source of mpv description 2024-11-06 18:00:42 +01:00
nanahi c9bc1e6cfe .github/ISSUE_TEMPLATE: clarify the template is for other platforms
It currently says "different" issue which is unclear.
Clarify this by saying it's for other platforms.
2024-11-06 18:00:42 +01:00
llyyr 168fb56fe8 osc.lua: observe playlist-count instead of playlist property
Observing playlist property with "native" type is too expensive for
larger playlists, and we only observe this property to
activate/deactivate next/prev buttons on the osc. We actually only need
to know if the playlist-count has changed, nothing else.

Fixes: https://github.com/mpv-player/mpv/issues/15264
2024-11-06 18:00:09 +01:00
der richter 91d4e6f937 mac/type: change never mutated variable to let 2024-11-05 18:34:15 +01:00
der richter c80757d782 videotoolbox: silence OpenGL deprecation warnings 2024-11-05 18:34:15 +01:00
der richter 84adbd9d35 ao_coreaudio: fix CoreAudio deprecations 2024-11-05 18:34:15 +01:00
der richter 6f009a91a6 mac/common: fix light sensor deprecations 2024-11-05 18:34:15 +01:00
Dudemanguy 23843b4aa5 vo_gpu_next: set --target-colorspace-hint to yes by default
It simply does not make any sense to not signal the correct colorspace
and metadata by default.
2024-11-04 19:35:28 +00:00
Dudemanguy d5f1cd07dc vo_gpu_next: add a pass_colorspace override for drm
The libplacebo colorspace hint api makes sense for things like vulkan,
but for other APIs like drm that are capable of directly handling
colorspaces and hdr metadata it's a nuisance. Add a pass_colorspace fns
that signals to vo_gpu_next that the backend doesn't need the color
information to be manipulated and can handle the metadata itself.
2024-11-04 19:35:28 +00:00
Dudemanguy ca31b94843 wayland: guard devices_are_equal completely
Only used if we have drm. Avoids a -Wunused-function error.
2024-11-04 19:35:28 +00:00
Dudemanguy c0f1954d66 github/workflows: install libdisplay-info on freebsd
Needed for drm to build now.
2024-11-04 19:35:28 +00:00
Dudemanguy a4d9bdd262 drm: parse edid using libdisplay-info
libdrm unfortunately doesn't give us what is actually supported by the
connector in question. To do that, we would have to parse the edid blob.
Use libdisplay-info to do this and make it required for drm support.
Using what we get back from the library, we can do a bit of sanity
checking for hdr metadata to make sure that the display in question can
handle it before we try setting the metadata. Strictly speaking,
libdisplay-info has stuff for dynamic metadata that we could potentially
use, but as a first pass and for simplicity, only static is considered
for now.
2024-11-04 19:35:28 +00:00
Dudemanguy 8039128693 vo_gpu: explicitly set target_params to NULL on uninit
Prevents vo_get_target_params from segfaulting if called somewhere else
in the code since the underlying p->renderer was just freed.
2024-11-04 19:35:28 +00:00
Dudemanguy 2827c9f323 context_drm_gl: add support for hdr metadata
It seems what we can do on this level is a bit limited but it's better
than nothing. Closes #8219.
2024-11-04 19:35:28 +00:00
Guido Cella a61518db98 player/client: reduce log level for hooks not sent to clients
If a hook event can't be sent to a client because it no longer exists,
stop logging it as a warning, as there is no way for a client to remove
hooks, so it is expected that the hook can't be sent. This is documented
in libmpv/client.h.

If the hook event can't be sent for other reasons, like the event queue
being full (currently the only other possible reason), keep logging as
warning.

Also add the client and hook type to the message. They are also logged
just above, but only in verbose mode, so when only the warning is logged
you didn't see the client before.

auto_profiles.lua logs these warning since 5dc4047415, and this commit
fixes that.

Fixes #15244.
2024-11-03 20:03:49 +02:00
llyyr 22116734e7 sd_ass: introduce sub-ass-prune-delay
Disabled by default because it breaks sub-seek and playback in cases
where the user changes play-dir from + to - during runtime and past
"seen" events need to be re-rendered.

Available since https://github.com/libass/libass/commit/dcc9eb722ebd485d2ed0e21c261b0a1b05497154
2024-11-03 05:23:41 +01:00
llyyr 9bf0c53763 sub/sd_ass: set ASS_OVERRIDE_BIT_BLUR if available
https://github.com/libass/libass/commit/4df64d060a8a89b2cd54678190426079bb9d49a6

Fixes: https://github.com/mpv-player/mpv/issues/14852
2024-11-03 05:12:34 +01:00
Kacper Michajłow b057af0a56 w32_common: update window style after changing maximized state
Maximized state is not allowed without WS_OVERLAPPEDWINDOW style and
doesn't stick. Set the style after.

Fixes: #15093
2024-11-03 02:21:15 +01:00
Kacper Michajłow 42ff6f92c3 vo_gpu_next: add chroma location and HDR metadata to shader parameters 2024-11-02 21:20:20 +01:00
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
Guido Cella 940ab99055 osc.lua: make shift+mbtn_left an alias of mbtn_mid
...instead of the opposite. This simplifies bind_mouse_buttons().
2024-10-28 23:16:54 +01:00
Guido Cella dc85266aff osc.lua: remove code repetition for mouse bindings 2024-10-28 23:16:54 +01:00
Guido Cella 4b97e723d6 osc.lua: rename the tog_fs button
Make it consistent with the command script-opt names.
2024-10-28 23:16:54 +01:00
Guido Cella a2106396bc console.lua: fix the clicked line calculation
e00d8dcb03 factored hidpi-scale in get_scaled_osd_dimensions(), so
max_lines was dividing by it a second time.
2024-10-27 21:36:32 +00:00
Guido Cella 29cffadf60 console.lua: document the new hipdi scaling behavior
Update the docs for the changes of a670f75679.
2024-10-27 21:36:32 +00:00
nanahi a670f75679 console.lua: don't scale with display dpi if scaling with window size
Fixes overly large text on hidpi displays.
2024-10-27 21:43:36 +01:00
Guido Cella 423e8f2711 osc.lua: increase the title font size in box layout
It is too small.
2024-10-27 21:10:36 +01:00
Guido Cella d2fd394036 console.lua: increase the font and border size
Make the console easier to read because the current default is too
small. See for example
https://github.com/mpv-player/mpv/discussions/14903#discussioncomment-10794701
or https://github.com/mpv-player/mpv/pull/15036#discussion_r1794178379
or https://github.com/mpv-player/mpv/pull/15145#issuecomment-2428762898
or https://github.com/mpv-player/mpv/pull/15031#issuecomment-2402289600.

This also prevents libass from decreasing performance by printing many
lines.
2024-10-27 21:07:37 +01:00
Guido Cella e00d8dcb03 console.lua: add scale_with_window script-opt
If this is set to yes or auto and --osd-scale-by-window is true, console
scales with the window height like everything else in mpv.

Defaults to auto.
2024-10-27 21:07:37 +01:00
Guido Cella fbf869584c osc.lua: cycle tracks on right click
This might be more useful than having the same binding as middle click.
Suggested by llyyr.
2024-10-27 01:24:03 +02:00
Guido Cella 897c04afe1 osc.lua: don't print auto before tracks are selected
While files are loading, track options have the value "auto". Print "-"
in that case.

Fixes 1a558bf5c2.
2024-10-27 01:23:20 +02:00
Guido Cella 99e4979b01 mac/menu: use show-text instead of old osc script messages
1a558bf5c2 made osc-*list script messages aliases to show-texting the
relative properties, so use show-text directly in the menu. Also
increase the duration to be the same as the OSC buttons because the
default of 1 second is too short.
2024-10-26 20:09:57 +02:00
nanahi c6883c4a56 options: add option to control OSD bar marker style
This adds --osd-bar-marker-style option which can be used to
customize OSD bar marker style. In addition to the existing triangle
style, a new style option is added to draw markers as lines.
2024-10-26 20:02:04 +02:00
nanahi ea8ac49f11 options: add options to control OSD bar marker size
This adds --osd-bar-marker-scale and --osd-bar-marker-min-size
options which can be used to customize OSD bar marker size.
2024-10-26 20:02:04 +02:00
nanahi 085a816c80 osd_libass: rename marker size variable
The size won't be dent anymore once other marker styles are
added.
2024-10-26 20:02:04 +02:00
Earnestly 9f6cca624f ytdl_hook.lua: track playlist metadata
Add support for tracking playlist_title and playlist_id metadata
corresponding to a given playlist url and the entries associated
with it.

This allows the inclusion of ytdl_playlist_title and ytdl_playlist_id
in the metadata property for single videos which have a corresponding
playlist-path property.

This commit also resolves yt-dlp/yt-dlp#11234
2024-10-26 19:59:26 +02:00
nanahi 9af491fc80 Copyright: fix -Dgpl=false description
Even with -Dgpl=false, some files including the documentation,
mpv.desktop, and some key binding files are still being built.
This means that mpv as a whole might not be LGPL even when the
program itself is LGPL.

Also the description that mpv is licensed under LGPLv2.1+
"if built with the -Dgpl=false configure switch" is incorrect
as it appears to give a license grant as long as the switch is
used, regardless if there is a bug in the build system that
results in a GPL file being compiled in.

Change the description to clarify this.
2024-10-25 14:01:16 +02:00
nanahi 246be60401 Copyright: remove some redundant texts
The same information is already covered by the second and the last
paragraphs.
2024-10-25 14:01:16 +02:00
nanahi 71ccc45188 Copyright: clean up nonexistent features
Remove some of the features that no longer exist or aren't directly
supported in the mpv code: Linux analog TV (DVB still supported),
SMB, bootstrap.py.
Also fix the path for mpv.desktop.
2024-10-25 14:01:16 +02:00
Guido Cella 5c59f8accc command: remove an extra space from track formatting 2024-10-24 22:04:44 +02:00
Guido Cella 4598ceb3f2 osc.lua: show track-list for one more second
Useful now that track metadata is printed. This now uses the same
duration as playlist and chapter-list.
2024-10-24 22:04:09 +02:00
der richter 96095bd591 github: add newline at end of file of pull request template 2024-10-24 17:40:26 +02:00
der richter e661165ead github/workflows: add editorconfig linting 2024-10-24 17:40:26 +02:00
Guido Cella ef6eda32a2 command: print track metadata when changing track 2024-10-24 17:39:46 +02:00
Guido Cella f0a852cda3 command: print lang in track-list 2024-10-24 17:39:46 +02:00
Guido Cella b1037f5d63 loadfile: reuse circle definitions in command.h 2024-10-24 17:39:46 +02:00
Guido Cella 3ea8d751f5 command: print track metadata in ${track-list}
Extract track metadata formatting out of loadfile.c to reuse in the
track-list property.
2024-10-24 17:39:46 +02:00
Guido Cella 1bee15d5da laodfile: remove redunant track type check
The data within the checks is unavailable if the track isn't of that
type, so there is no need to check the type.
2024-10-24 17:39:46 +02:00
llyyr c5561b8e09 demux_playlist: fix comparison for current file if it's in current dir
When the file is in the current working directory, stream->path points
the path user passed as arg, so it may or may not include './'.

Strip it from both to make the comparison work

Fixes: c201c4874d
2024-10-24 12:34:58 +02:00
Dudemanguy 851df7088a video/out/gpu/context: prefer vulkan over opengl when reasonable
For most actual desktop users, vulkan should be the a superior
experience over opengl as this point and our autoprobe should pick that.
For linux users, vulkan on wayland is rapidly seeing improvements and is
far ahead of egl. There is no sign of that changing anytime soon and
working fifo is on the horizon, so really wayland users should just all
be using vulkan from now on. For x11, there is not a big difference
between using egl vs vulkan as far as I know and both work well. macOS
already prefers the vulkan backend over the libmpv one anyways, and
finally windows still defaults to d3d11. Probably virtually no one uses
opengl on windows, but vulkan is reasonably common among windows users
and it doesn't make any sense to prefer opengl over it.

The two outliers here are Android and VK_KHR_display. On Android, vulkan
drivers are probably just a total disaster and let's not put ourselves
in that mess if there's no reason to. For VK_KHR_display, it actually
works fine except for one really big problem: VT switching doesn't work.
If you try it, enjoy losing all input and being forced to do a hard
reboot. It might be fixable if you use logind or something, but the
method of using signals like the drm context does won't work because
VK_KHR_display uses render nodes not primary nodes. Also, the opengl drm
context could support hdr in theory (some attempts were made but none
succesful) so it is probably "better". Maybe. Anyways, for these two
platforms, we still prefer opengl.
2024-10-23 19:09:20 +00:00
der richter a8d91b0b13 mac/vulkan: add retrieval of color depth and return auto (0)
this effectively disables the workaround that picks the color/dither
depth based on the source and instead picks it based on the output
surface/pixel format.

macOS apparently always operates at 10bit internally regardless of the
display's bit depth. this changed at some point in the more recent macOS
versions, where previously macOS operated at a frame buffer depth
corresponding to the display. either 30-Bit Color (ARGB2101010) for
10bit or 24-Bit Color (ARGB8888) for 8bit.

Fixes #13767
2024-10-23 19:39:20 +02:00
der richter 3c76afa05b vo_gpu_next/vulkan: add mechanism to retrieve color depth in gpu context 2024-10-23 19:39:20 +02:00
Rasmus Porsager 3d443cb267 x11: fix --fs-screen=all
The logic for getting the display edges was wrong and always resulting in 0 0 0 0 instead of the full desktop. This also fixes #11716
2024-10-23 14:22:39 +02:00
Guido Cella dec1b00a75 DOCS/man/osc: update default playlist mbtn_right bindings 2024-10-23 14:22:14 +02:00
Guido Cella f999b0a5c8 osc.lua: don't show the osd-bar on chapter navigation
It is redundant if you're already using the OSC, so only show the
chapter text. Also fix the documented default commands of these buttons
which were outdated.
2024-10-23 14:22:14 +02:00
Guido Cella 165159fdef osc.lua: cycle window-maximized when right clicking fullscreen
And add script-opts to configure the fullscreen button bindings.
2024-10-23 00:21:15 +02:00
Guido Cella dab5cf4ab0 osc.lua: toggle looping when right clicking playpause
Inspired by ModernX.

Closes #5067.
2024-10-22 22:44:21 +02:00
Guido Cella a80f535a6d osc.lua: make mouse bindings customizable
This adds several script-opts to configure what OSC buttons do when
clicked. It lets you restore the bindings present before they were
changed to call select.lua.

The script-opts are listed one per line in the manual to not make that
section huge.

skip_backward and skip_forward script-opts are omitted to lower the
script-opts number because they are only in box layout and undocumented.

I'm not sure if it's worth adding script-opts for the wheel on the
seekbar.

script-opts for the current and remaining time and fullscreen are not
added to not add more script messages.

Closes #6291 and #11878.
2024-10-22 22:44:21 +02:00
Guido Cella 8e327f28b4 osc.lua: default chapters_osd and playlist_osd to false
There is a consensus that showing these list when navigating is
distracting. Also if you set --osd-playing-msg, the playlist is briefly
displayed and then overwritten by the msg. The chapter list can even
contain spoilers:
https://github.com/mpv-player/mpv/issues/4675#issuecomment-978840475

The next commit will remove these completely in favoring of making the
commands customizable.
2024-10-22 22:44:21 +02:00
Guido Cella e6db75b04a osc.lua: rename buttons
Give buttons nicer names before exposing script-opts for their bindings.
In particular, rename cy_audio and cy_sub to audio_track and sub_track
because their left click binding no longer cycles.
2024-10-22 22:44:21 +02:00
Guido Cella c24c9027af osc.lua: bind middle button down instead of up for tracks
This makes it consistent with most other bindings and lets you cancel
the operation by moving the cursor away (the seekbar bind mouse down so
you can keep seeking to different timestamps).
2024-10-22 22:44:21 +02:00
Guido Cella cd2acb477c osc.lua: open select.lua by clicking buttons
8bf5548 added mouse support to the console's select menu, so open it
from OSC buttons.

Left click on the title opens the playlist selector and showing the
stats is moved to right click.

Right click on chapter buttons opens the chapter selector.

Left click on track buttons opens the track selectors because seeing
which track you're selecting beforehand is useful.

Fixes #10621.
2024-10-22 22:44:21 +02:00
Guido Cella 68e2b51066 osc.lua: show stats page 5 when clicking the title
Now that the playlist counter is shown by default there is no use in
showing it again, so repurpose the binding to show the stats page with
file and track info.
2024-10-22 22:44:21 +02:00
Guido Cella 8ca7386a38 osc.lua: add osc-hide script-message
This will be used to hide it when opening select.lua.
2024-10-22 22:44:21 +02:00
Guido Cella f156461360 osc.lua: show the playlist position when playing multiple files 2024-10-22 22:27:40 +02:00
Guido Cella 8aad03bf6d command: don't print unneeded new lines for track-list
Useful for terminal output.
2024-10-22 20:17:14 +02:00
Kacper Michajłow 153d4927ab options: add --script-opt alias for --script-opts-append 2024-10-22 18:54:16 +02:00
Kacper Michajłow 4045fac980 osdep/io: remove duplicated code for error to string conversion
This also removes \n from the end of the string, which shouldn't be
present in this string.
2024-10-22 18:53:18 +02:00
Guido Cella 7a652344ee osc.lua: seek to the nearest chapter when right clicking the seekbar
This allows seeking to the start of a chapter without exactly clicking a
chapter mark.

Inspired by ModernX.
2024-10-22 18:52:56 +02:00
Mohammad AlSaleh d027e02d37 vo_gpu_next: raise LUT file max size and report an error if exceeded
First of all, `lutdata` was passed to `pl_lut_parse_cube()` even if
 it was empty. This caused a bogus error message to be printed by
 the LUT parsing code in libplacebo.

 "[vo/gpu-next/libplacebo] Missing LUT size specification?"

 One of the reasons why `lutdata` can be empty is if the LUT file size
 exceeds the `max_size` limit passed to `stream_read_file()`.

 So in this commit, `lutdata` is checked first before getting passed to
 libplacebo, and a non-bogus error message is printed if it's empty.

 And secondly, the max size allowed is raised from the quite limiting
 value of 100MB to 1.5GiB. The new max matches the limit in LUT cache
 which is used to support up to 512x512x512 LUTs.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2024-10-22 18:49:21 +02:00
nanahi 25ccae9216 player/javascript: disable stream error logging
Failure to open a file here should not be treated as an error
if the exception is handled by the script.
2024-10-22 03:16:51 +03:00
nanahi bd5e3c0261 stream: allow max_size of 0 for stream_read_complete
In this case, it returns a bstr of a length of 0 rather than
error.
2024-10-22 03:16:51 +03:00
nanahi 2af0b0b34b player/javascript: allow reading partial result for af_push_file
ca7006a6a2 replaced file reading with
stream_read_file which results in error when af_push_file is used
to test existence with 1-byte limit. Fix this by using
STREAM_ALLOW_PARTIAL_READ flag to restore the old loading behavior.
2024-10-22 03:16:51 +03:00
nanahi dd23bf1555 demux_playlist: use STREAM_READ_FILE_FLAGS_DEFAULT 2024-10-22 03:16:51 +03:00
nanahi dc0d99eaff stream: add STREAM_READ_FILE_FLAGS_DEFAULT
This is the default set of flags used by stream_read_file().
Useful for doing flag customization for stream_read_file2().
2024-10-22 03:16:51 +03:00
nanahi c2e71ceb07 stream: add STREAM_ALLOW_PARTIAL_READ flag
This allows stream_read_complete() to return partial result
instead of error if the file size is larger than the limit.
2024-10-22 03:16:51 +03:00
nanahi fad946d778 player/javascript: use af for stream_read_file talloc context
Needed because js_pushlstring can throw and skip the free below.
2024-10-22 03:16:51 +03:00
Sam 2173565b56 osc.lua: replace escaped double quotes with single quotes 2024-10-22 00:02:38 +02:00
Guido Cella 0dc2e85ff8 console.lua: exit when left clicking outside of selectable items 2024-10-21 22:25:54 +02:00
Kacper Michajłow 1edc02174f workflows/comment: don't error out on closed pull requests
If the pull request is not found or is not open, it should not be
treated as a critical error. This situation can occur after a merge.
There is no reliable way to query a pull request from a workflow_run
event, so this has been made a non-error log.
2024-10-21 21:11:24 +02:00
Kacper Michajłow 649e397034 workflows/build: remove safe.directory git config
It has been set in our docker container.
2024-10-21 21:02:38 +02:00
Guido Cella 15ad917bb1 stats.lua: remove term_height_limit script-opt
It is excessive control to manually configure the terminal height limit
just for stats, if anything this should be added as an option used all
throughout mpv.
2024-10-21 20:07:01 +02:00
Guido Cella d6951e4039 stats.lua: don't print the scroll hint with bindlist 2024-10-21 20:07:01 +02:00
Guido Cella a187110f4a stats.lua: clip lines with ${term-clip-cc}
Use the property introduced in bf025cd289 to clip the lines of stats.lua
with accurate unicode width detection and considering --msg-module and
--msg-time. This allows removing the term ellipsis functions.

Also use script-opts-append instead of script-opts in the docs so
script-opts in mpv.conf, which could change keybindings, are not
overriden.
2024-10-21 20:07:01 +02:00
Guido Cella f72f6b0fc4 stats.lua: indent terminal output with 4 spaces instead of tab
Because the default tab width of 8 cells wastes too much space, and 4
spaces is closer to the width of ass_indent.
2024-10-21 20:07:01 +02:00
Guido Cella 869484d91e DOCS/man/stats: bindlist: use --script-opts-append
Use --script-opts-append=bindlist instead of --script-opts to not
overwrite script-opts in mpv.conf, which may set different key bindings.
2024-10-21 20:07:01 +02:00
Kacper Michajłow 0c4c2caabf misc/codepoint_width: assume tabstop width to be 8
It has been hardcoded to the same value in stats.lua so keep the current
behaviour. Can be made configurable if requested in the future.
2024-10-21 20:06:48 +02:00
Kacper Michajłow cd62cc7ecb player/osd: don't add newlines when message would be empty anyway
When only control char is present there is no point to add part for it.
2024-10-21 20:06:48 +02:00
Kacper Michajłow 201a39d7fa msg: skip formatting if there is only control char present
This doesn't change behaviour just skips some redundant code early.
2024-10-21 20:06:48 +02:00
Kacper Michajłow 3cf0f8309f msg: add newline conditionally
In idle mode, there is not status line and we sometimes want to have
output without last new line, which were always added after truncation.

Also, make sure we don't overwrite important chars with ellipsis, this
could happen when cut point is near the end.

Fixes: bf025cd289
2024-10-21 20:06:48 +02:00
Dudemanguy 0f78584518 x11: remove nvidia blacklist logic from --x11-present=auto
When the present extension was originally implemented, nvidia was
specifically blacklisted. The reason was because at the time it would
give bogus values that appeared to be real but actively made playback
worse. So out of an abundance of caution, any nvidia detection at all
(e.g. on a multi-gpu system) would disable the use of the extension.
Well times have changed and actually presentation-time on wayland for
nvidia works now amazingly enough. For xorg, the extension still doesn't
work, but from user testing it does not seem to be harmful anymore. It
just does nothing. So we can remove the blacklist part and just only use
a whitelist. Like before, we only enable the extension for mesa drivers
by default so no practical change for anyone except multi-gpu systems
whom may have this enabled now but should not see any negative behavior
change.
2024-10-21 15:13:47 +00:00
Guido Cella 0490a89ba6 DOCS/man/input: input-bindings can change at runtime
This paragraph is clearly wrong. load-input-conf was recently added, but
even before that the enable-section and disable-section commands could
change key bindings at runtime without scripts.
2024-10-21 15:13:39 +00:00
Kacper Michajłow be9b3ccb41 ci/win32: use upstream meson
The fix for response files escaping issues has been merged.

See: https://github.com/mesonbuild/meson/pull/11715
2024-10-21 04:11:25 +02:00
nanahi ca7006a6a2 player/javascript: use stream_read_file for af_push_file
Remove the complicated fopen/realloc logic.
2024-10-20 19:31:49 +02:00
nanahi 607997db24 options/parse_configfile: use stream_read_file2 for reading config
Remove the duplication with stream_read_file2, which also handles
directory correctly.
2024-10-20 19:31:49 +02:00
nanahi 8c3fd2cd38 input: use stream_read_file2 for reading config
The existing logic already duplicates stream_read_file other than
the flags. With stream_read_file2, this duplication can be removed.
2024-10-20 19:31:49 +02:00
nanahi ac648d2e0b stream: delete extra newline 2024-10-20 19:31:49 +02:00
nanahi 7673c4e34a stream: add stream_read_file2
This is stream_read_file with the ability to specify flags.
2024-10-20 19:31:49 +02:00
sfan5 9737b99845 Revert "editorconfig: punish tab usage"
This reverts commit 3840c98b36.
There are multiple reasons:
- the correct way to prevent tabs being mistakenly added is a CI linting step
- it can affect the editing experience of foreign source files
  under mpv's tree (e.g. subprojects)
- at least one editor (BBEdit) misinterprets the values and also turns
  soft tabs into 7 spaces
- it does not consistently apply to GH code view either
2024-10-20 11:22:09 +02:00
der richter 37159a8ee0 mac/remote: show external covers in Now Playing Info Center 2024-10-19 17:20:43 +02:00
der richter 8cc3160f71 mac/event: add MPV_FORMAT_NODE handler 2024-10-19 17:20:43 +02:00
der richter f866893c9c mac/type: add mpv_node type conversion helpers 2024-10-19 17:20:43 +02:00
der richter 61a09501d6 mac/app: add option to adjust Bundle PATH variable
App Bundles operate in their own shell environment that is different
from the one in the terminal. the default PATH variable for all Bundles
is /usr/bin:/bin:/usr/sbin:/sbin. because of that mpv can not find
binaries installed by package manager that might be used in scripts for
example.

add an option to prepend paths to the Bundle PATH. we prepend to make
the order fully configurable, opposed to appending where the default
Bundle binaries would always take precedence.
2024-10-19 17:18:29 +02:00
Dudemanguy c0fb6d0d62 wayland: be less stupid with color surface creation
Basically we only want to create the color surface if the compositor
supports parametric image descriptions and if the vo is dmabuf-wayland.
Instead of doing the weird dance of creating it in one spot and
destroying it later, just only make the wayland object when we actually
want it. It makes the logging less confusing as well.
2024-10-19 05:09:58 +00:00
Kacper Michajłow 6b695ac6e4 msg: use .. instead of … as ellipsis char
There were some concerns about the width of the … glyph, so avoid it and
use two dots.

Fixes: 6aa331289f
2024-10-18 19:57:53 +02:00
Guido Cella 1b53793a4c various: convert tabs to spaces 2024-10-18 18:32:26 +02:00
llyyr 7fe12574fa wayland: don't use functions not available in libplacebo338
Fixes #15120
2024-10-18 14:47:06 +00:00
Kacper Michajłow 5fed98e0ee various: use mp_tprintf_buf wrapper to work around mingw garbage
Look it up if you really care but basically z as a format specifier
often doesn't work in mingw because reasons. Our CI was working by
accident because of meson previously ignoring the CFLAGS variable. Use
our wrapper instead for these places.
2024-10-18 14:02:51 +00:00
Dudemanguy 3d3d06f981 ci/build-common: add -D_FORTIFY_SOURCE=3 2024-10-18 14:02:51 +00:00
Dudemanguy 04a2450aab ci/build-openbsd: don't enable cdda
We hit a -Wstrict-prototypes error which was fixed in the latest release
of libcdio-paranoia but openbsd is too old. We already have coverage of
this in other CIs so remove it.
2024-10-18 14:02:51 +00:00
Dudemanguy 09bbca8770 ci: refactor ci so common args are picked from one location
Mostly. It is annoying if we want to add some flag/option to all the cis
and then have to do it manually. Things easily get missed that way.
Skipped powershell because of course I'm not going to deal with that.
2024-10-18 14:02:51 +00:00
Kacper Michajłow 3e499ff3bc msg: fix width with ellipsis
Fixes: 6aa331289f
2024-10-18 00:25:10 +02:00
Guido Cella a0ca6ed5d5 options: rename --load-osd-console to --load-console
OSD is not accurate since when the console gained support for printing
to the terminal.
2024-10-17 23:57:24 +02:00
Kacper Michajłow b026fded7d msg: fix clipped output to non-tty
Not sure how it got lost.
2024-10-17 23:55:51 +02:00
Kacper Michajłow 6aa331289f msg: use … instead of ... dots 2024-10-17 23:55:51 +02:00
Kacper Michajłow 08e2acbae1 stats.lua: don't use io.write from builtin script
Scripts and especially internal scripts shouln't bypass msg.c logging
code for various resons, ranging from processing the input, filtering
the log levels, truncating the output and so on. io.write() is lazy way
of outputing to stdout without respecting mpv's logging module.

Uses osd message, because this has no prefixes. Added internal
flush-status-line command to flush current output without clearing
before exiting.

This commit will allow us to remove duplicated terminal handling code
from stats.lua, mpv core already handles all that and does it in better
way, without taking shortcuts.
2024-10-17 22:32:10 +02:00
Kacper Michajłow 2df582b839 msg: don't format status line if not printing to terminal 2024-10-17 22:32:10 +02:00
Kacper Michajłow c3404fdf37 console.lua: don't clear not ours osd messages
Note that this still is not perfect, because if osd message is changed,
console cannot know about it and would still clear it, but this change
make it at least not do it to every message even if console is not used.
2024-10-17 22:32:10 +02:00
nanahi 6880178269 DOCS/man/console.rst: document mouse bindings
Hiding console, pasting and history navigation are available
with mouse inputs.
2024-10-17 16:58:13 +02:00
Guido Cella 50faafd8bd stats.lua: exit with ESC if being toggled
If not opened in oneshot mode, close the stats with ESC. Especially now
that ? toggles showing key bindings by default, this provides an
intuitive way to close the stats.

Also do some minor reformatting of key binding documentation.
2024-10-17 16:57:35 +02:00
Dudemanguy 7e834ce870 meson: add back '-Wno-unused-result' for gcc
0fd4c84a5e removed this, but it turns out
gcc acts differently and (void) doesn't silence the warning. Hence why
the flag was there. Add it back.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
2024-10-16 20:57:25 +00:00
Kacper Michajłow e40442676a DOCS: explain origin of sigmoidization 2024-10-16 15:17:48 +02:00
Kacper Michajłow cd9761651f filter_kernels: explain origin of LanczosSharp(est) filters 2024-10-16 15:17:48 +02:00
Kacper Michajłow 742142ca92 filter_kernels: link to explanation of ginseng filter 2024-10-16 15:17:48 +02:00
llyyr 198f2e7451 wayland: don't access vo->target_params directly
Use vo_get_target_params instead.
2024-10-16 15:11:05 +02:00
Guido Cella 1a558bf5c2 osc.lua: remove NIH list formatting
All of the code to format playlist/track-list/chapter-list is
unnecessary when mpv's core can already show-text these properties.

Also an issue with this custom formatting is that showing fewer entries
than can fit on the OSD can make it seem like the playlist ends there
and there are no entries afterwards.

Also remove lots of pointless code around the track-list (mpv's track id
and the osc_id are exactly the same).

This simplification will make it easier to bind customizable commands,
otherwise yet another script message to call set_track would have to be
added, when cycle sub/audio already output information about the new
track on their own.
2024-10-16 15:10:23 +02:00
Guido Cella 65135e0f44 DOCS/input: list property values are not useless
The raw value of these properties is definitely not useless since they
return the whole list.
2024-10-16 15:10:23 +02:00
Guido Cella 3522dd836e command: implement printing ${track-list/{video,audio,sub}}
This brings show-text ${track-list} in line with osc.lua's
get_tracklist(type) before replacing it with show-text.
2024-10-16 15:10:23 +02:00
Guido Cella 89d78369c6 command: print the number of chapters in show-text ${chapter-list}
Call cut_osd_list() like with ${playlist} to print position/count above
the chapters. This is useful for movies with many chapters.

Stop printing the chapter numbers because they are not useful here, they
are only useful when navigating to a chapter.

Remove one of the spaces before the circles because they are too many.

This replicates osc-chapterlist before replacing it with show-text
${chapter-list}.
2024-10-16 15:10:23 +02:00
Guido Cella 841b66d3ec command: consider the terminal height in cut_osd_list()
cut_osd_list() calls osd_get_text_size() even when outputting to the
terminal, which results in max_lines = 19. Use the actual terminal
height instead.
2024-10-16 15:10:23 +02:00
Guido Cella be1be8ca61 command: print position/count in show-text ${playlist}
...instead of "n hidden items". This brings it in line with osc-playlist
before replacing it with show-text ${playlist}. Also make count_lines()
return the correct count.
2024-10-16 15:10:23 +02:00
Guido Cella 4e4d6a16d8 osd_libass: fix integer overflow in osd_get_text_size()
If show-text ${playlist} is used with --osd-scale-by-window=no while
printing to the terminal or while mpv is starting, the out_screen_h
assignment in osd_get_text_size() causes runtime error: signed integer
overflow: 288 - -2147483648 cannot be represented in type 'int'. Fix
this by not making prepare_osd_ass() use an infinite playresy.

This prevents printing show-text ${playlist} without a line limit to the
terminal with --osd-scale-by-window=no, which makes only the last
playlist entries be printed, and the selected one is not printed if it
isn't among them. A later commit will make the line calculation
accurate.
2024-10-16 15:10:23 +02:00
Guido Cella 0f74b1bc2d console.lua: improve hovered line calculation
- Don't do anything if clicking on the top counter, the input line or
  the new line between the items and the input line

- Don't scroll upwards when hovering the counter

- Don't redraw before clicking to avoid quickly updating the overlay
  before closing it with touch input, where the item you touch can be
  different from the one that was highlighted
2024-10-16 14:29:21 +02:00
Guido Cella b0f1830a8e console.lua: make the wheel scroll selectable items instead of the match
This makes scrolling with the wheel more usable because it doesn't
matter if the focused item is reset by moving the mouse slightly, and
scrolling always begins immediately.

This makes the MBTN_MID binding to handle_enter() unnecessary so it is
removed.
2024-10-16 14:29:21 +02:00
Guido Cella e88a1a7de7 console.lua: print position/count instead of n hidden items
This makes it consistent with the new changes to show-text ${playlist}
and greatly simplifies the logic, making it sane to implement scrolling
the view with the wheel in the commit.
2024-10-16 14:29:21 +02:00
Dudemanguy 77239b87f1 sub/sd_ass: handle subs with unknown durations on a per packet basis
A packet with an unknown duration flagged the entire context and then
this was saved forever throughout the entire lifetime of the object.
This inherently doesn't work with the redecoding sub logic which will go
through all the packets again. So the second time around, packets with
known durations get treated as if they were unknown and things go awry.
Rework this so it is per packet like it should be and not a global
state. Note that f9cefbfec4 originally
added this for specifically eia-608 subtitles but their packets are all
detected as unknown anyway due to the durations so this is not needed
anymore and interferes with other things.
2024-10-16 02:26:06 +00:00
Dudemanguy 0721b87237 player: make redraw_sub flag work on a per track basis
There can be multiple subtitle tracks (secondary subs) so this logic
should be handled separately.
2024-10-16 02:26:06 +00:00
Dudemanguy fe758a1761 player/command: destroy cached packets after UPDATE_SUB_{FILT,HARD}
Otherwise, the index can technically grow forever because
sub_read_packets will trigger again, read the same packets, then add
them to the list. We should just clear the cache here in this case to
reset it back to 0. Also flag redraw_subs here as well.
2024-10-16 02:26:06 +00:00
Dudemanguy d2d8667259 player: move a redraw_subs edgecase to loadfile
Putting this in handle_osd_redraw was strange and my own comments didn't
help me remember what this was even for. The actual purpose here is that
the osd needs to be redrawn in the still image edge case as you go
through a playlist. This is because all the logic with checking
timestamps isn't applicable and we need to essentially clear the screen
with another redraw. Clearly, it makes more sense for this to be done
when a new file is successfully loaded and not in the osd_redraw where
that happens to work but was called repeatedly pointlessly.
2024-10-16 02:26:06 +00:00
Dudemanguy dfe3edee76 player/sub: avoid pointlessly redecoding subs
This was added in 8f043de961 but the
redecode is a special case that is only ever needed for subtitles on a
still image. Normal video never needs this so just modify the
conditional to avoid doing more work.
2024-10-16 02:26:06 +00:00
Dudemanguy 4c24eae220 wayland: map BT.1886 to BT.709 for color-management protocol
Fixes #14592 as long as the compositor supports it.
2024-10-15 19:27:46 +00:00
Kacper Michajłow f33b89ca29 osdep/subprocess: log subprocess error as verbose if killed by us
Fixes: https://github.com/po5/thumbfast/issues/133#issuecomment-2413618437
2024-10-15 19:15:20 +02:00
Dudemanguy 187fffd0f5 wayland: add support for xx-color-management-v4 for vo_dmabuf_wayland
Although this protocol isn't official yet, several compositors are known
to support it to some extent and this lets users actually view HDR with
less hacks/workarounds. The actual protocol here is simply copy and
pasted from the upstream fork* where these are developed. There is also
icc profile support in the protocol, but this is omitted for now in
favor of setting colorspaces and signalling hdr metadata. However for
mpv, this only actually has any practical use with vo_dmabuf_wayland so
this is the only VO that will make use of the protocol. When using
vulkan, this is already handled via vulkan extensions by compositors and
vo_gpu_next. So actually we don't want to use the wayland protocol in
that case since it will just get in the way. The only known limitation
on that front is driver support for hdr vulkan surfaces but as soon as
that is available it should just work with no code changes. For opengl,
hdr support there is a whole other mess with a lot of unknowns but
simply using this protocol isn't good enough and would require changes
elsewhere. vo_wlshm is currently too stupid to pick any format besides
bgr0 or 0rgb, so any color management there is meaningless at this
stage.

So this means that only vo_dmabuf_wayland can actually use this
protocol. But that's perfectly fine. Without this, vo_dmabuf_wayland has
a very bad limitation in that it cannot communicate colorspaces at all
and compositors have to guess. Using xx-color-management-v4 fixes this.
For the other VOs, merely having the common protocol setup stuff in the
common code does no harm and later if they get smarter, it's easy for
them to use the stuff since it is written generically anyway.

*: https://gitlab.freedesktop.org/swick/wayland-protocols/-/tree/color-xx/staging/color-management
2024-10-15 00:15:40 +00:00
der richter ff64d87bb4 mac/common: fix usage of vo struct after vo uninit race
we keep track of the current vo struct to flag for events that are
initiated async by various thread from different system notifications.
the problem here is the usage of that vo struct after uninit.

make accessing of that vo struct atomic and clear it on uninit, so it
can't be used afterwards by concurrent threads from system
notifications or events.

Fixes #15088
2024-10-15 00:48:43 +02:00
der richter 3172186226 cocoa-cb: only request EDR on opengl layer for supported color spaces
this apparently has some performance drawbacks when not needed. so only
request EDR when we need it.

Fixes #14465
2024-10-15 00:46:45 +02:00
der richter d6aef54adb mac/app: add homebrew ARM install paths to the bundle PATH environment
since the bundle operates in a different shell environment than the one
from the terminal, it only has a few default paths set.

add the homebrew ARM default install paths to the PATH environment
variable, so the bundle can also find the needed binaries like yt-dl.
2024-10-15 00:45:51 +02:00
der richter 9a1c637e9e cocoa-cb: fix race on shutdown and toggling fullscreen
since commit 15c48f3 we were force to start drawing on the main queue
again. this has several unintended side effects due to the nature of the
main queue. in this case fullscreen event and shutdown event are
executed out of order and fullscreening is done after shutdown, leading
to accessing options that are already de-initialised.

just nil the window on shutdown and make it impossible to fullscreen
after shutdown.

Fixes #14810
2024-10-15 00:44:57 +02:00
Guido Cella 23e774d514 input.conf: bind ? to show key bindings
This should help new users to view mpv's key bindings as it's easier to
discover than shift+i and 4, because many other websites and terminal
applications show key bindings upon pressing ?.
2024-10-14 20:33:27 +02:00
Guido Cella 661bd61af8 console.lua: center selectable items around the default item 2024-10-14 20:14:27 +02:00
Guido Cella 3e63c97677 console.lua: highlight the select menu's preselected item
Requested in
https://github.com/mpv-player/mpv/pull/14087#issuecomment-2110889436 and
https://github.com/mpv-player/mpv/pull/15031#issuecomment-2401328081

This is mainly useful to keep highlighting the current playlist entry
after moving the mouse.
2024-10-14 20:14:27 +02:00
Guido Cella ad0c29e5ac console.lua: close with right click
Useful to close the console after it was opened with the mouse.

Also fix the spacing of the previous line.
2024-10-14 20:14:27 +02:00
nanahi 4ab1ab8284 video/out/x11_common: make IME work (for libmpv usage)
The implementation is minimal since it already uses XIM for UTF-8 text
input. The only changes needed are small fixes: setting the IC focus and
correct the usage of window param for XFilterEvent, and IME will
"just work"...

...after setting 2 process-wide global values before VO creation:
LC_CTYPE and X locale modifiers. So this usage is currently limited to
libmpv clients which don't want to do their own IME processing.

locale strikes once again:
XIM input methods require them to be set before creating the XIM context to
work, even though they don't matter after the context is created. Both of
these values being process-wide global means that the only time to safely
set these values is before the process creates any thread.

In theory, mpv could set LC_CTYPE in the main when running standalone,
but locale being locale means something is always messed up. In this case,
setting LC_CTYPE changes "Character classification and case conversion"
behavior. While mpv uses its own ASCII-only is*() and to*() functions to
avoid some of the issues, it also uses strcasecmp() and POSIX regex which
behaviors are affected by LC_CTYPE.

In summary, to avoid unavoidable race conditions mpv won't do this in
standalone mode right now.
It's now libmpv users' responsibility to:

- set LC_CTYPE to a locale usable for XIM, such as a UTF-8 locale
- set X locale modifiers with XSetLocaleModifiers
- hope that all stars align if trying to switch locale back afterwards

On most setups, both of these can be empty strings, In this case, the usual
XMODIFIERS environment variable must be set to enable IME support.
(e.g. XMODIFIERS=@im=fcitx)
2024-10-14 02:05:17 +02:00
Kacper Michajłow baabc291f1 build: fix dynamic generation of mpv.desktop file protocols
Running cross-compiled binaries may be possible, but the runtime
environment must be configured correctly. In some configurations, an
exe_wrapper needs to be used, and in all cases, the library path must be
set correctly for the given binary. Fortunately, Meson handles all of
this if cross-compilation is configured correctly.

Fix this by having Meson run the mpv binary directly, instead of as a
subprocess of a Python script. This ensures that the environment is
properly set for running host binaries, if possible.

Fixes: #15075
Fixes: 056b03f9ed
2024-10-14 01:56:25 +02:00
nanahi 86e8cae9ca stats.lua: add nonscalable prefix to cmd_prefixes 2024-10-14 01:55:49 +02:00
nanahi 72a705c598 console.lua: add nonscalable prefix to command_prefixes 2024-10-14 01:55:49 +02:00
nanahi da0160b0ee input/cmd: add nonscalable prefix
Some keys like WHEEL_UP are "scaled" if the input source is high
resolution, like touchpad. However, sometimes it's desirable to
disable this scaling and only active the key binding in discrete
steps, such as relative keyframe seeking which interacts poorly
if the command is scaled.

This adds the nonscalable prefix to disable this scaling.
2024-10-14 01:55:49 +02:00
Kacper Michajłow 228f38606b ci/build-linux-old: add missing Werror
Note that deprecated warnings are not disabled on this build, as the
idea is that on "old" one we shouldn't have any depracated warnings
anymore.
2024-10-13 00:46:58 +02:00
Guido Cella e34f6569ee stats.lua: rename a variable 2024-10-12 21:24:41 +02:00
Dudemanguy 63a81515ad stream_cdda: stop suppressing -Wscript-prototypes
This was fixed upstream* and in a new release, so it is no longer needed
for our CI.

*: https://github.com/rocky/libcdio-paranoia/commit/3ced3d72debae3cf304c81be820356c336fd31a2
2024-10-12 15:56:51 +00:00
Misaki Kasumi 6fadaf66c8 osdep: remove semaphore-mac
It is only used in one place in ao_coreaudio_utils.c,
and can be replaced by condvar.
Removing it can reduce the maintenance burden.
2024-10-12 17:26:39 +02:00
Julian Orth 1821c065b1 wayland: use wp-presentation v2 if available
Version 2 allows the compositor to send an appropriate refresh rate if
the output uses VRR. There are no changes to the API. Since mpv would
otherwise use a heuristic based on the last-seen output, it does not
matter to mpv if the output uses VRR.

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/320/diffs
2024-10-12 13:59:14 +00:00
Kacper Michajłow 3c57b395d3 hwdec_vaapi: try format upload lazily
Uploading all available formats has proven to be problematic because
more unusual ones can crash the driver, even when no upload is
necessary. Check the upload only if needed to avoid issues with broken
drivers.

This also might speedup the init process.

Fixes: #14956
Fixes: #15030
2024-10-12 01:36:44 +02:00
Kacper Michajłow 39d3591bb2 msg: strip control char also when not printing to terminal 2024-10-12 01:26:43 +02:00
Kacper Michajłow 65c81c3a39 vo_gpu_next: suppress tone_mapping_param deprecation warning
It is not going anywhere soon.

Fixes: #14696
2024-10-12 01:08:36 +02:00
Guido Cella ba3b4eda64 console.lua: use ${term-clip-cc} to clip lines
Instead of considering every non-ASCII character 2-cell wide, use this
newly introduced property to let msg.c clip the select menu using all
available with.
2024-10-11 15:31:17 +02:00
Kacper Michajłow bf025cd289 msg: allow to truncate the message to terminal width 2024-10-11 15:16:33 +02:00
Kacper Michajłow 95f0046309 misc/codepoint_width: add unicode width detection support
Add 4 stage trie to lookup unicode codepoint width and grapheme join
rules.

Generated by GraphemeTableGen from Microsoft Terminal (MIT Licence):
https://github.com/microsoft/terminal/blob/a7e47b711a2adc7b9e80eddea8168089f7d3b11e/src/tools/GraphemeTableGen/Program.cs

With minor adjustment to use it in C codebase.
- Replaced constexpr with static
- Replaced auto with explicit types

Generated from Unicode 16.0.0:
ucd.nounihan.grouped.xml: sha256(b11c2d23673bae660fff8ddcd3c1de4d54bdf6c60188a07696b010282f515fcf)
2024-10-11 15:06:14 +02:00
Kacper Michajłow fa77ad46cb win32: always fit to the screen on initial positioning
VO_WIN_FORCE_POS is set even if the position is not provided by the
user, so we have no choice but to always fit. We should do this
regardless, and if any issues occur in multi-monitor configurations,
they should be addressed separately.

Fixes: #15049
Fixes: e5159de811
2024-10-11 13:26:31 +02:00
Kacper Michajłow 3b95c00d96 ci/win32: add libjxl
For JPEG XL support.
2024-10-10 18:53:22 +02:00
norinoriko ee4402feca DOCS/man/options.rst: add gpu-next differences to --scale-antiring 2024-10-10 18:52:40 +02:00
Kacper Michajłow e5159de811 win32: center geometry, but only at start
I must have misunderstood the intent of the previous commit. Adjusted to
always center on window initialization.

Fixes: #15043
Fixes: e01eab4385
2024-10-10 18:50:08 +02:00
Kacper Michajłow ac7e9247b2 vulkan/context: make use of VK_EXT_shader_object only if available
VK_EXT_shader_object was added in 1.3.246, mpv currently requires
1.3.238. Debian stable is at 1.3.239.

Fixes build on Debian stable (Bookworm).

Fixes: #15041
Fixes: 2ac1d6db32
2024-10-10 18:37:22 +02:00
Crend King c8860fd816 ytdl_hook.lua: always specify --write-srt
Currently by default mpv sets --all-subs when calling yt-dlp for JSON
info. --all-subs is an option that simply expands to --sub-langs all
--write-subs. --write-subs is special that without it yt-dlp will no
longer extract any subtitle info.

mpv's yt-dlp hook has a logic that if user specify any sub-langs in
--ytdl-raw-options, it no longer uses --all-subs. Unfortunately, this
means unaware users will not get any subtitle any more until they study
the mpv internal code and add their own --write-subs.

This PR always specifies --write-srt, an alias of --write-subs, in the
hook, so users don't have to. The alias is used to maintain
compatibility with youtube-dl.

Fixes issue #14818
2024-10-10 18:28:41 +02:00
Kacper Michajłow 3df68c5807 options: mark sub-lavc-o as UPDATE_SUB_HARD
To properly update lavc options it may be required to reinit sub
decoder, so mark this option as UPDATE_SUB_HARD.
2024-10-10 16:24:09 +02:00
Dudemanguy 901b9bc888 player/sub: ensure subtitles are updated for images with no audio
The video_pts condition here would bail out on still images with no
audio since their pts is always MP_NOPTS_VALUE. This is not exactly
great because the subtitles may need to be updated so just let these
files also go through the subtitle redraw logic below.
2024-10-10 13:17:47 +00:00
Dudemanguy 5bf9cf5bf0 test: only run ffmpeg tests on release versions
The CI breaking because some new format was added in the master branch
is pretty annoying so only run these on release versions that are known
to work to reduce some maintenance burden. Although why we even bother
with this is still a valid question.
2024-10-10 13:17:29 +00:00
Kacper Michajłow e09278cfb9 win32: set consoleAllocationPolicy to detached in the manifest
This essentially obsoletes the console wrapper (mpv.com), which is no
longer needed. The console is attached depending on the context in which
mpv.exe is run.

Add an option to control which subsystem is targeted. Keep the GUI
application as the default to preserve compatibility with Windows
versions prior to 24H2.

For more information about the new console handling, see:
https://github.com/microsoft/terminal/blob/4386bf07fd65f763693132ee5e4c43a2a571dc76/doc/specs/%237335%20-%20Console%20Allocation%20Policy.md
2024-10-10 00:44:15 +02:00
Dudemanguy 48963aef4b vo_gpu_next: force a reset when --image-lut is updated
Bit of an edge case since image-lut requires the frames to be remapped
again so the normal redraw when paused doesn't work. Also we use
update_options in the VOCTRL here.
2024-10-09 13:39:06 +00:00
Kacper Michajłow 6da3a15ca8 win32: keep prev_windowrc consistent also for maximized state 2024-10-09 04:09:13 +02:00
Guido Cella 6ed3781a3d ytdl_hook.lua: add include script-opt of URLs to try with ytdl first
By the default mpv tries opening URLs with ffmpeg first, and users who
don't configure try_ytdl_first get a slower startup for youtube URLs, on
top of yt-dlp already being slow.

Fix this by adding a script-opt of URL pattern to try with ytdl first.
Youtube and twitch are included by default.

Compared to the alternative of trying ytdl first by default and
excluding URLs with a media extension, this only works for the sites
explicitly included in the new option's value, but doesn't have false
positives on media URLs without an extension.
2024-10-09 01:08:31 +02:00
Guido Cella 92403a068c ytdl_hook.lua: lower case URLs for exclude matching 2024-10-09 01:08:31 +02:00
Mohammad AlSaleh 28a4e19a67 command: avoid division by zero in av_timecode_make_string()
`av_timecode_make_string()` divides by fps unconditionally. And
 relying on container_fps always carrying a meaningful value was
 misguided. So we now check that fps is non-zero before calling that
 function.

 Issue encountered with a couple of old FLV files triggering a segfault.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2024-10-09 00:36:35 +02:00
Lynne 2ac1d6db32 vulkan/context: use VK_EXT_shader_object if available
FFmpeg has patches which add support for it.
2024-10-08 11:48:22 -07:00
Guido Cella 8bf5548589 console.lua: allow clicking selectable items
This adds click support for the select menu. Scrolling with the wheel
already worked.

If a custom OSC binds a button to a select.lua script-binding, this lets
users keep using the mouse to select an item.

While the OSC and the select menu are open at the same time, you can no
longer click the OSC's buttons. By using mp.add_key_binding instead of
add_forced_key_binding you could click both, but the console's binding
would be shadowed by MBTN_LEFT bindings in input.conf.
2024-10-08 20:37:56 +02:00
llyyr 6871304029 wayland: replace old keymap if we receive a new keymap event
Fixes: 2274311b25
Fixes: #15022
2024-10-08 20:06:41 +02:00
Kacper Michajłow c201c4874d demux_playlist: ensure the file is added to autocreated playlist
Even if it doesn't match extensions in filter mode.
2024-10-08 19:57:16 +02:00
Kacper Michajłow 946b29d4f4 ci/macos: shift macOS versions to 13-15
Homebrew does support 3 latest macOS versions, so while macOS 12 still
works it takes 1h 40m 7s to build. It is bit too much...

While we drop macOS 12, add macOS 15 as it is available now.
2024-10-08 18:35:44 +02:00
Kacper Michajłow fb9ac9b570 win32: don't change window size on video reconfig when maximized
Fixes: #7265
2024-10-07 09:41:40 +02:00
Kacper Michajłow 6667b9723e win32: fix window size restore after maximize state
This remembers and sets window-scale when exiting maximized state. Also
fixes not staying in maximized state when exiting fullscreen mode.

Fixes: #14126
2024-10-07 00:45:11 +02:00
Nathan Ruiz 62abcbdd88 ci/lint: fix missing return value in lint-commit-msg 2024-10-06 22:15:08 +02:00
Nathan Ruiz 44a296be97 ci/lint: add flake8-commas check 2024-10-06 22:15:08 +02:00
Nathan Ruiz c6903f9963 ci/lint: add isort checks 2024-10-06 22:15:08 +02:00
Nathan Ruiz 416035a174 ci/lint: check for pep8 naming convention 2024-10-06 22:15:08 +02:00
Nathan Ruiz 1562895af7 ci/lint: add pyupgrade check 2024-10-06 22:15:08 +02:00
Nathan Ruiz 8a82882d5e ci/lint: ensure double quotes are used in python 2024-10-06 22:15:08 +02:00
Nathan Ruiz e5a383a525 ci/lint: enable pyflakes and pycodestyle checks
This change required some minor rework to make the code conform to the
following:
- Restrict line length to 88 character
- Use spaces rather than tabs (only affect ci/lint-commit-msg.py)
- Use f-strings rather than % formatting or `str.format()`
2024-10-06 22:15:08 +02:00
Nathan Ruiz bee3598ba6 ci/lint: add python linting
Enabled the ruff python linter in CI, and resolved the issues that were
detected by it. Ruff was used due to it's faster checking compared with
other linters like pylint. This was added to resolve the python linting
request in #13608.
2024-10-06 22:15:08 +02:00
nanahi f46975c2d2 mp_image: restore dovi metadata before converting to AVFrame
They should be passed as side data instead.
2024-10-06 22:01:37 +02:00
nanahi e2365bfece vf_format: set original params when converting format
Otherwise it will restore to a format before vf_format conversion when
restoring params. Only do this when the out format isn't dolbyvision.
2024-10-06 22:01:37 +02:00
nanahi e35a559ce1 mp_image: only restore params when image is dolbyvision
Should be no need to do so otherwise.
2024-10-06 22:01:37 +02:00
nanahi 9b571a7aa7 mp_image: copy params before dovi mapping for mp_image_copy_attributes
It currently doesn't copy original params before mapping, resulting in
wrong colors when some video filters are used, e.g. d3d11vpp=scale.
2024-10-06 22:01:37 +02:00
der richter 7bd612ee66 mac: remove unnecessary window size change check
this is already done in the updateSize method of the window.

also fixes an issue where the size wasn't properly changed, even though
the new and old size were different. the unfsContentFrame should have
been checked instead of the pixel representation of the same frame.
2024-10-06 21:53:08 +02:00
der richter c5324cc483 DOCS/input: clarify display-names naming on macOS
this was meant to refer to round brackets and not square brackets.
2024-10-06 21:53:08 +02:00
der richter 94d034ed99 mac/swift: fix typo in mpv_event_id string representation
this didn't break anything but might be confusing in log outputs.
2024-10-06 21:53:08 +02:00
der richter 20b7f96ab3 meson: error out when swift unavailable or disabled and cplayer enabled
without swift mpv as a standalone app is unusable on macOS, since the
cocoa main main loop doesn't exists. furthermore most of the other
needed functionalities like video outputs, contexts, platform features,
etc are also missing.

without swift mpv is really only usable as libmpv.
2024-10-06 21:52:35 +02:00
der richter 2fb8b00ac9 mac/app: fix building with swift disabled
Fixes #14931
2024-10-06 21:52:35 +02:00
Kacper Michajłow f7a895e7c1 docs: remove stray newlines 2024-10-06 21:51:59 +02:00
Kacper Michajłow 1b08e8b08e ci/{openbsd,win32}: bump FFmpeg to 7.1 2024-10-06 21:51:12 +02:00
Kacper Michajłow 9d55c5bcaf ci/msys2: removed unused clang32 reference 2024-10-06 21:50:59 +02:00
Kacper Michajłow 28bc58a3e8 Revert "ci/msys2: disable some features for 32-bit build"
No longer needed after 232919336d.

This reverts commit 883a45fa3e.
2024-10-06 21:50:59 +02:00
Kacper Michajłow 51c613bbcd README.md: reference nasm instead of yasm
yasm is no longer supported by FFmpeg.

See: https://github.com/FFmpeg/FFmpeg/commit/2f888fb99eef07a259879273bc9999c5e86620ca
2024-10-06 18:24:48 +02:00
Kacper Michajłow 3e74b1176e d3d11_helpers: remove leftover variables 2024-10-06 18:24:33 +02:00
Dudemanguy 232919336d github/workflows: drop clang32
It's being dropped upstream* and recently lua51 was removed along with
luajit*. mingw32 already covers 32-bit support, and it's not like we're
in dire need of this so just remove it.

*: https://github.com/msys2/msys2.github.io/commit/89521b9f8d43b6ebf4a4f4a51c912066ab5f5b50
*: https://github.com/msys2/MINGW-packages/commit/947a8592ca9b7d4af6d6520d3083f6118a390036
2024-10-06 16:04:55 +00:00
der richter 9791c6d178 mac/common: don't unconditionally move the window on geometry changes 2024-10-05 18:40:11 +00:00
Dudemanguy 2fa87117e0 x11: don't unconditionally move the window on geometry changes
With the pieces set in place with the previous changes, we can implement
the desired behavior. The trick here is that we do want to force
centering the window when mpv first initially starts and the window size
is not known yet. This can be done by simply checking
x11->pseudo_mapped. The other change is to just look if we have the
VO_WIN_FORCE_POS flag and feed that to highlevel resize.
2024-10-05 18:40:11 +00:00
Dudemanguy e01eab4385 win_state: move window centering to vo_calc_window_geometry
c4e8c36071 made any usage of --geometry
implicitly center the window on the screen after a resize even if the
user did not pass any x/y arguments to the option. At the time, this was
probably wanted since --geometry was primarily a startup option and
likely the window wouldn't be centered on x11 without moving
coordinates. Times have changed since then and we support full runtime
--geometry changes on all the relevant platforms but it comes with this
automatic window centering behavior (except on wayland of course hah).

It's better to make such window centering optional and user controllable
since it is entirely reasonable that someone wants --geometry=50% to
just resize and not move anything. It's already trivial for a person
that does want to move the window to just add their coordinates to the
--geometry command so there's no reason to continue to force this
behavior since it is less flexible.

Instead, move the window centering stuff out of m_geometry_apply into
vo_calc_window_geometry. We give the power to the caller to whether or
not to force centering the window here and all usage of the function is
updated to simply call it with false for now. Additionally,
--force-window-position being set will also center the window like
before. All that is left is for the windowing code to take advantage of
this. See subsequent commits.
2024-10-05 18:40:11 +00:00
Dudemanguy 8b30a2386f win_state: remove redundant vo_calc_window_geometry functions
There's really no reason to have all these extra variants. It's not like
this is public API. Collapse it all into one vo_calc_window_geometry
function and callers can simply just pass the appropriate parameters to
get the same behavior as before. I'm about to edit this function again
in a future commit and I really don't want to make a
vo_calc_window_geometry4 for this so let's clean it up.
2024-10-05 18:40:11 +00:00
Guido Cella 493cab7efc stats.lua: allow keybindings to toggle the display of a specific page
This lets you define bindings like h script-binding
stats/display-page-4-toggle. Requested in #14966.
2024-10-04 21:13:29 +03:00
Guido Cella be814e3753 stats.lua: scroll keybindings while filtering them
console.lua binds up and down to navigate its history. Add a private
flag to mp.input.get to instruct console.lua not to bind up and down, so
you can use them to scroll the keybindings page while filtering
keybindings.

If it is requested, this can be replaced with an argument to input.get
to not bind arbitrary keys.

Fixes #14966.
2024-10-04 21:13:29 +03:00
Guido Cella b3f8464fa9 input.lua,defaults.js: don't hardcode mp.input arguments
Pass everything in the tables passed by mp.input callers to console.lua
so new flags can be added without modifying these clients.

In Lua, callbacks have to be excluded from the argument tables to not
make utils.format_json() error, while with JSON.stringify they are
automatically omitted.
2024-10-04 21:13:29 +03:00
Guido Cella dcd681ecdd stats.lua: filter keybindings by comment
Requested in #14966.
2024-10-04 21:13:29 +03:00
Kacper Michajłow a6c363e8da f_hwtransfer: fix too aggressive preference to use direct upload format
Well, this was thinko on last minute code simplification I made. We need
to check both input and output formats.
2024-10-04 05:10:36 +02:00
Kacper Michajłow 216abbc121 bstr: add missing function docs 2024-10-04 00:45:30 +02:00
Kacper Michajłow 3fd6c31e1f f_hwtransfer: fix upload formats selection
There was mixup between upload formats and device formats. Instead of
filtering the device formats with VO constraints, upload formats were
affected. It was working, because most of the time the upload is using
the same formats. But if there is conversion on the fly needed we were
filtering wrong list of formats. Upload formats are those that can be
used to upload to the given hardware frame, conversion during upload are
allowed if possible. The main fix is in select_format() which were using
device formats as input, instead of ouptut formats and upload formats as
output, instead of input.
2024-10-04 00:10:05 +02:00
Kacper Michajłow 822daeb89f f_hwtransfer: ensure that we convert to full range rgb with scale_vaapi
Limited range rgb is evil and not supported by FFmpeg, this ensures
parity of hardware conversion with software conversion.
2024-10-04 00:06:58 +02:00
Dudemanguy 0d7b4d64a5 wayland: support multiple devices and tranches when querying formats
The multi device part is mostly theoretical, but it turns out that
plasma does send multiple tranches to the same device so we have to take
that into account. And that means taking into account multiple devices
as well. In theory, a compositor should give us tranches for any device
that will work so as long as we find a match it should be OK. This is
still technically incomplete since mpv's core wouldn't react to a device
being hotplugged.
2024-10-02 21:27:01 +00:00
Bergmann Atmet 7ca5fd2ad2 ci/mingw: pass --enable-gpl to ffmpeg's configure
A bunch of lavfi filters were presumably not available in mingw builds
because of this.

```
% grep -E '=(".+ |")gpl("| .+")$' configure
blackframe_filter_deps="gpl"
boxblur_filter_deps="gpl"
boxblur_opencl_filter_deps="opencl gpl"
colormatrix_filter_deps="gpl"
cover_rect_filter_deps="avcodec avformat gpl"
cropdetect_filter_deps="gpl"
delogo_filter_deps="gpl"
eq_filter_deps="gpl"
find_rect_filter_deps="avcodec avformat gpl"
fspp_filter_deps="gpl"
histeq_filter_deps="gpl"
hqdn3d_filter_deps="gpl"
interlace_filter_deps="gpl"
kerndeint_filter_deps="gpl"
mcdeint_filter_deps="avcodec gpl"
mpdecimate_filter_deps="gpl"
mptestsrc_filter_deps="gpl"
nnedi_filter_deps="gpl"
owdenoise_filter_deps="gpl"
perspective_filter_deps="gpl"
phase_filter_deps="gpl"
pp7_filter_deps="gpl"
pp_filter_deps="gpl postproc"
pullup_filter_deps="gpl"
repeatfields_filter_deps="gpl"
sab_filter_deps="gpl swscale"
signature_filter_deps="gpl avcodec avformat"
smartblur_filter_deps="gpl swscale"
spp_filter_deps="gpl avcodec"
stereo3d_filter_deps="gpl"
super2xsai_filter_deps="gpl"
tinterlace_filter_deps="gpl"
uspp_filter_deps="gpl avcodec"
vaguedenoiser_filter_deps="gpl"
postproc_deps="avutil gpl"
```

 Also include built postproc in dlls.

Signed-off-by: Bergmann Atmet <BergmannAtmet@github>
2024-10-02 15:10:55 +02:00
Dudemanguy f1865f312c vo_{dmabuf_wayland,wlshm}: use proper values with MP_ALIGN_{UP,DOWN}
Both of these VOs draw buffers in software via wl_shm to an mp_image, so
they are affected by the internals of whatever mpv does for alignment.
When wlshm was originally written, mp_sws was aligning to 16 bytes and
thus it chose this value but it was hardcoded. vo_dmabuf_wayland later
blindly copied this value. e1157cb6e8
actually changed the internal value to 64 bytes. In theory, this doesn't
probably doesn't really matter since 16 should also work in most cases,
but we might as well stop using a magic number and be consistent.

Additionally, wl_shm did some funny alignments that no other software
output did. The reasoning was apparently due to warning messages from
ffmpeg while cropping*. This was left in at the time, but I'm not able
to reproduce any such warning messages on my end when I make this match
other software VOs. Go ahead and remove the MP_MAX business and align to
the fmt x/y like the other VOs do.

*: https://github.com/mpv-player/mpv/pull/6240#discussion_r227930233
2024-10-02 02:32:49 +00:00
Kacper Michajłow 171c91623d ci/mingw: update fribidi to 1.0.16 2024-10-01 21:30:29 +02:00
Kacper Michajłow 816c17d363 ci/mingw: update harfbuzz to 10.0.1 2024-10-01 21:30:29 +02:00
Kacper Michajłow 9440ab9b88 ci/mingw: update freetype to 2.13.3
And change the mirror to working one.
2024-10-01 20:51:18 +02:00
Kacper Michajłow 7202406fe8 various: remove global.h inclusion where not needed 2024-10-01 12:23:44 +02:00
sfan5 c11239be8c options: enable handling --no-hwdec as --hwdec=no
Reusing M_OPT_ALLOW_NO has the side-effect of applying to --ab-loop-[ab],
which makes sense.
2024-09-30 11:26:13 +02:00
Guido Cella ce0452fa0d zsh-completion: fix completing --screenshot-avif-opts-*
The list options --screenshot-avif-opts and --vo-image-opts are
completed with an extra 8), e.g. --screenshot-avif-opts-add=8), because
*= in
screenshot-avif-opts=-:Key/value list (default\: usage=allintra,crf=0,cpu-used=8):
matches up to cpu-used= instead of instead of up to
screenshot-avif-opts=.

Fix this by enabling non-greedy matching.
2024-09-30 11:26:00 +02:00
Dudemanguy 344ce9200d ra_wldambuf: don't unconditionally filter out non-planar formats
4d09cde8f9 added this behavior and made
the format filtering more aggressive, but it's over correcting. The
misunderstanding on my part is that the problem was with modifiers not
with formats. There is hardware that do not have any valid modifiers
which means certain formats cannot possibly work correctly with
vo_dmabuf_wayland (broken colors etc.). Formats on the primary plane do
not require modifiers so if it happens to be a planar format, we can
accept it and possibly use mpv's autoconverter. If we do get a valid
format + modifier pair from the compositor, then we should always accept
it regardless if it is planar or not.
2024-09-30 03:12:59 +00:00
Dudemanguy 99d4dec38f wayland: rename gpu_formats to planar_formats
The old name is misleading. We do want these formats, but it is not
accurate to call them "gpu formats". Call it "planar" instead so it's
more obvious these come from drm primary planes.
2024-09-30 03:12:59 +00:00
Dudemanguy c5aa7d83ac wayland_common: fix some stray tabs
quite unfortunate
2024-09-30 03:12:59 +00:00
Kacper Michajłow 6ca3752f75 vf_d3d11vpp: add NVIDIA RTX Video HDR support
Fixes: #13352
2024-09-30 02:51:21 +02:00
nanahi ffb40ab958 video/decode/vd_lavc: fix null deref when hwdec is empty
This can happen when using --hwdec-clr.

Fixes: 9ff8c9e780
2024-09-29 22:56:40 +02:00
nanahi 151fa74806 player/external_files: fix null deref when cover-art-whitelist is empty
This can happen when using --cover-art-whitelist-clr.

Fixes: d384a6b793
2024-09-29 22:56:40 +02:00
Kacper Michajłow 4c19df1ded msg: print format string on format errors 2024-09-29 16:06:25 +02:00
Kacper Michajłow 96006fa97b bstr: don't abort on format error in bstr_xappend_vasprintf
Most of the time it is recoverable error, and it makes no sense to
abort here.
2024-09-29 16:06:25 +02:00
Kacper Michajłow 2c2755992d bstr: use vsnprintf with a proper size of 0 instead of a 1-sized buffer
There is no need for that, use of 0 size is well defined.
2024-09-29 16:06:25 +02:00
Misaki Kasumi c3d9243a3e ao_coreaudio: fix nan in ca_get_device_latency_ns 2024-09-28 14:15:55 +02:00
Andreas Klauer c365e2f7b1 misc/random: seed using libavutil/random_seed
When starting multiple processes of `mpv --shuffle` in parallel,
sometimes the random seed happens to be identical, so files are
played in the same random order.

mp_rand_seed(0) now uses a random seed provided by libavutil,
and only falls back to time in case of failure.
2024-09-28 14:11:56 +02:00
nanahi 53f2619dbd options: force --ab-loop-count and --loop-file notification
Since f411f3145b, these properties
no longer change with each loop. This however caused a regression
on the behavior of resetting loop count by resetting these
properties.

Previously, after the loop count is decreased, it is possible to
reset these properties back their original values and thus reset
the remaining loop count. Currently, because setting properties
has no effect if the new value is the same as the existing value
(which no longer changes), resetting these properties does nothing,
and remaining-*-loops (which are read-only) remain unchanged.
There is no way to reset them other than temporarily setting them
to a different value, which is awkward.

Fortunately, this can be fixed by marking these properties as
force_update, which always notifies changes when being set.
2024-09-26 22:48:52 +02:00
Guido Cella 69ced646f8 lua: remove unused #define mp_lua_len
This is unused since 548ef07864 and 7f91e2684e.
2024-09-26 16:45:08 +02:00
Dudemanguy d54e8c3f40 demux_mkv: drop image probing down to 10000 blocks
It turns out that probing too many blocks is bad. I did not attempt to
go through all the logic but reading that many blocks causes the
demux_reader_state have some pretty funny values which then makes the
playloop think it needs to buffer for cache. It's probably fixable...
but seems hard admittedly so I'll be lazy. Just take out a magnitude off
the probing down to 10000. These seems to be more than sufficient. The
sample in #13975 where we had the opposite issue only needs somewhere
between 1700 and 1750 blocks to be properly detected. Crudely looking
at the demuxer values, 10000 here doesn't appear to alter anything
meaningfully so it does not have the "too many blocks problem".
Hopefully this is a perfect medium? Further improvements to the probe
can always be added later. Or maybe we decide this is all a giant
mistake and delete it. Fixes #14924.
2024-09-26 02:55:35 +00:00
Kacper Michajłow c9f3fa33a6 demux_mkv: add missing color repr init
Fixes: 66e451f4e6
2024-09-25 19:35:21 +02:00
Dudemanguy 92e97d239e meson: replace vector code compile check with function attribute check
Makes it a nice one liner.
2024-09-24 22:16:59 +00:00
Dudemanguy b52a67dde2 meson: bump required version to 1.3.0
Newer meson versions added support for features that mpv has been using
for a long time. Annoying fallbacks were left in place to not break old
versions but ideally everyone should be using the newer build features.
Both the latest ubuntu LTS and debian stable (in backports) have 1.5.0
in their repos, so go ahead and bump the version so we can drop some old
code and let developers use newer meson features if applicable.
2024-09-24 22:16:59 +00:00
Kacper Michajłow 1c55d600ab stats.lua: add timecode display 2024-09-24 19:47:42 +02:00
llyyrandKacper Michajłow d33bcc51a7 command: add video-frame-info/{gop,smpte,estimated-smpte}-timecode
Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2024-09-24 19:47:42 +02:00
nanahi 3863221246 input: skip BOM properly
Key names are already required be UTF-8 like everything else
in mpv other than media file formats which support other encodings.
stream_skip_bom is the wrong function for this, since it also skips
UTF-16 BOM.
2024-09-24 19:22:47 +02:00
nanahi b08cab7a6c DOCS/man/mpv.rst: clarify configuration files should be UTF-8
mpv only supports UTF-8 for configuration files. Other ASCII-compatible
encodings may "work" to some limited extent, but strings likely won't
as many places assume that all internal strings are UTF-8.
2024-09-24 19:22:47 +02:00
Kacper Michajłow 2a1485772b console.lua: clear terminal msg after changing to OSD display 2024-09-24 19:21:00 +02:00
Kacper Michajłow 2c5928e518 vf_d3d11vpp: remove unnecessary compatibility defines 2024-09-24 00:21:19 +02:00
Kacper Michajłow d650b3a5a3 d3d11_helpers: remove not needed compatibility define 2024-09-24 00:21:19 +02:00
Kacper Michajłow e7e759cdfd opengl/context_dxinterop: remove unnecessary compatibility defines
No longer needed after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
Kacper Michajłow a73c73255b osdep/timer-win32: remove unnecessary compatibility defines
No longer needed after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
Kacper Michajłow 01383c606c osdep/terminal-win: remove unnecessary compatibility defines
No longer neeeded after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
Kacper Michajłow 4ad3db855a osdep/main-fn-win: remove unnecessary compatibility defines
No longer needed after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
Kacper Michajłow 7746942a55 win32: remove pathcch compatibility code
No longer needed after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
Kacper Michajłow 1a3e3a0c98 w32_common: remove backward compatibility code
No longer needed after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
Kacper Michajłow c6a8b6852c win32: remove dxgi debug checks
No longer needed after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
llyyr e538c7f413 player/main: guard smtc.h include 2024-09-23 22:13:51 +02:00
Dudemanguy 2bd1e78701 build: ensure HAVE_WIN32_SMTC is always defined
It makes sense to only descend into the subdirectory meson build file on
windows, but we should always make sure HAVE_WIN32_SMTC is 0 for other
platforms. Otherwise, it gets unneccesarily awkward to work with.
2024-09-23 22:13:51 +02:00
sfan5 b64c53f730 ci/lint-commit-msg: make some minor adjustments to the rules 2024-09-23 19:49:43 +02:00
sfan5 0e6d050c3b Update MPV_VERSION 2024-09-23 19:37:35 +02:00
sfan5 a0fba7be57 Release 0.39.0 2024-09-23 19:36:41 +02:00
sfan5 5e9e756f53 TOOLS/gen-interface-changes: small usability improvement 2024-09-23 19:20:05 +02:00
Kacper Michajłow 883a45fa3e ci/msys2: disable some features for 32-bit build
See: https://github.com/msys2/MINGW-packages/commit/1e7737f090e651059d5127d92ab117aa7654fd3e
2024-09-23 12:48:10 +02:00
Guido Cella 68ea9fecda console.lua: fix the height calculation with --video-osd=no 2024-09-22 17:31:54 +02:00
Kacper Michajłow 71f2220991 meson: use relative file paths for file2string
This fixes "Generated from" comments to not include local source path in
generated files.
2024-09-21 23:39:10 +02:00
Maxim Biro ff47926d6a ytdl_hook: make path and json available to other scripts
It's useful for user scripts to be able to use the same ytdl binary that
ytdl_hook uses without having to replicate ytdl_hook's process of
searching for the ytdl binary.

Some user scripts might also find it useful to be able to access ytdl's
json output that the ytdl_hook already receives, sparing user scripts
from having to make a duplicate ytdl binary invocation to get the json
output.

Providing just the json output is not enough though, as ytdl doesn't communicate
errors though it -- if an error occurs, ytdl provides no json output and instead
prints to stderr. So without stderr, there is no way for user scripts to figure
out why ytdl has failed: no such username / video id, the channel is not live
yet, etc. Because of that, the entire result of the subprocess call is provided
to the user scripts, containing stdout (json), stderr, ytdl's exit code, etc.
2024-09-21 17:53:01 +02:00
Guido Cella e3eeaec813 select.lua: don't use add_forced_key_binding
There's no advantage in using the forced version here. It is a leftover
from when this was an external script and forced was necessary to bind
key sequences reliably until 3f83671f20.
2024-09-19 13:57:39 +00:00
llyyr 140196f297 ytdl_hook: fix typo (chapters -> chapter)
Fixes: ec966fb866
2024-09-19 13:55:58 +00:00
Oneric 7431896cd1 DOCS/man/options.rst: further tweak sub-ass-use-video-data description 2024-09-19 13:55:50 +00:00
Guido Cella 284293ceb5 TOOLS/cycle-deinterlace-pullup.lua: fix removing the filter
This has been broken since b56e63e2a9 removed vf del. Replace it with vf
remove. Fixes #14881.
2024-09-19 13:38:16 +00:00
Dudemanguy 21a0fa7abe options: fix missing comma in default watch_later_options values
Missed in 207b1a2c91.

Fixes https://github.com/mpv-player/mpv/pull/14731#issuecomment-2358718766
2024-09-18 10:40:42 -05:00
llyyr 22620af459 workflows/comment: fix workflow syntax
Github doesn't evaluate expressions unless they're inside ${{ }}

See: https://github.com/mpv-player/mpv/actions?query=is%3Afailure+event%3Aworkflow_run
2024-09-17 18:52:35 +02:00
nanahi cae3aee23b Revert "mp_image: don't restore image params if they're unknown"
This results in all image params not being restored even if only one is
unknown. In particular params->color.hdr isn't cleared, causing
overblown color for some samples.

It should be safe to restore even unknown values.
mp_image_params_guess_csp will handle that.

This reverts commit 3acd253e89.
2024-09-16 10:34:14 +02:00
Dudemanguy c0c57be07b f_hwtransfer: filter out unsupported hwuploads from p->fmts
With the previous change, it is possible that the mp_hwdec_ctx contains
a list of known supported hwuploads. Take this into account when adding
to the p->fmts list. We want to be sure to select only something that is
actually possible to use. If the hwdec does not implement
supported_hwupload_formats, then all are assumed to work.
2024-09-16 00:07:36 +00:00
Dudemanguy 6797f54378 hwdec/vaapi: additionally probe hwupload format conversions
This is probably fringe, but I encountered it on my machine. The
hwupload filter happily does conversions all on the GPU side if
possible. Makes sense. However, it turns out that there is a difference
between e.g.yuv420p -> vaapi[bgr0] and a vaapi[yuv420p] -> vaapi[bgr0].
The latter worked without any issues on my hardware, but the first
example fails. To remedy this, we need to also do hardware uploads
during probing against formats and track what actually works (i.e.
vaSurfaceExportHandle). This commit only implements it in vaapi since it
is the only known place where this edge case is relevant. But other
hardware decoding drivers could easily add support later if needed.
2024-09-16 00:07:36 +00:00
Dudemanguy 7a80330be3 wayland: properly use tranche_formats when getting compositor formats
It's a bit roundabout, but we were doing this incorrectly before. The
format table alone isn't good enough because it is possible the the
compositor may advertise different formats for a specific device which
is a subset of the format table. What we need to do is add formats based
on the array in tranche_formats. Note that it is possible for the
compositor to send multiple tranches (was not able to simulate this but
it's allowed by the protocol). For mpv, we only care about the very
first one which is supposed to be the most preferred one. The compositor
can also send the entire chain of events (main device, format_table,
tranches, etc.) all over again. We handle this in the wayland code, but
handling this in mpv's core code isn't done. e.g. say a format in use
was suddenly no longer supported. We ideally should do a full reconfig
in this case, but that gets complicated and is pretty niche so save that
for another day. Multiple GPUs isn't taken into account either. We just
pick the first one. Not strictly correct, but close enough for us.
Fixes #14544.
2024-09-16 00:07:36 +00:00
Dudemanguy 4d09cde8f9 vo_dmabuf_wayland: reject formats not supported by the GPU
The linux-dmabuf protocol gives us the main device being used. Using
that along with some drm code, we can get what drm formats are supported
by the GPU. This is pretty crude as we just check against the first
primary plane we find and hope for the best. Also the protocol can
technically update formats at any time (e.g. if the device changes). We
do update what gets stored in  wl->gpu_formats but the next commit won't
make any attempt to address this hypothetical scenario. It's complicated
and this is better than nothing. In practice, this will only work
against one constant device during VO runtime. Additionally, we can add
this check to ra_compatible_format to filter out additional unsupported
formats.
2024-09-16 00:07:36 +00:00
Dudemanguy 7d4abdbd45 wayland: rename wayland_format to compositor_format
Cosmetic. This is to better indicate that these formats come from the
compositor.
2024-09-16 00:07:36 +00:00
llyyr d02f03bc2b sub/sd_ass: don't override event attributes to mpv defaults
ASS_OVERRIDE_BIT_STYLE includes ASS_OVERRIDE_BIT_ATTRIBUTES, which we
don't want.

This prevents --sub-ass-override=force from overriding attributes such
as bold, italics, underline or strikeout to mpv defaults.
2024-09-15 20:10:51 +02:00
llyyr c7dce6a838 TOOLS/gen-mpv-desktop.py: set --no-config when probing protocols
Apparently for an user mpv would crash on startup if built with asan and
mpv attemps to load mpv-mpris. Just set --no-config so we don't load
anything external since this is more correct anyway.
2024-09-15 20:10:29 +02:00
Kacper Michajłow e41ee0524c f_auto_filters: don't set interlaced-only for userdeint
Not wanted apparently: https://github.com/mpv-player/mpv/pull/14822#discussion_r1758134111
2024-09-15 20:10:09 +02:00
Kacper Michajłow 6133033e33 DOCS/man/options.rst: fix nono typo
Fixes: f1f091759a
2024-09-15 19:20:23 +02:00
llyyr 22a7a0af8a vo_gpu_next: allow setting antiring value for cscale
This has been possible since https://github.com/haasn/libplacebo/commit/11771cdd82cec0d2f775553611c276092fb283cf
but nobody bothered to map it to mpv until now?
2024-09-15 18:54:23 +02:00
nanahi f1f091759a DOCS/man/options.rst: clarify sub-ass-use-video-data a bit 2024-09-15 18:46:44 +02:00
nanahi d245e9dc8c DOCS/interface-changes: fix format for sub-ass-use-video-data 2024-09-15 18:46:44 +02:00
Guido Cella 030c283ef5 console.lua: respect --video-osd=no 2024-09-15 18:27:24 +02:00
Guido Cella 8592206c75 console.lua: truncate more characters with --msg-module and --msg-time
Fix the terminal width calculation for the select menu with these
options.
2024-09-15 18:27:24 +02:00
Guido Cella b98d4fde0d console.lua: fix highlighting the selected item with --msg-module
With --msg-module the select menu also highlights the "statusline" on
the next line. Fix this by resetting the color before \n instead of
after it.

This requires changing all log code to not preemptively add a newline,
which is actually simpler, though we have to modify the messages
received with log-message which already contain a newline.
2024-09-15 18:27:24 +02:00
nanahi b440821d18 osdep/terminal-win: reset tmp_buffers_key when uninit
To prevent potential undefined results when using a freed value.
2024-09-15 17:03:33 +02:00
nanahi 42b40d03f1 player/main: revert msg uninit order changes
msg must be the last module to uninit since pretty much
everything else uses logging.

This reverts commit f92d5da89c.
This reverts commit c1282d4d43.
2024-09-15 17:03:33 +02:00
Philip Langdale 429e379c7f DOCS/man/options.rst: update description of hwdec=auto behaviour
When I introduced the behaviour of `auto` trying every hwdec down the list
instead of giving up after the first one fails, I forgot to update this
part of the docs.
2024-09-14 19:35:31 -07:00
Kacper Michajłow ef19a4a09d sub/osd: add log if osd rendering takes too long time
Ideally it should be fast, it is on VO thread and steals precious frame
time budget. Looks like this is one of the main reasons why
display-resample on higher refresh rate displays is too slow.
2024-09-14 20:23:22 +02:00
Kacper Michajłow 0e43eea5bb meson: require Vulkan loader/headers >= 1.3.238
Even Debian stable has them, so no need to keep compatible with ancient
versions.

Note that this does not change runtime version requirement for Vulkan.

Fixes: https://github.com/mpv-player/mpv-build/issues/234
2024-09-14 17:20:16 +02:00
Kacper Michajłow 2aab3fc381 vd_lavc: add Vulkan hardware decoding to autoprobe
On platforms where it is unstable/experimental, it is disabled behind
environmental variable, so safe to probe it there too.

Fixes usage of hwdec=yes with gpu-api=vulkan, where hwdec would be not
enabled. Position it after older and more stable variants. That means
the -copy variant of the other API will likely be prefered.
2024-09-14 17:20:16 +02:00
Kacper Michajłow a6e13f41eb console.lua: sync colors after msg.c change
Keep ASS pallete the same, as it doesn't print trace messages anyway.
Remove only bold and keep debug gray.
2024-09-14 17:11:07 +02:00
Kacper Michajłow 4de6390d25 msg: don't use bold colors and instead use bright ones
Also avoid regular white/black, because it is often the terminal
background and invisible as foreground color.

Change debug messages to blue while at it to differentiate them from
trace ones.
2024-09-14 17:11:07 +02:00
Guido Cella 7362f72fdf console.lua: fix completing empty --dscale and --cscale
These options accept an empty value within their choices. If the user
didn't add manually input a quote before completing them, add quotes
automatically so that the blank value can actually be used.
2024-09-14 17:06:07 +02:00
Guido Cella dd77d0a7da vo_gpu{,_next}: convert scale options to type choice
This allows Tab completing them in the console and zsh, and using cycle
scale.

jinc is also added to --tscale=help's output, while before it was
missing because validate_scaler_opt() skipped filter windows with the
same name as a filter kernel, but the jinc kernel was skipped with
--tscale because it is polar.
2024-09-14 17:06:07 +02:00
llyyr d84a7c5112 stream: don't mark stdin as a filesystem file
Also rename the field to appropriately reflect what it is supposed to be
used for. The only other use of this was to search for ordered chapter
sources, and that makes no sense for mkv files from stdin.

This also fixes autocreate-playlist loading in the current directory
when the input file is stdin.
2024-09-14 16:17:44 +02:00
llyyr d2f3b66439 vulkan: don't tolerate suboptimal swapchain configurations
The comment was probably only ever true for x11, and it currently isn't
true anymore. X11 WSI used to return VK_SUBOPTIMAL_KHR in
vkQueuePresentKHR and vkAcquireNextImageKHR before, but as of
https://gitlab.freedesktop.org/mesa/mesa/-/commit/2b885b233f7a6300ae88732c179888c02788493d
it only returns VK_SUBOPTIMAL_KHR in vkAcquireNextImageKHR for
performance reasons. This makes it so that we don't have to tolerate
suboptimal swapchain configurations for the sake of smoother resizing.

On top of that, not recreating swapchain when it was suboptimal, it
also prevented mpv from being directly scanned out when fullscreened on
Wayland compositors. On Wayland, the preferred modifier from the wsi
may change depending on whether the window is fullscreened or not for
direct scan out. If mpv is fullscreened but not using modifiers that
can be directly scanned out, mpv will be receive VK_SUBOPTIMAL_KHR from
WSI and should recreate swapchain to use the right modifier with the
format mpv picked. mpv will always get the format it picks, WSI can't
give us a different format. This allows for recreating the swapchain
with modifiers that will allow mpv to be directly scanned out when the
window is fullscreened spanning an output on Wayland.

I checked X11 and Wayland myself to have no regressions when resizing,
and others have checked Windows and Mac to have no regressions.

With this, direct scanout with Vulkan on Wayland should just work.
You might also need https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31122
if your compositor enables explicit syncronization via
linux-drm-syncobj-v1.
2024-09-14 16:16:35 +02:00
llyyr a44a726301 ao_alsa: assume device lost if we couldn't recover after 10 attempts
ALSA API reports -EPIPE even when the the device is lost, which we
currently always assume to be an XRUN. If we assumed XRUN 10 times and
didn't manage to recover, just consider the device lost and try to
reconnect. Allows ao_alsa to recover from alsa server being killed then
reinitialized. And even in the worst case, this should be better than
the status quo of mpv attempting to prepare a PCM device indefinitely
until the user restarts mpv.

This is admittedly not ideal, and I don't think the -EPIPE hack is
necessary anymore, but I can only test on my setup and removing the
'assume -EPIPE is an XRUN' hack might break some setups for whatever
mysterious reasons.
2024-09-14 14:08:30 +02:00
llyyr 44da754018 ao_alsa: don't early exit out of the loop if we have an error
This would cause us to exit out of the loop with a goto anytime we ran
into XRUN or DRAINING and preparing PCM for use failed.
2024-09-14 14:08:30 +02:00
llyyr ec966fb866 ytdl_hook: add some more yt-dlp tags
These might be useful
2024-09-14 14:07:54 +02:00
Oneric 5357d18fe6 sub: add ass-video-aspect-override option
It is unclear whether there actually is any usecase for this option
which isn't better served by sub-ass-use-video-data and/or LayoutRes
overrides, but prior to the introduction of sub-ass-use-video-data
it was possible to pass along storage resolution while faking an
aspect ratio of 1:1.
sub-ass-video-aspect-override=1 combined with sub-ass-use-video-data=all
now makes this possible again.

The uper limit of a 10:1 aspect matches
the general video-aspect-override option.
2024-09-13 23:24:08 +02:00
Oneric 207b1a2c91 sub: merge vsfilter-aspect and vsfilter-blur-compat options
The naming for "blur-compat" was misleading since the setting
actually affects more than just blur affects. Additionally
forwarding storage resolution but forcing an aspect ratio
of 1.0 for the video is likely to result in odd rendering
and there’s no known usecase for it.

Both options control which video properties are exposed to libass
so to fix the aforementioned issues merge these settings into one
tri-state sub-ass-use-video-data.

The default V keybind now cycles through all states of
use-video-data instead of toggling vsfilter-aspect-compat.

Resolves: https://github.com/mpv-player/mpv/issues/10680
2024-09-13 23:24:08 +02:00
Kacper Michajłow f6d931301b vf_d3d11vpp: adjust options for userdeint filter
Fixes: #14816
2024-09-08 21:44:51 +02:00
Dudemanguy e6c536ae45 wayland: fix vertical resizing
Resizing in strictly the vertical direction has been broken forever on
wayland. It's because of how the keepaspect calculation always resized
with respect to the width. So if you moved the mouse strictly
vertically with no change left/right, the mpv window would never change
size since it just calculates with respect to the width that doesn't
change.

Fixing this is kind of weird and maybe someone should think of a better
algorithm for preserving aspect ratio (we just multiply by the gcd
basically), but whatever. You might naively try something like "resize
with respect to what direction changes the most" at first, but this
leads to very cludgy resizing since during a typical mouse dragging
motion, it will flip constantly from "resize w/ respect to the width"
and "resize w/ respect to the height". It "works" but it's really ugly
and not worth it.

The trick is to realize that we need to consider the resizing state as
one continuous motion, choose a direction initially, stick to it
throughout the entirety of the resize, and reset the relevant parameters
after we finish the resize. This ensures the direction never
unintuitively flips during a motion, but also allows for the strictly
vertical case to still work.

Might as well note it here in the commit, but mpv's resizing behavior
technically violates xdg-shell. For the resizing event, "[t]he window
geometry specified in the configure event is a maximum; the client
cannot resize beyond it." Well, we do obviously go beyond the maximum in
certain cases. For example consider resizing strictly horizontally. The
width value increases from the compositor but not the height. Since mpv
preserves aspect ratio by default, the height obviously must increase
which will go over the prescribed bounds by the compositor. This happens
before and after this commit, and I think everyone agrees is the desired
behavior. With this commit, now vertical resizing works which violates
xdg-shell in the same way. Before, it incidentally obeyed the protocol
since it did not resize at all, but let's presume users expect the
window to actually get bigger when they do a drag resize.

*: https://wayland.app/protocols/xdg-shell#xdg_toplevel:enum:state:entry:resizing
2024-09-08 18:36:17 +00:00
Kacper Michajłow 5edc8973eb various: use talloc_replace 2024-09-08 17:33:27 +02:00
Kacper Michajłow 3edbd30798 ta_utils: add talloc_replace
Helper to replace a string with a new one without reallocating the
buffer, if not needed.
2024-09-08 17:33:27 +02:00
Kacper Michajłow 077f05f7a1 ta_talloc: remove non-existent function prototype 2024-09-08 17:33:27 +02:00
Kacper Michajłow e7f153db58 stats.lua: don't use ASS tags when use_ass is false
Fixes terminal output.
2024-09-08 17:33:03 +02:00
nanahi f92d5da89c player/main: uninit input after terminal uninit
The terminal input thread holds the input_ctx reference.
Fixes: c1282d4d43
2024-09-08 17:14:37 +02:00
nanahi e169302e2d video/out/wayland_common: set key state only on keyboard_enter keys
These keys should be considered "being pressed" instead of an action of
press. This way, the keypress action won't be triggered; it now triggers
only when the key binding is repeatable and after the initial ar delay.
2024-09-07 18:14:56 +00:00
nanahi c4ff675198 input: add MP_KEY_STATE_SET_ONLY
Trivial.
2024-09-07 18:14:56 +00:00
nanahi 4295141703 input/keycodes: fix typo 2024-09-07 18:14:56 +00:00
Kacper Michajłow 0eb5e914d9 ci/win32: add dav1d 2024-09-05 16:29:16 +02:00
nanahi f02b8bc9fd stats.lua: fix text size/alignment for key bindings page
After a subject line, the text style needs to be reset to make
sure that key binding lines have correct size and alignment
while scrolling the page.
2024-09-05 14:06:05 +02:00
norinoriko ecc6cddef0 DOCS/man/options: update defaults for --hwdec-codecs
`prores` was added to the whitelist in 629b63740611ddb9072487988320a9ddf4bb2fa7.
2024-09-04 18:46:30 -04:00
bodayw db19dbca5c DOCS/man/options: fix deinterlacing typo 2024-09-04 16:27:53 +02:00
Kacper Michajłow ad7976c33e input: fix use of bstr like null terminated one
It has been changed in one of the iterations of the patch during review,
but bstr doesn't have to be null terminated. Fix it by adding dedicated
node_map helper.

Fixes: 1a27f3c
2024-09-04 03:52:09 +02:00
Kacper Michajłow 1ecfb29932 osdep/io: redefine off_t for Windows build
off_t is long (4 bytes) on Windows, regardless of _FILE_OFFSET_BITS,
which is not supported there.

Fixes: #14790
2024-09-04 03:51:56 +02:00
llyyr a0ebfc3462 sub: remove dead code 2024-09-03 18:31:38 +02:00
llyyr c02aa154ab vo_gpu: restore dovi mapping directly on image_params after init 2024-09-03 17:08:28 +02:00
llyyr 3acd253e89 mp_image: don't restore image params if they're unknown 2024-09-03 17:08:28 +02:00
llyyr fe4ba71962 etc/mpv.conf: update stale comment about mpv config location
We don't support reading mpv.conf without a mpv parent directory anymore
(did we ever?).
2024-09-02 13:51:00 -04:00
Kacper Michajłow 1f33889c03 vo_libmpv: use fallback colorspace for Dolby Vision
Same as 2a72e6cb20 for libmpv.
2024-09-02 04:14:56 +02:00
norinoriko afdbbac81d input.conf: swap the positions of values for ctrl+h binding
Allows users to toggle software decoding with a single action if they
are using a value for `hwdec` that is different from `auto-safe`.
2024-09-01 19:42:15 +02:00
Kacper Michajłow c2997aa7de vf_d3d11vpp: add output format selection 2024-09-01 19:41:41 +02:00
nanahi c4d85fc0c4 vf_format: restore image params before dovi mapping 2024-09-01 19:41:25 +02:00
nanahi 2a72e6cb20 vo_gpu: use fallback colorspace for Dolby Vision 2024-09-01 19:41:25 +02:00
nanahi 14d3a8ed28 mp_image: save fallback colorspace when dovi metadata is present
Since d9c1e9bc5c dovi metadata is
unconditionally mapped to colorspace in mp_image.

However, Dolby Vision videos can have backwards compatibility present for
players without the ability to interpret dovi metadata, like all current
VOs other than gpu-next. In this case, the original video colorspace should
be used to make sure backwards compatibility work properly.

Save the fallback colorspace for VOs which don't interpret dovi metadata.

Fixes: d9c1e9bc5c
2024-09-01 19:41:25 +02:00
Kacper Michajłow d6eb85bb1a ci/linux: disable leak detector temporarily
After libass update our jobs started failing. It has been fixed upstream
already, but we need to wait for next stable release to have that.

See: https://github.com/libass/libass/commit/6e83137cdbaf4006439d526fef902e123129707b
2024-09-01 19:27:51 +02:00
Guido Cella 7c672e33a5 command: expand ~ paths in load-config-file
Fixes #14766.
2024-08-30 18:54:37 +02:00
nanahi c890635634 video/out/gpu/video: use video rectangle for video-target-params
This makes the reported sizes the same as how stats.lua calculates
sizes for VOs witout video-target-params while in dumb mode.
2024-08-30 00:34:05 +02:00
nanahi e8d14cd314 video/out/wayland_common: don't pass mouse inputs on resizing edges
Since a6683ea3c9 it is possible to bind
MBTN_LEFT to something useful without conflicting with VO dragging.
However, currently wayland edge resizing is an exception and trying to
resize still triggers MBTN_LEFT. This is not a problem on win32 which
does not pass these inputs to the input system.

Fix this on wayland to do the same.
2024-08-28 03:30:46 +02:00
Kacper Michajłow 938938a985 fuzzer_options_parser: add options parser fuzzing
To improve coverage of parse_commandline.c
2024-08-27 01:31:40 +02:00
Kacper Michajłow 7398e755d1 DOCS/vf: update obsolete note hwdec in d3d11vpp
mpv has ability to upload frames.
2024-08-27 01:27:48 +02:00
Kacper Michajłow 47cb503bf5 f_hwtransfer: fix best upload format selection
It is possible for a format to be supported by hardware but not by
av_hwframe_transfer for uploading. This breaks the best upload format
selection. We first select the hardware input format and then choose the
best software format that can be uploaded. In some cases, this may
result in a format that is not uploadable at all, leading to an error.
To solve this, we should avoid adding non-uploadable formats to the fmts
table.

For example, for format d3d11/yuv420p, av_hwframe_transfer_get_formats()
returns empty list of formats.
2024-08-27 01:27:48 +02:00
Kacper Michajłow bb0a852f56 vf_d3d11vpp: skip conversion mode selection if not requested 2024-08-27 01:27:48 +02:00
Kacper Michajłow 1c34b72aeb vf_d3d11vpp: don't force nv12 output 2024-08-27 01:27:48 +02:00
Kacper Michajłow a341b128de vf_d3d11vpp: alloc output frames through AVHWFramesContext
This fixes d3d11 frame download further in filtering chain.

Fixes: #14732
2024-08-27 01:27:48 +02:00
Kacper Michajłow 421df7564a vulkan/context_display: don't fake avalibity of callbacks
There are generic fallback paths for those and it shouldn't be replaced
by noop.
2024-08-27 01:27:39 +02:00
llyyr cb4fdb530a video/csputils: remove space from choice option for chroma loc
Also document the field
2024-08-24 17:11:39 +02:00
llyyr 488c636a71 DOCS/man/vf: don't document removed vf_format field
This field was removed in c6b9288465

Reported-by: burgerga
2024-08-24 17:11:39 +02:00
Guido Cella 64a0e31aa9 console.lua: pre-filter searched commands if the line is filled
If you type something before pressing Ctrl+r, filter the commands
containing the typed line.

fuzzy_find() is modified to not code a separate case when the line is
empty in both handle_edit() or search_history().
2024-08-24 03:14:04 +02:00
llyyr 92f052c14e playlist: fix setting current item with autocreate-playlist
when the current directory isn't the playlist directory.
2024-08-23 00:56:17 +02:00
Kacper Michajłow b6f0599bfd demux_mkv: fix av_parser_codec leak 2024-08-22 18:13:53 +02:00
verygoodlee e3a9ce22f9 console.lua: add numpad + - * / keybindings
numpad + - * / was remapped to KP_ADD/KP_SUBTRACT/KP_MULTIPLY/KP_DIVIDE in #14660
2024-08-21 14:31:01 +02:00
Kacper Michajłow f44c29b223 vf_d3d11vpp: ensure width and height is even
Fixes: bbb3d5ba78
2024-08-20 20:27:03 +02:00
Kacper Michajłowandxc 2848af5618 vf_d3d11vpp: add support for Intel VSR and NVIDIA RTX scaling modes
Adds `--vf=d3d11vpp=scaling-mode` to control which extensions should be
enabled.

Fixes: #11390
Co-authored-by: xc <wxc9312@gmail.com>
2024-08-20 03:34:08 +02:00
Kacper Michajłowandxc bbb3d5ba78 vf_d3d11vpp: add support for scaling
Adds `--vf=d3d11vpp=scale` to scale video using d3d11 video processor.

Co-authored-by: xc <wxc9312@gmail.com>
2024-08-20 03:34:08 +02:00
nanahi 67e087dcae DOCS/man/options.rst: add a note about the effective limit of --pitch 2024-08-19 15:37:08 +02:00
nanahi ec125d6fc6 DOCS/man/mpv.rst: add documentation for the numpad volume key bindings 2024-08-19 15:37:08 +02:00
nanahi 365708cf32 DOCS/interface-changes: fix KP_DIVIDE typo 2024-08-19 15:37:08 +02:00
nanahi b9e63ae5d8 github/issue_template: don't use markdown for "Important Information"
There are too many issues created with problematic contents (like "#1"
in uname output) that cause unwanted expansion to markdown formats
and links to issues. The information here should be fairly simple in
format that markdown isn't needed. Use plain text rendering instead.
2024-08-19 12:34:42 +02:00
nanahi 6c3bb2381a github/issue_template: ask users to check for already supported features
This helps weeding out the low-quality feature requests that really are
questions.
2024-08-19 12:34:42 +02:00
Lynne a3baf94ab9 hwdec_vulkan: allow using multiple decoding family queues
Some devices may only support a single codec type on a single
queue family. The new libavutil API allows this.
2024-08-17 02:01:05 +02:00
Lynne 678ad90bf4 hwdec_vulkan: update to new libavutil queue family API
The new API allows duplicates to easily port any old API users.
It does require users to check and fill in video decode capabilities.
2024-08-17 02:01:05 +02:00
Guido Cella ebc14a58ae console.lua: implement history search 2024-08-16 18:32:58 +02:00
Kacper Michajłow 3cc3c9ced3 Revert "ci/mingw: don't run test on 32-bit binary"
Support for 32-bit binaries were restored.

See:
https://github.com/actions/runner-images/issues/9977
https://bugs.launchpad.net/ubuntu/+source/linux-signed-azure/+bug/2071445
https://launchpad.net/ubuntu/+source/linux-azure/6.8.0-1012.14

This reverts commit f47cbcd439.
2024-08-16 12:57:56 +02:00
Kacper Michajłow 08935d5d21 ci/{mingw,win32}: specify nasm as it seems to be required now by libass
Fixes mingw and win32 builds after https://github.com/libass/libass/commit/1774117b8048d6296c79425cfbb1086bcd2ac2fa
2024-08-16 12:57:56 +02:00
Mike Will acc69e082f img_format: prevent an offset >= MP_MAX_PLANES into bpp
Addresses the warning: "writing 1 byte into a region of size 0"
2024-08-13 12:35:27 +02:00
Kacper Michajłow e3f426aa4a common/playlist: add missing playlist_dir clear
Fixes: https://github.com/mpv-player/mpv/pull/14555#issuecomment-2282759582
2024-08-11 21:06:13 +02:00
Kacper Michajłow 9978cb821d player/loadfile: don't clear watch later for auto playlist parent file
Fixes: https://github.com/mpv-player/mpv/pull/14555#issuecomment-2282338707
2024-08-11 21:06:13 +02:00
Jonas Karlman ea01b042c2 context_drm_egl: always use drmModeAddFB2WithModifiers
Change to always use drmModeAddFB2WithModifiers for all formats and fall
back on using drmModeAddFB2 if drmModeAddFB2WithModifiers fail.

With the DRM_MODE_FB_MODIFIERS-flag now only being used for formats with
modifiers all formats without modifiers should also work.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2024-08-11 08:22:59 -07:00
Jonas Karlman 84c18f6b96 drm_prime: fix use of formats with modifiers
Similar to handles the modifiers must be supplied for each plane of the
format or a framebuffer cannot be created.

Use the format_modifier tied to the object used for the plane to fix use
of formats with modifiers.

Also fix the improper use of the DRM_MODE_FB_MODIFIERS-flag for formats
without modifiers.

This fixes playback of videos decoded by e.g. rpivid into a NV12 format
using SAND128 modifer on RPi using the drmprime-overlay interop.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2024-08-11 08:22:59 -07:00
nanahi d06f3d39cb input.conf: add KP_DIVIDE/KP_MULTIPLY key bindings
Map them to volume up/down, which is arguably the original intent
of these key bindings, as the non-numpad positions of them make
little sense.
2024-08-11 15:08:42 +02:00
nanahi f3a00ea131 various: handle numpad add/subtract/multiply/divide keycodes 2024-08-11 15:08:42 +02:00
nanahi ab0aaaad39 input/keycodes: add KP_ADD/SUBTRACT/MULTIPLY/DIVIDE keycodes
In general, mpv treats numpad keys as separate inputs. The +-*/ keys
however are exceptions so it's not possible to distinguish them from
non-numpad keys.

This adds keycodes corresponding to these keys so that they can be
handled differently.
2024-08-11 15:08:42 +02:00
Kacper Michajłow 4e50da3ddc demux_playlist: use --directory-filter-types for --autocreate-playlist 2024-08-10 23:27:40 +02:00
Kacper Michajłow ff1f8baecd common/playlist: add playlist_set_current() 2024-08-10 23:27:40 +02:00
Kacper Michajłow 73b58722e7 player/misc: add str_in_list() and use it 2024-08-10 23:27:40 +02:00
Kacper Michajłow b73445dcf3 demux_playlist: add only media files when opening directory 2024-08-10 23:27:40 +02:00
Kacper Michajłow 44a3a3293f options: add --{video,audio,image}-exts 2024-08-10 23:27:40 +02:00
Kacper Michajłow 4f1e9e34c3 demux_playlist: add --directory-filter-types 2024-08-10 23:27:40 +02:00
Kacper Michajłow c54ad6933b demux_playlist: add --autocreate-playlist-{video,audio,image}-exts 2024-08-10 23:27:40 +02:00
Kacper Michajłow bb9b862f0c demux: add --autocreate-playlist 2024-08-10 23:27:40 +02:00
Philip Langdale 4b97c23dac video: hwdec: extend look up of hwdecs to consider device type as well
Now that we have identified the device types associated with each hwdec, we
can take advantage of this to ensure that get the right hwdec is chosen when
decoding frames and there are multiple choices available with different device
types.

This is also plumbed into the filter initialisation logic, although in practice
the decision on the hwdec has already been made at this point - still it's
easier than retaining the ambiguous look up logic and worrying that it might
lead to an inconsistent result.
2024-08-10 14:24:36 -07:00
Philip Langdale 7bbf132e20 vo: hwdec: add AVHWDeviceType property to hwdecs
As the first step towards handling scenarios where the are multiple hwdecs for
a given image format but backed by different AVHWDeviceTypes, let us annotate
the hwdecs with their corresponding device types.

From this, we can also see how all the existing hwdecs which match the same
image format also match the same device type.
2024-08-10 14:24:36 -07:00
Dudemanguy 70fad1daa6 DOCS/man: improve explanation on how to shift notes with --pitch
Previously, this was in the rubberband filter but it gives out random
numbers without explaning where they come from. Move it to the --pitch
section instead and reword it a bit. Closes #14652.
2024-08-09 14:22:23 +00:00
Mike Will 88885c0401 audio: add pitch-shifting feature
Uses resampling in tandem with a time-stretching audio filter to
change the audio's pitch while leaving its tempo intact.
2024-08-07 22:56:17 +02:00
Kacper Michajłow 763bcd3e52 ci/freebsd: update to 14.1 2024-08-07 13:09:21 +02:00
Kacper Michajłow 57ed94ced0 ci/win32: update to FFmpeg 7.0 2024-08-07 13:09:21 +02:00
Kacper Michajłow c4b963d775 workflows/fuzz: report OOMs and timeouts 2024-08-07 13:09:21 +02:00
nanahi 0818f6001c console.lua: guard user-data/osc/margins value
Defaults margins to 0 if an external script sets this to an invalid value.
2024-08-06 20:28:44 +02:00
nanahi 9133ce7623 DOCS/man/input: document user-data/osc/margins
This property is used by the built-in OSC and some third-party OSC scripts
to indicate the margin they occupy so that other scripts such as
console.lua can use this value to position UI elements.
2024-08-06 20:28:44 +02:00
nanahi d302fe0de5 DOCS/man/input: reserve user-data/osc and user-data/mpv sub-paths
Currently user-data/osc is used for interpolation between the osc and
other internal scripts. Reserve this sub-path and also user-data/mpv
to make sure external scripts can only use these values as directed.
New internal uses of user-data should use user-data/mpv instead.
2024-08-06 20:28:44 +02:00
Guido Cella ee05804bfa {osc,select}.lua: show playlist entries with trailing /
If a playlist entry ends with a slash these scripts only show the
basename which is empty. Fix this by stripping trailing slashes so that
the last directory component becomes the basename.
2024-08-06 20:27:33 +02:00
llyyr 67bd00f163 input: fix inverted condition
I don't know if this broke anything but the the condition was inverted
as a result of the recent commit.

Fixes: 1a27f3caf7 ("input: use bstr for section name")
2024-08-06 20:26:49 +02:00
llyyr d766fc0914 input: don't mutate 'section' variable inside a loop
This fixes broken input-section parsing

Fixes: 1a27f3caf7 ("input: use bstr for section name")
2024-08-06 20:26:49 +02:00
Kacper Michajłow 6f619d5ef4 vo_libmpv: don't steal pointer provided by the API user
It won't be TA allocated and would fail on header check. Also
documentation doesn't mention that ownership is transfered to mpv, so it
is unexpected.

This will cause existing clients of this API leak this memory, but I
doubt anyone really used it in this broken state.

Fixes: #14633
2024-08-06 20:17:35 +02:00
Kacper Michajłow 25f441b740 fuzzer_set_property: ensure idle is enabled
It is used in play loop to check if playback ended cleanly. Don't allow
set_property to disable idle.
2024-08-04 21:33:36 +02:00
Kacper Michajłow ec40dcca9b loadfile: fix relative file open exclusion for fuzzing 2024-08-04 21:33:36 +02:00
Kacper Michajłow 1a27f3caf7 input: use bstr for section name
Resolves mixed use of bstr in internal processing and char* for storage.
Also makes faster comparision when searching for section and resolves
comparision when name contains null chars.
2024-08-04 21:33:36 +02:00
Kacper Michajłow aa35f2e4bd demux_mf: disable glob for fuzzing 2024-08-04 21:33:36 +02:00
Guido Cella 5f768a688b loadfile,select.lua: print only one bitrate
Print demux-bitrate if available, else hls-bitrate, not both (as
demux-bitrate is generally more reliable). This avoids printing "HLS
kbps" which looks weird.

Fixes
https://github.com/mpv-player/mpv/pull/14453#discussion_r1700550385
2024-08-02 08:41:43 +02:00
llyyr 11ed012c34 player/audio: invert audio_started boolean
Waiting for audio_started to be set to true takes too long which causes
us to miss it for the first frame, instead invert the condition so it's
set on the first frame.

Fixes #14615
2024-08-01 11:45:13 +00:00
Kacper Michajłow 24f42acd1d ad_spdif: update list of DTS_HD profiles 2024-08-01 13:27:08 +02:00
llyyr dcb4b491b2 TOOLS/stats-conv: minor cleanup 2024-08-01 01:58:30 +02:00
llyyr 0c72a2f26d TOOLS/stats-conv: silence linter messages 2024-08-01 01:58:30 +02:00
llyyr f1cd59ba92 TOOLS/stats-conv: convert to pyqt6 2024-08-01 01:58:30 +02:00
Dudemanguy 06470899df github/workflows/{build,fuzz}: exclude pr/issue template paths 2024-07-30 14:08:24 +00:00
Kacper Michajłow 7ab6458cf9 github/issue_template: fix paragraph spacing
Fixes: 051e2a8b7a
2024-07-29 21:55:25 +02:00
Kacper Michajłow 6a43514097 win32/smtc: add thumbnail support 2024-07-29 21:38:19 +02:00
Kacper Michajłow 3bef4a8599 ci/{msys2,win32}: explicitly enable win32-smtc 2024-07-29 21:38:19 +02:00
Kacper Michajłow 5fed12e025 win32: add Media Control support
Add support for SystemMediaTransportControls interface. This allows to
control mpv from Windows media control ui.
2024-07-29 21:38:19 +02:00
Kacper Michajłow 06da680630 ci/msys2: install cppwinrt
Will be useful for future commits.
2024-07-29 21:38:19 +02:00
Kacper Michajłow c430420840 osdep/threads-win32: cast function type directly to avoid warnings 2024-07-29 21:38:19 +02:00
Kacper Michajłow ab3d0b73f7 build: bump minimal Windows version to 10 2024-07-29 21:38:19 +02:00
Kacper Michajłow e17b5c635e VERSION: rename to MPV_VERSION to avoid standard library header conflict
Root directory is added to include directories and `VERSION` conflicts
with `#include <version>` which is standard library header.
2024-07-29 21:38:19 +02:00
Kacper Michajłow 2ad6566e51 meson: define WINRT_NO_SOURCE_LOCATION
Not really needed currently for our limited use of winrt.
2024-07-29 21:38:19 +02:00
Kacper Michajłow 5bb467e58a meson: minor adjustment for compatibility
- Move C only warnings to own test
- Add missing native arg for add_languages
- Undef __STRICT_ANSI__ only for c/objc
2024-07-29 21:38:19 +02:00
nanahi 40f1a89e40 input/ipc: use bstr for fd parsing
Also rejects the case of "fd://" without any number which was
silently accepted as 0.
2024-07-29 21:00:48 +02:00
nanahi bb0932a3ad input/ipc-win: support fd:// for --input-ipc-client
This makes --input-ipc-client work on Windows.

To use this feature, a parent process needs to create a connected named pipe,
wrap the server handle in a CRT fd, and then spawn mpv as a child process
with the fd as the --input-ipc-client parameter.
The process can then communicate through the client handle.

The named pipe must be created duplex with overlapped IO and inheritable
handles.
2024-07-29 21:00:48 +02:00
nanahi 87686a80e5 DOCS/man: add more --input-ipc-client references
Mention the alternative ipc method through fd inheritance.
Also fix a grammar mistake.
2024-07-29 21:00:48 +02:00
nanahi fc6aa2cc8a player/scripting: remove outdated comment about posix_spawn
The comment was added in e2ab6b7f35,
but posix_spawn usage was removed in 5309497727
to ensure CLOEXEC correctness.
2024-07-29 21:00:48 +02:00
Kacper Michajłow f8700c5a94 meson: check for vulkan headers
Vulkan dependency implies only vulkan loader, but some distributions
split vulkan-loader and vulkan-headers, so check if the headers are
actually there.
2024-07-29 20:59:46 +02:00
rtldg 05b964fdec DOCS/compile-windows.md: fix MSYS2 packages
Attempting to install `git` on the `pacboy` line fails with
`error: target not found: mingw-w64-clang-x86_64-git`
so move that to another spot.

`video_mp_image_pool.c` fails to build due to libavutil right now
because of missing vulkan headers so install those with `pacboy`.
(also improved in https://github.com/mpv-player/mpv/pull/14610 )

Simplify package lists since pacboy doesn't require `:p` anymore.
2024-07-29 20:59:22 +02:00
Brad Smith a36f8ad162 build: detect VT_GETMODE on OpenBSD 2024-07-29 15:09:49 +00:00
Kacper Michajłow 051e2a8b7a github/issue_template: add a note about log file 2024-07-29 15:27:14 +02:00
Guido Cella 544240c829 player/command: fix --force-window=yes acting like immediate
player/main.c runs all option callbacks with a flag on init, so since
a5937ac7e3 which added UPDATE_VO, if --force-window=yes is passed, the
VO is immediately initialized, as if --force-window=immediate was
passed. Fix this by not running the UPDATE_VO code when there is no
video output.
2024-07-29 01:46:21 +00:00
Guido Cella 6107112b32 player: don't decrement --ab-loop-count=N and add remaining-ab-loops
Follow up to the previous commit. Stop decreasing --ab-loop-count=N on
each iteration so it is preserved across different loops. In particular
it is preserved between different files without adding it to
--reset-on-next-file. Add a property to expose the remaning A-B loop
count instead.

The current behavior of --ab-loop-count=N is even worse than --loop-file
since it also doesn't reset when defining a new A-B loop in the same
file. Defining it has no effect after --ab-loop-count has decreased to
0, and this can't be fixed by adding it to --reset-on-next-file. This
commit also resets remaining-ab-loops every time --ab-loop-a and
--ab-loop-b are set to fix this.
2024-07-26 20:09:19 +02:00
Guido Cella f411f3145b player: don't decrement --loop-file=N and add remaining-file-loops
This stops decreasing numerical values of --loop-file on each iteration
so that loop-file=N loops every playlist entry without having to add
--loop-file to --reset-on-next-file.

The current behavior confuses users as seen in:

https://github.com/mpv-player/mpv/issues/2481
https://github.com/mpv-player/mpv/issues/5943
https://github.com/mpv-player/mpv/issues/11291
https://github.com/mpv-player/mpv/issues/13860
https://www.reddit.com/r/mpv/comments/rcwnrw/looping_each_file_n_times_in_a_playlist/

Also options are supposed to reflect the value configured by the user
and not change on their own.

A remaining-file-loops property is exposed as a replacement to check how
many loops are left.
2024-07-26 20:09:19 +02:00
Kacper Michajłow 397212ae15 player: remove empty line from --help
Follow-up after 127b6a3455.
2024-07-26 20:07:30 +02:00
Kacper Michajłow 77f1083098 options/m_config_frontend: remove empty line from --show-profile
Follow-up after 127b6a3455.
2024-07-26 20:07:30 +02:00
Dudemanguy 3c7b6db205 options: move all wayland specific options to vo_opts
Unlike most other platforming backends, wayland has its own specific
sub_options struct. 027ca4fb85 originally
introduced this and some more options were added later, but in
retrospect it's an unneccesary complication. There are already x11,
and windows-specific options within vo_opts. In fact, there actually is
a wayland one in there already as well (wayland-content-type) so it's
split btween two places. The wayland code already has to handle vo_opts
and it is already handles callbacks if needed. There is no advantage to
having a separate wayland-specific sub_options struct which is stuck
with whatever you set at init time.

So solve everything by deleting the old sub_options struct, moving it to
vo_opts and make some minor option naming changes for clarity (i.e.
adding a 'wl_' in front of the name). This simplifies the wayland common
code and also makes it have more functionality since you get runtime
updates for free.
2024-07-24 18:46:04 +00:00
Guido Cella bde7cac447 various: allow changing GPU API options at runtime
Set UPDATE_VO to GPU API options that are only set on init.

To change multiple options without multiple reinits, use
set vo null; set opengl-foo 1; set opengl-bar 1; set vo gpu
2024-07-24 18:44:41 +00:00
Guido Cella a5937ac7e3 m_option: add UPDATE_VO flag
This will allow reiniting the VO when more options are changed without
hardcoding them in options.c

Also reinit the VO when changing --gpu-debug and --gpu-sw.
2024-07-24 18:44:41 +00:00
Guido Cella d384a6b793 external_files: allow specifying --cover-art-whitelist filenames
Fixes https://github.com/mpv-player/mpv/discussions/14520.
2024-07-23 14:12:11 +00:00
llyyr e509ec0aaf DOCS/options: remove misdirection in sub-color
ARGB is in fact _not_ like web color. It's easy to skim over the
actual hexadecimal provided in the next sentence and just assume mpv
understands RGBA after reading the words "web colors"
2024-07-19 15:56:29 +02:00
nanahi 07acdf09b3 sd_ass: fix margin y scale with font size
--sub-margin-y is documented to scale with font size, which is scaled
"by" or "with" window depending on the options. However, when using
ass_set_font_scale to change font size, the y margin isn't scaled, so it is
still scaled to video size. This causes the y margin size becoming smaller
when the video becomes smaller, even when the font size isn't changing.

Fix this by also scale the MarginV with the font scale. Also use lrint
instead of round.
2024-07-18 23:03:02 +02:00
nanahi b59ac04db9 DOCS/man/options: clarify subtitle scale options
The current documentation of sub-scale-by-window and sub-scale-with-window
doesn't sufficiently convey what these options do exactly. Specifically,
the described effects of disabling one option is only true when the other
option is not disabled. The "clarification" of sub-scale-with-window option
only adds more confusion, when the effect of that option is already told
in more detail before (it scaled with window instead of video).

Clarify this by listing the effects of all combinations of these options.
2024-07-18 23:03:02 +02:00
nanahi 42e9f302df sd_ass: fix sub scale with window when use_margins is enabled
By default, libass scales subtitle with video size.
When --sub-scale-with-window is enabled, mpv attempts to undo this scale
and use window size instead. However, the current bahavior is incorrect
when use_margins is enabled, because in this case libass uses the size
of video as if it's "fit" to the window, instead of the displayed size.
As a result, subtitle scale is broken when video-zoom is used in this case:
when zooming out video, the subtitle is scaled up.

Fix this by using the correct factor when use_margins is enabled.
2024-07-18 23:03:02 +02:00
Guido Cella 8110bdac6d command: remove deprecated packet-*-bitrate properties
These have been deprecated for 9 years so it's fine to remove them.

Using the replacement properties like video-bitrate in stats.lua will
convert big enough bitrates to Mbps.
2024-07-18 22:52:35 +02:00
Guido Cella 5f8ac5b862 loadfile,select.lua: print bitrates of tracks 2024-07-18 22:52:35 +02:00
Guido Cella 7bcd525dce various: sync shown track flags
Show the same flags in loadfile.c, select.lua and stats.lua. The only
differences are that only stats.lua prints both image and albumart
because it's supposed to show detailed track information, and select.lua
prints the image flag because pressing g-v doesn't show Video or Image
like in loadfile.c and stats.lua.
2024-07-18 22:52:35 +02:00
Guido Cella 2fd88ffbae various: print Image instead or Video for image tracks
Fixes #8561.
2024-07-18 22:52:35 +02:00
nanahi 21df853624 osc.lua: don't hide osc when touch is active
This lets touch events activate a separate timeout for osc hiding so that
the osc only hides when both mouse and touch timeout are expired.
This is the general expectation with touchscreen UI, and also fixes
platforms which reset the mouse position when all fingers leave the
touchscreen (e.g. sway).
2024-07-18 22:49:51 +02:00
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
nanahi 33e414fa5d demux: avoid seeking video streams for refresh seek
940854c86f added this logic, but when the
demuxer contains a selected video stream, it causes a seek for the video
stream. This is unnecessary since the problems that commit fixed are only
relevant for external audio streams. For a demuxer with a video stream
selected, the synchronization is done by the demuxer implementation.
Add a check to prevent this.
2024-07-04 22:23:27 +00:00
nanahi c461ea6cd1 demux: don't log if track isn't refreshed
Also use demux_internal type for the refresh_track in style of other
internal functions.
2024-07-04 22:23:27 +00:00
Guido Cella dc523b137f video/out/gpu/context: convert --gpu-api to object settings list
This follows up 96e1f1dfa5 which converted --gpu-context, and has the
same advantages as listed there.

Unlike with --gpu-context auto can be used anywhere in the list, e.g.
--gpu-api=d3d11,auto works.

I wanted to use the list of GPU contexts as the description in
get_type_desc(), but there is no talloc context to allocate it to, so I
set a print_help_list to print them. The APIs go before the contexts so
that etc/_mpv.zsh doesn't try to complete the contexts.
2024-07-04 22:23:17 +00:00
Guido Cella 3f43999bd6 video/out/gpu/context: simplify --gpu-context's check_unknown_entry
This function is used to reject invalid context names early, and without
it the context fails to create and only audio is played, but it doesn't
need to check for known entries again.
2024-07-04 22:23:17 +00:00
bashonly e78e2c73cf ytdl_hook: strip quotes from cookie values 2024-07-04 19:10:37 +00:00
nanahi 7c70df0934 input/cmd: move m_option_type_cycle_dir to m_option.c
A relic when commands lived in input.c. Move them to where other option
types live. Also remove the redundant copy_opt.
2024-07-01 10:02:13 +02:00
Kacper Michajłow 4969d6e03e player/lua: restore original lua allocator before close
We wrap the default Lua allocator to allow used memory tracking. This
works well, except that we never destroy the default allocator or notify
it that we are closing. Since we override it for the current Lua state,
it is reasonable that the Lua engine does not expect it to be used. We
get and pass through a free call, but in the case of LuaJIT, the
internal allocator has additional state and is freed differently. So, in
fact, it is a LuaJIT leak because once we replace the allocator with our
custom one, they should clean its internal state. I guess the assumption
is to override allocator only before any allocation happen. To work
around this issue, restore the default allocator, the one that we use,
before closing the state. This way, everything is cleared as expected.

Note that the current solution of wrapping the default allocator works
only because none of the supported Lua engines actually invalidate the
allocator on the lua_setallocf() call. However, they could, so keep in
mind that we are currently depending on an implementation detail.

Thanks to @Dudemanguy for help with finding the changes that introduced
the leak.

Fixes: a67bda2840
Fixes: #14451
2024-06-30 21:15:37 +02:00
Dudemanguy 68a1a3879c wayland: add a --wayland-present option
Mainly for debugging. It might be handy to disable presentation feedback
on wayland to make sure something isn't going wrong with the
calculations somewhere.
2024-06-28 03:33:16 +00:00
Kacper Michajłow a3f72ea87c stats.lua: fix codec-profile position for audio 2024-06-27 20:24:13 +02:00
nanahi ea03451d1e misc/natural_sort: avoid implementation-defined behavior in comparison
Before a7158ceec0, string comparision was
done with strcmp, which does unsigned comparison. The natural sort
implementation instead compares on char values.
This causes implementation-defined behavior in comparison, depending on
the signedness of char type.

Fix this by using unsigned comparison instead.
2024-06-27 19:45:21 +03:00
Kacper Michajłow 4574644b7a fuzzers: wait for file start event before idle
Sometimes we exited too soon, not waiting for full transition to idle
state.
2024-06-27 02:57:22 +02:00
Kacper Michajłow 995283bd7a filters/f_lavfi: fix null dereference on empty graph 2024-06-27 02:57:22 +02:00
Kacper Michajłow 2b1e9a6537 demux_playlist: don't add base path to self-expanding protocols
Adding base path make sense only if it is a real directory or url
location. In case of protocols like memory adding base path to playlist
entry in facts adds the whole playlist to that entry.

For example `mpv $'memory://#EXTM3U\na/b'` produces infinite loop,
expanding playlist, adding more to it.

open_file adds the dirname to support relative playlist enties, however,
the dirname is invalid when the name doesn't represent a path, such as
with memory://..., so avoid taking the dirname with such protocols.

Found by OSS-Fuzz.
2024-06-27 02:57:22 +02:00
Kacper Michajłow 529450a965 test/paths: add tests for mp_basename and mp_dirname
Note that those functions have different behaviour than POSIX ones.
2024-06-27 02:56:59 +02:00
Kacper Michajłow 4a0c0ce92d test/paths: use helper functions for result testing 2024-06-27 02:56:59 +02:00
Kacper Michajłow 22fc2e6af3 bstr: change memcpy to memmove to allow aliased copies
mp_property_expand_escaped_string() needs this.

Found by OSS-Fuzz.
2024-06-26 01:28:55 +02:00
Kacper Michajłow 5995f13b5f fuzzer_set_property: fix setting audio-files list
`:` were not escaped correctly. Also while at it clear other external
file lists, as we don't want to load any. Subtitle fuzzer will be added
in the future.

It is surprisingly hard to clear the list with C API. That needs whole
mpv_node_list with 0 elements, to make it clear it.
2024-06-26 01:28:55 +02:00
der richter 88db2d0b61 mac/menu: add option to disable default shortcuts
Fixes #14305
2024-06-25 20:14:38 +02:00
Kacper Michajłow 95ac32220e m_option: parse the timestamp as unsigned value
The sign is handled manually. This allows us to skip the check for
negative integers.
2024-06-25 05:29:46 +02:00
Kacper Michajłow 7fb7e1dd73 various: add more format specifiers checks 2024-06-25 05:29:46 +02:00
Dudemanguy 0db6abadd4 playlist: let playlist-next go to first item if player is idle
Similar to the previous commit but the other way around. If you start
mpv as idle, load up a playlist without immediately hitting play and
then try to go to the next item, nothing happens. Naturally, you would
expect this to go to the first item. Fix this detecting if the playlist
has not started yet, the direction, and going to the first item in the
list.
2024-06-25 02:19:08 +00:00
Dudemanguy 0f76848e5f playlist: let playlist-prev go to last item in playlist
Previously, playlist-prev didn't work if you played a playlist to
completion using --idle and tried to go back. Naturally, one would
expect this to bring up the last item in the playlist, but nothing
happens. This is just because playlist_get_next is stupid and doesn't
take this into account since pl->current is NULL and thus returns NULL.
Fix this by considering the direction, checking if the playlist was
played to completion and grabbing the last entry in the index.
2024-06-25 02:19:08 +00:00
Dudemanguy 111571bd05 options: remove some options with .deprecation_message
In both cases, setting these options did nothing other than give you a
warning that they may be removed in the future. Remove them now.
2024-06-25 02:18:58 +00:00
Dudemanguy 4d7e440533 options: remove various OPT_REMOVED usage
Most of these are pretty obscure things that were replaced a long time
ago. The special messages they were printing are also not really useful
at all so just remove them.
2024-06-25 02:18:58 +00:00
Dudemanguy 6e3d90d72a options: remove some deprecated OPT_REPLACED option mapping
These were all deprecated in mpv 0.37.0 or earlier and are not
considered common enough options to warrant keeping the deprecated
mapping longer. Since demux_cue had only a single option in it, the
entire option substract is removed. This can be readded later if someone
wants to introduce a specific option to it again.
2024-06-25 02:18:58 +00:00
Kacper Michajłow 7eec246d56 fuzzer_load: seal the input fd after writing the data
Nothing should ever modify this data. Also, add CLOEXEC for good
measure.
2024-06-25 02:17:40 +02:00
Guido Cella 01330dba71 console.lua: assume non-ASCII characters span 2 cells for truncation
This prevents line wraps in select mode with terminal output which hide
the top items (OSD output no longer uses truncate_utf8 since the
previous commit). This is not ideal as even accented letters are assumed
to be 2 cells wide. The alternative is using \e[?7l and \e[?7h to
disable and enable text wrapping, but it won't work in Windows console
with VT processing disabled.
2024-06-24 21:30:14 +02:00
Guido Cella 06cfdc80a6 console.lua: let libass clip lines in select mode
In select mode and when printing the OSD, use \q2 to let libass clip
lines longer than the OSD. This works around having to leave a large
horizontal space unused due to libass subtracting the left margin from
the max text width even though the ASS event is anchored to the bottom
left. It also fixes truncating wide Unicode characters.
2024-06-24 21:30:14 +02:00
Guido Cella ad6bca9c31 console.lua: subtract --osd-margin-x in the max width calculation
Even if ass:pos() hardcodes the position at 6px from the left, we still
need to subtract the left --osd-margin-x from the available text width.
See how libass/ass_render.c:ass_render_event() subtracts it from
max_text_width without checking if the event is positioned.

The calculation is still not perfect as the width could be made a bit
larger before the text wraps.
2024-06-24 21:30:14 +02:00
Kacper Michajłow 22ca65a59d fuzzer_set_property: destroy mpv also on error
Shouldn't matter much and in fact even LSAN doesn't complain, but we
should clean it correctly.

Fixes: 1225bcbd41
2024-06-24 17:36:53 +02:00
Kacper Michajłow 8a5989628c meson: add fuzzers alias for all fuzzer targets
Makes it easier to build only fuzzer binaries and avoid building
unnecessary targets from subprojects.
2024-06-24 17:36:53 +02:00
Kacper Michajłow 893ea5e47b player/playloop: fix null dereference if filter_root does not exist
For example when `input-commands=drop-buffers` is added to the config.

Add a check inside mp_filter_reset().

Found by OSS-Fuzz.
2024-06-24 16:20:46 +02:00
Guido Cella 82ffe8f425 loadfile: update the format of terminal track information
Stop making unselected tracks and editions grey because they can be hard
to read over a dark background (\033[2m would be hard to differentiate
from regular text with a light theme instead), and because there is no
way to not print the escape sequences in --log-file.

Just use the same circles as the OSD and OSC. We need to print the empty
circles for alignment on mlterm with East Asian fonts (we could also
make them invisible with \033[8m but it would still get added to log
files).

Add back the space before tracks and editions when printed after
"Playing..." or "Track switched" and similar, so they look like a
sub-section of it, consistently with the metadata which starts with
space which makes it look like a sub-section of the "File tags" line.

Leave 2 spaces between track columns.

Make the lang options only as long as the longest language.

Place hls-bitrate within the same parentheses as the other data.

Replace the incomprehensible (*) (f) and [P] with textual descriptions
within []. Also place external there.

Stop converting Hz to kHz for consistency with other log messages, e.g.
AO: [pipewire] 48000Hz stereo 2ch floatp

Remove the space in "2 ch" so it doesn't look like 2 separate values (We
considered using mp_chmap_to_str(&s->codec->channels) but it prints
values like "unknown2").
2024-06-24 16:19:31 +02:00
Guido Cella f7c1461053 DOCS/input: document undocumented track-list sub-properties 2024-06-24 12:52:36 +00:00
Dudemanguy 26029cfbb0 m_option: add a way for aliases to use sub option prefix
Previously, using m_option_type_alias required that the alias have the
full name of the option value. This is limited if you are reusing the
same opts struct in different sub options. Fix this by add an additional
field to m_option to signal whether or not prefixes should be taken into
account for the alias option. Instead of blindly using whatever is
stored in opt->priv as the name, we can construct the desired option
name for either case (using the prefix or not).
2024-06-24 12:51:28 +00:00
Kacper Michajłow 1225bcbd41 fuzzer_set_property: don't run mpv if set property failed
We can avoid testing this cases, hopefully there are no side-effects
when set property fails.
2024-06-24 03:05:09 +02:00
Kacper Michajłow a5f2816278 fuzzer_load_{config_file,input_conf}: take into account file size limit
We are strict about load command errors, so we have to clamp the size.
2024-06-24 03:05:09 +02:00
Kacper Michajłow 103cae2591 m_option: ignore excessive elements only for obj_settings_list
It makes sense to allow the first part of the list. There are
warnings about excessive elements already. This also allows overriding
elements with the same label.
2024-06-24 03:05:09 +02:00
Kacper Michajłow 5b3b2273db player/command: limit user-data name splits to 100
It fixes stack-overflow with keys that contains hundreds of splits. 100
is more than enough for any valid use of user-data, normally key
shouldn't contain more than a few splits.

Found by OSS-Fuzz.
2024-06-24 03:05:09 +02:00
Kacper Michajłow 2b056c89cd m_config_frontend: disallow profile=default in config files
profile=default in config file causes infinite recursion. It triggers
reload of the default config, which contains the profile=default...
2024-06-24 03:05:09 +02:00
Kacper Michajłow a949e0c2d5 misc/random: set constant seed for fuzzing
Fuzzing expect deterministic behavior. While we don't use this random
generator for anything significant, still good to set the seed, in case
of future usage.
2024-06-24 03:05:09 +02:00
Kacper Michajłow 799137a87c fuzzers: disallow include command in more principal way
We should never allow include command for fuzzers and it can be
triggered also by direct set property.
2024-06-24 03:05:09 +02:00
Kacper Michajłow cd1b63f628 ad_{lavc,spdif}: initialize channel layout
It is not always available for the demuxer, so update it from decoder.
2024-06-23 05:09:13 +02:00
nanahi f7ed8c42d2 options: add secondary-{sid,sub-delay} to watch_later_options 2024-06-23 05:05:22 +02:00
Kacper Michajłow c3de4f04db fuzzer_load: disallow include option in config files
It produces undeterministic results, especially if it do
`include=fd://N` which starts loading external data.
2024-06-23 02:33:04 +02:00
Kacper Michajłow b4123826e5 input/keycodes: validate parsed value to avoid overflow 2024-06-23 02:33:04 +02:00
Kacper Michajłow 7fda885747 m_option: do float multiplication to avoid integer overflow
Huge values doesn't make much sense, but to avoid some arbitrary limits,
use double, as the output is already floating point value.

Found by OSS-Fuzz.
2024-06-23 02:33:04 +02:00
Kacper Michajłow 5534e0e1d9 common: validate parsed unicode codepoints value
Fixes UB when converting out of expected range values.

Found by OSS-Fuzz.
2024-06-23 02:33:04 +02:00
Kacper Michajłow 758019bf92 m_options: fix obj settings list leak on error
Fixes: b3b542af51
2024-06-23 02:33:04 +02:00
nanahi 265056fa54 vo_gpu: optimize pass_info_reset
No need to reset mp_pass_perf which is only read when desc.len > 0.
This avoids zeroing >16384 uint64_t's every time it's called.
Profiling shows that this reduces CPU usage for frame rendering by ~4%.
2024-06-22 22:48:40 +02:00
nanahi 940854c86f demux: allow refresh seek for non-video streams
Since d41f0a54b0, enabling a stream will
no longer perform a refresh seek, to fix issues with switching video
tracks. Additionally, 62e9a0c5f6 also
prevents refresh seek on track switching when it happens right after a
seek.

Unfortunately, when external audio files are loaded, preventing refresh
seeks can cause A-V sync issues. Since external tracks have separate demuxer
instances from the internal tracks, the demuxer instances from both
internal and external tracks are explicitly sought to the same pts when
seeking is performed. When enabling an external audio track for the first
time, the existing logic prevents refresh seek because no packets have ever
been read, so the track ends up not being sought. This means that switching
the track in the middle of playback results in a huge A-V desync.

To make it worse, unlike one demuxer instance with multiple tracks,
tracks from multiple demuxer instances are not synced in any meaningful
way beyond the separate explicit seeking. The only thing which keeps these
tracks synced is the generic A-V sync logic, which is unfit for such large
desync above. This means the audio is at the start position after the track
is switched, behind the video, so the audio is not considered ready, and
audio is continuously filtered sequentially until it is synced to the video.
While this is happening, the audio filtering exhausts all CPU resources.

There is also a case with cache enabled: if a seek causes some new data to
be cached, the demuxer is sought to the end of joined cache range.
If track is switched after this, the existing logic prevents a refresh seek,
so the demuxer is at a wrong position after the track is switched.

Fix this by allowing refresh seek for non-video streams, even when no packets
have been read yet or immediately after a seek.
2024-06-22 18:21:28 +00:00
Kacper Michajłow e5d85704a3 av_log: sort library version print and add missing libavdevice
Incidentally sorted list put more important libs to the top.
2024-06-22 16:12:14 +02:00
Kacper Michajłow 9e1271260f ad_spdif: fix lavf version check
Fixes: 62b1bad755
2024-06-22 16:12:14 +02:00
Kacper Michajłow 687eb4c875 various: remove no longer needed availability checks
image_writer: remove jpegxl availability check

meson: remove check for lavu vulkan support

image_writer: remove avif availability check

ad_spdif: remove no longer needed definitions

demux_lavf: remove side data extraction compatibility code

demux/packet: remove ITU T.35 availability check

filters/f_lavfi: remove avfilter_filter_pad_count availability check

image_writer: remove PNG cICP support check

mp_image: remove AV_FRAME_DATA_DOVI_METADATA availability check

mp_image: remove AV_FRAME_FLAG_INTERLACED availability check

vd_lavc: remove ctx->pic->duration availability check

sws_utils: remove av_chroma_location_enum_to_pos availability check

vd_lavc: remove AV_CODEC_EXPORT_DATA_FILM_GRAIN availability check

demux_lavf: always use io_close2
2024-06-22 16:12:14 +02:00
Kacper Michajłow 0d8f74231f misc/uuid: remove no longer needed vendored implementation 2024-06-22 16:12:14 +02:00
Kacper Michajłow 3c5a79300c various: remove av channel layout check 2024-06-22 16:12:14 +02:00
Kacper Michajłow b64521ae10 ci/openbsd: bump to 7.5 and remove libplacebo subproject
The available version is enough now.
2024-06-22 16:12:14 +02:00
Kacper Michajłow 2887b2e64c meson: increase FFmpeg minimum required version to 6.1 2024-06-22 16:12:14 +02:00
Guido Cella 8873beabc3 select.lua: consider --sub-delay for the subtitle line selector
Preselect and seek to the correct subtitle line when there is a
sub-delay.

Also slightly increase the offset without a video track else it
occasionally doesn't seek to the selected line with non-0 sub-delay and
no video. This now uses the same offset as sub/sd.h.
2024-06-22 13:42:27 +00:00
Guido Cella e3f496dbf5 select.lua: don't use sub-start to preselect subtitle lines
There is no need to compare sub-start now that we don't check for exact
matches with ffmpeg's timestamps. time-pos can always be used.

Comparing time-pos removes the need for the workaround of sub-start of
embedded subtitles being earlier than ffmpeg's timestamps, as time-pos
is always slightly after sub-start.

Removing this workaround also fixes a bug present since 4059d1832b,
which started comparing numerical values of timestamps instead of
strings to determine the preselected subtitle line, where the line after
the current one is preselected when sub-start is greater than ffmpeg's
timestamps because they have been rounded, e.g. sub-start 10.001 is >
than ffmpeg's 10.00.

This will also allow considering --sub-delay in the comparisons, as
comparing sub-start - sub-delay would preselect the wrong lines.
2024-06-22 13:42:27 +00:00
Kacper Michajłow 4ec060f946 vo_tct: clear backbuffer on reconfig
We were drawing garbage data after reconfig, if there is no video
frame ready or with --force-window without video track.

Found by OSS-Fuzz.
2024-06-22 00:50:38 +02:00
Dudemanguy 23ecfa9845 options: remove deprecated auto choice for --mute
Since 995c47da9a, setting --mute=auto has
been equivalent to --mute=no. It was formally documented later in
79e20ff485. This is an old legacy relic
and the auto choice popping up during auto completion could be confusing
to users who aren't aware of the history. Remove it for good and convert
the option to a proper boolean.
2024-06-21 21:29:33 +02:00
Dudemanguy bab9b2cf4e player/command: alias playback-time to time-pos
Since 7fc4bac29f182cab1823221ed580423594041fc1, playback-time and
time-pos will now always have exactly the same values. Both properties
are commonly used, so just make playback-time an alias for
time-pos and document it.
2024-06-20 13:07:41 +00:00
Dudemanguy 42a4c306ec test/libmpv_test: fix some stray tabs 2024-06-19 23:04:21 -05:00
Dudemanguy 157566904f ao_pipewire: fix some stray tabs 2024-06-19 23:04:05 -05:00
Dudemanguy b402cc3248 test/libmpv_encode: avoid mktemp warning
Doesn't really matter but it's annoying so replace it with mkstemp
instead. For windows, just use _mktemp.
2024-06-19 13:55:54 +00:00
nanahi 8df4cb5e21 osc.lua: don't use legacy argument for seeking
Deprecated since mpv 0.9. Use the flags instead.
No need to specify flags for relative seek since it's the default.
2024-06-19 01:30:18 +00:00
der richter bc5ab97d9a ao_avfoundation: guard features only available on macOS 11.3 and 12
build time and runtime checks.
2024-06-18 19:30:07 +02:00
der richter 55241da4ad cocoa-cb: guard color spaces that are only available on 10.15.4 upwards 2024-06-18 19:30:07 +02:00
der richter e3a290b618 mac/compat: fix broken CGColorSpace declaration on SDK 11 only
seems like apple missed those two colour spaces and didn't add a obj-c
to swift redeclaration of the CFStringRef kCGColorSpace* global
variables.
2024-06-18 19:30:07 +02:00
der richter 0f9630f28d mac/event: remove swift 5.6 language feature that is mandatory with 6.0
this can be tested with -enable-upcoming-feature ExistentialAny
2024-06-18 19:30:07 +02:00
der richter 1364c80e64 mac/compat: add withLock fallback for xcode older than 14
withLock is available for macOS versions starting from 10.10 but can
only be used on xcode 14+. xcode 14 introduced swift 5.7, so we guard it
behind a swift version check.
2024-06-18 19:30:07 +02:00
der richter b390ade709 mac/log: properly guard logger usage behind platform version check 2024-06-18 19:30:07 +02:00
Diederik de Haas 1acb49f9c6 bash-completion: remove hashbang
Hashbangs are meant for scripts that are executed, but a bash completion
script is meant to be sourced and therefor shouldn't have a hashbang.

Remarked by Debian's ``lintian`` tool with the
``bash-completion-with-hashbang`` tag.
2024-06-18 16:06:02 +00:00
Kacper Michajłow 8e7d442f08 fuzzers: enable edl, file and lavf protocols
To close already fixes issues on OSS-Fuzz.

Hopefully there is enough space for those. There is no way of checking
that, except that it stops working.
2024-06-18 03:11:14 +02:00
Kacper Michajłow b3b542af51 m_options: limit list entries to 100
Limit list entries to 100. obj_settings_list is not designed to hold
more items, and it quickly starts taking ages to add all items. 100 is
more than enough.

Fixes 30s timeout on OSS-Fuzz and generally fixes possible DoS on mpv.
2024-06-18 03:11:14 +02:00
Kacper Michajłow 783150722d m_options: fix mark_del leak on error
Found by OSS-Fuzz.
2024-06-18 03:11:14 +02:00
Kacper Michajłow ee2be6dc82 fuzzer_set_property: force untimed and pause state
We don't want to accidentally set those options and timeout in pause
state.

Remove video-osd as there is no reason to set it in fact.
2024-06-18 03:11:14 +02:00
Kacper Michajłow c194f2dc32 demux_edl: fix infinite loop on empty EDL files
"file" is implicit key, it is always available, so we have to check if
it is not empty.

Found by OSS-Fuzz.

Fixes: 96ef62161a
2024-06-18 03:11:14 +02:00
Kacper Michajłow 71d3f4157b fuzzers: disable some targets as we hit out of space errors
To test if this resolves issues with oss-fuzz.
2024-06-16 05:42:34 +02:00
Crend King c9ea2798a4 osc.lua: add script message to show up the OSC
Add a way to briefly show the OSC, which is useful to check file name,
playback progress and time left, etc.

Fix issue #3826
2024-06-16 01:23:38 +02:00
Kacper Michajłow df6b16c0ca stream: don't exit on first iteration if there is no match
Fixes: f921b64ed7
2024-06-16 01:22:30 +02:00
Kacper Michajłow 3b3604e162 ad_spdif: add an assert for lavf_ctx
To suppress forward null warning.
2024-06-16 01:22:30 +02:00
nanahi 3840c98b36 editorconfig: punish tab usage
This makes tab width to 7 on GitHub web UI and supported editors, making it
impossible to use tabs to match the existing 4 space indentation.
2024-06-16 01:22:13 +02:00
Guido Cella eae74bdb7a osc.lua: replace tabs with spaces
Fixes b6d7f778b8.
2024-06-16 01:21:55 +02:00
Kacper Michajłow 9b935c9076 fuzzers/meson: set link language to cpp 2024-06-16 01:21:16 +02:00
Kacper Michajłow 6c908363cd demux_lavf: fix null derefence of stream variable
demux_stream_is_selected() already checks if stream is valid, so move
the image format hack check after that.

Fixes: 4ef7931266
2024-06-15 18:08:16 +02:00
Kacper Michajłow ab0a50874b d3d11: return minimum bitdepth for display output and swapchain
If the output display reports high bitdepth, 12-bit and 10-bit swapchain
is used the value returned from d3d11_color_depth needs to take it into
account.
2024-06-15 01:18:44 +02:00
nanahi 3fa09458da demux_lavf: add format hack entry for jpeg metadata frames 2024-06-14 17:16:19 +00:00
nanahi daa3264d3f demux_lavf: fix null derefence in io_open callback
The options parameter here can be NULL. It's NULL checked a few lines down,
but not for the propagate_opts loop. This results in null derefence with
--demuxer-lavf-format=image2.

Fixes: b6413f82b2
2024-06-14 17:16:19 +00:00
Kacper Michajłow a41cdf0289 stats.lua: align 100% correctly on page 2
It is not common to have one pass with 100% usage, but it is not
impossible, so handle this case too.
2024-06-14 00:26:04 +02:00
Crend King 6031a0e173 vf_vapoursynth: upgrade to VapourSynth API v4
VapourSynth introduced their version 4 API in R55, 3 years ago. mpv is
still using the deprecated version 3. I think it is good to migrate
before VapourSynth completely removes it.

The most impacted area is the video format. Previously we have a fixed
table of supported formats, each represented by an integer. In v4, the
integer is replaced by pointer to the full struct of the format.

Second, the way to create video filter is changed. Previously caller
needs to supply a "initialization" callback to `createFilter()`, which
sets up video info etc. In v4, video info is prepared first, passed to
the `createVideoFilter2()` and we get back the node.

Also, previously mpv was using the `fmSerial` filter mode, which means
VapourSynth 1) can only request one frame from mpv at a time, and 2) the
order of frames requested must be sequential. I propose to change it to
the parallel request mode, which requests multiple frames at a time in
semi random order. The reasons are, for 1), the get frame function,
`infiltGetFrame()`, unlocks the mutex during output image generation,
thus can benefit from parallel requests. For 2) thanks to the frame
buffer, unordered frame requests are acceptable. Just make sure the
buffer is large enough.

Third, the way VapourSynth scripting environment works change. In v4,
the scripting API is operated through struct pointer, much like the
exist `vsapi` pointer. The "finalize" function is also no longer needed.
2024-06-14 00:25:18 +02:00
Dudemanguy 4ef7931266 demux_lavf: drop jpeg frames that are at a nonzero pos
There are jpg files out there that have extra embedded metadata
(pictures from smartphones commonly have an embedded gain map). ffmpeg
doesn't currently support this, so mpv currently sees the extra metadata
as essentially another frame. This results in weird video-like behavior.
Until ffmpeg support this more properly, we can work around this by
simply discarding extra packets and not sending the new frame to the
internal playloop. If demux_lavf detects that the stream is a
single-frame jpg, then we only accepts the packet at pos 0. Anything
else is discarded. Ref #13192.
2024-06-13 19:12:29 +00:00
Dudemanguy a900d41b1e Revert "demux_lavf: pass jpg filenames to ffmpeg for probing"
Passing jpg filenames to ffmpeg is actually quite bad. This causes all
jpg images (at least in my testing) to be probed as image2 which is
blacklisted in demux_lavf since it's completely broken (see commit
74e62ed2d1 for some details). What happens
in practice is that the lavf demxuer fails and the it opens in the mf
demuxer instead. This is OK for simple viewing, but because that demuxer
is limited, many specific file properities and other things are
completely unavailable which breaks any script that may depend on them
(e.g. width, height, etc.) For the small subset of files that this
commit appeared to "fix" (in reality, it just fell back to the mf
demuxer) is not worth breaking property usage in the vast majority of
normal proper files. Ideally ffmpeg should fix this but some other
workaround on our end can be used instead.

This reverts commit d0aeca5918.
2024-06-13 19:12:29 +00:00
Kacper Michajłow b4bbc27d9c input: map Num 5 to distinct value when numlock is off
Until now both numlock on and off were mapped to KP5.
2024-06-13 20:42:24 +02:00
Guido Cella 80de88361b input.conf: make Alt+BS reset panscan
It makes sense to reset panscan along with the zoom because it is a kind
of zoom.
2024-06-13 12:57:48 +00:00
Guido Cella 5158a3d779 console.lua: don't enable the console-input input section
https://github.com/rossy/mpv-repl enabled and disabled its keybindings
with input sections (define-section, mp.enable_key_bindings and
mp.disable_key_bindings), but when wm4 merged it in mpv, he changed it
to use mp.add_forced_key_binding and mp.remove_key_binding because he
deprecated input sections, but he forgot to remove the
mp.enable_key_bindings line. Remove it now.
2024-06-09 20:50:03 +02:00
nanahi 22103b8a8f osc.lua: fix timetotal and timems settings 2024-06-09 06:08:10 +02:00
nanahi d2bd77ada0 stats.lua: display file tags
This adds file tags to display along with the title, including
album/artist etc. for music, and series etc. for some videos.
The list of tags to display is identical to the tags printed to
the terminal and is controlled by the --display-tags option.

To filter out overlength tags (such as long comments and lyrics) and
files with too many tags, add file_tag_max_length and file_tag_max_count
options so that tags longer than this length are not displayed, and only
the first few tags are displayed.

Also makes tags show on page 5 only.
2024-06-09 00:58:48 +02:00
nanahi 65fef73c2b input: don't resolve double clicks on the active mouse section
Normally, key bindings are resolved in the input section stack order.
However, mouse key bindings have a special "active mouse section" feature
(which is a section with MOUSE_MOVE bound and mouse button is down in the
section) which lets the section to be selected instead, with a fallback
to the "default" section. The intention of the feature is for mouse
dragging which should "stick" to the section where the mouse is down.

This causes a problem with scripts which bind mouse double clicks:
since double clicks are triggered on mouse down, it's resolved with the
"active mouse section" feature instead of the section stack order.
If the section which has the double click bound doesn't also have
MOUSE_MOVE bound, the "default" section will be used instead.
If it's already bound there, it will be triggered.

Fix this by not resolving double clicks on the active mouse section, which
is not the intention of the feature.
2024-06-08 23:13:15 +02:00
Guido Cella 948faa5482 lua: don't pass nil as the second argument of mp.get_property_number
This doesn't do anything because nil is already the default value of
unavailable properties.
2024-06-08 23:10:37 +02:00
nanahi 828ffc0c8f DOCS/interface-changes: fix formatting 2024-06-08 23:08:43 +02:00
nanahi e8905650fe TOOLS/gen-interface-changes.py: sort interface changes by file content
With the previous commit, they're in effect sorted by the types of the
interface changes.

As a lazy measure to sort changes by the breakages they cause, sort the
content reverse alphabetically, which works OK by accident.
2024-06-08 23:08:43 +02:00
nanahi 20bd4483b1 DOCS/contribute.md: require interface change begin with type
This makes interface changes appear sorted with the types of changes,
making it easier for users to find breaking changes among all changes.
2024-06-08 23:08:43 +02:00
Guido Cella 1a5edb1e49 stats.lua: remove print_perfdata_passes
22a8b99 introduced print_perfdata_passes as a stopgap until a dedicated
performance stats page would be implemented. Since it has been
implemented for many years, remove this option, which isn't even
documented, and is likely to make the stats overflow beyond the screen.
2024-06-08 23:07:17 +02:00
Kacper Michajłow 73e779a1ee stats.lua: add page 5 for currently selected tracks information 2024-06-08 23:06:22 +02:00
nanahi 6679ef003e stats.lua: make the append function increment index only on newline
To avoid a large append parameter refactoring is to make the append
function add the table index only if the newline character is not empty.
Otherwise, new strings are appended to the existing string.
2024-06-08 23:06:22 +02:00
Kacper Michajłow 94859997b8 sub: update codec info 2024-06-08 23:06:22 +02:00
nanahi f8f47d06f4 osc.lua: add option to use display fps for update interval
If the display fps is unavailable, use the tick_delay as a fallback.
2024-06-08 13:46:11 +02:00
nanahi fa525265b4 osc.lua: unify observe_property style 2024-06-08 13:46:11 +02:00
nanahi 6337bc27ff osc.lua: add option to make rendering smoother
OSC rendering used to be smooth (up to OSD rendering fps) before
48f906249e, but after that commit the
frame duration is hardcoded to 30 ms. This is too high and results in
choppy OSC rendering, which is very noticeable with the progress bar
while moving mouse over it or playing a short 60 fps video.

This makes the duration an option so that it can be decreased to make
OSC rendering smoother.
2024-06-08 13:46:11 +02:00
Misaki Kasumi c55ff4176c opengl: add --egl-output-format 2024-06-08 10:23:32 +02:00
Misaki Kasumi cd74f8f7c5 opengl: add --egl-config-id 2024-06-08 10:23:32 +02:00
Crend King fe709c986b vf_vapoursynth: add parameter to pass arbitrary string to script
Currently the vapoursynth video filter does not accept any argument for
passing arbitrary user data. This limits what the VS script can do.

Ideally, the vapoursynth filter has an user-data parameter that contain
string value. mpv passes that value to the VS script just like
container_fps and others. Once the VS script gets the data, it can do
all sorts of data extraction and transformation.

Another benefit is that instead of mpv always have to catch up to user
needs for this filter, with this users can just pass whatever needed
themselves, thus becomes more future-proof.

Fixes #14214
2024-06-08 03:13:41 +02:00
Guido CellaandKacper Michajłow dc998560aa options: add --osd-playlist-entry
Allow configuring whether to print the media-title, the filename or both
(as `<title> (<filename>)`) in show-text ${playlist}, the OSC playlist
and in the playlist selector.

Showing only titles hides information when files are badly tagged, or
when it hides the track numbers of album songs. But showing filenames is
not as useful as titles e.g. when playing URLs with media titles. This
option lets the user choose which one to show, or show both if switching
is inconvenient.

The OSC's playlist_media_title script-opt is removed because this option
is better since it works everywhere after configuring it once.

Closes #11653.

Also show the full URLs of playlist entries instead of their basenames
in osc.lua and select.lua, consistently with mp_property_playlist().

For simplicity, this just checks if entries contain :// instead of
replicating all of mp_is_url().

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2024-06-08 01:43:15 +02:00
Crend King d53aa6d3e2 DOCS/compile-windows.md: improve Windows build documentation
Currently the documentation for building on Windows, specifically the
"Native Compilation with Clang (Windows SDK Build)" route, could use a
few minor improvement to make the development onboarding experience more
smoothly.

Fixes #14214
2024-06-08 01:15:56 +02:00
Guido Cella 2becb971e9 console.lua: prettify unselected track log messages
After d49879f1f7 terminal escape sequences are printed in the console
log for unselected tracks. Remove them and make those lines grey.
2024-06-07 22:47:44 +02:00
Guido Cella 75645263dd select.lua: support extracting ytdl_hook subtitles
They don't work because they have EDL URLs, but we can attempt to
extract their real URLs.
2024-06-07 22:45:41 +02:00
Guido Cella 5657cd65b7 select.lua: hide the hour when it's 0
Omit the hour in the chapter and subtitle line selectors when the file
is shorter than an hour.
2024-06-07 22:45:41 +02:00
Guido Cella 8939bfc3ef select.lua: seek to the currect subtitle line when paused without video
Add an offset to sub seek correctly like in b35e34ae2f. The extra 0.01
offset apparently isn't necessary in this case.
2024-06-07 22:45:41 +02:00
Guido Cella 4059d1832b select.lua: preselect the correct sub line with duration >= 100 minutes
ffmpeg outputs timestamps like '100:00.00' in LRCs instead of adding
hours, and timestamps like '100:00' are < '10:00', so since these
strings are being compared, if there is no current subtitle line, there
are subtitle lines at >= 100 minutes, and time-pos is between 10 minutes
and 100 minutes, one of the last subtitle lines gets preselected.

Fix this by converting the timestamps to numbers before comparing them.

Also simplify the logic by merging the 2 loops to determine the default
line, and reformat the timestamps by adding hours to not print minutes >
60 in the selector, and by removing the hundredths of seconds. This
requires storing the accurate timestamps in a table to seek to them on
submit.
2024-06-07 22:45:41 +02:00
Guido CellaandKacper Michajłow d49879f1f7 loadfile: improve the format of terminal track information
Print vlang if present.

Make unselected tracks and editions grey instead of adding (+) before
selected tracks. Mark them with the same circles as show-text
${track-list} and script-message osc-tracklist when not outputting to a
TTY.

Don't print a different symbol with --sub-forced-events-only because
nobody uses this option, and subtitles are very unlikely to mix forced
and non-forced events.

Align 2-digit track IDs.

Align languages of up to 7 characters (the length of zh-Hans).

Leave spaces when a track has no language but at least another track
does to align the following track data with the other tracks.

Add a space between values and their units.

Convert Hz to kHz.

Pretty print FPS and kHz with mp_format_double().

Don't print images' FPS because it's just a bogus value taken from
--mf-fps.

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2024-06-07 22:24:25 +02:00
Kacper Michajłow 22aa570cf8 ci/mingw: install wine optionally 2024-06-07 21:12:38 +02:00
Kacper Michajłow 9f8b4b38c9 ci/mingw: use Ubuntu 24.04
This effectively bumps minimal MinGW-w64 requirement to v11.0.1. As it
is available in the latest Ubuntu LTS.

While at it clean installed packages list.
2024-06-07 21:12:38 +02:00
Kacper Michajłow 05e870f76b ci/msys2: compact build script 2024-06-07 21:12:38 +02:00
Kacper Michajłow de1c0b5464 ci/msys2: re-enable 32-bit builds
The 32-bit builds were disabled, because some packages started
disappearing. MSYS2 is slowly phasing out 32-bit support, but since we
still support it we have to test it somehow. Recent brakage with calling
convention mismatch would be spotted a lot quicker. So enable it, but
with some, not available, packages disabled.

This reverts a56d5c7fa1
2024-06-07 21:12:38 +02:00
Kacper Michajłow f47cbcd439 ci/mingw: don't run test on 32-bit binary
Ubuntu 24.04 linux-azure kernel, used on GHA, is compiled with
CONFIG_COMPAT_32BIT_TIME=n. This prevents running any 32-bit binaries
through wine, so disable tests when doing i686 build. 32-bit builds are
still tested on Windows.

See: https://github.com/actions/runner-images/issues/9977
2024-06-07 21:12:38 +02:00
Kacper Michajłow dea176a7bf hwdec_vaapi: suppress comparision warning
comparison of unsigned expression in '< 0' is always false
2024-06-07 21:12:38 +02:00
nanahi b2a4c0ce91 wayland_common: properly handle modifiers for keyboard enter keys
Wayland protocol only guarantees the delivery of modifier information after
the enter event. To handle it properly for keys pressed in the enter
event, save those keys for later processing in the modifier event.
2024-06-07 18:57:35 +00:00
Kacper Michajłow d59a606cbd meson: add -fno-trapping-math to default flags
It is safe to enable for mpv, we don't check or care about floating
point exceptions. Allow the compiler to ignore them too.
2024-06-07 20:12:40 +02:00
Kacper Michajłow 3f84969b21 meson: add -fno-signed-zeros to default flags
It is safe to enable. Even FFmpeg enables this by default.
https://github.com/FFmpeg/FFmpeg/blob/0415bb74c81ab0019e48bd2989ddf48d66918e9e/configure#L7521
2024-06-07 20:12:40 +02:00
Kacper Michajłow ac5d27fce5 ci/mingw: enable javascript support 2024-06-07 20:07:29 +02:00
UNIVPM-S1079707 b6d7f778b8 osc.lua: fix user configurable colors 2024-06-07 19:45:46 +02:00
Kacper Michajłow 8dd262ffa5 ra_d3d11: make cache header constant size regardless of the build
This makes cache entries compatible between 32-bit and 64-bit builds and
avoids issues with loading cache wrong.
2024-06-07 19:41:50 +02:00
Kacper Michajłow d7ceedbd99 ao_wasapi: don't limit the scope of execution context
May fix broken systems like #12145 or #14314. Probably won't change
anything, but it is the correct context to use anyway.
2024-06-07 19:41:28 +02:00
Kacper Michajłow 965809f108 w32_common: stop IME initialization timer after first try
It will be set again on first key press, but no need to call IME api
every 250ms until any key is pressed.
2024-06-07 19:41:15 +02:00
nanahi 31ae111ff5 default.js: handle canceled key bindings 2024-06-06 23:38:39 +03:00
nanahi eeb8e6e451 defaults.lua: handle canceled key bindings
There is a subtle behavior difference for built-in/input.conf key bindings
and key bindings registered by scripts: when a key binding is canceled
(e.g. a mouse button is bound to a command, is pressed down, and then
another key is pressed which is bound to another command), the command is
not invoked if the binding is built-in/input.conf, but is invoked if it's
registered by scripts, because it's handled with a different mechanism,
which gives no way for scripts to detect this.

Fix this by using the newly available canceled flag to detect this.
If a key binding is canceled, the callback is now not invoked unless
the key binding is registered with the complex option. In this situation,
the callback is invoked with the canceled state available so that scripts
can detect and handle this situation.
2024-06-06 23:38:39 +03:00
nanahi 5fcbe1c417 command: add canceled state to key-binding client message
This allows libmpv clients to know whether the key binding is canceled
and thus should normally be ignored.
2024-06-06 23:38:39 +03:00
nanahi de97cb0964 input: mark a command as canceled if it is explicitly dropped
In certain situations (including but not limited to begin window dragging),
it is desired to cancel the current command completely. However, commands
which have on_updown flag set require the command to be invoked in this
situation. There is currently no way to know if the command is triggered
normally or triggered because it is dropped.

This adds a canceled state to mp_cmd which indicates this.
2024-06-06 23:38:39 +03:00
Kacper Michajłow a8d95fd51a bstr: use memchr and memrchr for bstrchr and bstrrchr
May be faster to use optimized variants instead of simple loop.
2024-06-06 21:42:58 +02:00
Kacper Michajłow a32674bb29 terminal-win: use proper NTAPI callback for FLS
Fixes crash when FLS data is attempted to be cleared.

This affects only 32-bit build where the calling convention were not
matching the expected one. It has to be __stdcall in this case.

Fixes: 3372e17d
2024-06-06 21:42:12 +02:00
Kacper Michajłow 112fa549be DOCS/compile-windows.md: update Windows compilation documentation
General update. Removed MXE as it is not supported, doesn't support
libplacebo and in general it doesn't do anything useful which native
Meson cannot do already.
2024-06-05 19:17:49 +02:00
Kacper Michajłow 00cfe1e1fd common: clang supports __builtin_clz also in non-GNU modes 2024-06-05 19:16:35 +02:00
Kacper Michajłow 0fd3fe857c parse_commandline: fix incorrect win32 check 2024-06-05 19:16:35 +02:00
Kacper Michajłow 7258ca3247 misc/thread_tools: fix incorrect win32 check 2024-06-05 19:16:35 +02:00
Kacper Michajłow f394349066 ao_pcm: fix incorrect win32 check 2024-06-05 19:16:35 +02:00
Kacper Michajłow f40b569426 player/main: concat string at compile time 2024-06-05 19:16:35 +02:00
b0aa088bc4 sub/sd_ass: rewrite is_animated()
Using strchr should be faster as it is optimized for the job. Also
ensure that tags are not escaped and are within {} correctly. This also
is important for performance as it allows to scan only needed areas of
the string.

Co-authored-by: Avi Halachmi (:avih) <avihpit@yahoo.com>
Co-authored-by: rcombs <rcombs@rcombs.me>
2024-06-05 19:13:41 +02:00
Kacper Michajłow 0fd4c84a5e meson: clear flags used for build
Some were duplicated between GCC and Clange. Others were missing in
Clang case. Instead test all the flags and don't make assumptions that
will get invalid over time. Testing flags is almost free.
2024-06-05 19:07:58 +02:00
Kacper Michajłow b4683fd3d8 {x11_common,context_x11egl}: suppress Wundef warning 2024-06-05 19:07:58 +02:00
Kacper Michajłow b558b99f67 ao_pipewire: fix access to undefined byte order definitions
spa/param/audio/raw.h on FreeBSD accesses those, so defined them.
Probably should be fixed upstream, but to suppress warnings lets do it
locally.
2024-06-05 19:07:58 +02:00
Kacper Michajłow 8e4dcb15ce osdep/endian: add missing byte order defines 2024-06-05 19:07:58 +02:00
Kacper Michajłow 8657b20574 ao_coreaudio_chmap: fix shadowed variable 2024-06-05 19:07:58 +02:00
Kacper Michajłow 2e19420756 stream_cdda: suppress Wundef warning 2024-06-05 19:07:58 +02:00
Kacper Michajłow fc0d0f10eb fuzzers/common: add prototype for LLVMFuzzerTestOneInput
To suppress warning.
2024-06-05 19:07:58 +02:00
nanahi 16612672fd input: fix grammar errors and typo 2024-06-05 13:35:33 +00:00
nanahi 0509e5b2ed input: only begin VO dragging if the section allows
Otherwise, on sections which don't allow VO dragging, the mouse button
is force released and dragging events won't be generated.

Fixes: 349aac462e
2024-06-05 11:11:00 +02:00
Kacper Michajłow e7630722d8 autoload.lua: always accept current file as a valid file
This allows loading other types of media from the current directory,
with same_type=no, regardless of whether the current type is enabled for
autoload.

Fixes: #14287
2024-06-04 15:39:18 +02:00
Kacper Michajłow a64a5c2222 autoload.lua: match also image extension
For clarity, it is already matched if extention is in EXTENSIONS if
pl_count == 1.
2024-06-04 15:39:18 +02:00
Kacper Michajłow 8dcd5ea288 autoload.lua: cosmetic changes 2024-06-04 15:39:18 +02:00
Kacper Michajłow 7d4719704e autoload.lua: fix options update
The extensions list needs to be cleared in this case. Also, add the
missing split_patterns().
2024-06-04 15:39:18 +02:00
Dudemanguy fa89082f2e sub: avoid unneeded calls to is_animated
4e5d996c3a added this as part of a series
of patches written to avoid wasteful sub redraws when playing a still
image with subs. The is_animated special case was specifically for ASS
subtitles that have animations/effects and would need repeated redraws
in the still image case. This check was done unconditionally for all ASS
subtitles, but for very big ASS subtitles, this text parsing can get a
bit expensive.

Because this function call is only ever needed for the weird edge case
of ASS subtitles over a still image, some additional logic can be added
to avoid calling is_animated in the vast majority of cases. The animated
field in demux_packet can be changed to a tristate instead where -1
indicates "unknown" (the default state). In update_subtitle, we can look
at the current state of the video tracks and decide whether or not it is
neccesary to perform is_animated and pass that knowledge to sd_ass
before any subtitle packets are decoded and thus save us from doing this
potentially expensive call.
2024-06-04 12:29:13 +00:00
nanahi 7e82108bec input: reset doubleclick timer when dragging begins
This prevents doubleclick from activation if a second mouse click comes
quickly after a click which begins dragging.
2024-06-04 12:41:51 +02:00
nanahi 49b5e6d042 input: un-hardcode VO dragging
This adds the --input-builtin-dragging option, which allows the built-in
dragging behavior to be disabled. This allows scripts to implement custom
dragging behavior with left button down events and begin-vo-dragging
command, which could only be done for other mouse buttons before.
2024-06-04 12:41:51 +02:00
nanahi 349aac462e input: prevent MBTN_LEFT conflict with VO dragging
Currently, the built-in VO dragging conflicts with the MBTN_LEFT binding,
so the binding is activated even though the VO dragging begins. Fix this
by releasing the currently down command so that MBTN_LEFT can be bound to
a useful action (such as play/pause).
2024-06-04 12:41:51 +02:00
nanahi a6683ea3c9 input: implement VO dragging deadzone
This adds the --input-dragging-deadzone option, which adds a deadzone
for the built-in VO deagging. This prevents accidental VO dragging.
2024-06-04 12:41:51 +02:00
nanahi a23098b555 input: fix mouse position equality check
The stored mouse position mouse_vo_x/y are scaled (currently only for
vo_xv), but the position equality check compares between raw position
and scaled position.

Fix this by storing and checking the raw position instead. The raw
position is useful for the next commit.
2024-06-04 12:41:51 +02:00
nanahi 82c8a98884 input: begin VO dragging when moving mouse while left button is down
Will be used for the VO dragging deadzone.
2024-06-04 12:41:51 +02:00
nanahi 23d9c8dc6a DOCS/man/options.rst: remove DVD menu reference for --input-cursor
Not supported anymore.
2024-06-04 12:41:51 +02:00
Kacper Michajłow 0c716e762f test/meson: remove unneded sources 2024-06-03 19:18:06 +02:00
Kacper Michajłow 8f220067df ci/mingw: resolve pkgconfig deprecation warning in meson
pkgconfig is deprecated in favor of pkg-config. Define both for
compatibility with meson < 1.3.0.

https://mesonbuild.com/Release-notes-for-1-3-0.html#machine-files-pkgconfig-field-deprecated-and-replaced-by-pkgconfig
2024-06-03 19:18:06 +02:00
Kacper Michajłow bec3f606cf ci/mingw: run meson tests 2024-06-03 19:18:06 +02:00
Kacper Michajłow bb078b8303 ci/mingw: add exe_wrapper to cross file
Allows running complied binaries on build machine.
2024-06-03 19:18:06 +02:00
Kacper Michajłow 7e8c887873 ci/mingw: support encode mode 2024-06-03 19:18:06 +02:00
Kacper Michajłow edcc72ba02 ci/mingw: use ninja for cmake builds 2024-06-03 19:18:06 +02:00
Kacper Michajłow 4caca3e6c0 test/paths: skip normalize tests if pathcch library is not available
If pathcch is not available paths are not normalized on Windows.

Fixes tests on ancient mingw.
2024-06-03 19:18:06 +02:00
Kacper Michajłow 734846c123 test_utils: don't use subprocess for diffing test results
Helps with testing during cross-compilation and avoids external
dependency.

Output maybe is not that nice, but this output in our tests is not
useful anyway. We know if it changes it is beacuse one of the dependency
version changed.
2024-06-03 19:18:06 +02:00
Kacper Michajłow 09c359e1d3 test/libmpv_encode: print logs also during initialize 2024-06-03 19:18:06 +02:00
Kacper Michajłow 8a9901963d test/libmpv_encode: don't use mpv internals for test
mktemp is good enough for this test purposes and also tests if libmpv is
able to create a file that doesn't exist.
2024-06-03 19:18:06 +02:00
Kacper Michajłow d70a0b4494 player/playloop: remove now unused get_percent_pos() 2024-06-03 19:16:35 +02:00
Kacper Michajłow 37127276cc win32: quantize taskbar playback position into uint8 range
Also, if the position is valid, set it to 1 / INF. Windows interprets 0
as non-progress.

Progress is quantized into uint8 range, it is good enough for this
use-case. This avoids unnecessary vo_control and
ITaskbarList3::SetProgressValue calls and should be visually
indistinguishable in practice.

Fixes #14282
2024-06-03 19:16:35 +02:00
Kacper Michajłow d3b251bb99 Revert "d3d11: calc vsync interval on real stats, not just last interval"
The values provided since last disjoint event may include significant
error in case there are periods of slower presentation. We should look
at more localized/current values of presentation.

For more accurate approximation of vsync rate I plan to add better
algorithm to calculate it.

Revert this commit alone as it is not neccessary and gives as separation
from other changes for better regression testing.

This reverts commit f27767f59e.
2024-06-03 19:16:01 +02:00
Guido Cella e95af5b607 TOOLS/autoload.lua: fix directory_mode and ext options
Operations on option values need to be performed after they are read.

Fixes 843161d96e.
2024-06-03 15:25:51 +02:00
nanahi cfc651a805 osd: don't use get_percent_pos function
Use get_current_pos_ratio instead, and round the value to integer with
printf precision specifier.
2024-06-03 15:14:40 +02:00
nanahi b77c5168b4 command: simplify printing floats as integers
For this purpose, the printf precision specifier can be used.
No need to call lrint.
2024-06-03 15:14:40 +02:00
Guido Cella 9fa8101847 README: link to discussions 2024-06-02 22:53:49 +02:00
Guido Cella 525fa85932 osc.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella c5468ba5ff TOOLS/test-hooks.lua: fix lint warning 2024-06-02 22:26:00 +02:00
Guido Cella 3613070380 TOOLS/status-line.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella c28525ac9d TOOLS/osd-test.lua: fix lint warning 2024-06-02 22:26:00 +02:00
Guido Cella 1f356d6784 TOOLS/observe-all.lua: fix lint warning 2024-06-02 22:26:00 +02:00
Guido Cella 5977722adc TOOLS/nan-test.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella c12e437d43 TOOLS/cycle-deinterlace-pullup.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella f3f77353f2 TOOLS/command-test.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 843161d96e TOOLS/autoload.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 44d7100296 TOOLS/autodeint.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 142b75a95f TOOLS/autocrop.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella ee514c6acf TOOLS/ao-null-reload.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 62868beffe ytdl_hook.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella fe760f2b8a console.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Dudemanguy df166c1333 mpv.desktop: fix capitalization error
Missed in 481e498427
2024-06-01 15:08:59 -05:00
x9a 481e498427 mpv.desktop: add Arabic translation
Added Arabic translation for "Name", "GenericName", "Comment", and
"Keywords" entries in the .desktop file.
2024-05-30 12:54:44 +00:00
llyyr c2968244e4 TOOLS/gen-interface-changes: wrap long lines to 80 col 2024-05-29 17:48:50 +00:00
llyyr 7aaa7b221f input.conf: change 'u' binding to cycle between 'force' and default 2024-05-29 17:48:50 +00:00
llyyr de8bce33ed options: make sub-ass-override default to 'scale'
Previous commit changed the semantics of 'yes', so change the default to
scale to prevent unexpected user facing changes
2024-05-29 17:48:50 +00:00
llyyr f37691a156 options: move sub-ass-override 'scale' above 'force'
Also make it an enum for clarity

This is the right order in terms of both destructiveness and also the
total number of --sub-* options applied.
2024-05-29 17:48:50 +00:00
llyyr af7ab6f603 sd_ass: only set sub-scale for 'scale', 'force' or 'strip'
Currently we also set it for sub-ass-override=yes which is unintended
2024-05-29 17:48:50 +00:00
Dudemanguy 42181a8769 DOCS/input: clarify the difference between audio-pts and time-pos
In light of the changes in the recent commits.
2024-05-29 13:48:40 +00:00
Dudemanguy 5988473b76 player: replace get_current_time with get_playback_time in some spots
The problem with using get_current_time is that it can return negative
values. Interally in mpv, we need this but for some spots negative
values are not great. Since the previous commit enforced nonnegative
returns for get_playback_time, we can use that instead. The two areas
changed here are watch later configfile writing (clearly should always
be a positive number) and the time-pos property (negative numbers are
nonsense for users). This fully fixes #10346.
2024-05-29 13:48:40 +00:00
Dudemanguy d93f53b324 player/playloop: force get_playback_time to be at least 0
Except for MP_NOPTS_VALUE. We keep that as is. When this was originally
added in a73415584c, it appears like
having the time always start at 0 was the intent. In cases where
get_current_time returns a negative that isn't MP_NOPTS_VALUE, force
this to 0.
2024-05-29 13:48:40 +00:00
Dudemanguy 652036ba54 player: put speed adjustment back into playing_audio_pts
Effectively reverts 7051e94e4b. There's
been some confusion with how audio pts gets used internally in mpv which
leads to weird results. The crux of the problem is essentially that
playing_audio_pts can return negative numbers and in many places this is
not expected. This is the first step in trying to hopefully iron out all
the weird corner cases.
2024-05-29 13:48:40 +00:00
nanahi eaae9e9cf5 player/video: fix incorrect VO frame duration and frame drops
The logic in question was added in 201bef7ee1
for the VDPAU vsync frame timing algorithm, but after the code was moved
around for several times, it is now used for all VOs with non-display-sync
mode (where the video is synced to audio or system time). It nonetheless
likely never did whatever it was intended for.

This "correction" reduced the VO frame duration by the amount that the
frame is fallen behind the ideal time. Since a frame is presented between
pts (the ideal time for which the frame is scheduled) and pts + duration
(the end time for which frame drop is determined), and pts is already
computed from the current time and the deviation from the ideal time, this
"correction" causes the end time to have the deviation added twice, which
is nonsense: if the deviation is -0.5x the frame duration, the frame is
dropped, even though it should be displayed from now to 0.5x the frame
duration from now.

It was not noticed at that time probably because the VDPAU secret rabbit
code undid some of its damage, and the subsequent development focus on
display-sync modes resulted in negligence and simplification of audio mode
(e.g. b8bcf0f466), but the generic VO frame
drop algorithm has been observed to cause inconsistent frame drops with
this "correction": playing a 59.94 Hz video at 2x speed on a 60 Hz display
results in spending over half of the time dropping adjacent frames instead
of every other frames, visually causing stuttering, while it should only
happen briefly when the pts is very close to vsync time.

Fix this by deleting this logic, making the VO frame always having the
duration of the video frame.

Fixes: 201bef7ee1
2024-05-29 13:39:32 +00:00
Dudemanguy 52bdeb07a1 x11: correct position coordinates if mpv was launched with --fs
If mpv is launched with --fs, the x11 code tries to reset the size and
position of the window when the fullscreen exits. This has bad behavior
with multiple monitors because the saved nofsrc is not reliable in many
situations. Particularly if the window manager moves the fullscreen
window somewhere else while mpv is fullscreen. The result will be that
exiting fullscreen always goes back to screen 0.

Fix this by translating the rc coordinates of the nofsrc rc to the new
monitor when we're leaving fullscreen from an initial --fs case. By
giving get_current_display a specific rc, we can return what xrandr
display the coordinates are associated with and decide if the nofsrc
should be translated to its new location. After that bit of math, the
usual move/resize logic takes care of the rest but this time it actually
works off of the correct position. Fixes #14226.
2024-05-29 13:39:20 +00:00
llyyr 7ff6cf807c vo_vaapi: remove redundant function call
we already free video specifics when reconfiguring
2024-05-28 21:29:07 +02:00
llyyr 0aec73d1bf vo_vaapi: fix use-after-free when quitting
p->output_surfaces gets freed by destroy_frame when quitting
2024-05-28 21:29:07 +02:00
llyyr ff73aeb5c3 vo_vaapi: fix use-after-free of current frame
This was forgotten when switching vo_vaapi from using draw_image to
draw_frame API

Fixes: 0b70598358 ("vo: fully replace draw_image with draw_frame")
2024-05-28 21:29:07 +02:00
Guido Cella 15ea0d1987 console.lua: fix crash with set ;<Tab>
Fixes https://github.com/mpv-player/mpv/pull/14247#issuecomment-2134418206
2024-05-28 13:25:37 +00:00
nanahi 75f252c47c console.lua: fix crash if no completions exist
If complete is case-sensitive and no completions exist the script crashes
with the following:

Lua error: @console.lua:1417: attempt to concatenate local 'prefix'
(a nil value)
2024-05-28 13:24:16 +00:00
Misaki Kasumi ef026ffdb6 Revert "ao_pipewire: add EOF handling"
This reverts commit 3fc8929caf.
2024-05-28 13:23:17 +00:00
Misaki Kasumi 2938ed5942 Revert "ao_pipewire: wait for draining finishes before restart ao"
This reverts commit 88f20a7011.
2024-05-28 13:23:17 +00:00
Guido Cella 021c5dedb1 playloop: don't loop when seeking to the end of cover art while paused
Fix the bug that seeking to the end of cover art while paused goes back
to the beginning of the file because of this condition meant for videos.

This doesn't check mpctx->vo_chain->is_sparse because prevent_eof should
be true with actual sparse videos.
2024-05-26 14:23:57 +00:00
Misaki Kasumi 88f20a7011 ao_pipewire: wait for draining finishes before restart ao
When the stream is draining, setting stream to active has no effect.
2024-05-25 22:52:45 +02:00
Misaki Kasumi 3fc8929caf ao_pipewire: add EOF handling 2024-05-25 22:52:45 +02:00
Misaki Kasumi a3a9bc289a ao_avfoundation: use blocking ao_read_data 2024-05-25 22:52:45 +02:00
Misaki Kasumi eb996a13bc ao_avfoundation: add EOF handling 2024-05-25 22:52:45 +02:00
Misaki Kasumi aebe58203b ao: add ao_stop_streaming 2024-05-25 22:52:45 +02:00
Misaki Kasumi bfadd31957 ao: add eof, pad_silence, and blocking arguments for ao_read_data 2024-05-25 22:52:45 +02:00
Misaki Kasumi a791408659 ao_coreaudio: set ao->device_buffer base on hardware latency 2024-05-25 15:35:26 +02:00
maxdunbar 4e6d591f12 osxbundle: refactor Information Property List
Includes cleanup of CFBundleDocumentTypes, UTImportedTypeDeclarations,
LSItemContentTypes. Reordered general structure of the Property List as
in nodes/collections/arrays. Declared MIME types.
2024-05-25 15:28:52 +02:00
nanahi 2fa66b850d wayland_common: ignore unknown key states
Once https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/368
is merged and we upgrade wl_seat version to 10, compositors will also
generate "repeated" events, which mpv treats as key up right now.
Change the check so that unknown key states are ignored.
2024-05-24 17:57:55 +00:00
nanahi 0fcfbab9af wayland_common: handle pressed keys in keyboard_enter event
This is required by the wayland protocol to keep the logical keyboard
state consistent.
Quoting https://gitlab.freedesktop.org/wayland/wayland/-/commit/9e4f25692792df679660b390324842c19c0031a5:

> In the wl_keyboard logical state, this event sets the active surface to
> the surface argument and the keys currently logically down to the keys
> in the keys argument.
2024-05-24 17:57:55 +00:00
nanahi 43136b603a DOCS/man: replace legacy option syntax usage
They are replaced by --option=value.
2024-05-24 17:57:43 +00:00
Kacper Michajłow f652f38147 Revert "fuzzers/load: clear old temp files if they exist"
It is not a problem, so revert.

This reverts commit 06ec0319db.
2024-05-24 16:55:04 +02:00
Kacper Michajłow 7923a633a0 ad_spdif: check return value of av_parser_parse2 2024-05-22 22:13:54 +02:00
Kacper Michajłow 82ce07d640 ad_spdif: check for AC3 if parser fails to detect profile
c522d0dfbd added parser to avoid opening
decoder and left decoder only for DTS. Since then more audio codec needs
decoder, so open decoder always when it might be needed. Exclude only
AC3, other codec have profile to be extracted.

Fixes: c522d0dfbd
2024-05-22 22:13:54 +02:00
Kacper Michajłow 6eb0f4b27f ad_spdif: set codec params
It seems that we decode small portion of the audio to determine codec
params. We can remember that information.

Fixes: #14178
2024-05-22 22:13:54 +02:00
Dudemanguy 7b77672794 stream_lavf: don't add ffmpeg bluray or dvd protocols
The naming of these conflict with existing mpv protocols, so skip if we
get them. Users can still use them via lavf://bluray: or lavf://dvd: if
they wish.
2024-05-22 20:10:52 +00:00
Dudemanguy 056b03f9ed build: dynamically generate mpv.desktop file protocols
If we can run the built mpv binary, then it is possible to use a custom
target that reads the protocols we have available in mpv and write the
mpv.desktop file based on the output. For cases where this is not
possible (e.g. cross compiling), then just install the unmodified
mpv.desktop file like before. Fixes #8731 and fixes #14124.
2024-05-22 20:10:52 +00:00
Dudemanguy f921b64ed7 stream: implement get_protocols method for stream_lavf
Previously, all stream protocols were a static list in mpv. This is okay
for own builtin stuff, but for protocols that depend on ffmpeg it's not
so great. Support for certain protocols may or may not be enabled in a
user's ffmpeg and the protocol list that mpv generates should ideally
match this. Fix this by implementing a get_protocols method for
stream_lavf that will have different results depending on the ffmpeg mpv
is built against. We keep the safe and unsafe protocols separation. The
former is essentially a whitelist. Any protocol that is found in ffmpeg
but is not in the safe whitelist is considered unsafe. In the stream
list, ffmpeg is moved to the bottom so any possible protocols that are
added in the future don't automatically take precedence over any builtin
mpv ones.
2024-05-22 20:10:52 +00:00
Dudemanguy 406301f23d av_common: parent mp_get_lavf_demuxer contents to the list
The only usage of this function is freed in mpv's generic property code,
so no other changes are needed.
2024-05-22 20:10:52 +00:00
Dudemanguy 1e1e365c18 wayland: use wl->callback_surface for idle inhibitor creation
The idle inhibit protocol specifies that the compositor may ignore the
idle inhibitor if the surface is occluded. In the case of
vo_dmabuf_wayland, wl->surface corresponds to typical black bars when
the video aspect ratio is different than the display's. So in many
cases, wl->surface is actually occluded by wl->video_surface which sits
above it. Change this so that the idle inhibitor is created on
wl->callback_surface instead which is either wl->surface for the gpu VOs
or wl->video_surface for vo_dmabuf_wayland. Fixes #14206.
2024-05-22 14:08:01 +00:00
Kacper Michajłow 06ec0319db fuzzers/load: clear old temp files if they exist
They were previously left over, and now that it looks like runners are
stuck, the big question is: is /tmp persistent?

This commit will be reverted after the next rebuild.
2024-05-22 02:09:47 +02:00
qadzek 0dd6321c51 DOCS/man/console.rst: remove extraneous words 2024-05-21 16:02:03 +02:00
Kacper Michajłow 072d0ac836 mp_image: remove unneeded PL_HAVE_LIBDOVI check
This function is always available, if libplacebo is compiled without
libdovi it is no-op.
2024-05-21 11:23:29 +02:00
Kacper Michajłow e56054bc40 fuzzers: always return 0
While LibFuzzer supports rejecting unwanted inputs, it looks like
Honggfuzz treats anything other than 0 as fatal error.

https://llvm.org/docs/LibFuzzer.html#rejecting-unwanted-inputs
https://github.com/google/honggfuzz/blob/348a47213919f14b9453e89a663b1515369bd9a2/libhfuzz/persistent.c#L67
This LOG_F calls exit(EXIT_FAILURE)
2024-05-21 06:28:18 +02:00
Guido Cella 76ad8efe39 DOCS/options: --sub-scale-by-window doesn't affect ASS subtitles 2024-05-20 21:04:19 +02:00
Guido Cella 4bbaa4d0d0 ci/lint: only allow specific characters in subjects 2024-05-20 20:59:10 +02:00
Guido Cella 7c4e7d8c7b ci/lint: allow the first word after : to be an option with -- 2024-05-20 20:59:10 +02:00
Guido Cella 68a5490be2 ci/lint: only allow space instead of \s or \s+ 2024-05-20 20:59:10 +02:00
Kacper Michajłow 772b4fdde2 workflows/comment: more newline fixes to make formatting work 2024-05-20 19:48:18 +02:00
Kacper Michajłow 8fea10502e workflows/comment: add missing escape fix
It hid in local version on script.
2024-05-20 19:29:02 +02:00
der richter d4eff86330 ci/mac: silence unnecessary reinstall warnings 2024-05-20 18:53:01 +02:00
Kacper Michajłow c3bf2c72a6 select.lua: allow ffmpeg to print errors if it fails
Also don't print subprocess result to OSD, as it is not comprehensible.
2024-05-20 18:32:22 +02:00
nanahi 691a25de38 osc.lua: handle osd-scale-by-window runtime update
Allows the scale mode to be changed at runtime if vidscale is set to auto.
2024-05-20 18:29:44 +02:00
nanahi de371a579f stats.lua: handle osd-scale-by-window runtime update
Allows the scale mode to be changed at runtime if vidscale is set to auto.
2024-05-20 18:29:44 +02:00
nanahi 85b3a6e567 {stats,osc}.lua: respect --osd-scale-by-window by default
This lets these scripts scale the elements with OSD by default.
2024-05-20 18:29:44 +02:00
nanahi 1f29d037a0 stats.lua: add add auto value to vidscale option
This adds auto to vidscale script option, which lets the scale be
inherited from OSD --osd-scale-by-window option.
2024-05-20 18:29:44 +02:00
nanahi 0c74199a8f osc.lua: add auto value to vidscale option
This adds auto to vidscale script option, which lets the scale be
inherited from OSD --osd-scale-by-window option.
2024-05-20 18:29:44 +02:00
nanahi e61911c513 DOCS/man/options.rst: recommend --osd-scale-by-window for UI scale
This recommends querying the value of this option when drawing UI elements.
This allows a greater level of consistency by using a single flag which
already controls the scaling behavior of the OSD to control the behavior
of all scripts.

Also fix a capitalization nearby.
2024-05-20 18:29:44 +02:00
Kacper Michajłow b11f236eb9 meson: limit concurrent link jobs to 16
Statically linking, especially with LTO can use a lot of memory. Limit
to 16 jobs by default, which is more than enough. Only fuzzers are
affected as we don't produce that much binaries otherwise.
2024-05-20 18:25:05 +02:00
Misaki Kasumi 4d03efb4b0 ao: don't call driver->set_paused after reset
This commit adds a state `hw_paused` for pull-based AO.
`driver->set_paused(false)` is only called if `hw_paused` is true.
`hw_paused` is cleared after `ao_reset`, so `set_paused` will
not be called after a reset; instead, `driver->start()` will
be called, which properly starts the AO.
2024-05-20 18:22:31 +02:00
Kacper Michajłow d31543a7e6 osdep/path-win: fix leak of portable_path 2024-05-20 18:18:42 +02:00
Kacper Michajłow 9ffbc1eef9 osdep/io: fix leak of environment strings on win32 2024-05-20 18:18:42 +02:00
nanahi 4ad1fa28b4 DOCS/interface-changes.rst: document loadfile breaking change 2024-05-20 18:07:38 +02:00
nanahi 8143779e24 DOCS/man/input.rst: document breaking change of loadfile index argument
As an instance of "extraordinary circumstances", such incompatibility
must be extensively documented.
2024-05-20 18:07:38 +02:00
nanahi d890f369df DOCS/man: note that default autoprobe order is unrealiable
The default values for --ao, --vo, --gpu-api, --gpu-context change from
time to time, but some libmpv clients rely on the existing autoprobe order
and breaks as a result when the value changes. This specifies that the
default autoprobe order should not be relied upon.
2024-05-20 18:07:38 +02:00
nanahi 46dbaff961 DOCS/compatibility.rst: add requirement when changing default values
Documented default values are relied upon by scripts, so changing these
values can casuse incompatible changes. This makes documenting them
required.
2024-05-20 18:07:38 +02:00
nanahi eb38c3cb87 DOCS/compatibility.rst: add provision for dealing with severe breakages
Currently there is no policy on what should be done when an immediate,
severe breakage happens for "important/often used parts", which can cause
serious concerns especially if such changes remain obscured.

This adds a provision for this kind of incompatible changes under
"extraordinary circumstances", which allows for the breaking change to happen
if there is a critical reason to do so. Such changes must be extensively
documented, and should be avoided as much as possible.
2024-05-20 18:07:38 +02:00
nanahi c489f34060 DOCS/compatibility.rst: require more details about breaking changes
Currently incompatible changes are not clearly outlined in the related
documentations, such as interface-changes.rst. The impacts and suggested
actions to address the compatibility concerns also rarely exist.

This adds a requirement to include these information for incompatible
changes, so that such changes are clearly conveyed to the users, with
suggested actions to minimize the impacts of such changes.
2024-05-20 18:07:38 +02:00
nanahi c5c68333e9 DOCS/compatibility.rst: fix formatting 2024-05-20 18:07:38 +02:00
Kacper Michajłow b03fa20015 ci: save cache also on failures
This makes rebuilds after build failures significantly faster. There is
no reason to discard newly acquired ccache entries.
2024-05-20 18:06:35 +02:00
rcombs 843259ad0f playloop: don't redraw without subs on quit
handle_osd_redraw is called while we're in the middle of the cleanup portion
of play_current_file (via kill_demuxers_reentrant and mp_idle). This happens
after we've torn down the subtitle track, so we end up requesting a redraw
from the vo, which results in a 1-frame flash of the video without subs
before we either quit or switch to the next file (or the force-window state).
This detects that condition and skips the redraw, without interfering with
drawing the osd during idle (eg for pseudo-gui mode).
2024-05-20 18:05:38 +02:00
Kacper Michajłow 7924afcba0 workflows/cleanup_caches: minor cosmetic changes 2024-05-20 18:04:54 +02:00
Kacper Michajłow 2697a8c362 workflows/comment: refactor comment workflow to not use github-script
It is not actively maintained, third-party, javascript wrapper for GitHub
API. The v7 version has issues and most importantly, we don't need a
JavaScript interface to create a comment. Use the first-party CLI tool
and jq.

Sort artifacts by name while at it.
2024-05-20 18:04:54 +02:00
Guido Cella d3800a67fc console.lua: fix completing change-list ao/vo/gpu-context remove
The value of list options is a table not just for vf and af but for all
object settings lists. Extract just the names from the tables returned
when retrieving these options.
2024-05-20 17:58:28 +02:00
Guido Cella 3f83671f20 input: prioritize builtin bindings matching longer key sequences
This fixes 2 different bugs:

- mp.add_key_binding('c', ...) taking priority over the builtin g-c
  binding.

This follows up 994a08f5a7 which fixed this within the same input
section. This fixes it across different input sections.

- mp.add_key_binding('g-c', ...) not taking priority over a c binding
  defined in input.conf.

This happened because is_builtin of bindings added with
mp.add_key_binding is true though they're not actually builtin.
2024-05-20 17:57:12 +02:00
Guido Cella 5e65999eb2 console.lua: fix the max log lines calculation 2024-05-20 17:56:42 +02:00
Guido Cella daba15b272 stats.lua: prevent freeze in certain cases with vidscale=no
If using --script-opts=stats-vidscale=no, until osd-height changes from
0 to the correct value, stats.lua's text sizes are multiplied by a scale
of 720, which with the default font size results in a font size of 5760.
Depending on the order of operations, if the stats are drawn at this
size before osd-height is updated, mpv freezes. I get this with
--input-commands=script-message-to stats display-stats-toggle in
conditional profiles, e.g.:

mpv --script-opts=stats-vidscale=no --include=<(echo $'[test]\nprofile-cond=true\ninput-commands=script-message-to stats display-stats-toggle') av://lavfi:testsrc

Fix this by setting a scale to 1 until osd-height is updated to the
correct value.
2024-05-20 17:56:17 +02:00
Guido Cella 657ad9db00 console.lua: use all available lines for selection
Refine populate_log_with_matches()'s logic to not reserve 2 lines for "n
hidden items" when it is not necessary. This avoids printing "1 hidden
items", and doesn't leave an empty line when there are hidden items only
in one direction.
2024-05-20 17:55:36 +02:00
Guido Cella b82d437ea4 select.lua: strip trailing zeros from FPS values
Show e.g. "30 fps" instead of "30.000 fps".

Also switch to %.4f for consistency with pretty_print_double().
2024-05-20 17:54:57 +02:00
Guido Cella 78b2de677b select.lua: handle sub-start being earlier than ffmpeg's timestamps 2024-05-20 17:54:40 +02:00
Guido Cella 8f596b44be select.lua: don't needlessly initialize default_item 2024-05-20 17:54:40 +02:00
Guido Cella 99fd55ad75 select.lua: preselect the previous sub line without a current line 2024-05-20 17:54:40 +02:00
Guido Cella ce2f501c23 select.lua: fix preselecting the current subtitle line
Fixes 4d32db21c5.
2024-05-20 17:54:40 +02:00
nanahi 07e5d69351 console.lua: add nonrepeatable prefix to command_prefixes 2024-05-20 17:47:01 +02:00
nanahi bc5863a631 input/cmd: add nonrepeatable prefix
This allows forcing certain commands to be non-repeatable, e.g. volume.
2024-05-20 17:47:01 +02:00
Kacper Michajłow e6e0aaa6c6 ad_spdif: add missing codec_desc initialization 2024-05-19 22:09:13 +02:00
Kacper Michajłow 0c85b9915f ci/cleanup_caches: group by cache prefixes too
I've simplified this too much during refactoring, forgot about this. We
need to preserve the latest cache with each prefix.

Fixes: c6b950ae1e
2024-05-19 21:34:37 +02:00
Kacper Michajłow c6b950ae1e ci: clear old caches to avoid master branch cache trashing
GitHub cache action doesn't allow updating cache with the same key. We
workaround this by saving the cache with a unique key each time (added
timestamp). This works fine, but since there is a limit on cumulative
storage size for all caches, it can force the master branch cache to be
evicted if a lot of PRs are updated. Cache is evicted with LRU policy,
so as long as master branch cache is used it should stay alive, but it
can happen that only PR specifc caches were only used. As a reminder,
PRs can access the master cache, but they are isolated from each other.
Because of this, it is important to keep the master cache, which is
available to all, alive longer.

The solution is to remove all old caches per branch. This is done in a
separate workflow that validates all cache items and removes ones that
would never be used anyway. If PR is closed all caches per branch are
removed. In other cases most recently used one is preserved.

It is done in a separate workflow to limit cache manipulation access.
GitHub workflows triggered by pull_request event are run in the context
of the fork and does not have access to our token, which is good thing.
Also it is quite awkward to get PR number which triggered build
workflow, so just do a full cleanup pass.
2024-05-19 20:35:34 +02:00
Kacper Michajłow a16f653eb5 msg: clear status line only if needed 2024-05-19 19:10:58 +02:00
Kacper Michajłow 895dd9e4e2 msg: split mp_msg_flush_status_line into private and public variant 2024-05-19 19:10:58 +02:00
Kacper Michajłow 243c1d6d91 msg: check target stream before printing
After f18ce7eca0 status is not always
printed to stderr.
2024-05-19 19:10:58 +02:00
Kacper Michajłow 0988ac85b5 ci: don't pin Ubuntu version where it doesn't matter
Use ubuntu-latest for all jobs that uses container under the hood
anyway, exact Ubuntu version does not matter, so use latest stable one.
2024-05-19 19:10:19 +02:00
Kacper Michajłow 29388538f3 ci/mingw: clean installed packages 2024-05-19 19:10:19 +02:00
Kacper Michajłow f2f62c5436 ci/mingw: use meson for libass build 2024-05-19 19:10:19 +02:00
Kacper Michajłow 0f93a6934f ci/mingw: remove non-existent cmake option 2024-05-19 19:10:19 +02:00
Dudemanguy 2c68e6cb1f wayland: also log version numbers with protocol interface names
Might be useful for debugging.
2024-05-19 00:05:48 +00:00
Kacper Michajłow 875378ff01 ci/win32: override link args only for the target that needs them
Fixes compilation after USE_GAS related fixes upstream. It links
asm_offset.exe, which shouldn't use a .def file.

Fixes: 0125d35954
2024-05-19 01:29:14 +02:00
Kacper Michajłow 0125d35954 ci/win32: add Vulkan-Loader
vulkan-1.dll is packaged, but is not neccessary in most cases where
Vulkan Loader is already instaled by GPU driver.
2024-05-18 23:22:18 +02:00
Kacper Michajłow 89ed75e63e meson: assume vkCreateDisplayPlaneSurfaceKHR is available when internal
When Vulkan loader is build internally, let's assume it is available.
2024-05-18 23:22:18 +02:00
Kacper Michajłow 2b4c64e321 ci/win32: build shaderc
Instead of linking binary blobs, build everything ourselves.
2024-05-18 23:22:18 +02:00
Kacper Michajłow 85db6a9f15 ci/win32: use ccache 2024-05-18 23:22:18 +02:00
Kacper Michajłow a0195d335d ci/win32: enable all available projects from meson's wrapdb
Rubber Band is disabled because it pulls more dependencies and it is not
worth build. Might be reconsidered later.
2024-05-18 23:22:18 +02:00
Kacper Michajłow 58d9f565c4 ci/win32: add spirv-cross 2024-05-18 23:22:18 +02:00
Kacper Michajłow 8c4b081da9 ci/win32: add shaderc
Use pre-built binaries to reduce CI build time.
2024-05-18 23:22:18 +02:00
Kacper Michajłow 281c66a815 ci/win32: remove Strawberry Perl from path
It provides broken tools like diff, patch.

Also fix PATH in test stage
2024-05-18 23:22:18 +02:00
der richter 541e00fcdb github/issue_template: ask for possible sample files on feature request 2024-05-17 20:30:43 +02:00
der richter ae894d9b9b github/issue_template: rework system info section and provide commands 2024-05-17 20:30:43 +02:00
der richter 247eac729c github/issue_template: move mpv information into its own section 2024-05-17 20:30:43 +02:00
der richter ea66507dd1 github/issue_template: add information on how to create backtraces 2024-05-17 20:30:43 +02:00
der richter 3058028168 github/issue_template: mention (nightly) builds and packages for testing
mention our windows and macOS nightly builds and also link to our mpv.io
installation page.
2024-05-17 20:30:43 +02:00
der richter e9c98c1f2f github/issue_template: reword file upload instruction 2024-05-17 20:30:43 +02:00
der richter 9f2590b6d1 github/issue_template: reword log file instructions 2024-05-17 20:30:43 +02:00
der richter 704863a016 github/issue_template: be more specific about performance-related issues 2024-05-17 20:30:43 +02:00
der richter 2a68a6cd9e github/issue_template: add checkboxes as instruction check 2024-05-17 20:30:43 +02:00
der richter d4d5fa0084 github/issue_template: rework issue templates with github forms 2024-05-17 20:30:43 +02:00
der richter 7fd305d4ea github/issue_template: mention github Discussions for questions 2024-05-17 20:30:43 +02:00
Dudemanguy 47f60d1c52 wayland: cap xdg_wm_base at 4 if wm_capabilities aren't supported
Fixes #13986.
2024-05-16 16:23:18 +00:00
Dudemanguy d59f4fd3ec Revert "player: do not exit when a seek gets queued"
In various edge cases, this causes an assertion that was added later in
8816e1117e to be hit. The actual purpose
of the special case is not really clear. mp_seek already will change the
mpctx->stop_play value, so there shouldn't be any need to do it in
queue_seek. And it is known to cause problems so revert it. Also, remove
the special play direction logic that works around this behavior.
Fixes #13778.

This reverts commit dbdc46c97a.
2024-05-16 13:26:34 +00:00
sfan5 03ca340835 stream: remove directory playlist hint
The stream layer is the wrong place to handle this and the benefit
seems dubious.
2024-05-15 22:45:18 +02:00
sfan5 553fb024d4 stream: check file descriptor passed to fd:// or fdclose:// 2024-05-15 22:45:18 +02:00
sfan5 54c755b08d various: add missing checks for directory streams
All of this code opens a stream and expects to read stuff from a file.
But streams can also be directories and that has to be handled.
2024-05-15 22:45:18 +02:00
sfan5 b69b58a12a {options,player}: fix stream leaks 2024-05-15 22:45:18 +02:00
sfan5 ae23556b6f stream: disallow reading or writing to directories
Reading an entire file is a common operation, meanwhile
stream_file will happily open a directory. This doesn't match well.

Analogously for open_output_stream().
2024-05-15 22:45:18 +02:00
Kacper Michajłow 7a93a584fc fuzzer: add dedicated fuzzers for each demuxer
This will help drill deeper into specific code.
2024-05-15 20:09:54 +02:00
Kacper Michajłow 6ede789092 fuzzer_load: use memfd_create instead of real file
Should be slightly faster. Also fixes leaking temporary file on errors.
2024-05-15 20:09:54 +02:00
Kacper Michajłow 3c26389312 fuzzer_load: merge file and config load into one file
Removes code duplication. Add missing unlink while at it.
2024-05-15 20:09:54 +02:00
Kacper Michajłow fd1c13f9b3 fuzzers: don't build binaries for disabled protocols
While there is a merit to test if disabled protocols doesn't crash or
something, such test can be made as simple unit tests, no fuzzing needed.
2024-05-15 20:09:54 +02:00
Kacper Michajłow 1f7c223749 av_common: fix integer overflow when adjusting timebase
Found by OSS-Fuzz.
2024-05-15 01:25:18 +02:00
Guido Cella 4d32db21c5 select.lua: strip brackets in select-subtitle-line 2024-05-13 16:36:27 +02:00
Guido Cella 61f72bd512 select.lua: add this script
This adds script messages to select playlist entries, tracks, chapters,
subtitle lines, bindings and properties using the newly introduced
mp.input.select().

This fully closes #13964.
2024-05-12 23:13:48 +02:00
Guido Cella 367a6b561a console.lua: close when pressing enter with input.select
When you select an item, due to the submit handler being called
asynchronously, the default item list is redrawn before the console
closes, which is jarring. Fix this by always closing the console as soon
as enter is pressed, as keeping it open is unlikely to be useful with a
fuzzy selector (unlike with input.get() where it can be used e.g. to
implement a Lua REPL). If desired we can later add a close_on_submit
flag defaulting to true.

Also fix a crash when pressing enter without any match.
2024-05-12 23:13:48 +02:00
Guido Cella 30fd3c1a96 console.lua: fix ctrl+f and ctrl+b keybindings
With mp.input.select() these keybindings were both scrolling and moving
the cursor because of how the condition was written and
handle_pgup()/handle_pgdown() not returning a truthy value.
2024-05-12 23:13:48 +02:00
Guido Cella 1ebe11d06f console.lua: don't crash when scrolling without matches
selected_match can become 0 when pressing certain scrolling
keybindings without any match, and

for i = first_match_to_print, last_match_to_print do

in populate_log_with_matches() runs from 0 to 0 and accessing
matches[0].text crashes console.lua. Return early when it is 0.
2024-05-12 23:13:48 +02:00
Guido Cella 9d75289ced console.lua: truncate lines longer than the maximum width
Avoid messing up the max_log_lines calculation when mp.input.select() is
called with very long items.

This doesn't work with Japanese characters because they are bigger.
2024-05-12 23:13:48 +02:00
Guido Cella eb4c6be630 console.lua: don't convert integers for mp.input to string
I misunderstood CogentRedTester's review in
https://github.com/mpv-player/mpv/pull/10282#discussion_r1428972352 as
referring to the cursor_position in mp.input's arguments instead of the
one received by the closed callback.

The cursor_position passed to input.get doesn't need to be converted to
a number because it was already JSON, while the cursor_position received
by the closed callback is currently a string, and we need to pass JSON
in input-event script messages to keep it as an integer to work around
mpv converting integer script message arguments to string.

This is more noticeable after implementing mp.input.select(): its submit
argument currently receives the selected index as a string, and this
makes Lua error if you use it as an index of a numerical table, e.g.:

submit = function (id)
    mp.set_property(property, tracks[tonumber(id)].selected and "no"
                              or tracks[tonumber(id)].id)
    ...
end,

This commit avoids having to call tonumber(id).
2024-05-12 23:13:48 +02:00
Guido Cella 994a08f5a7 input: fix builtin sequence bindings
If g-p is a builtin binding and p is bound in input.conf, pressing g-p
triggers the p binding. Fix this by searching for builtin bindings that
match a longer key sequence even after a user-defined binding has been
found.

Even after changing the condition from >= to > bindings of the same key
defined later in input.conf are still preferred over earlier ones,
because bind_keys() overwrites duplicate bindings. Bindings defined by
later mp.add_key_binding calls are also still preferred.
2024-05-12 23:13:48 +02:00
Guido Cella e6af31dc0c console.lua: implement a command parser to complete more things
This allows more completions than patterns:

Both single and double quotes are recognized.
Quotes around the first token are recognized.
Command prefixes are recognized.
Choice options are completed after change-list/vf/af add/append/pre/set.
File paths are completed after set/cycle-values/change-list with options
that expect files, including cycling between paths with spaces, e.g.
cycle-values glsl-shaders 'foo bar' 'baz qux'.
File paths are completed in the fourth argument of dump-cache.
Items that have been set are completed after change-list remove.
2024-05-12 22:29:40 +02:00
Guido Cella c4b03700e1 player: add option-info/<name>/expects-file
This will allow console.lua to complete files after e.g. set
glsl-shaders <Tab>.
2024-05-12 22:29:40 +02:00
Guido Cella 4e5845ad03 osc.lua: remove scaleforcedwindow
This is unused since 4e013afd37 because the mpv logo and the "Drop files
or URLs to play here." message are shown instead of the OSC controls. It
has the adverse affect of making the OSC twice as big when playing
videos with --lavfi-complex, because that makes the video property which
osc.lua checks unavailable.
2024-05-12 21:00:38 +02:00
Kacper Michajłow f220f0fb89 autocrop.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow e5e17c80ba ytdl_hook.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow f348a8b303 stats.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow 8fa0e09b27 osc.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow e17546333a options.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow fe488151dc defaults.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow 5e77d3b640 console.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow 1831c548db auto_profiles.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow c5c5a5a2ad test-hooks.lua: fix variable shadowing warning 2024-05-12 20:06:39 +02:00
Kacper Michajłow c431b532b8 status-line.lua: fix unused variable warning 2024-05-12 20:06:39 +02:00
Kacper Michajłow 0f7aab534a skip-logo.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow 885cc30596 pause-when-minimize.lua: fix unused variable warning 2024-05-12 20:06:39 +02:00
Kacper Michajłow b927857d03 ontop-playback.lua: fix unused variable warning 2024-05-12 20:06:39 +02:00
Kacper Michajłow 50c4b2cd4c observe-all.lua: fix some lint warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow 16c19445bc cycle-deinterlace-pullup.lua: fix unused variable warnings 2024-05-12 20:06:39 +02:00
Kacper Michajłow e47d768d51 command-test.lua: fix some lint warnings
Fixes unused variable warnings.
2024-05-12 20:06:39 +02:00
Kacper Michajłow a1caa00187 autoload.lua: fix some lint warnings
Fixes:

autoload.lua:201:1: setting undefined field filter of global table
autoload.lua:209:1: setting undefined field append of global table
autoload.lua:322:11: value assigned to variable extensions is unused
2024-05-12 20:06:39 +02:00
Kacper Michajłow b4fcf7d248 autodeint.lua: fix some lint warnings
Fixes:

autodeint.lua:90:1: right side of assignment has more values than left
side expects
2024-05-12 20:06:39 +02:00
Kacper Michajłow fabc92453f audio-hotplug-test.lua: fix some lint warnings
Fixes:

audio-hotplug-test.lua:1:7: unused variable utils
audio-hotplug-test.lua:3:61: unused argument name
audio-hotplug-test.lua:5:9: unused loop variable index
2024-05-12 20:06:39 +02:00
Kacper Michajłow 71d9c31394 acompressor.lua: break long lines 2024-05-12 20:06:39 +02:00
Kacper Michajłow 0084fbd458 github/workflows: add lua linting 2024-05-12 20:06:39 +02:00
sfan5 a33fd3b4cf Revert "stream: don't try to read from all-sparse/no-data files"
The stream layer is just not the right place to make this change
since it's also used for completely unrelated purposes such as reading
configs.

This reverts commit bb7a485c09.
2024-05-12 18:06:21 +02:00
Kacper Michajłow 21e167cc6a vf_vapoursynth: pass image properties from input
This might not always be correct depending on filtering done in VS. But
unless VS send us all the metadata we have to get it from somewhere.

Fixes dynamic frame metadata, which was copied from fmt_in, initialized
only upon reinitialization.

Fixes crashes caused by the use of stale pointers.

Fixes: #13956
2024-05-12 17:56:53 +02:00
Kacper Michajłow 83e51a82e6 vf_vapoursynth: fix _ChromaLocation 2024-05-12 17:56:53 +02:00
Kacper Michajłow 3874145248 hwdec_cuda_vk: add missing io.h include
Fixes compilation on Windows with cuda enabled.
2024-05-11 21:34:24 +02:00
Kacper Michajłow 552c4552a2 audio: report EOF also for untimed AO mode 2024-05-10 23:56:56 +02:00
Guido Cella aa067f5984 console.lua: increase margins from the bottom-left corner
console.lua is too close to the left and bottom of the OSD IMO. Make the
margins a bit bigger.
2024-05-10 22:57:44 +02:00
Kacper Michajłow f17ad792c6 vo_gpu_next: check if existing cache file has correct size 2024-05-10 22:54:25 +02:00
Guido Cella 1f69659a77 test: test mp_guess_lang_from_filename with [] and () 2024-05-10 22:54:12 +02:00
Kacper Michajłow d79aef1425 meson: add link flags also to cpp
If subprojects are used, linking language of mpv might be upgraded to C++
add our flags there too.
2024-05-10 21:42:10 +02:00
Kacper Michajłow 0d18c1bfdc audio: change bps format to int64_t
Same as ffmpeg uses. Such big values does not make sense probably, but
let's not overflow values and maybe one day it will be useful.

Fixes signed integer overflow.
2024-05-10 05:16:27 +02:00
Kacper Michajłow c1d5f0e9c8 fuzzers: set network-timeout to 1 second
We don't expect any data to actually access, so timeout as soon as
possible.
2024-05-10 04:15:10 +02:00
Kacper Michajłow aa3cf6d57b command: add dolby-vision-profile and dolby-vision-level to track-list 2024-05-10 01:26:30 +02:00
Kacper Michajłow c83c273400 demux_mkv: inject AV_PKT_DATA_DOVI_CONF to demuxed packets 2024-05-10 01:26:30 +02:00
Kacper Michajłow a094971ce8 demux_mkv: demux Block Additional Mappings
Parse Dolby Vision configuration.
2024-05-10 01:26:30 +02:00
Guido Cella 63d820bd68 test: test mp_guess_lang_from_filename() 2024-05-10 01:22:31 +02:00
Guido Cella 20b8fe05bf misc/language: move mp_guess_lang_from_filename() here 2024-05-10 01:22:31 +02:00
Guido Cella dffc37dcfa external_files: detect language tags with hyphens
This loads subtitle files like foo.en-US.srt with --sub-auto=exact.

To preserve the case of these locales and not convert them to e.g.
en-us, stop lower casing filenames, and instead use case insensitive
functions to check if the media filename is contained in the external
filenames. Extensions, whitelisted cover art filenames and idx files
were already being compared case insensitively.

Fixes #12372, fixes #13251.
2024-05-10 01:22:31 +02:00
Guido Cella e451d9c21b external_files: rename variables in guess_lang_from_filename() 2024-05-10 01:22:31 +02:00
Kacper Michajłow e175b3f685 lcms: check for null arg in gl_parse_3dlut_size
This fixes `icc-3dlut-size` validation in config which would crash if
set without argument.

Found by OSS-Fuzz.
2024-05-09 21:21:40 +02:00
Kacper Michajłow 4fe67933c2 misc/language: store string length instead of null terminator
Allows to construct bstr directly without strlen, while keeping language
table the same size.
2024-05-09 17:12:55 +02:00
Kacper Michajłow 5009e13431 player/loadfile: match language and subcodes 2024-05-09 17:12:55 +02:00
Kacper Michajłow 40ba63405f Revert "misc: add language-matching utilities"
This reverts commit 8c8d97c26c.
2024-05-09 17:12:55 +02:00
Kacper Michajłow 65c71b1643 Revert "loadfile: use mp_match_lang_single"
This reverts commit 76009bf7a6.
2024-05-09 17:12:55 +02:00
Kacper Michajłow b7216d5d03 Revert "loadfile: compute audio lang for sub selection when using lavfi-complex"
This reverts commit 9e6c6c0897.
2024-05-09 17:12:55 +02:00
Kacper Michajłow bf6d49cbd4 fuzzer_loadfile_direct: exclude paths also for file://
Loading external files makes little sense. Might disable this completely
later, but let see how it works, The idea is the same as for direct
load. Exclude paths starting with `file://.` and `file:///`. But still
fuzz any processing that other input might have. It shouldn't be a huge
problem if we do `file://mpv` for example. Not great, but also not
terrible.
2024-05-09 02:01:24 +02:00
Kacper Michajłow d6803c4518 demux_edl: make protocol comparison case insensitive
Else nested edl protocol causes infinite recursion, when loading.

Found by OSS-Fuzz.
2024-05-08 18:52:40 +02:00
Kacper Michajłow 49cb039b8c fuzzer_set_property: fix for other types than string
I tested with string version, oops.
2024-05-08 18:52:40 +02:00
Kacper Michajłow 325abfeed7 dmabuf: fix warnings on 320-bit build 2024-05-08 18:52:40 +02:00
Kacper Michajłow aa9cc72199 filter/vf_gpu_vulkan: fix Vulkan handle type 2024-05-08 18:52:40 +02:00
Kacper Michajłow 111d90d9e5 player/client: fix typo in description of MPV_ERROR_UNINITIALIZED 2024-05-08 18:52:40 +02:00
Kacper Michajłow e1d1eb7ace fuzzers: add fuzzer for config parsers 2024-05-08 18:52:40 +02:00
nanahi 467c1e860a Revert "ao: in ao_play_data, wakeup core for untimed AO as well"
This problem does not exist with --demuxer=lavf. --demuxer=mkv just never
signals EOF for the problematic sample, so it needs to be fixed there, not
in AO.

This reverts commit 0cfd52074b.
2024-05-08 11:14:01 +02:00
Misaki Kasumi 0cfd52074b ao: in ao_play_data, wakeup core for untimed AO as well 2024-05-08 03:12:28 +02:00
Christoph Heinrich e166ae0ed8 af_scaletempo: optimize overlap search
scaletempo2 has this optimization where it first uses a step size of 5
together with a quadratic interpolation to quickly get the approximate
position of the best overlap and then does a more thorough search aroun
that area.

Doing the same thing in scaletempo brought a 4.8x performance
improvement, however in my measurements a step size of 3 more
consistently finds good overlaps and it's still a 2.9x improvement for
this function.
I should note that while a step size of 3 produced better numbers,
I was not actually able to hear any difference in my test.

A step size of 3 was chosen just in case it actually makes an audible
difference in some cases and the cpu usage isn't really a problem
anymore, but that can be revisited in the future.

scaletempo2 is still faster then scaletempo with a step size of 5,
which I suspect is mostly because it uses some vectorized functions and
scaletempo does not.
2024-05-07 23:32:55 +02:00
Christoph Heinrich 18ed9e105a af_scaletempo: use taxicab distance for offset search
Cross correlation is the defualt method for correlating signals in
signal processing, but in this case the taxicab distance gets better
results.
2024-05-07 23:32:55 +02:00
Christoph Heinrich 3f6874f4d7 af_scaletempo: don't use a window for offset search
This might seem counter intuitive at first, but we want to change the
sound in total as little as possible, not only the middle part of the
overlap.

This also removes the loop unrolling from the integer path to keep it as
close to the float path as possible. The difference in performance is
fairly small and if such an optimization is deemed desirable in the
future it should be implemented for both float and integer
2024-05-07 23:32:55 +02:00
Christoph Heinrich 2287804739 af_scaletempo: use Hann function for overlap window
Better in theory, but not really noticable.
2024-05-07 23:32:55 +02:00
Christoph Heinrich 3a85fd97e5 af_scaletempo: add comment to overlap calculation
Also reduce pointer dereferences by one. That won't make much of a
difference (if at all), but since it already needs two lines we might
as well.
2024-05-07 23:32:55 +02:00
Guido Cella ae7e7d07b8 js: fix defaults.js
Fixes 2354d876da.
2024-05-07 22:57:53 +02:00
Guido Cella 2354d876da scripting: add mp.input.select()
This allows scripts to make the user choose from a list of entries by
typing part of their text and/or by navigating them with keybindings,
like dmenu or fzf.

Closes #13964.
2024-05-07 22:34:22 +02:00
Kacper Michajłow 43b702d707 drm_prime: remove off by one when allocating new ref counter 2024-05-07 21:05:18 +02:00
repojohnray d1e55a0e87 drm_prime: fix issue detected by valgrind
Conditional jump or move depends on uninitialised value(s)
   at 0x10FE22: drm_prime_remove_handle_ref (drm_prime.c:144)
   by 0x10FCCD: drm_prime_destroy_framebuffer (drm_prime.c:107)
   by 0x10FEB1: set_current_frame (hwdec_drmprime_drm.c:73)
   by 0x11054F: overlay_frame (hwdec_drmprime_drm.c:223)
   by 0xF1311: gl_video_render_frame (video.c:3315)
   by 0xFA015: draw_frame (vo_gpu.c:85)
   by 0xF8FDB: render_frame (vo.c:961)
   by 0xF943F: vo_thread (vo.c:1099)
   by 0x5EBE89B: start_thread (in /lib/libpthread-2.31.so)
 Uninitialised value was created by a heap allocation
   at 0x484713C: realloc (vg_replace_malloc.c:1437)
   by 0x10258B: ta_realloc_size (ta.c:195)
   by 0x10325D: ta_xrealloc_size (ta_utils.c:298)
   by 0x10FDBF: drm_prime_add_handle_ref (drm_prime.c:133)
   by 0x10FC57: drm_prime_create_framebuffer (drm_prime.c:87)
   by 0x1102FF: overlay_frame (hwdec_drmprime_drm.c:188)
   by 0xF1311: gl_video_render_frame (video.c:3315)
   by 0xFA015: draw_frame (vo_gpu.c:85)
   by 0xF8FDB: render_frame (vo.c:961)
   by 0xF943F: vo_thread (vo.c:1099)
   by 0x5EBE89B: start_thread (in /lib/libpthread-2.31.so)

Conditional jump or move depends on uninitialised value(s)
   at 0x10FCE4: drm_prime_destroy_framebuffer (drm_prime.c:109)
   by 0x10FEB1: set_current_frame (hwdec_drmprime_drm.c:73)
   by 0x11054F: overlay_frame (hwdec_drmprime_drm.c:223)
   by 0xF1311: gl_video_render_frame (video.c:3315)
   by 0xFA015: draw_frame (vo_gpu.c:85)
   by 0xF8FDB: render_frame (vo.c:961)
   by 0xF943F: vo_thread (vo.c:1099)
   by 0x5EBE89B: start_thread (in /lib/libpthread-2.31.so)
 Uninitialised value was created by a heap allocation
   at 0x484713C: realloc (vg_replace_malloc.c:1437)
   by 0x10258B: ta_realloc_size (ta.c:195)
   by 0x10325D: ta_xrealloc_size (ta_utils.c:298)
   by 0x10FDBF: drm_prime_add_handle_ref (drm_prime.c:133)
   by 0x10FC57: drm_prime_create_framebuffer (drm_prime.c:87)
   by 0x1102FF: overlay_frame (hwdec_drmprime_drm.c:188)
   by 0xF1311: gl_video_render_frame (video.c:3315)
   by 0xFA015: draw_frame (vo_gpu.c:85)
   by 0xF8FDB: render_frame (vo.c:961)
   by 0xF943F: vo_thread (vo.c:1099)
   by 0x5EBE89B: start_thread (in /lib/libpthread-2.31.so)
2024-05-07 21:05:18 +02:00
Mohammad AlSaleh bb7a485c09 stream: don't try to read from all-sparse/no-data files
```
 dd if=/dev/zero of=/tmp/10g.empty bs=1 seek=10G count=0
 dd if=/dev/zero of=/tmp/10m.empty bs=1 seek=10M count=0
 time mpv /tmp/10{g,m}.empty
 ```

 I keep files with the name format `${name}-${hash}.${ext}.empty`
 around, where the original is removed, and a sparse file with
 the size of the original is created instead.

 A lot of time is wasted on such files when going through
 playlists/directories that include some of them.

 This admittedly may not be that common of a use-case.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2024-05-07 12:22:09 +02:00
nanahi 4e59a56896 various: fix comma style 2024-05-07 11:23:08 +02:00
nanahi 9f5edd4eed various: fix indentation 2024-05-07 11:23:08 +02:00
nanahi f11002cef3 various: fix tabs in code 2024-05-07 11:23:08 +02:00
nanahi bb88e4aeb5 various: fix trailing whitespace 2024-05-07 11:23:08 +02:00
Jrelvas 1759d73c83 hwdec_cuda: reduce nesting in check functions
This simplifies the code and makes it easier to read.
2024-05-07 00:34:46 +02:00
Jrelvas 58f50c8e49 hwdec_cuda: avoid gpu wakeup by deferring cuInit
`cuInit` wakes up the nvidia dgpu on nvidia laptops. This is bad news because the wake up process
is blocking and takes a few seconds. It also needlessly increases power consumption.

Sometimes, a VO loads several hwdecs (like `dmabuf_wayland`). When `cuda` is loaded, it calls
`cuInit` before running all interop inits. However, the first checks in the interops do not
require cuda initialization, so we only need to call `cuInit` after those checks.

This commit splits the interop `init` function into `check` and `init`. `check` can be called without
initializing the Cuda backend, so cuInit is only called *after* the first interop check.

With these changes, there's no cuda initialization if no OpenGL/Vulkan backend is available. This prevents
`dmabuf_wayland` and other VOs which automatically load cuda from waking up the nvidia dgpu unnecessarily,
making them start faster and decreasing power consumption on laptops.

Fixes: https://github.com/mpv-player/mpv/issues/13668
2024-05-07 00:34:46 +02:00
Kacper Michajłow f18ce7eca0 msg: print all messages to one stream
This reverts commit 4939570e17 and makes
it more strict about the output stream. Status message is also on the
same stream now.
2024-05-06 22:21:46 +02:00
Kacper Michajłow 414c47d1d8 player/main: select msg output stream early
This avoids printing any stray messages in encode output stream.

--o is already pre-parse cli option which is designed to be parsed
before anything else is printed to output. So we can use that to force
stderr output if needed for encode mode.
2024-05-06 22:21:46 +02:00
Kacper Michajłow 425c6d03d7 github/workflows: link MSVC artifacts in comments 2024-05-06 22:01:17 +02:00
Kacper Michajłow 0ffabf5d45 ci: add Windows native build
x86_64-pc-windows-msvc build without mingw dependency. For now it lacks
some key dependencies like lua or shaderc. Will be extended in the
future.
2024-05-06 22:01:17 +02:00
Kacper Michajłow 006c3ce9fe test: mark libmpv as expected fail if OSC is not available
This test is expected to fail without lua and osc.lua support.
2024-05-06 22:01:17 +02:00
Kacper Michajłow cd12e923f8 test/libmpv_encode: minor adjustments for win32 build fix 2024-05-06 22:01:17 +02:00
Kacper Michajłow 4d5642887d win32: add WinMain 2024-05-06 22:01:17 +02:00
Kacper Michajłow 3ffb5c90ee player/configfiles: fix utime.h include for Windows SDK 2024-05-06 22:01:17 +02:00
Kacper Michajłow 7f6bfab0d3 stream_file: declare structures available only in Windows DDK 2024-05-06 22:01:17 +02:00
Kacper Michajłow 9fc2343512 osdep/mpv.rc: fix encoding of MPVCOPYRIGHT
llvm-rc doesn't allow multi-byte codes in narrow utf-8.
2024-05-06 22:01:17 +02:00
Kacper Michajłow ed7fe505b4 common: define some bits for Windows SDK 2024-05-06 22:01:17 +02:00
Kacper Michajłow 3ea684e7ef ao_wasapi_utils: define missing GUIDs for C 2024-05-06 22:01:17 +02:00
Kacper Michajłow 529cc38c67 ao_wasapi_changenotify: fix IsEqualPropertyKey for C 2024-05-06 22:01:17 +02:00
Kacper Michajłow 5cf0da2a6a various: remove unused sys/time.h include 2024-05-06 22:01:17 +02:00
Kacper Michajłow 323ed3cb10 osdep/compiler: clang also recognizes those attributes 2024-05-06 22:01:17 +02:00
Kacper Michajłow 041a925ada osdep/main-fn-win: add struct typedef for compatibility 2024-05-06 22:01:17 +02:00
Kacper Michajłow 419898267e osdep/semaphore: don't include files if they are not used 2024-05-06 22:01:17 +02:00
Kacper Michajłow 86abbb89a7 win32: fix platform checks 2024-05-06 22:01:17 +02:00
Kacper Michajłow 5c2918b4f3 io_utils: use mp_mkostemps instead of mkstemp 2024-05-06 22:01:17 +02:00
Kacper Michajłow b647201795 osdep/dirent: add implementation for Windows SDK build 2024-05-06 22:01:17 +02:00
Kacper Michajłow 7253a7dea9 ao_wasapi: fix include order
ks.h has to be included first.
2024-05-06 22:01:17 +02:00
Kacper Michajłow fffe723fc4 various: move strings.h inclusion to common.h 2024-05-06 22:01:17 +02:00
Kacper Michajłow 18ef834ef4 various: move unistd.h inclusion to common.h 2024-05-06 22:01:17 +02:00
Kacper Michajłow e1e09938c5 meson: add defines for Windows build to avoid warnings
See:
https://learn.microsoft.com/cpp/c-runtime-library/compatibility
https://learn.microsoft.com/cpp/c-runtime-library/security-features-in-the-crt
2024-05-06 22:01:17 +02:00
Kacper Michajłow 94eb07e3ea meson: remove Windows subsystem version, it is 6.0 by default 2024-05-06 22:01:17 +02:00
Guido Cella 6ec3e1549d command: add normalize-path command
This can be used e.g. by a bookmarking script to show normalized paths.
2024-05-05 20:29:27 +02:00
Guido Cella b6615cd474 DOCS/lua: fix some argument names
These need to coincide with the ones in command.c because they can be
specified in mp.command_native.
2024-05-05 20:29:07 +02:00
Guido Cella 67644888e7 DOCS/input: move escape-ass documentation
It should be next to expand-text and expand-path, not under Input
Commands that are Possibly Subject to Change.
2024-05-05 19:57:25 +02:00
Kacper Michajłow 053d971507 misc/path_utils: normalize win32 paths 2024-05-05 19:37:57 +02:00
Guido Cella 1d640c9887 player: normalize paths for resuming playback
Paths like foo.mkv, ./foo.mkv .//foo.mkv, ../"$(basename
"$PWD")"/foo.mkv, and C:\foo.mkv and C:/foo.mkv on Windows, use
different config files for resuming playback, so if you quit-watch-later
and later play the same file with a different path, mpv does not resume
playback. This commit normalizes the paths on Unix to fix this.
2024-05-05 19:37:57 +02:00
der richter 8a61929eb8 cocoa-cb: add support for macOS color space transformation (EDR/HDR)
by default utilises the color space of the screen on which the window is
located. if a specific value is defined, it will instead be utilised.

depending on the chosen color space the macOS EDR (HDR) support is
activated and that OS's transformation (tone mapping) is used.

Fixes #7341
2024-05-05 19:02:50 +02:00
der richter cb75ecf19f github/workflows: add swift linting 2024-05-05 18:30:58 +02:00
Guido Cella 1128989885 test: fflush between printf and abort
This is necessary to show the output with meson test. Followup to
06edb04692.
2024-05-05 17:51:34 +02:00
stax76 01d815d95d powershell-completion: add PowerShell command line completion 2024-05-05 15:38:46 +02:00
Guido Cella 1c42589ce0 DOCS/input: document sub-seek 0
Documents the functionality added by 155f7fa. Also make it clear than
can you can seek with arbitrary <skip>s instead of just 1 and -1.
2024-05-05 15:23:18 +02:00
Kacper Michajłow 427e07b93a docs: mention Cache section in sub-seek
sub-seek depends on cached range to know future subtitles, make it clear
in documentation how to control this range.
2024-05-05 15:08:20 +02:00
Guido Cella b086a404b5 command: return lavfi filters in option-info/[av]f/choices
This adds non-mpv filters to option-info/af/choices and
option-info/vf/choices, which allows completing them with set af/vf
<Tab> in console.lua.

Partial fix of #13017. Getting the filter options would required adding
af-list and vf-list properties.
2024-05-05 14:43:57 +02:00
Kacper Michajłow eab9737ea6 osc: remove trailing space
Fixes: b80e4e46a3
2024-05-05 14:38:18 +02:00
Kacper Michajłow 22ed5d0d3a demux_mkv: fix image detection
If blocks were already demuxed we would skip them and ask for new ones.
For files with few blocks it would return EOF without actually checking
the content.

Also make demux limit higher. In practice it doesn't matter, because if
it is image, video track will have only 1 block. And if it is not image
it will break on 2nd video block.

Fixes: #13975
2024-05-05 14:28:02 +02:00
Aman Karmani abe8f3f9df demux: keep track of ts information per stream type
Signed-off-by: Aman Karmani <aman@tmm1.net>
2024-05-05 14:11:47 +02:00
Kacper Michajłow 4cc9e6f999 win32: fix maximize state with --border=no
WS_POPUP windows cannot be maximized, so instead of forcing it with
unavoidable side-effects, change the window style before maximizing to
make it work correctly.
2024-05-05 14:02:57 +02:00
Guido Cella 646f31f196 sd_ass: don't log if subtitles have unknown duration
Users shouldn't have to care if subtitles' duration is unknown because
the only difference is that decode() sets a duration to packets without
one, if any.

The main difference was code intentionally breaking sub-seek, sub-step,
sub-start and sub-end for unknown duration subtitles for some reason,
but I removed it in 0f2370476b and 185fa9ffc6.

LRC subtitles always have unknown duration so if you use them having
this logged on every song is annoying, so only log it in verbose mode.
2024-05-05 13:59:41 +02:00
Kacper Michajłow d347ee0e91 ci/lint: use long commit hash
No reason to use short hash in script internally.
2024-05-05 13:54:07 +02:00
Kacper Michajłow e42e0f2e2a demux_mkv: make V_QUICKTIME codec detection generic
This allows playing files with any fourcc that is supported by mpv.
2024-05-05 13:53:43 +02:00
Matthias Hunstock 2414051d76 osd: show left arrow when playing backwards
If playback direction is backwards, display a triangle
pointing to the left as status symbol of OSD.
2024-05-05 13:47:20 +02:00
Matthias Hunstock 5631d83b5f tools: add narrow left arrow glyph for OSD
Add rotated arrow glyph on unused codepoint U+E00D.
2024-05-05 13:47:20 +02:00
Matthias Hunstock b80e4e46a3 osc: show left arrow when paused while playing backwards
Use existing glyph for playlist buttons to show a triangle
pointing left if playback is stopped with a backward playback
direction.
2024-05-05 13:47:20 +02:00
sfan5 c4b6d0da38 f_lavfi: reject filters with too many in/outs
The pad count serves as a minimum even if the filter has
dynamic inputs/outputs, so we should reject them here.

At least on FFmpeg 6.1 this results in no practical change
in the list accepted filters.

fixes: 8bf3fe7e2a
2024-05-04 16:13:03 +02:00
Kacper Michajłow 637bc6994f f_decoder_wrapper: clear decoder info on deinit
It is not longer valid and may cause use-after-free if used after
decoder itself is destroyed.

Fixes: #14051
2024-05-04 11:20:38 +02:00
sfan5 943a50b300 ci/mingw: update dependency versions 2024-05-03 23:44:51 +02:00
omar a26bbbd78d OSC: implemented user configurable colors 2024-05-03 16:50:49 +02:00
nanahi 861908c70f win32: make context menu items accessible from the window menu
This makes the context menu items accessible from the window menu,
which can be opened by either right-clicking on the title bar or
left-clicking on the mpv icon on the title bar.
2024-05-03 16:36:02 +02:00
nanahi ee2e14015d win32: move context menu init/uninit to GUI thread
Currently if VO init fails, the context menu is leaked. Additionally,
init/uninit are in the VO thread, while other accesses are in the GUI
thread.

Fix this by moving them to the GUI thread, similar to other resources.
This also lets init function take the mpv HWND in the next commit.
2024-05-03 16:36:02 +02:00
Dudemanguy cb613ba916 wayland: set wl->scaling if there is no wl->current_output yet
If we get either preferred_scale or preferred_buffer_scale this early
during initialization the wl->scaling value should be immediately
updated instead of being deferred until later for correct geometry.
Fixes #14019.
2024-05-03 16:18:35 +02:00
nanahi dec73f503f sub/osd: fix rounding when rescaling bitmap subtitle rects
With multiple rects touching each other without any gaps, the current
scale method can cause gaps or overlaps between rects. To make sure that
this does not happen, scale on the edges of the rects instead, and then
calculate the width and height from the results.

NB: while this is better than the status quo, it does not fix all
scaling artifacts because of the following:

- When two rects share a vertical edge but have different heights,
  misalignment will occur: after rounding rect heights to pixels,
  the height scale factor for the two rects will be slightly different.
  As a result, there will be misalignment between the scaled images.
- With a GPU renderer, different bitmap subtitle parts are rendered as
  different textures. This means that the pixel contents of the parts have
  different boundary conditions from the whole combined image. As a result,
  there will still be small gaps when the subtitle is scaled up.

The only way to properly address these points is to make sure that the
parts are combined to a single image at the native resolution before
being scaled. This can be partly achieved with --blend-subtitles=video.
2024-05-03 16:16:53 +02:00
nanahi e20ca15b66 win32: support multitouch
Use the multitouch API. To disable system's defualt mouse emulation,
set --native-touch=yes.
2024-05-03 16:14:03 +02:00
nanahi 807a6d875a options: add --native-touch option
For platforms which send emulated mouse inputs for touch-unaware clients,
such as Win32 and X11, this option enables the native multitouch handling
and disables emulated mouse inputs. This enables interested scripts to
handle multitouch events while keeping compatibility with touch-unaware
scripts.
2024-05-03 16:14:03 +02:00
nanahi f0e163bab5 wayland_common: support multitouch
Use the multitouch API. No need to emulate mouse input as it's already
done by the input system.
2024-05-03 16:14:03 +02:00
nanahi 89aa10de24 input: add MP_TOUCH_RELEASE_ALL
Release all touch points. Used by some VOs like Wayland touch cancel
event.
2024-05-03 16:14:03 +02:00
nanahi 77809faea1 input: add --input-touch-emulate-mouse option
This adds --input-touch-emulate-mouse option, which controls whether to
enable legacy touch handling where touch inputs are emulated as mouse
inputs. This establishes a primary touch point (the one with the lowest
index) as the emulated mouse position, and MBTN_LEFT up/down with the
appearance of the first touch point and the disappearance of the last
touch point.

This fixes some problems with touch handling on Wayland, for example
attempting to pinch results in a double click.
2024-05-03 16:14:03 +02:00
nanahi 46cca1a67f command: add touch-pos property
This adds touch-pos property, which contains the information of all
current touch points. The property has sub properties:

touch-pos/count: the number of current touch points
touch-pos/N/x,y: the position of touch point N
touch-pos/N/id: unique identifier of the touch point
2024-05-03 16:14:03 +02:00
nanahi 28a4fb8e4e input: add multitouch support functions
The goal of multitouch support is to interpret as little as possible:
mpv just stores the touch point information and makes the position
available for query. Does not participate in the deprecated input section
system.

The API is modeled after the common part of the touch input APIs of
Win32, X11, and Wayland, to make sure the platform-specific implementations
are as simple as possible.
2024-05-03 16:14:03 +02:00
nanahi 91bb2f2543 sd_lavc: reduce unnecessary error log on probing nonexistent codecs 2024-05-03 16:13:07 +02:00
nanahi fc741dab1a sd_lavc: fix null dereference on error
If sub decoder does not exist, priv remains NULL.

Fixes: 1394e5a111
2024-05-03 16:13:07 +02:00
Dudemanguy d61d294665 wayland: log if cursor shape support is missing
This is done for the other protocol interfaces already but was
accidentally omitted.
2024-05-02 13:46:20 +02:00
Sebastian Ramacher ec447fd4a2 DOCS: fix spelling of environment and corresponding/corresponds 2024-05-01 14:39:52 +02:00
Kacper Michajłow b68c742b27 demux/packet: add support for ITU T.35 metadata in Matroska 2024-04-29 01:37:02 +02:00
MartinEesmaa 4f828676fd demux: support VVC Matroska demux
This allows to demux Versatile Video Codec with Matroska container to play.
2024-04-29 01:35:31 +02:00
der richter 4a686dac6f mac: properly handle regular expressions without force unwrap 2024-04-28 20:21:18 +02:00
der richter 8f1189341f mac: code cleanup and consistency changes, fix linting issues 2024-04-28 20:21:18 +02:00
der richter 984c890661 mac/helper: make wakeup callback declaration consistent 2024-04-28 20:21:18 +02:00
der richter 6df06e5dc5 mac/touchbar: use KVO block API instead of old obj-c instance method 2024-04-28 20:21:18 +02:00
Kacper Michajłow 69d70148c7 TOOLS/lua/autoload: make ignore_patterns more generic 2024-04-27 03:14:31 +02:00
oficsu 3ca71b0c0e TOOLS/lua/autoload: allow multiple ignore_patterns 2024-04-27 03:14:31 +02:00
oficsu 96b34148f1 TOOLS/lua/autoload: add ignore_pattern option
Autoload script can now exclude certain files

Why? Sometimes you want to ignore thumbnails,
auto-generated backups or just unwanted files

A non-exhaustive list of real-world examples:
- user backup files: '%.bak%.mp4$' or '^bak-'
- telegram-desktop thumbnails: '_thumb%.jpg$'
- a krita graphics editor backup suffix: '^~'

See documentation here: lua.org/pil/20.2.html
2024-04-27 03:14:31 +02:00
nanahi 93708a9d38 w32_common: fix show-in-taskbar toggling after explorer is restarted
After explorer is restarted while show-in-taskbar is false, toggling
show-in-taskbar no longer puts mpv back to the taskbar until it's
unfocused and refocused.

My guess of how this works is that the HWND of the taskbar is cached,
and setting the WS_EX_TOOLWINDOW style internally uses this value to
show/hide the taskbar button. But after explorer is restarted it no
longer works until its taskbar state needs to change (such as focusing).
Only then it realizes the HWND is no longer valid and refreshes it.

Fix this by following MS documentation on this: the window needs to be
hidden before changing the style, and be shown after that. This
unfortunately can sometimes introduce a brief window flash, but it
fixes the problem.
2024-04-27 03:02:00 +02:00
Guido Cella 2f4c550b4b zsh-completion: complete --gpu-context
This is made by possible by 96e1f1dfa5 standardizing --gpu-context's
help output. This changes the check to complete any Object settings list
so it will automatically work with future options of this kind.
2024-04-27 03:01:06 +02:00
Kacper Michajłow fbfc9d22c7 ci: add fuzzers build test 2024-04-27 02:47:47 +02:00
Kacper Michajłow 47dbc3a74e fuzzers: add new fuzzer targets
fuzzer_set_property.c:

fuzz mpv_set_property in both initialized and non-initialized state.
Useful for user provided values sanitization test. I've already seen
some memory leaks in parsing code, good to drill it.

fuzzer_loadfile.c:

mpv_command "loadfile" test. Good for testing demuxers, decoding and
playback loop. Sadly in headless mode we can't really test AO and VO,
but at least all the code around can be fuzzed. Especially our custom
demuxers like demux_mkv.

fuzzer_loadfile_direct.c:

Similar to loadfile above, but instead of saving the data to file, it
passes the fuzz input in the command. Generated protocol specific
versions (mf:// and memory:// for now) and generic one.

Nothing really complex, but good start and even those few targets should
give good coverage of the most common code paths in libmpv.
2024-04-27 02:47:47 +02:00
Kacper Michajłow 0b234af113 player/command: mark sub-text-ass as deprecated
Fixes: 437fff9f21
2024-04-27 01:23:52 +02:00
rcombs 99f1b2b7b4 player/command: add sub-text/ass-full sub-property
This is like sub-text/ass, but it returns a full ASS line, making it suitable for some more advanced scripting use-cases.
2024-04-27 01:19:56 +02:00
rcombs 437fff9f21 player/command: move sub-text-ass to a sub-property 2024-04-27 01:19:56 +02:00
rcombs aa0a9ce2ec sd_ass: allow get_text to return more than 500 bytes 2024-04-27 01:19:56 +02:00
Kacper Michajłow e3fd24496a stats.lua: show osd-dimensions property
This change displays the scaled position and size of the image before
cropping to the target rectangle. In simple terms, it shows how much
margin has been added to the image or how much of the image has been
cropped.

Note that target resolution is displayed after crop as in fact all other
pixels are discarded anyway.
2024-04-27 01:15:25 +02:00
Kacper Michajłow f55d19e846 sub/lavc_conv: don't override style of converted teletext pages
This fixes teletext pages rendering, while keeping the same default
style for subtitles and other converted formats.
2024-04-27 01:14:23 +02:00
Kacper Michajłow d8378dc226 sub/lavc_conv: don't strip ASS style header
This fixes converted subtitles that are styled.

This reverts commit 5e2c211a4e.

Most of the subtitle decoders in libavcodec sets meaningful style
values. For the rest we can conditionally strip style.
2024-04-27 01:14:23 +02:00
Shreesh Adiga 4aa7588e44 DOCS/vf: update vf_gpu options 2024-04-27 01:08:22 +02:00
Shreesh Adiga d9c5aef98d vf_gpu: vulkan and egl implementations
Abstract out EGL, and allow choosing between EGL and vulkan at runtime.
vf_gpu_egl.c contains GL specific context and creation/destroy code,
vf_gpu_vulkan.c contains Vulkan specific. This allows vf_gpu being
built in systems where EGL is not available and where Vulkan is
available.
2024-04-27 01:08:22 +02:00
ferreum 773c5e2ae0 af_scaletempo2: migrate to internals to talloc
Fixes corrupted audio after resize_input_buffer; realloc_2d did not move
data to new location. Rather than reimplementing more allocator logic,
migrate internals to use talloc and grow buffer with realloc.
2024-04-27 01:05:07 +02:00
ferreum 190b15c827 af_scaletempo2: remove redundant buffer zeroing
First iteration does not overlap with initial buffer contents any more,
so this zeroing was redundant.
2024-04-27 01:05:07 +02:00
nanahi 51e01e9772 ao_wasapi: fix player core lockup when avoiding premature buffer fills
6863eefc3d handled this situation by using
an atomic variable to express the state for which the wakeup is caused
by AO control, and the dispatch queue is only processed at this state.
However, this can cause permanent lockup of the player core when the
following happens:

- AO control sets the thread state to WASAPI_THREAD_DISPATCH, and
  sets the wakeup handle.
- WASAPI thread reads the WASAPI_THREAD_DISPATCH state and processes
  the dispatch queue.
- Another AO control happens. A dispatch item is enqueued, and the
  state stays at WASAPI_THREAD_DISPATCH.
- WASAPI thread resets the thread state to WASAPI_THREAD_FEED since
  the state has not changed.
- WaitForSingleObject() returns in the WASAPI thread, sees this state,
  and does not process the dispatch queue.
- The player core locks permanently because it is waiting for the dispatch
  to be processed.

This has been experimentally verified on a system under high contention:
The easiest way to trigger this lockup is to continuously hold down "i",
which rapidly issues AO get volume/mute controls.

To properly handle this, use separate handles for system and user wakeup
requests. Only feed audio when woke up by system and only process the
dispatch queue when woke up by user.

Fixes: 6863eefc3d
2024-04-27 00:59:09 +02:00
nanahi 7f0961479a Revert "ao_wasapi: address premature buffer fills in exclusive mode"
This reverts commit 6863eefc3d.
2024-04-27 00:59:09 +02:00
Dudemanguy 76367dae35 m_config_core: fix forced option notification with m_config_cache
bc28f7693d originally added this, but the
implementation isn't correct and causes excessive notifications when
writing to other options which may have bad behavior in some some
circumstances. Fix this by reworking the implementation for force
options so that the timestamps of the option update compared instead.
Whenever an option gets changed, the internal timestamp in the cache is
always incremented. For a special force option, we can save this
timestamp internally as well.

Because cache_check_update is always checked before potentially sending
an option notification, we know that if the internal timestamp is equal
to the timestamp saved by a force update option, it must have been
previously written. Thus, the notification can be sent. This lets
options like geometry work repeatedly but without constantly sending
notifications. Fixes #13954.
2024-04-26 17:42:52 +00:00
der richter 2e03e0305c mac/input: add support for dead key reporting
dead keys like tilde and accents were not reported because they returned
an empty string from the NSEvent.

try to retrieve dead key with alternative Carbon API when an empty key
is reported.
2024-04-24 20:35:53 +02:00
der richter f7a32b5f29 mac: make display-names unique to allow specific selection
the Screen property localizedName returns a none unique dynamic name
that doesn't allow a specific selection of a Screen on every OS boot.
the name consists of the vendor name and model name (eg DELL U2723QE).
if the same model display is connected to the system several times,
macOS starts to add numbers to the localizedName (eg DELL U2723QE (1)),
that may not be associated to the same Screen on every OS boot or
connecting the display. it also changes the name of the first connected
display by adding that numeration. this makes it impossible specify the
proper screen with the screen-name option every time.

to circumvent this we remove the enumeration from the name and instead
add the serial number to the display-names property. this makes the
actual Screen unique and none dynamic. furthermore the selection of a
screen by name will check for equality for the old localizedName, simple
name without enumeration, serial number and the combined name with
serial number. this makes it possible to select the screen by either of
those names and identifiers, and keeps backwards compatibility with the
old behaviour.

Examples:
localized name (System Settings name): DELL U2723QE, DELL U2723QE (1)
simple name: DELL U2723QE
serial number: 123456789
combined name: DELL U2723QE (123456789)
2024-04-24 20:35:38 +02:00
Kacper Michajłow afae94cfbd dec_sub: fix locking for sub_ass_get_extradata
Fixes: 715feea8d8
2024-04-24 15:52:17 +02:00
sfan5 426be8441a test: make libmpv_test abort if an error is logged
Among others this provides a trivial test that built-in scripts aren't throwing
an error at load or init time.
2024-04-24 12:58:50 +02:00
Dudemanguy d255f31f98 vo_dmabuf_wayland: use wl_fixed_from_int when setting viewport source
When this was originally implemented, the fixed conversion factor was
accidentally reverse engineered. It was left as is though. Instead, use
the wl_fixed_from_int helper, so it's more obvious what is going on
here.
2024-04-21 13:42:49 -05:00
Dudemanguy 8db1902ae9 vo_dmabuf_wayland: fix scaling for subsurface positioning
It's off if the video aspect ratio doesn't match the monitor aspect
ratio. Fixes c243946338.
2024-04-21 13:42:49 -05:00
nanahi 5318522b50 DOCS/man: refer to "mp.options functions" for script config docs
Currently they refer to the OSC documentation. However,
the "mp.options functions" already documents that, is more detailed,
and does not contain false statements like "there may be no spaces around
the ``=`` or anywhere else" (the primitive parser does not care about
them, so starting a string option value with spaces is perfectly fine).

Change them to refer to "mp.options functions" and remove the redundant
section in the OSC documentation.
2024-04-21 15:26:46 +02:00
Dudemanguy b364e4a65c player/loadfile: check if forced track is also tagged as default first
If a forced sub track also happens to be tagged as default, we should
check that before deselecting in compare_track. Fixes #13944.
2024-04-20 00:55:30 -05:00
Robert Kopaczewski e7b0d6b38b ao/avfoundation: optimise preprocessors for included coreaudio code 2024-04-20 00:44:46 +02:00
Robert Kopaczewski 578b9dade2 ao/audiounit: fix building for iOS 2024-04-20 00:44:46 +02:00
Misaki Kasumiandsfan5 e855836ed1 ao_coreaudio: add a comment for ignoring returned sample count
Co-authored-by: sfan5 <sfan5@live.de>
2024-04-20 00:12:16 +02:00
Misaki Kasumi d46d428f73 Revert "ao_coreaudio: signal buffer underruns"
This reverts commit 0341a6f1d3.
Fixes #13348.
2024-04-20 00:12:16 +02:00
nanahi 5109c599db input: fix deadlock in adding gamepad input src
mp_input_sdl_gamepad_add() calls mp_input_add_thread_src() which
already locks, so it cannot be called inside a lock.

Missed in e8b9476bf7 refactoring.
2024-04-19 21:04:02 +02:00
Kacper Michajłow 1a495451ab d3d11: disable IDXGIInfoQueue usage if dxgidebug.h is incomplete
Older MinGW-w64 doesn't define IDXGIInfoQueue in dxgidebug.h.
2024-04-19 03:32:29 +02:00
Kacper Michajłow 19a9164e24 d3d11: use IDXGIInfoQueue instead ID3D11InfoQueue
DXGI debug interface encapsulate multiple message queues, which allows
to get validation not only for D3D11 calls, but also DXGI ones.

Also this makes leak detector not report self debug interface as alive
like it was before. And same as with validation, it has ability to
detect more alive objects, not being limited to D3D11.
2024-04-19 03:32:29 +02:00
Florian Albrechtskirchinger 56b3bcaaf2 demux: also read "CUESHEET" tag from stream metadata
Read embedded cue sheets from stream-level metadata, in addition to
format-level metadata.

Fixes missing chapters in opus files with "CUESHEET" tags.
2024-04-19 03:10:48 +02:00
sunpenghao f75f32977c ao_wasapi: set 0 buffer duration on initialization for shared mode
Microsoft requires that both `hnsBufferDuration` and `hnsPeriodicity` should be
0 when initializing a shared mode stream using event-driven buffering. Do as
they say.

Ref: https://learn.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-iaudioclient-initialize
2024-04-19 02:28:23 +02:00
sunpenghao 503a0f184c ao_wasapi: add --wasapi-exclusive-buffer option
This allows users to set buffer duration in exclusive mode. We have
been using the default device period as the buffer size and it is
robust enough in most cases. However, on some devices there are
horrible glitches after a stream reset. Unfortunately, the issue is not
consistently reproducible, but using a smaller buffer size (e.g., the
minimum device period) seems to resolve the problem.

Fixes #13715.
2024-04-19 02:28:23 +02:00
Dudemanguy e5d683e187 context_drm_egl: guard gbm_device on uninit
Not all cards support gbm which means the creation of the gbm device
will fail. However during the uninit process, the destruction of the
device was unconditionally done which leads to a segfault. Guard it
instead. Fixes #13929.
2024-04-18 14:57:01 -05:00
Dudemanguy 4d80e7b72c x11: always do a reset_size if geometry/autofit is updated at runtime
Previously, the code required a check against the old saved geometry to
make sure the size and/or position was different before updating. The
doesn't work with the previous changes that allow a geometry value to be
set again with the same value as before. It would probably be nicer to
check against something that always keeps track of the actual window
size in real time, but it seems geometry in x11 doesn't quite work that
way so we'll do it the easier way instead.
2024-04-18 17:40:16 +00:00
Dudemanguy dc9da5d463 options: flag geometry/autofit options with force_update
Same reasoning as window-scale. This still requires that the windowing
backend correctly reacts to the notification.
2024-04-18 17:40:16 +00:00
Dudemanguy bd1bcc1f31 player: always notify when writing window-scale option
As described in the previous commit, update_window_scale will always
execute whenever window-scale is written even if the value doesn't
change.
2024-04-18 17:40:16 +00:00
Dudemanguy bc28f7693d m_option: add a force_update boolean
mpv's core does not propagate option notifications unless they actually
change to the rest of the player. Most of the time, this makes perfect
sense. If the user sets fullscreen multiple times, there's no reason to
care about anything other than the change in state. However, there are
certain options where it makes sense to always broadcast a notification
even if the value doesn't change. For example, consider the window-scale
case. A user may set window-scale to some value, resize the window
further through some other means (such as mouse resizing) and then want
to set the window-scale again to the same value as earlier. The
window-scale value did not change from before so no notification is sent
and nothing happens even though it is desirable and expected that it
operates again.

This was solved by making the current-window-scale property writable a
few years ago, but actually the easier solution is to just always force
the option to update on any write. For the big callback, the needed
changes are trivial. Unfortunately, it requires a hot mess in order to
have this work with the m_config_cache_update APIs. Spooky stuff in
there, but it does send the notification now.
2024-04-18 17:40:16 +00:00
nanahi db6b195f3f stats.lua: add option to disable scale with video size
This adds a new configuration option vidscale, which controls whether
stats display is scaled with video, similar to the option for OSC.lua.
2024-04-18 18:44:53 +02:00
nanahi d283688939 stats.lua: add option to control plot border width
This adds a new configuration option plot_bg_border_width, which
controls the border width of plots.
2024-04-18 18:44:53 +02:00
nanahi 5370923a35 stats.lua: remove redundant style override 2024-04-18 18:44:53 +02:00
Guido Cella d0aeca5918 demux_lavf: pass jpg filenames to ffmpeg for probing
Fixes #13192, fixes #13431. See the comment for details.
2024-04-18 16:48:25 +02:00
nanahi 750dec880c m_option: change confusing error messages for obj_settings_list
This option type is not used only by filter options: they're already
used by --ao, --vo, and --gpu-context. Replace the mentions of
"filter" to "item" instead, and changes some languages to improve clarity.

Also change the documentation on "Filter options" to describe what it
really is, and fix a typo.
2024-04-18 16:28:21 +02:00
nanahi e968a505d6 DOCS/man/options: mention the new priority list usage of --gpu-context
The settings list conversion means a custom priority list can now be used.
2024-04-18 16:28:21 +02:00
nanahi 2533ea764f various: add GPU context description
Now that obj_settings_list is used for GPU contexts, detailed
descriptions can be added so that --gpu-context=help can print
the descriptions of the GPU contexts using standard
obj_settings_list help printing.
2024-04-18 16:28:21 +02:00
nanahi a6ff33425d video/out/gpu/context: add auto dummy context
This adds a dummy context at the start of the context lists, which
serves three purposes:

- The "auto" option is listed for --gpu-context=help.
- Some special handlings of "auto" string are removed.
- Make sure that lists have at least one element, so MP_ARRAY_SIZE()
  works as intended.
2024-04-18 16:28:21 +02:00
nanahi 96e1f1dfa5 video/out/gpu/context: convert --gpu-context to use obj_settings_list
Since the list of available GPU contexts is a compile time constant,
use obj_settings_list instead of opt_string_validate for GPU contexts.
This has several advantages:

- Aligns with the existing usage of vo, ao, and filter lists.
- Allows custom probing order.
- Allows list option suffixes. (--gpu-context-append, etc.)
- Allows autocomplete in console.lua.
- Uses the standard obj_settings_list help printing, so the custom
  help printing function is no longer needed.

This also deduplicates some context creation code for ra_ctx_create
and ra_ctx_create_by_name.
2024-04-18 16:28:21 +02:00
nanahi d5ec069829 video/out/gpu/context: don't use hidden flag for contexts
For contexts that have no API, just use a separate list for them.
This keeps validate func for the main contexts simpler.
2024-04-18 16:28:21 +02:00
Shuanglei Tao fefa1b6645 DOCS/client-api-changes.rst: fix formatting 2024-04-18 16:13:57 +02:00
rcombs d3a63e16d2 command: use property_time() for sub-start and sub-end
This gives these properties the "time" type, which allows them to be pretty-printed as HH:MM:SS easily (but also still allows raw formatting using e.g. ${=sub-start}).
2024-04-18 13:11:01 +02:00
Kacper Michajłow 2f8038c598 vo_gpu_next: invalidate cache object if requested by libplacebo
See: https://code.videolan.org/videolan/libplacebo/-/merge_requests/659
2024-04-18 02:25:12 +02:00
Kacper Michajłow dc632e16d2 stats.lua: display short decoder name if not generic one is used 2024-04-18 01:20:32 +02:00
Kacper Michajłow a569c3ce0c player/command: add track-list/N/decoder 2024-04-18 01:20:32 +02:00
Guido Cella 8a4ecda940 stats.lua: filter input bindings by typing them
This lets you press / in page 4 of the stats and type a keybinding or
part of its command to filter it by using mp.input.

This works badly without a VO because both stats.lua and console.lua use
show-text and only one can be displayed at a time, but it's still better
than not having the search available at all.
2024-04-18 01:17:53 +02:00
nanahi 7cfd369ffb terminal-win: support mouse input events
The mouse input information is available from the INPUT_RECORD
with MOUSE_EVENT event type.
2024-04-18 01:03:33 +02:00
nanahi 8a2892a68f terminal-win: implement terminal_get_size2
The size of the console font can be acquired with GetCurrentConsoleFont,
and the terminal size can be calculated from the rols, cols, and font
size.
2024-04-18 01:03:33 +02:00
nanahi eff18a8a11 terminal-win: implement terminal_set_mouse_input 2024-04-18 01:03:33 +02:00
nanahi c2ed2e7bc8 terminal: add terminal_set_mouse_input function
This function is used to enable/disable mouse input for win32 and unix.
2024-04-18 01:03:33 +02:00
nanahi abc0b0e8c9 terminal-unix: style fix 2024-04-18 01:03:33 +02:00
nanahi 7c6bb9c37b vo_{tct,sixel,kitty}: implement mouse support 2024-04-18 01:03:33 +02:00
nanahi cbc3fb104d terminal-unix: ignore unhandled mouse CSI sequences
21d434d2db attempted to ignore unknown
CSI sequences with a specific termination rule. This however does not
apply to mouse CSI sequences which can have characters out of that
range. Fix this by throwing away the whole sequence when an unhandled
mouse sequence is detected.
2024-04-18 01:03:33 +02:00
nanahi 9ae58ba186 terminal-unix: support mouse escape codes
These 6-byte codes have the format of \e [ M <button> <xpos> <ypos>.
Support the first 3 mouse bottons + scroll up/down for now as
button numbers > 5 are pretty non-portable across terminals.
Pixel-based mouse position values are calculated and sent to the
input system.
2024-04-18 01:03:33 +02:00
llyyr 805577c792 sd_ass: add sub-vsfilter-bidi-compat to enable vsfilter bidi compat
Enable ASS_FEATURE_{WHOLE_TEXT_LAYOUT, BIDI_BRACKETS} and auto base
detection by default, and add an option to disable this if needed.

This is strictly an improvement for webvtt files as they always use
auto base detection. This _fixes_ right-to-left text rendering for
webvtt files which correctly mark rtl/ltr. Webvtt files obtained from
sources which sideload the RTL information through css also see an
improvement due to the auto detection.

Generally SRT files also want this, but some are also written to
workaround VSFilter quirks.

See also: https://github.com/mpv-player/mpv/pull/12985#issuecomment-1839565138
2024-04-18 00:14:44 +02:00
llyyr f862d3b6cd sd_ass: fix margins for all styles when overriding PlayResX
Also save old playresx and use it instead of assuming values of things
we know.
2024-04-18 00:14:44 +02:00
llyyr d2efa1c1be sd_ass: replace ifdef with explicit version check 2024-04-18 00:14:44 +02:00
nanahi c9a53780cf DOCS: document --show-in-taskbar option 2024-04-18 00:09:09 +02:00
nanahi 8c614e0df5 w32_common: implement --show-in-taskbar option
When the window style changes, use WS_EX_TOOLWINDOW style to exclude
the window from the taskbar and Alt+Tab switching.
2024-04-18 00:09:09 +02:00
nanahi dcd1034529 x11_common: implement --show-in-taskbar option
This adds a new option --show-in-taskbar, which controls whether
mpv appears in taskbars. This is useful for picture-in-picture
setups where the video window should not appear in taskbars.

On X11, this can be controled by setting the
_NET_WM_STATE_SKIP_TASKBAR window state.
2024-04-18 00:09:09 +02:00
nanahi 3a92d7ba3b x11_common: detect wm support for _NET_WM_STATE_SKIP_TASKBAR 2024-04-18 00:09:09 +02:00
Guido Cella 51bd00c33a stats.lua: inherit OSD styles
Avoid having to configure both the OSD and the stats script opts when
you change the OSD options, in particular avoid having to convert colors
to BGR.

Also document the shadow options.

font_size, border_size and shadow offset defaults are kept because the
same values look much bigger in the stats than in the corresponding OSD
options.

osd-back-color is now respected without extra checks until you
explicitly set a shadow_color.
2024-04-17 23:47:55 +02:00
sunpenghao 75d899bcaf DOCS/input: minor typo correction 2024-04-17 23:46:35 +02:00
sunpenghao c70cc5b01d osc: add playlist_media_title option
Showing media titles in the playlist is pointless when sources are ill
tagged and media titles contain only garbage. Being able to opt for
file names at least gives us a choice in such cases.
2024-04-17 23:46:35 +02:00
nanahi 715feea8d8 dec_sub: fix locking for sub_ass_get_extradata
sub->sd can be destroyed and recreated when update_segment is called
inside a lock.

Fixes: f9918b5390
2024-04-17 23:42:35 +02:00
nanahi dbe377645f input: make mp_input_queue_cmd return a meaningful value
It's currently always a meaningless 1. Make it so it returns 0 is cmd
is NULL. Remove the unused return value from queue_cmd.
2024-04-17 23:42:35 +02:00
nanahi b7ad0968ad dec_sub: don't use recursive mutex
92a9f11a0b added locking for dec_sub.
At that time, because the lock was exposed to the outside world,
a recursive mutex was used. However, this is no longer true after
e9e883e3b2, when the public locking
functions were removed. This means that the lock is now private.

Unlike input.c, dec_sub already enforces said call hierarchy, so
combined with the aforementioned change, the lock is only ever
called once and never recursively. Thus the lock can be converted to
a normal mutex.
2024-04-17 23:42:35 +02:00
nanahi e731972163 dec_sub: fix locking for sub_is_{primary,secondary}_visible
These public functions should use locks to keep its usage
consistent with input.c.

Fixes: 024e0cd4c1
2024-04-17 23:42:35 +02:00
nanahi f4db4aaed7 input: don't use recursive mutex
Previous commits made sure that the lock will never be called for more
than once for all public functions. Thus deadlock is impossible, so
recursive mutex is unneeded and can be converted to a normal mutex.
2024-04-17 23:42:35 +02:00
nanahi e8b9476bf7 input: avoid unnecessary recursive locks
The absense of a call hierarchy between public and private functions
results in many unnecessary recursive locks: public functions require
locks, which are also called by other public and private functions in this
file. Fortunately, since the lock is private to this file, this situation
can be avoided by establishing a call hierarchy:

- Public functions must lock, and can only call private functions in
  this file
- Private functions must not lock, and can only call private functions
  in this file
- No function can call any public function in this file, the only
  exception being mp_input_wakeup and mp_input_parse_cmd.

This arrangement ensures that there will be no locks more than necessary:
All public function calls will lock only once, and never recursively.
2024-04-17 23:42:35 +02:00
nanahi 3cbb34fd03 input: remove mp prefix for static functions
This makes it easy to eyeball check the call hierarchy between public
and private functions.
2024-04-17 23:42:35 +02:00
nanahi ce4294bc37 input: fix locking of mp_input_bind_key
This is a public function, yet its access to ictx through
get_bind_section is not locked.

Fixes: 4614d432a8
2024-04-17 23:42:35 +02:00
Kacper Michajłow 7b181c989e options: fix runtime update of teletext-page 2024-04-17 23:41:30 +02:00
Kacper Michajłow 1394e5a111 sub/sd_lavc: check decoder output type for dvb and arib
Depending on the options:
For AV_CODEC_ID_ARIB_CAPTION this allows using bitmap output.
For AV_CODEC_ID_DVB_TELETEXT this allows using text output.

Fixes: #13471
2024-04-17 23:41:30 +02:00
Kacper Michajłow 35c6b62ddc sub/lavc_conv: set dvb teletext and arib caption output type to ASS
Also set teletext page while at it.
2024-04-17 23:41:30 +02:00
Kacper Michajłow 73779a8c70 sub/lavc_conv: take sd context as a parameter for lavc_conv_create
Will be useful for future commits.
2024-04-17 23:41:30 +02:00
sfan5 1586ccc0c8 Update VERSION 2024-04-17 21:19:56 +02:00
737 changed files with 58053 additions and 18394 deletions

No files matched your search

+11
View File
@@ -13,3 +13,14 @@ trim_trailing_whitespace = true
[.git/COMMIT*]
max_line_length = 72
[{osdep/dirent-win.h,TOOLS/osxbundle/mpv.app/Contents/PkgInfo,TOOLS/osxbundle/mpv.app/Contents/Resources/Assets.car}]
charset = unset
insert_final_newline = unset
indent_style = unset
indent_size = unset
max_line_length = unset
trim_trailing_whitespace = unset
[menu.conf]
indent_style = tab
+7
View File
@@ -0,0 +1,7 @@
{
"Format": "github-actions",
"Disable": {
"IndentSize": true,
"MaxLineLength": true
}
}
-16
View File
@@ -1,16 +0,0 @@
---
name: 'README: DO NOT IGNORE OR DELETE THE ISSUE TEMPLATE'
about: 'Chose and fill out one of the following templates!'
title: ''
labels: priority:ignored-issue-template
assignees: ''
---
We ask you to not ignore the issue template. Fill it out as good and correct as
possible. Issues that don't adhere to our request will be closed for ignoring
the issue template. This is because analyzing a bug without a log file is harder
than necessary. Low quality bug reports are noise.
Please go back and chose the proper issue template. Opening issues with this
template will be closed immediately.
@@ -1,55 +0,0 @@
---
name: 'Report a Linux Issue'
about: 'Create a report for a runtime related Linux Issue'
title: ''
labels: 'os:linux'
assignees: ''
---
### Important Information
Provide following Information:
- mpv version
- Linux Distribution and Version
- Source of the mpv binary
- If known which version of mpv introduced the problem
- Window Manager and version
- GPU model, driver and version
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Try to reproduce your issue with --no-config first. If it isn't reproducible
with --no-config try to first find out which option or script causes your issue.
If the issue is performance-related, try to reproduce it with --no-config
--profile=fast, which is designed to work on lower-end mobile devices.
Additionally, enable hardware decoding with --hwdec=yes or the Ctrl+h shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Make a log file made with -v -v or --log-file=output.txt, attach it to
the issue, and replace this text with a link to it.
Without the log file, this issue will be closed for ignoring the issue template.
In the case of a crash, please provide a backtrace.
### Sample files
Sample files needed to reproduce this issue can be attached to the issue
(preferred), or be uploaded to https://0x0.st/ or similar sites.
(Only needed if the issue cannot be reproduced without it.)
Do not use garbage like "cloud storage", especially not Google Drive.
@@ -0,0 +1,160 @@
name: "Report a Linux Issue"
description: "Create a report for a runtime related Linux Issue"
labels: ["os:linux"]
type: Bug
body:
- type: textarea
id: mpv_information
attributes:
label: "mpv Information"
placeholder: |
mpv v0.38.0-96-gf776be6af5 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on May 5 2024 18:37:43
libplacebo version: v7.349.0 (v6.338.0-120-g7b294350)
FFmpeg version: 6.1.1
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
description: |
Provide the output of `mpv --version`.
render: bash
validations:
required: false
- type: textarea
id: other_information
attributes:
label: "Other Information"
description: >
Provide following information if applicable.
- Linux Version: `cat /etc/os-release | grep "NAME"`
- Kernel Version: `uname -a`
- GPU Model: `lspci -nn | grep VGA` or `lshw -C display -numeric`
- Mesa/GPU Driver Version: `glxinfo -B | grep "OpenGL version string"` or `vulkaninfo | grep driverInfo`
- Window Manager and Version
- Source of the mpv binary
- Latest version of mpv you know without the problem
- The time when the problem started to happen (after updating mpv, system, driver, etc.)
- Possible screenshot or video of visual glitches
If you're not using the git master branch or the [latest release](https://github.com/mpv-player/mpv/releases/latest), please update.
Older versions are not supported. If your distribution does not provide the latest version, please report the issue to them.
Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- Linux version:
- Kernel Version:
- GPU Model:
- Mesa/GPU Driver Version:
- Window Manager and Version:
- Source of mpv:
- Latest known working version:
- Issue started after the following happened:
render: text
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
Try to reproduce your issue with `--no-config` first. If it isn't reproducible
with `--no-config` try to find out which option or script causes your issue.
If the issue is render performance-related, try to reproduce it with `--no-config
--profile=fast`, which is designed to work on lower-end mobile devices.
For decoding performance-related issues, additionally try to enable hardware
decoding with `--hwdec=yes` or the `Ctrl+h` shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Make a log file with `--gpu-debug --log-file=output.txt`, which is our preferred way, and
attach it to the issue.
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
In the case of a crash, please provide a [backtrace](https://wiki.archlinux.org/title/Debugging/Getting_traces).
Without the log file, this issue will be closed for ignoring the issue template.
Disclaimer: The log file may contain identifiable information, such as your username.
Review the log file before sharing and redact any sensitive data if necessary.
validations:
required: true
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files for a minimal reproduction case, if the issue can't be
reproduced without it or it is helpful to demonstrate the issue.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of files, parameters, and conditions
used in "Reproduction Steps", with the addition of `--log-file=output.txt`.
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
- label: "I attached the backtrace in the case of a crash."
required: true
@@ -1,57 +0,0 @@
---
name: 'Report a macOS Issue'
about: 'Create a report for a runtime related macOS Issue'
title: ''
labels: 'os:mac'
assignees: ''
---
### Important Information
Provide following Information:
- mpv version
- macOS Version
- Source of the mpv binary or bundle
- If known which version of mpv introduced the problem
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Try to reproduce your issue with --no-config first. If it isn't reproducible
with --no-config try to first find out which option or script causes your issue.
If the issue is performance-related, try to reproduce it with --no-config
--profile=fast, which is designed to work on lower-end mobile devices.
Additionally, enable hardware decoding with --hwdec=yes or the Ctrl+h shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Make a log file made with -v -v or --log-file=output.txt, attach it to
the issue, and replace this text with a link to it.
If you use the Bundle, a default log is created for your last run at
~/Library/Logs/mpv.log. You can jump to that file via the
Help > Show log File… menu.
Without the log file, this issue will be closed for ignoring the issue template.
In the case of a crash, please provide the macOS Crash Report (Backtrace).
### Sample files
Sample files needed to reproduce this issue can be attached to the issue
(preferred), or be uploaded to https://0x0.st/ or similar sites.
(Only needed if the issue cannot be reproduced without it.)
Do not use garbage like "cloud storage", especially not Google Drive.
@@ -0,0 +1,153 @@
name: "Report a macOS Issue"
description: "Create a report for a runtime related macOS Issue"
labels: ["os:mac"]
type: Bug
body:
- type: textarea
id: mpv_information
attributes:
label: "mpv Information"
placeholder: |
mpv v0.38.0-96-gf776be6af5 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on May 5 2024 18:37:43
libplacebo version: v7.349.0 (v6.338.0-120-g7b294350)
FFmpeg version: 6.1.1
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
description: |
Provide the output of `mpv --version`.
render: bash
validations:
required: false
- type: textarea
id: other_info
attributes:
label: "Other Information"
description: >
- macOS Version: `system_profiler SPSoftwareDataType | sed -rn 's/^ *System Version: (.*$)/\1/p'`
- Source of the mpv binary or bundle
- Latest version of mpv you know without the problem
- The time when the problem started to happen (after updating mpv, system, driver, etc.)
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Nightly builds from master can be found [here](https://github.com/mpv-player/mpv/actions/workflows/build.yml?query=branch%3Amaster+event%3Apush),
click on the latest workflow run, scroll down to the Artifacts section and download the
appropriate build. Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- macOS version:
- Source of mpv:
- Latest known working version:
- Issue started after the following happened:
render: text
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
Try to reproduce your issue with `--no-config` first. If it isn't reproducible
with `--no-config` try to find out which option or script causes your issue.
If the issue is render performance-related, try to reproduce it with `--no-config
--profile=fast`, which is designed to work on lower-end mobile devices.
For decoding performance-related issues, additionally try to enable hardware
decoding with `--hwdec=yes` or the `Ctrl+h` shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Make a log file with `--gpu-debug --log-file=output.txt`, which is our preferred way, and
attach it to the issue. If you use the Bundle, a default log is created for your last run
at `~/Library/Logs/mpv.log`. You can jump to that file via the `Help > Show log File…` menu.
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
In the case of a crash, please provide the macOS Crash Report or create a [backtrace](https://developer.apple.com/library/archive/documentation/General/Conceptual/lldb-guide/chapters/C5-Examining-The-Call-Stack.html)
yourself.
Without the log file, this issue will be closed for ignoring the issue template.
Disclaimer: The log file may contain identifiable information, such as your username.
Review the log file before sharing and redact any sensitive data if necessary.
validations:
required: true
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files for a minimal reproduction case, if the issue can't be
reproduced without it or it is helpful to demonstrate the issue.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of files, parameters, and conditions
used in "Reproduction Steps", with the addition of `--log-file=output.txt`.
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
- label: "I attached the backtrace in the case of a crash."
required: true
@@ -1,54 +0,0 @@
---
name: 'Report a Windows Issue'
about: 'Create a report for a runtime related Windows Issue'
title: ''
labels: 'os:win'
assignees: ''
---
### Important Information
Provide following Information:
- mpv version
- Windows Version
- Source of the mpv binary
- If known which version of mpv introduced the problem
- GPU model, driver and version
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Try to reproduce your issue with --no-config first. If it isn't reproducible
with --no-config try to first find out which option or script causes your issue.
If the issue is performance-related, try to reproduce it with --no-config
--profile=fast, which is designed to work on lower-end mobile devices.
Additionally, enable hardware decoding with --hwdec=yes or the Ctrl+h shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Make a log file made with -v -v or --log-file=output.txt, attach it to
the issue, and replace this text with a link to it.
Without the log file, this issue will be closed for ignoring the issue template.
In the case of a crash, please provide a backtrace.
### Sample files
Sample files needed to reproduce this issue can be attached to the issue
(preferred), or be uploaded to https://0x0.st/ or similar sites.
(Only needed if the issue cannot be reproduced without it.)
Do not use garbage like "cloud storage", especially not Google Drive.
@@ -0,0 +1,154 @@
name: "Report a Windows Issue"
description: "Create a report for a runtime related Windows Issue"
labels: ["os:win"]
type: Bug
body:
- type: textarea
id: mpv_information
attributes:
label: "mpv Information"
placeholder: |
mpv v0.38.0-96-gf776be6af5 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on May 5 2024 18:37:43
libplacebo version: v7.349.0 (v6.338.0-120-g7b294350)
FFmpeg version: 6.1.1
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
description: |
Provide the output of `mpv --version`.
render: bash
validations:
required: false
- type: textarea
id: other_information
attributes:
label: "Other Information"
description: >
- Windows Version: `cmd /c ver`
- GPU model, driver and version
- Source of the mpv binary
- Latest version of mpv you know without the problem
- The time when the problem started to happen (after updating mpv, system, driver, etc.)
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Nightly builds from master can be found [here](https://github.com/mpv-player/mpv/actions/workflows/build.yml?query=branch%3Amaster+event%3Apush),
click on the latest workflow run, scroll down to the Artifacts section and download the
appropriate build. Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- Windows version:
- GPU model, driver and version:
- Source of mpv:
- Latest known working version:
- Issue started after the following happened:
render: text
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
Try to reproduce your issue with `--no-config` first. If it isn't reproducible
with `--no-config` try to find out which option or script causes your issue.
If the issue is render performance-related, try to reproduce it with `--no-config
--profile=fast`, which is designed to work on lower-end mobile devices.
For decoding performance-related issues, additionally try to enable hardware
decoding with `--hwdec=yes` or the `Ctrl+h` shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Make a log file with `--gpu-debug --log-file=output.txt`, which is our preferred way, and
attach it to the issue.
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
In the case of a crash, please provide a backtrace, attach the appropriate `.dmp` file
from `%LOCALAPPDATA%\CrashDumps`.
Without the log file, this issue will be closed for ignoring the issue template.
Disclaimer: The log file may contain identifiable information, such as your username.
Review the log file before sharing and redact any sensitive data if necessary.
validations:
required: true
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files for a minimal reproduction case, if the issue can't be
reproduced without it or it is helpful to demonstrate the issue.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of files, parameters, and conditions
used in "Reproduction Steps", with the addition of `--log-file=output.txt`.
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
- label: "I attached the backtrace in the case of a crash."
required: true
-54
View File
@@ -1,54 +0,0 @@
---
name: 'Report a different Issue'
about: 'Create a report for a runtime related Issue'
title: ''
labels: ''
assignees: ''
---
### Important Information
Provide following Information:
- mpv version
- Platform and Version
- Source of the mpv binary
- If known which version of mpv introduced the problem
- GPU model, driver and version
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Try to reproduce your issue with --no-config first. If it isn't reproducible
with --no-config try to first find out which option or script causes your issue.
If the issue is performance-related, try to reproduce it with --no-config
--profile=fast, which is designed to work on lower-end mobile devices.
Additionally, enable hardware decoding with --hwdec=yes or the Ctrl+h shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Make a log file made with -v -v or --log-file=output.txt, attach it to
the issue, and replace this text with a link to it.
Without the log file, this issue will be closed for ignoring the issue template.
In the case of a crash, please provide a backtrace.
### Sample files
Sample files needed to reproduce this issue can be attached to the issue
(preferred), or be uploaded to https://0x0.st/ or similar sites.
(Only needed if the issue cannot be reproduced without it.)
Do not use garbage like "cloud storage", especially not Google Drive.
+151
View File
@@ -0,0 +1,151 @@
name: "Report an Issue on other platforms"
description: "Create a report for a runtime related Issue on other platforms"
labels: []
type: Bug
body:
- type: textarea
id: mpv_information
attributes:
label: "mpv Information"
placeholder: |
mpv v0.38.0-96-gf776be6af5 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on May 5 2024 18:37:43
libplacebo version: v7.349.0 (v6.338.0-120-g7b294350)
FFmpeg version: 6.1.1
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
description: |
Provide the output of `mpv --version`.
render: bash
validations:
required: false
- type: textarea
id: important_information
attributes:
label: "Important Information"
description: >
- Platform and Version
- GPU model, driver and version
- Source of the mpv binary
- Latest version of mpv you know without the problem
- The time when the problem started to happen (after updating mpv, system, driver, etc.)
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- Platform version:
- GPU model, driver and version:
- Source of mpv:
- Latest known working version:
- Issue started after the following happened:
render: text
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
Try to reproduce your issue with `--no-config` first. If it isn't reproducible
with `--no-config` try to find out which option or script causes your issue.
If the issue is render performance-related, try to reproduce it with `--no-config
--profile=fast`, which is designed to work on lower-end mobile devices.
For decoding performance-related issues, additionally try to enable hardware
decoding with `--hwdec=yes` or the `Ctrl+h` shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Make a log file with `--gpu-debug --log-file=output.txt`, which is our preferred way, and
attach it to the issue.
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
In the case of a crash, please provide a backtrace.
Without the log file, this issue will be closed for ignoring the issue template.
Disclaimer: The log file may contain identifiable information, such as your username.
Review the log file before sharing and redact any sensitive data if necessary.
validations:
required: true
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files for a minimal reproduction case, if the issue can't be
reproduced without it or it is helpful to demonstrate the issue.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of files, parameters, and conditions
used in "Reproduction Steps", with the addition of `--log-file=output.txt`.
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
- label: "I attached the backtrace in the case of a crash."
required: true
@@ -1,35 +0,0 @@
---
name: 'Report a build Problem'
about: 'Create a report for a build related Issue'
title: ''
labels: 'core:meson'
assignees: ''
---
### Important Information
Provide following Information:
- mpv version
- Platform and Version
- meson version
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Attach meson-logs/meson-log.txt or meson setup build output to the issue,
and replace this text with a link to it.
Without the log file, this issue will be closed for ignoring the issue template.
@@ -0,0 +1,76 @@
name: "Report a build Problem"
description: "Create a report for a build related Issue"
labels: ["core:meson"]
type: Bug
body:
- type: textarea
id: important_information
attributes:
label: "Important Information"
description: >
- mpv version
- Platform and Version
- Meson version
If you're not using git master or the latest release, update.
Releases are listed [here](https://github.com/mpv-player/mpv/releases).
value: |-
- mpv version:
- Platform version:
- Meson version:
render: text
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Attach meson-logs/meson-log.txt or meson setup build output to the issue.
Without the log file, this issue will be closed for ignoring the issue template.
validations:
required: true
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of parameters, and conditions used in
"Reproduction Steps".
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
@@ -1,21 +0,0 @@
---
name: 'Request a new Feature'
about: 'Create a request for a new feature'
title: ''
labels: 'meta:feature-request'
assignees: ''
---
Before requesting a new feature make sure it hasn't been requested yet.
https://github.com/mpv-player/mpv/labels/meta%3Afeature-request
### Expected behavior of the wanted feature
### Alternative behavior of the wanted feature
### Log file
Even if you think it's not necessary at first, it might help us later to find
possible issues. Make a log file made with -v -v or --log-file=output.txt,
attach it to the issue, and replace this text with a link to it.
@@ -0,0 +1,60 @@
name: "Request a new Feature"
description: "Create a request for a new feature"
labels: ["meta:feature-request"]
type: Feature
body:
- type: textarea
id: expected_behavior
attributes:
label: "Expected behavior of the wanted feature"
description: >
Before requesting a new feature, make sure it hasn't been
[requested yet](https://github.com/mpv-player/mpv/labels/meta%3Afeature-request),
and isn't already supported by [mpv](https://mpv.io/manual/master/),
[ffmpeg](https://ffmpeg.org/documentation.html), or existing
[mpv scripts](https://github.com/mpv-player/mpv/wiki/User-Scripts).
If you are not sure about this, ask on
[mpv Discussions](https://github.com/mpv-player/mpv/discussions) and
[mpv IRC channel](https://mpv.io/community/) first before opening a feature request.
validations:
required: true
- type: textarea
id: alternative_behavior
attributes:
label: "Alternative behavior of the wanted feature"
- type: textarea
id: log_file
attributes:
label: "Log File"
description: >
Even if you think it's not necessary at first, it might help us later to find
possible issues. Make a log file with `--log-file=output.txt`, which is our preferred way,
and attach it to the issue.
If you have trouble producing a log file, you can alternatively use `-v -v`, save the
terminal output to a file, and attach it to the issue.
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files in the case you request a format/codec/container dependent
feature, and it could help us test and implement it.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
+3
View File
@@ -1,5 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: mpv Discussions
url: https://github.com/mpv-player/mpv/discussions
about: If you have questions or want to discuss things use our GitHub Discussions
- name: mpv IRC channel
url: https://mpv.io/community/
about: Feel free to ask questions here irc://irc.libera.chat/mpv
+1 -1
View File
@@ -2,4 +2,4 @@ Read this before you submit this pull request:
https://github.com/mpv-player/mpv/blob/master/DOCS/contribute.md
Reading this link and following the rules will get your pull request reviewed
and merged faster. Nobody wants lazy pull requests.
and merged faster. Nobody wants lazy pull requests.
+8
View File
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "ci"
+452 -84
View File
@@ -10,6 +10,8 @@ on:
- 'DOCS/**'
- 'TOOLS/lua/**'
- '.editorconfig'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE'
- '.gitignore'
- 'Copyright'
- 'README.md'
@@ -20,100 +22,280 @@ on:
- 'DOCS/**'
- 'TOOLS/lua/**'
- '.editorconfig'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE'
- '.gitignore'
- 'Copyright'
- 'README.md'
- 'RELEASE_NOTES'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
mingw:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
DOWNLOAD_CACHE: ${{ github.workspace }}/.ccache/downloads
TARGET: ${{ matrix.arch }}-w64-mingw32
RUST_TARGET: ${{ matrix.arch }}-pc-windows-gnu
strategy:
fail-fast: false
matrix:
target: [i686-w64-mingw32, x86_64-w64-mingw32]
include:
- arch: i686
wine: wine32
- arch: x86_64
wine: wine64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Get time
id: get_time
run: echo "timestamp=`date +%s%N`" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
- name: Restore cache
uses: actions/cache/restore@v5
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ matrix.target }}-
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ env.TARGET }}-
- name: Install dependencies
run: |
rustup target add ${{ env.RUST_TARGET }}
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y autoconf automake pkg-config g++-mingw-w64 gcc-multilib python3-pip ninja-build nasm wine wine32 wine64 ccache
sudo python3 -m pip install meson
sudo apt-get install --no-install-recommends -y ccache g++-mingw-w64 gcc-multilib python3-pip nasm ninja-build pkgconf ${{ matrix.wine }} wine
python -m pip install meson
- name: Install Meson Wraps
run: |
mkdir subprojects -p
meson wrap install mujs
meson subprojects download
- name: Build libraries
run: |
./ci/build-mingw64.sh
env:
TARGET: ${{ matrix.target }}
- name: Build with meson
id: build
run: |
./ci/build-mingw64.sh meson pack
env:
TARGET: ${{ matrix.target }}
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
cat ./mingw_build/meson-logs/meson-log.txt
- name: Functional test
id: tests
run: |
cd artifact && wine64 ./mpv.com -v --no-config
cd artifact && wine ./mpv.com -v --no-config
env:
WINEDEBUG: '+loaddll'
- uses: actions/upload-artifact@v4
- name: Run meson tests
id: tests
run: |
meson test -C mingw_build
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./mingw_build/meson-logs/testlog.txt
- name: Artifact name
id: artifact
run: |
VERSION_FILE=$(find . -path "*/common/version.h" -type f | head -n 1)
VER=$(grep VERSION "$VERSION_FILE" | cut -d'"' -f2)
PR=${{ github.event.pull_request.number && format('-pr{0}', github.event.pull_request.number) || '' }}
echo "name=mpv-$VER$PR-${{ github.run_id }}-$TARGET" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v7
with:
name: mpv-${{ matrix.target }}
path: mpv-git-*.zip
name: ${{ steps.artifact.outputs.name }}
path: artifact/*
- name: Save Cache
uses: actions/cache/save@v5
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
win32:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
arch: "x64"
os: "windows-2025-vs2026"
- target: aarch64-pc-windows-msvc
arch: "arm64"
os: "windows-11-arm"
env:
CC: "ccache clang"
CXX: "ccache clang++"
CC_LD: "lld-link"
CXX_LD: "lld-link"
RUST_LD: "lld-link"
WINDRES: "llvm-rc"
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: "${{ github.workspace }}\\.ccache"
CCACHE_MAXSIZE: 500M
steps:
- name: Disable autocrlf
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v6
- name: Get time
id: get_time
run: |
"timestamp=$((Get-Date).Ticks)" >> $env:GITHUB_OUTPUT
- name: Restore cache
uses: actions/cache/restore@v5
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ matrix.target }}-
- name: Install Winget on windows-11-arm
if: matrix.os == 'windows-11-arm'
shell: pwsh
run: |
Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
Repair-WinGetPackageManager -Latest -Force
- name: Install dependencies
run: |
python -m pip install meson
winget install --accept-source-agreements --accept-package-agreements Ccache.Ccache NASM.NASM
echo "$env:LOCALAPPDATA\Microsoft\WinGet\Links" >> $env:GITHUB_PATH
# For cargo -C
rustup default nightly
- name: Update Meson WrapDB
run: |
meson wrap update-db
# Explicitly download wraps, as nested projects may have older versions of them.
meson wrap install expat
meson wrap install harfbuzz
meson wrap install libpng
meson wrap install zlib
- name: Find Visual Studio
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if (-not $vsPath) { throw "Could not find a Visual Studio installation" }
"VS=$vsPath"
"VS=$vsPath" >> $env:GITHUB_ENV
- name: Build
id: build
run: |
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' -and `
$_ -ne 'C:\Program Files\CMake\bin' -and `
$_ -ne 'C:\Strawberry\c\bin' }) -join ';'
$env:PATH += ';C:\Program Files\NASM'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }}"
./ci/build-win32.ps1
- name: Print build log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
run: |
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' -and `
$_ -ne 'C:\Program Files\CMake\bin' -and `
$_ -ne 'C:\Strawberry\c\bin' }) -join ';'
$env:PATH += ';C:\Program Files\NASM'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }}"
meson test -C build -t 2
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./build/meson-logs/testlog.txt
- name: Artifact name
id: artifact
run: |
$VERSION_FILE = gci . -r -Filter "version.h" | ? { $_.FullName -match "[/\\]common[/\\]version\.h$" } | select -First 1 -exp FullName
$VER = (sls $VERSION_FILE -Pattern 'VERSION').Line -replace '.*"([^"]+)".*', '$1'
$PR = if ("${{ github.event.pull_request.number }}") { "-pr${{ github.event.pull_request.number }}" } else { "" }
$name = "mpv-$VER$PR-${{ github.run_id }}-${{ matrix.target }}"
"name=$name" >> $env:GITHUB_OUTPUT
- uses: actions/upload-artifact@v7
with:
name: ${{ steps.artifact.outputs.name }}
path: |
build/mpv.???
build/mpv-*.bat
build/vulkan-*.dll
!build/mpv.lib
!build/mpv.pdb
- uses: actions/upload-artifact@v7
with:
name: ${{ steps.artifact.outputs.name }}-pdb
path: |
build/mpv.pdb
- name: Save Cache
uses: actions/cache/save@v5
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
cc:
- "clang"
cxx:
- "clang++"
os:
- "macos-12"
- "macos-13"
- "macos-14"
include:
- os: "macos-12"
arch: "intel"
- os: "macos-13"
arch: "intel"
- os: "macos-14"
arch: "arm"
xcode: "Xcode_15.2"
xcode: "Xcode_15.0"
- os: "macos-15"
arch: "arm"
- os: "macos-15-intel"
- os: "macos-26"
arch: "arm"
- os: "macos-26"
arch: "test"
swift: "-target arm64-apple-macosx10.15"
target: "10.15"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Remove stray upstream python binary symlinks under /usr/local
run: |
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete -print
brew unlink python && brew link --overwrite python
- name: Unlink pkg-config if the CI runner happens to have it already installed
run: |
find "$(brew config | grep HOMEBREW_PREFIX | cut -f 2- -d ' ')/bin" -lname '*/pkg-config@0*/*' -print -exec brew unlink pkg-config@0.29.2 \; -quit
- name: Change Xcode version
if: ${{ matrix.xcode != '' }}
run: |
@@ -121,20 +303,30 @@ jobs:
- name: Install dependencies
run: |
brew update
brew install autoconf automake pkg-config libtool python freetype fribidi little-cms2 \
luajit libass ffmpeg meson uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers
if [[ -n "${{ matrix.homebrew }}" ]]; then
export HOMEBREW_NO_AUTO_UPDATE=1
cd "$(brew --repo homebrew/core)"
git checkout --force ${{ matrix.homebrew }}
else
brew update
fi
if brew list ffmpeg &> /dev/null; then brew unlink ffmpeg; fi
brew install -q autoconf automake curl pkgconf libtool python freetype fribidi little-cms2 \
luajit libass ffmpeg-full meson rust uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers \
libarchive libbluray libcaca libcdio-paranoia libdvdnav rubberband zimg
brew link ffmpeg-full
- name: Build with meson
id: build
run: |
./ci/build-macos.sh
env:
CC: "${{ matrix.cc }}"
CXX: "${{ matrix.cxx }}"
TRAVIS_OS_NAME: "${{ matrix.os }}"
SWIFT_FLAGS: "${{ matrix.swift }}"
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.target }}"
- name: Create App Bundle
if: ${{ matrix.arch != 'test' }}
run: |
meson compile -C build macos-bundle
tar -czvf mpv.tar.gz -C build mpv.app
@@ -154,41 +346,47 @@ jobs:
run: |
cat ./build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v4
- name: Artifact name
id: artifact
run: |
VERSION_FILE=$(find . -path "*/common/version.h" -type f | head -n 1)
VER=$(grep VERSION "$VERSION_FILE" | cut -d'"' -f2)
TARGET=${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }}
PR=${{ github.event.pull_request.number && format('-pr{0}', github.event.pull_request.number) || '' }}
echo "name=mpv-$VER$PR-${{ github.run_id }}-$TARGET" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v7
if: ${{ matrix.arch != 'test' }}
with:
name: mpv-${{ matrix.os }}-${{ matrix.arch }}
name: ${{ steps.artifact.outputs.name }}
path: mpv.tar.gz
linux:
runs-on: "ubuntu-22.04"
runs-on: ubuntu-latest
container:
image: "registry.opensuse.org/home/mia/images/images/mpv-ci:stable-deps"
env:
CC: "${{ matrix.config.cc }}"
CXX: "${{ matrix.config.cxx }}"
CC_LD: "${{ matrix.config.ld }}"
CXX_LD: "${{ matrix.config.ld }}"
strategy:
matrix:
config:
- {
cc: "gcc",
cxx: "g++",
}
- {
cc: "clang",
cxx: "clang++",
}
- cc: "gcc"
cxx: "g++"
args: "-Db_ndebug=true"
- cc: "clang"
cxx: "clang++"
ld: "lld"
args: "-Db_lto=true -Db_lto_mode=thin"
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
# workaround to avoid "fatal: unsafe repository" error
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v6
- name: Build with meson
id: build
run: |
./ci/build-tumbleweed.sh
./ci/build-tumbleweed.sh ${{ matrix.config.args }}
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
@@ -205,20 +403,44 @@ jobs:
run: |
cat ./build/meson-logs/testlog.txt
linux-ffmpeg-4-4:
runs-on: ubuntu-22.04
linux-fuzz:
runs-on: ubuntu-latest
container:
# We want to test ffmpeg 4.4 which alpine 3.15 has exactly.
# Furthermore, this is a very minimal build of mpv without commonly
# used features to test build compatibility. Musl is a nice bonus as well
image: alpine:3.15
image: "registry.opensuse.org/home/mia/images/images/mpv-ci:stable-deps"
env:
CC: "clang"
CXX: "clang++"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build with meson
id: build
run: |
meson setup build \
--werror \
-Dfuzzers=true -Dlibmpv=true -Dcplayer=false
meson compile -C build fuzzers
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
linux-ffmpeg-6-1:
runs-on: ubuntu-latest
container:
# We want to test ffmpeg 6.1.2, which Alpine 3.21 includes.
# Also test compatibility with Wayland Protocols 1.38 and Wayland libs 1.23.
# Musl support is an added bonus.
image: alpine:3.21
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: |
apk update
apk add \
binutils \
curl-dev \
ffmpeg-dev \
gcc \
git \
@@ -226,21 +448,24 @@ jobs:
libass-dev \
lua5.2-dev \
pulseaudio-dev \
libplacebo-dev \
libx11-dev \
libxfixes-dev \
libxkbcommon-dev \
libxrandr-dev \
libxpresent-dev \
libxscrnsaver-dev \
meson \
musl-dev \
py3-pip \
samurai
pip install meson
rust \
samurai \
wayland-dev \
wayland-protocols
- name: Build with meson
id: build
run: |
./ci/build-linux-old.sh
./ci/build-linux-old.sh
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
@@ -259,17 +484,18 @@ jobs:
openbsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 30 # avoid any weirdness with the VM
timeout-minutes: 15 # avoid any weirdness with the VM
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Test in OpenBSD VM
uses: cross-platform-actions/action@v0.23.0
uses: cross-platform-actions/action@v1.1.0
with:
operating_system: openbsd
version: '7.4'
version: '7.8'
run: |
sudo pkg_add -U \
cmake \
curl \
ffmpeg \
git \
libarchive \
@@ -278,6 +504,7 @@ jobs:
libcdio-paranoia \
libdvdnav \
libiconv \
libplacebo \
libv4l \
libxkbcommon \
luajit \
@@ -287,6 +514,7 @@ jobs:
pulseaudio \
python3 \
rubberband \
rust \
sdl2 \
shaderc \
spirv-cross \
@@ -296,23 +524,27 @@ jobs:
vulkan-headers \
zimg
./ci/build-openbsd.sh
meson test -C build
if ! meson test -C build; then
cat ./build/meson-logs/testlog.txt
exit 1
fi
freebsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 30 # avoid any weirdness with the VM
timeout-minutes: 15 # avoid any weirdness with the VM
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Test in FreeBSD VM
uses: cross-platform-actions/action@v0.23.0
uses: cross-platform-actions/action@v1.1.0
with:
operating_system: freebsd
version: '14.0'
version: '15.0'
run: |
sudo pkg update
sudo pkg install -y \
alsa-lib \
cmake \
curl \
evdev-proto \
ffmpeg \
git \
@@ -323,10 +555,11 @@ jobs:
libcaca \
libcdio-paranoia \
libdvdnav \
libdisplay-info \
libplacebo \
libXinerama \
libxkbcommon \
libxpresent \
libXpresent \
libXv \
luajit \
meson \
@@ -337,6 +570,7 @@ jobs:
pulseaudio \
python3 \
rubberband \
rust \
sekrit-twc-zimg \
sdl2 \
sndio \
@@ -345,17 +579,35 @@ jobs:
vulkan-headers \
wayland-protocols
./ci/build-freebsd.sh
meson test -C build
if ! meson test -C build; then
cat ./build/meson-logs/testlog.txt
exit 1
fi
msys2:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
sys:
- clang64
- mingw64
- ucrt64
include:
- sys: "clang64"
os: "windows-2025-vs2026"
auto-var-init: "uninitialized"
- sys: "clang64"
os: "windows-2025-vs2026"
asan: true
- sys: "clang64"
os: "windows-2025-vs2026"
auto-var-init: "zero"
- sys: "clang64"
os: "windows-2025-vs2026"
auto-var-init: "pattern"
- sys: "mingw64"
os: "windows-2025-vs2026"
- sys: "ucrt64"
os: "windows-2025-vs2026"
- sys: "clangarm64"
os: "windows-11-arm"
defaults:
run:
shell: msys2 {0}
@@ -365,17 +617,19 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: git
pacboy: >-
amf-headers:p
angleproject:p
ca-certificates:p
cc:p
diffutils:p
cppwinrt:p
curl:p
ffmpeg:p
lcms2:p
libarchive:p
@@ -391,6 +645,7 @@ jobs:
python:p
rst2pdf:p
rubberband:p
rust:p
shaderc:p
spirv-cross:p
uchardet:p
@@ -401,6 +656,10 @@ jobs:
id: build
run: |
./ci/build-msys2.sh meson
env:
SYS: ${{ matrix.sys }}
ASAN: ${{ matrix.asan }}
AUTO_VAR_INIT: ${{ matrix.auto-var-init }}
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
@@ -411,8 +670,117 @@ jobs:
id: tests
run: |
meson test -C build
env:
GGML_NO_BACKTRACE: 1
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./build/meson-logs/testlog.txt
publish:
name: Publish git release
needs: [mingw, win32, macos]
if: github.event_name == 'push' && github.ref == 'refs/heads/master' &&
github.repository == 'mpv-player/mpv'
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
concurrency:
group: publish-git
cancel-in-progress: false
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Publish to git release
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
tag=git-release
base_url="https://github.com/$GH_REPO/releases/download/$tag"
artifacts=$(gh api "repos/{owner}/{repo}/actions/runs/${{ github.run_id }}/artifacts")
# Attach every build artifact unchanged; the notes link to them with
# labels derived from the verbose names.
mkdir -p release
jq -r '.artifacts[] | "\(.id)\t\(.name)"' <<< "$artifacts" |
while IFS=$'\t' read -r id name; do
gh api "repos/{owner}/{repo}/actions/artifacts/$id/zip" > "release/$name.zip"
done
section() {
jq -r --arg url "$base_url" --arg re "$1" '
def pretty:
(if test("i686") then "i686"
elif test("aarch64") then "arm64"
elif test("-arm$") then "arm64"
elif test("intel") then "x86_64"
else "x86_64" end) as $arch
| [ (if test("mingw") then "GCC" elif test("msvc") then "Clang" else empty end),
(if test("macos") then "macOS " + capture("macos-(?<v>[0-9]+)").v else empty end),
(if test("-pdb") then "debug symbols" else empty end) ] as $q
| $arch + (if ($q | length) > 0 then " (" + ($q | join(", ")) + ")" else "" end);
# primary builds first (x86_64, arm64, i686; Clang before GCC), debug symbols last
def rank:
[ (if test("-pdb") then 1 else 0 end),
(if test("x86_64|intel") then 0 elif test("i686") then 2 else 1 end),
(if test("mingw") then 1 else 0 end),
(if test("macos") then (capture("macos-(?<v>[0-9]+)").v | tonumber) else 0 end) ];
[ .artifacts[] | select(.name | test($re)) ] | sort_by(.name | rank)
| map("* [\(.name | pretty)](\($url)/\(.name).zip)") | join("\n")
' <<< "$artifacts"
}
# Match the version string baked into the build (see common/meson.build).
version=$(git describe --abbrev=9 --tags --dirty)
notes=$(cat <<EOF
Automated development build of the latest \`master\` branch.
- Version: \`$version\`
- Commit: ${{ github.sha }}
- Built: $(date -u '+%Y-%m-%d %H:%M:%S UTC')
### Windows
$(section 'w64|msvc')
### macOS
$(section 'macos')
> [!WARNING]
> These are untested development builds of the very latest \`master\`.
> They are **not** official releases. For stable builds see the
> [latest release](https://github.com/$GH_REPO/releases/latest).
EOF
)
# Create the release once (which also creates the tag), then only edit
# it in place so watchers aren't notified on every master push. Stale
# assets are dropped first since their names embed the run id.
if gh release view "$tag" >/dev/null 2>&1; then
gh release view "$tag" --json assets --jq '.assets[].name' |
while read -r asset; do
gh release delete-asset "$tag" "$asset" --yes
done
gh release edit "$tag" \
--prerelease \
--latest=false \
--title "mpv development build" \
--notes "$notes"
gh release upload "$tag" release/*
else
gh release create "$tag" \
--target "$GITHUB_SHA" \
--prerelease \
--latest=false \
--title "mpv development build" \
--notes "$notes" \
release/*
fi
+48
View File
@@ -0,0 +1,48 @@
name: Cleanup caches
on:
workflow_run:
workflows: [build]
types: [completed]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
actions: write
jobs:
cache:
runs-on: ubuntu-latest
steps:
- run: |
gh cache list -L 100 --json id,key,ref -S last_accessed_at -O desc --jq '
map(select(.key | startswith("x86_64-w64-mingw32-") or
startswith("i686-w64-mingw32-") or
startswith("aarch64-pc-windows-msvc-") or
startswith("x86_64-pc-windows-msvc-"))) |
group_by(.ref) |
map({
ref: .[0].ref,
caches: map({
key: .key,
prefix: (.key | capture("^(?<prefix>[\\w_-]+-)\\d+$").prefix)
}) | group_by(.prefix) | map({keys: map(.key)})
}) |
.[]
' |
while read -r group; do
pr=$(echo "$group" | jq -r '.ref | capture("refs/pull/(?<num>[0-9]+)/merge").num')
if [[ -n "$pr" ]] && [ "$(gh pr view $pr --json state --jq '.state')" != "OPEN" ]; then
keys=$(echo "$group" | jq -c '.caches | map(.keys) | .[]')
else
keys=$(echo "$group" | jq -c '.caches | map(.keys[1:]) | .[]')
fi
for key in $(echo "$keys" | jq -r '.[]'); do
gh cache delete "$key"
done
done
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+42 -52
View File
@@ -2,64 +2,54 @@ name: comment
on:
workflow_run:
workflows: ["build"]
workflows: [build]
types: [completed]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
actions: read
contents: read
pull-requests: write
jobs:
pr_comment:
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
if: github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
const { owner, repo } = context.repo;
const run_id = ${{ github.event.workflow_run.id }};
const pull_head_sha = '${{github.event.workflow_run.head_sha}}';
- env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pr=$(gh pr list --state open --json headRefOid,number \
--jq '.[] | select(.headRefOid == "${{ github.event.workflow_run.head_sha }}") | .number')
if [ -z "$pr" ]; then
echo "No matching open pull request found"
exit 0
fi
const issue_number = await(async () => {
const pulls = await github.rest.pulls.list({ owner, repo });
for await (const { data } of github.paginate.iterator(pulls)) {
for (const pull of data) {
if (pull.head.sha === pull_head_sha) {
return pull.number;
}
}
}
})();
if (issue_number) {
core.info(`Using pull request ${issue_number}`);
} else {
return core.error(`No matching pull request found`);
}
artifacts=$(gh api repos/{owner}/{repo}/actions/runs/${{ github.event.workflow_run.id }}/artifacts --jq '.artifacts')
if [ "$(echo "$artifacts" | jq 'length')" -eq 0 ]; then
echo "No artifacts found"
exit 0
fi
const { data: { artifacts } } = await github.rest.actions.listWorkflowRunArtifacts({ owner, repo, run_id });
if (!artifacts.length) {
return core.error(`No artifacts found`);
}
body=$(echo "$artifacts" | jq -r '
def link: "https://nightly.link/${{ github.repository }}/actions/artifacts/\(.id).zip";
def entry: "* [\(.name)](\(link))";
"Download the artifacts for this pull request:\n<details><summary>Windows</summary>\n\n" +
(sort_by(.name) | map(select(.name | test("w64|msvc")) | entry) | join("\n")) +
"\n</details>\n<details><summary>macOS</summary>\n\n" +
(sort_by(.name) | map(select(.name | test("macos")) | entry) | join("\n")) +
"\n</details>"
')
let body = `Download the artifacts for this pull request:\n\n<details><summary>Windows</summary>\n`;
for (const art of artifacts) {
const art_link = `https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip`;
if (art.name.includes('w64')) {
body += `\n* [${art.name}](${art_link})`;
}
}
body += `\n</details>\n\n<details><summary>macOS</summary>\n`;
for (const art of artifacts) {
const art_link = `https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip`;
if (art.name.includes('macos')) {
body += `\n* [${art.name}](${art_link})`;
}
}
body += `\n</details>`;
const { data: comments } = await github.rest.issues.listComments({ repo, owner, issue_number });
const existing_comment = comments.find((c) => c.user.login === 'github-actions[bot]');
if (existing_comment) {
core.info(`Updating comment ${existing_comment.id}`);
await github.rest.issues.updateComment({ repo, owner, comment_id: existing_comment.id, body });
} else {
core.info(`Creating a comment`);
await github.rest.issues.createComment({ repo, owner, issue_number, body });
}
comment_id=$(gh issue view $pr --json comments \
--jq '.comments[] | select(.author.login == "github-actions") | .id')
if [ -n "$comment_id" ]; then
edit=--edit-last
fi
gh pr comment $pr --body "$body" $edit
+6 -2
View File
@@ -13,14 +13,18 @@ on:
paths:
- 'DOCS/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
check-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Docs
run: |
sudo apt-get install python3-docutils rst2pdf
sudo apt-get install --no-install-recommends -y python3-docutils rst2pdf
./TOOLS/docutils-wrapper.py rst2man --strip-elements-with-class=contents --halt=2 ./DOCS/man/mpv.rst mpv.1
./TOOLS/docutils-wrapper.py rst2html --halt=2 ./DOCS/man/mpv.rst mpv.html
./TOOLS/docutils-wrapper.py rst2pdf -c -b 1 --repeat-table-rows ./DOCS/man/mpv.rst -o mpv.pdf
+61
View File
@@ -0,0 +1,61 @@
name: Pull Request Fuzzing
on:
pull_request:
branches: [master]
paths-ignore:
- 'DOCS/**'
- 'TOOLS/lua/**'
- '.editorconfig'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE'
- '.gitignore'
- 'Copyright'
- 'README.md'
- 'RELEASE_NOTES'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: {}
jobs:
Fuzzing:
runs-on: ubuntu-latest
permissions:
security-events: write
strategy:
fail-fast: false
matrix:
sanitizer: [address, undefined, memory]
steps:
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'mpv'
language: c
sanitizer: ${{ matrix.sanitizer }}
- name: Run Fuzzers (${{ matrix.sanitizer }})
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'mpv'
language: c
fuzz-seconds: 1200
sanitizer: ${{ matrix.sanitizer }}
report-ooms: true
report-timeouts: true
output-sarif: true
- name: Upload Crash
uses: actions/upload-artifact@v7
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts
path: ./out/artifacts
- name: Upload Sarif
if: always() && steps.build.outcome == 'success'
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: cifuzz-sarif/results.sarif
checkout_path: cifuzz-sarif
+54 -1
View File
@@ -9,14 +9,67 @@ on:
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
commit-msg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 50
- name: Lint
run: |
./ci/lint-commit-msg.py
swift:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: norio-nomura/action-swiftlint@3.2.1
lua:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: lunarmodules/luacheck@v1
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check
id: check
uses: astral-sh/ruff-action@v3
with:
src: ". TOOLS/umpv"
- name: Suggested changes
if: ${{ failure() && steps.check.outcome == 'failure' }}
run: ruff check . TOOLS/umpv --diff
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: python/mypy@master
with:
install_project_dependencies: no
options: '--check-untyped-defs'
paths: ". TOOLS/umpv"
editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker -config .editorconfig-checker.json
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pre-commit/action@v3.0.1
+110
View File
@@ -0,0 +1,110 @@
local mp_globals = {
mp = {
fields = {
command = {},
commandv = {},
command_native = {},
command_native_async = {},
add_hook = {},
abort_async_command = {},
del_property = {},
get_property = {},
get_property_osd = {},
get_property_bool = {},
get_property_number = {},
get_property_native = {},
set_property = {},
set_property_bool = {},
set_property_number = {},
set_property_native = {},
get_time = {},
add_key_binding = {},
add_forced_key_binding = {},
remove_key_binding = {},
register_event = {},
unregister_event = {},
observe_property = {},
unobserve_property = {},
add_timeout = {},
add_periodic_timer = {},
get_opt = {},
get_script_name = {},
get_script_directory = {},
osd_message = {},
get_wakeup_pipe = {},
get_next_timeout = {},
dispatch_events = {},
register_idle = {},
unregister_idle = {},
enable_messages = {},
register_script_message = {},
unregister_script_message = {},
create_osd_overlay = {},
get_osd_size = {},
msg = {
fields = {
fatal = {},
error = {},
warn = {},
info = {},
verbose = {},
debug = {},
trace = {},
}
},
-- Not documented
-- TODO: Document or remove them
disable_key_bindings = {},
enable_key_bindings = {},
find_config_file = {},
flush_keybindings = {},
format_time = {},
get_mouse_pos = {},
set_key_bindings = {},
set_mouse_area = {},
set_osd_ass = {},
}
},
exit = {},
unpack = {},
}
local mp_internal = {
mp = {
fields = {
-- Internal
-- TODO: Move to mp_internal module
ARRAY = { fields = { info = {}, type = {} }},
MAP = { fields = { info = {}, type = {} }},
UNKNOWN_TYPE = { fields = { info = {}, type = {} }},
_legacy_overlay = { fields = { res_x = {}, res_y = {}, data = {}, update = {} }},
cancel_timer = {},
get_osd_margins = {},
input_define_section = {},
input_disable_section = {},
input_enable_section = {},
input_set_section_mouse_area = {},
keep_running = {},
log = {},
raw_abort_async_command = {},
raw_command_native_async = {},
raw_hook_add = {},
raw_hook_continue = {},
raw_observe_property = {},
raw_unobserve_property = {},
raw_wait_event = {},
request_event = {},
script_name = {},
use_suspend = {},
wait_event = {},
}
}
}
std = "min+mp"
stds = { mp = { read_globals = mp_globals } }
-- mp_internal seems to be merged with mp for other files too...
files["player/lua/defaults.lua"] = { globals = mp_internal }
files["player/lua/auto_profiles.lua"] = { globals = { "p", "get" } }
files["player/lua/select.lua"] = { globals = { "p", "get" } }
max_line_length = 100
+23
View File
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-illegal-windows-names
- id: check-json
- id: check-shebang-scripts-are-executable
- id: check-xml
exclude: ^TOOLS/mpv-osd-symbols.sfdir/font.props$
- id: check-yaml
- id: end-of-file-fixer
exclude: ^TOOLS/osxbundle/mpv.app/Contents/PkgInfo$
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ["--ignore-words-list", "ALS,als,datas,DNE,enew,HDA,numer,ontop,optionA,Paeth,pathc,inout,requestor"]
exclude: ^(etc/menu.conf|misc/language.c)$
+10
View File
@@ -0,0 +1,10 @@
disabled_rules:
- identifier_name
- line_length
- large_tuple
- void_function_in_ternary
- function_body_length
- cyclomatic_complexity
- file_length
- type_body_length
strict: true
+17 -13
View File
@@ -2,9 +2,20 @@ mpv is a fork of mplayer2, which is a fork of MPlayer.
mpv as a whole is licensed under the GNU General Public License GPL version 2
or later (called GPLv2+ in this document, see LICENSE.GPL for full license
text) by default, or the GNU Lesser General Public License LGPL version 2 or
later (LGPLv2.1+ in this document, see LICENSE.LGPL for full license text) if
built with the -Dgpl=false configure switch.
text) by default. The mpv program is licensed the GNU Lesser General Public
License LGPL version 2 or later (LGPLv2.1+ in this document, see LICENSE.LGPL
for full license text) if built without using any GPL only files.
The -Dgpl=false configure switch is provided as a convenience for excluding
the GPL only files listed below from the build process.
However, do note that the build system is provided "as is" and using the
-Dgpl=false configure switch does not in itself create a LGPLv2.1+ license
grant.
Additionally, some non-program parts, such as the documentation and some config
files listed below, are still built and licensed under their respective licenses
even when -Dgpl=false is used. Please consult GPLv2+ and LGPLv2.1+ license texts
for further details on how to distribute these files.
Most source files are LGPLv2.1+ or GPLv2+, but some files are available under
more liberal licenses, such as BSD, MIT, ISC, and possibly others. Look at the
@@ -26,12 +37,7 @@ See DOCS/contribute.md for binding rules wrt. licensing for contributions.
For information about authors and contributors, consult the git log, which
contains the complete SVN and CVS history as well.
"v2.1+" in this context means "version 2.1 or later".
Some libraries are GPLv2+ or GPLv3+ only. Building mpv with Samba support makes
it GPLv3+.
mpv can be built as LGPLv2.1+ with the -Dgpl=false configure option. To add a
mpv can be built as LGPLv2.1+ without using any GPL only files. To add a
LGPL mode to mpv, MPlayer code had to be relicensed from GPLv2+ to LGPLv2.1+ by
asking the MPlayer authors for permission. Since permission could not be
obtained from everyone, LGPL mode disables the following features, some of them
@@ -39,8 +45,7 @@ quite central:
- Linux X11 video output
- BSD audio output via OSS
- NVIDIA/Linux hardware decoding (vdpau, although nvdec usually works)
- Linux TV input
- minor features: jack, DVD, CDDA, SMB, CACA, legacy direct3d VO
- minor features: jack, DVD, CDDA, DVB, CACA, legacy direct3d VO
Some of these will be fixed in the future. The intended use for LGPL mode is
with libmpv, and currently it's not recommended to build mpv CLI in LGPL mode
at all.
@@ -64,9 +69,8 @@ The following files are still GPL only (-Dgpl=false disables them):
video/vdpau.h unknown
video/vdpau_mixer.* actual code must be rewritten
DOCS/man/ GPLv2+
bootstrap.py unknown license, probably GPLv2+ or LGPLv2+
etc/mplayer-input.conf unknown license, probably GPLv2+
mpv.desktop unknown license, probably GPLv2+
etc/mpv.desktop unknown license, probably GPLv2+
etc/restore-old-bindings.conf unknown license, probably GPLv2+
None of the cases listed above affect the final binary if it's built as
+8 -2
View File
@@ -31,6 +31,13 @@ API changes
===========
::
--- mpv 0.40.0 ---
2.5 - Deprecate MPV_RENDER_PARAM_AMBIENT_LIGHT. no replacement.
--- mpv 0.39.0 ---
2.4 - mpv_render_param with the MPV_RENDER_PARAM_ICC_PROFILE argument no
longer has incorrect assumptions about memory allocation and can be
correctly used.
--- mpv 0.38.0 ---
2.3 - partially revert the changes from API version 1.27, remove libmpv as
the default VO and move it to the bottom of the auto-probing order.
@@ -50,7 +57,7 @@ API changes
TRACK_SWITCHED, METADATA_UPDATE, CHAPTER_CHANGE events
--- mpv 0.33.0 ---
1.109 - add MPV_RENDER_API_TYPE_SW and related (software rendering API)
- inactivate the opengl_cb API (always fails to initialize now)
- deactivate the opengl_cb API (always fails to initialize now)
The opengl_cb API was deprecated over 2 years ago. Use the render API
instead.
1.108 - Deprecate MPV_EVENT_IDLE
@@ -281,4 +288,3 @@ API changes
- macOS: the "coreaudio" AO spdif code is split into a separate AO
--- mpv 0.4.0 ---
1.0 - the API is declared stable
+22 -4
View File
@@ -29,7 +29,16 @@ All of these are important for interfacing both with end users and API users
(which include Lua scripts, libmpv, and the JSON IPC). As such, they constitute
a large part of the user interface and APIs.
All incompatible changes to this must be declared in interface-changes.rst.
Certain options and commands may have documented default values. These default
values are considered a part of the API since scripts may already rely on these
documented behaviors. Changing these defaults are considered incompatible
changes and must be documented. Undocumented default values do not subject to
this requirement, and it is recommended to discourage such usage in the related
documentations if there is a need to frequently change such defaults.
All incompatible changes to this must be declared in interface-changes.rst,
which include the types of changes, the impact of these changes, and suggested
actions to address such impact so that the incompatibility is alleviated.
(This may also list compatible additions, but it's not a requirement.)
Degrees of importance and compatibility preservation
@@ -49,8 +58,17 @@ functionality still works, and a replacement is available (if technically
reasonable). For example, a feature deprecated in mpv 0.30.0 may be removed in
mpv 0.32.0. Minor releases do not count towards this.
Under extraordinary circumstances, such as missed incompatible changes that are
already included in a release, critical security fixes, or a severe shortage of
developer time to address the known incompatible changes, important/often used
parts may be broken immediately, but the change must be extensively documented:
all of the related documentations (including manpage, interface-changes.rst,
etc., retrospectively modified if applicable) must clearly state the following:
the fact that the change is a breaking change; the version when the breaking
change happened; and the reason, impact, and suggested remedy actions.
Less useful parts can be broken immediately, but must come with some sort of
removal warning-
removal warning.
Parts for debugging and testing may be removed any time, potentially even
without any sort of documentation.
@@ -108,7 +126,7 @@ CLI
Things such as default key bindings do not necessarily require compatibility.
However, the release notes should be extremely clear on changes to "important"
key bindings. Bindings which restore the old behavior should be added to
restore-old-bindings.conf.
restore-old-bindings.conf and restore-osc-bindings.conf.
Some option parsing is CLI-only and not available from libmpv or scripting. No
compatibility guarantees come with them. However, the rules which mpv uses to
@@ -135,7 +153,7 @@ command-interface.
libmpv C API
------------
The libmpv client API (such as ``<libmpv/client.h>``) mostly gives access to
The libmpv client API (such as ``<mpv/client.h>``) mostly gives access to
the command interface. The API itself (if looked at as a component separate
from the command interface) is intended to be extremely stable.
+238 -168
View File
@@ -1,214 +1,284 @@
Compiling for Windows
=====================
# Compiling for Windows
Compiling for Windows is supported with MinGW-w64. This can be used to produce
both 32-bit and 64-bit executables, and it works for building on Windows and
cross-compiling from Linux and Cygwin. MinGW-w64 is available from:
https://www.mingw-w64.org/
Compiling for Windows is supported using GNU-like compilers (GCC/Clang). Clang
is compatible with both the ``w64-windows-gnu`` [MinGW-w64](https://www.mingw-w64.org/)
and ``pc-windows-msvc`` [Windows SDK](https://developer.microsoft.com/windows/downloads/windows-sdk)
targets. It supports the production of both 32-bit and 64-bit binaries and is
suitable for building on Windows as well as cross-compiling from Linux and Cygwin.
While building a complete MinGW-w64 toolchain yourself is possible, there are a
few build environments and scripts to help ease the process, such as MSYS2 and
MXE. Note that MinGW environments included in Linux distributions are often
broken, outdated and useless, and usually don't use MinGW-w64.
Although it is possible to build a complete MinGW-w64 toolchain yourself, there
are build environments and scripts available to simplify the process, such as
MSYS2 on Windows or a packaged toolchain provided by your favorite Linux
distribution. Note that MinGW-w64 environments included in Linux distributions
can vary in versions. As a general guideline, mpv only supports the MinGW-w64
toolchain version included in the latest Ubuntu LTS release.
**Warning**: the original MinGW (https://osdn.net/projects/mingw/) is unsupported.
mpv employs Meson for building, and the process is the same as any standard Meson
compilation.
Cross-compilation
=================
For the most up-to-date reference on build scripts, you can refer to
[build.yml](https://github.com/mpv-player/mpv/blob/master/.github/workflows/build.yml),
which builds and tests all supported configurations: ``MinGW-w64``, ``Windows SDK``,
and ``MSYS2`` builds.
When cross-compiling, it is recommended to use a meson crossfile to setup
the cross compiling environment. A minimal example is included below:
## Cross-compilation
```ini
[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'x86_64-w64-mingw32-strip'
exe_wrapper = 'wine64'
When cross-compiling, it is recommended to use a Meson ``--cross-file`` to set up the
cross-compiling environment. For a basic example, please refer to
[Cross-compilation](https://mesonbuild.com/Cross-compilation.html).
[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
Alternatively, consider using [mpv-winbuild-cmake](https://github.com/shinchiro/mpv-winbuild-cmake),
which bootstraps a MinGW-w64 toolchain and builds mpv along with its dependencies.
### Example with Meson
1. Create ``cross-file.txt`` with definitions for your toolchain and target platform.
Refer to [x86_64-w64-mingw32.txt](https://mesonbuild.com/Cross-compilation.html)
as a directly usable example.
- **Important**: Beware of pkg-config usage. By default, it uses build machine
files for dependency detection, even when ``--cross-file`` is used. It must
be configured correctly. Refer to ``pkg_config_libdir`` and ``sys_root``
in the [documentation](https://mesonbuild.com/Cross-compilation.html#defining-the-environment)
for proper setup. **In this example pkg-config is not used/required.**
2. Initialize subprojects. This step is optional; other methods are also
available to provide the necessary dependencies.
``` bash
# Update the subprojects database from Meson's WrapDB.
meson wrap update-db
# Explicitly download wraps as nested projects may have older versions of them.
meson wrap install expat
meson wrap install harfbuzz
meson wrap install libpng
meson wrap install zlib
# Add wraps for mpv's required dependencies
mkdir -p subprojects
cat <<EOF > subprojects/libplacebo.wrap
[wrap-git]
url = https://github.com/haasn/libplacebo
revision = master
depth = 1
clone-recursive = true
EOF
cat <<EOF > subprojects/libass.wrap
[wrap-git]
revision = master
url = https://github.com/libass/libass
depth = 1
EOF
# For FFmpeg, use Meson's build system port; alternatively, you can compile
# the upstream version yourself. See https://trac.ffmpeg.org/wiki/CompilationGuide
cat <<EOF > subprojects/ffmpeg.wrap
[wrap-git]
url = https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git
revision = meson-8.1
depth = 1
[provide]
libavcodec = libavcodec_dep
libavdevice = libavdevice_dep
libavfilter = libavfilter_dep
libavformat = libavformat_dep
libavutil = libavutil_dep
libswresample = libswresample_dep
libswscale = libswscale_dep
EOF
```
3. Build
``` bash
meson setup -Ddefault_library=static -Dprefer_static=true \
-Dc_link_args='-static' -Dcpp_link_args='-static' \
--cross-file cross-file.txt build
ninja -C build mpv.exe mpv.com
```
This will produce fully portabiel, statically linked, ``mpv.exe`` and ``mpv.com``
binaries.
#### Building libmpv
- To also build ``libmpv``, execute the following commands:
``` bash
# For a static library
meson configure build -Dlibmpv=true -Ddefault_library=static
ninja -C build libmpv.a
# For a shared library
meson configure build -Dlibmpv=true -Ddefault_library=shared
ninja -C build libmpv-2.dll
```
- Depending on the use case, you might want to use ``-Dgpl=false`` and review
similar options for subprojects.
- If any of Meson's subprojects are not linked statically, you might need to
specify options like the following example for ffmpeg:
``-Dffmpeg:default_library=static``.
#### Enabling more mpv features
The process above produces a basic mpv build. You can enable additional features.
Check the Meson
[WrapDB packages](https://mesonbuild.com/Wrapdb-projects.html) for available
dependencies or by providing them through other means.
Enhancing mpv with more features is as simple as adding more arguments to the
Meson setup command, for example:
``` bash
-Dlua=enabled -Djavascript=enabled -Dlcms2=enabled -Dlibplacebo:lcms=enabled
```
See [meson's documentation](https://mesonbuild.com/Cross-compilation.html) for
more information.
they will be automatically downloaded and built by Meson.
[MXE](https://mxe.cc) makes it very easy to bootstrap a complete MingGW-w64
environment from a Linux machine. See a working example below.
## Native Compilation with Clang (Windows SDK Build)
Alternatively, you can try [mpv-winbuild-cmake](https://github.com/shinchiro/mpv-winbuild-cmake),
which bootstraps a MinGW-w64 environment and builds mpv and dependencies.
1. Install [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022)
or the full [Visual Studio](https://visualstudio.microsoft.com/downloads/#visual-studio-community-2022):
- From the installer, select the necessary components:
- Clang compiler for Windows
- C++ CMake tools for Windows
- Windows SDK
- Activate the developer shell. The target and host architecture must match
(e.g. `amd64` for x86_64, `arm64` for ARM64):
```
& "<Visual Studio Path>\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64 -SkipAutomaticLocation | Out-Null
```
2. Install the remaining build tools that are not part of the Visual Studio installer:
- [Meson](https://mesonbuild.com/Getting-meson.html), the build system.
- [NASM](https://www.nasm.us/), required to assemble the hand-written assembly
in FFmpeg, dav1d and aom. Make sure it is in `PATH`.
- [Rust](https://www.rust-lang.org/tools/install) (via `rustup`), required to
build mpv's Rust components and the `subrandr` subproject. A **nightly**
toolchain is needed, as the build relies on Cargo's unstable `-C` option:
Example with MXE
----------------
```powershell
rustup default nightly
```
```bash
# Before starting, make sure you install MXE prerequisites. MXE will download
# and build all target dependencies, but no host dependencies. For example,
# you need a working compiler, or MXE can't build the crosscompiler.
#
# Refer to
#
# https://mxe.cc/#requirements
#
# Scroll down for disto/OS-specific instructions to install them.
3. The following build script utilizes the Meson subprojects system to build mpv and its dependencies.
To make sure all dependency versions are up-to-date, update the subprojects database from Meson's WrapDB.
Also explicitly download several wraps as some nested projects may pull older versions of them.
```
meson wrap update-db
# Download MXE. Note that compiling the required packages requires about 1.4 GB
# or more!
meson wrap install expat
meson wrap install harfbuzz
meson wrap install libpng
meson wrap install zlib
```
4. Set environment variables so Meson uses the Clang/LLVM toolchain, or pass an
equivalent `--native-file` to Meson.
```powershell
$env:CC = 'clang'
$env:CXX = 'clang++'
$env:CC_LD = 'lld-link'
$env:CXX_LD = 'lld-link'
$env:RUST_LD = 'lld-link'
$env:WINDRES = 'llvm-rc'
```
Note that some dependencies (e.g. LuaJIT) may require `sed` to configure. Fortunately, it is already bundled in
[Git for Windows](https://www.git-scm.com/download/win):
```powershell
$env:PATH += ';<Git Path>\usr\bin'
```
5. Execute [ci\build-win32.ps1](https://github.com/mpv-player/mpv/blob/master/ci/build-win32.ps1). Refer to the script for more details.
cd /opt
git clone https://github.com/mxe/mxe mxe
cd mxe
This process will produce a fully static ``mpv.exe`` and ``mpv.com``, as well as
a static ``libmpv.a``.
# Set build options.
## Native Compilation with MSYS2
# The JOBS environment variable controls threads to use when building. DO NOT
# use the regular `make -j4` option with MXE as it will slow down the build.
# Alternatively, you can set this in the make command by appending "JOBS=4"
# to the end of command:
echo "JOBS := 4" >> settings.mk
For Windows developers seeking a quick setup, MSYS2 is an effective tool for
compiling mpv natively on a Windows machine. The MSYS2 repositories provide
binary packages for most of mpv's dependencies, simplifying the process to
primarily involve building mpv itself.
# The MXE_TARGET environment variable builds MinGW-w64 for 32 bit targets.
# Alternatively, you can specify this in the make command by appending
# "MXE_TARGETS=i686-w64-mingw32" to the end of command:
echo "MXE_TARGETS := i686-w64-mingw32.static" >> settings.mk
### Installing MSYS2
# If you want to build 64 bit version, use this:
# echo "MXE_TARGETS := x86_64-w64-mingw32.static" >> settings.mk
1. Follow the installation steps from [MSYS2](https://www.msys2.org/).
2. Initiate one of the [Environments](https://www.msys2.org/docs/environments/),
with the CLANG64 (``clang64.exe``) being the recommended option.
**Note:** This environment is distinct from the MSYS2 shell that opens
automatically after the final installation dialog. You must close that
initial shell and open a new one for the appropriate environment.
# Build required packages. The following provide a minimum required to build
# a reasonable mpv binary (though not an absolute minimum).
### Updating MSYS2
make gcc ffmpeg libass jpeg lua luajit
For guidance on updating MSYS2, please refer to the official documentation:
[Updating MSYS2](https://www.msys2.org/docs/updating/).
# Add MXE binaries to $PATH
export PATH=/opt/mxe/usr/bin/:$PATH
### Installing mpv Dependencies
# Build mpv. The target will be used to automatically select the name of the
# build tools involved (e.g. it will use i686-w64-mingw32.static-gcc).
``` bash
# Install pacboy and git
pacman -S pactoys git
cd ..
git clone https://github.com/mpv-player/mpv.git
cd mpv
meson setup build --crossfile crossfile
meson compile -C build
```
Native compilation with MSYS2
=============================
For Windows developers looking to get started quickly, MSYS2 can be used to
compile mpv natively on a Windows machine. The MSYS2 repositories have binary
packages for most of mpv's dependencies, so the process should only involve
building mpv itself.
To build 64-bit mpv on Windows:
Installing MSYS2
----------------
1. Download an installer from https://www.msys2.org/
Both the i686 and the x86_64 version of MSYS2 can build 32-bit and 64-bit
mpv binaries when running on a 64-bit version of Windows, but the x86_64
version is preferred since the larger address space makes it less prone to
fork() errors.
2. Start a MinGW-w64 shell (``mingw64.exe``). **Note:** This is different from
the MSYS2 shell that is started from the final installation dialog. You must
close that shell and open a new one.
For a 32-bit build, use ``mingw32.exe``.
Updating MSYS2
--------------
To prevent errors during post-install, the MSYS2 core runtime must be updated
separately.
```bash
# Check for core updates. If instructed, close the shell window and reopen it
# before continuing.
pacman -Syu
# Update everything else
pacman -Su
```
Installing mpv dependencies
---------------------------
```bash
# Install MSYS2 build dependencies and a MinGW-w64 compiler
pacman -S git $MINGW_PACKAGE_PREFIX-{python,pkgconf,gcc,meson}
pacboy -S python pkgconf cc meson
# Install the most important MinGW-w64 dependencies. libass and lcms2 are also
# pulled in as dependencies of ffmpeg.
pacman -S $MINGW_PACKAGE_PREFIX-{ffmpeg,libjpeg-turbo,luajit}
# Install key dependencies. libass and lcms2 are also included as dependencies
# of ffmpeg.
pacboy -S ffmpeg libjpeg-turbo libplacebo luajit vulkan-headers
```
Building mpv
------------
### Building mpv
Finally, compile and install mpv. Binaries will be installed to
``/mingw64/bin`` or ``/mingw32/bin``.
```bash
meson setup build --prefix=$MSYSTEM_PREFIX
meson compile -C build
```
Or, compile and install both libmpv and mpv:
To compile and install mpv, execute the following commands.
The binaries will be installed in the directory ``/$MSYSTEM_PREFIX/bin``.
```bash
# Set up the build directory with the desired configuration
meson setup build -Dlibmpv=true --prefix=$MSYSTEM_PREFIX
# Compile
meson compile -C build
# Optionally, install the compiled binaries
meson install -C build
```
Linking libmpv with MSVC programs
---------------------------------
## Running mpv
mpv/libmpv cannot be built with Visual Studio (Microsoft is too incompetent to
support C99/C11 properly and/or hates open source and Linux too much to
seriously do it). But you can build C++ programs in Visual Studio and link them
with a libmpv built with MinGW.
Depending on your build configuration, ``mpv.exe`` may rely on external
libraries. To create a portable package, you will need to include these
dependencies as well. The quickest way to determine which libraries are needed
is to run ``mpv.exe`` and note any error messages that list the required ``.dll``
files. You can find these libraries in the sysroot used for compilation, such as
``/clang64/bin/`` in MSYS2.
To do this, you need a Visual Studio which supports ``stdint.h`` (recent ones do),
and you need to create a import library for the mpv DLL:
## Linking libmpv with MSVC Programs
Building mpv/libmpv directly with the MSVC compiler (cl.exe) is not supported
due to differences in compiler flags. Our build system is designed specifically
for GNU-like compiler drivers. However, you can still build programs in
Visual Studio and link them with libmpv.
When ``libmpv`` is built with the recommended Clang/``lld-link`` toolchain,
``lld-link`` emits an import library (``mpv.lib``) next to the DLL in the build
directory. Add that ``mpv.lib`` to your MSVC project.
To generate an import library from a DLL yourself, first create a ``.def`` file
listing its exports. There are several ways to do this. One is ``gendef``, which
writes a ``.def``, based on DLL.
```bash
lib /name:mpv-1.dll /out:mpv.lib /MACHINE:X64
gendef libmpv-2.dll
```
The string in the ``/name:`` parameter must match the filename of the DLL (this
is simply the filename the MSVC linker will use).
Static linking is not possible.
Running mpv
-----------
If you want to run mpv from the MinGW-w64 shell, you will find the experience
much more pleasant if you use the ``winpty`` utility
Then build the import library from it. ``/name`` must match the DLL filename, and
``/machine`` must match the DLL's architecture (e.g. ``x64`` or ``arm64``):
```bash
pacman -S winpty
winpty mpv.com ToS-4k-1920.mov
lib /def:libmpv-2.def /name:libmpv-2.dll /out:mpv.lib /machine:x64
```
If you want to move / copy ``mpv.exe`` and ``mpv.com`` to somewhere other than
``/mingw64/bin/`` for use outside the MinGW-w64 shell, they will still depend on
DLLs in that folder. The simplest solution is to add ``C:\msys64\mingw64\bin``
to the windows system ``%PATH%``. Beware though that this can cause problems or
confusion in Cygwin if that is also installed on the machine.
Use of the ANGLE OpenGL backend requires a copy of the D3D compiler DLL that
matches the version of the D3D SDK that ANGLE was built with
(``d3dcompiler_43.dll`` in case of MinGW-built ANGLE) in the path or in the
same folder as mpv. It must be of the same architecture (x86_64 / i686) as the
mpv you compiled.
**Note:** Static linking is only feasible with matching compilers. For instance,
if you build with Clang in Visual Studio, static linking is possible.
+23 -2
View File
@@ -42,7 +42,7 @@ Copyright of contributions
this. If the license of the code is not LGPLv2.1+, you must mention this.
- These license statements are legally binding.
- Don't use fake names (something that looks like an actual name, and may be
someone else's name, but is not your legal name). Using a pseudonyms is
someone else's name, but is not your legal name). Using a pseudonym is
allowed if it can be used to identify or contact you, even if whatever
account you used to submit the patch dies.
- Do not add your name to the license header. This convention is not used by
@@ -141,7 +141,10 @@ Interface change policy
must be documented by making a new text file with a txt extension containing a
small note in the DOCS/interface-changes directory.
- The name of the file should be brief and related to the commit that makes the
change.
change. The content of the file should begin with the type of the change
(add, remove, deprecate, change, rename, etc.). If the file contains multiple
changes, the change which causes the most serious compatibility issues should
be placed first.
- Grouping multiple related changes in the same file is also OK. Just be sure to
put each separate change on a different line.
- Documenting additions in DOCS/interface-changes is optional but encouraged.
@@ -252,6 +255,24 @@ General coding
- If you add features that require intrusive changes, discuss them on the dev
channel first. There might be a better way to add a feature and it can avoid
wasted work.
- Newly added code for any Apple Platform (macOS, iOS, etc), that uses Cocoa or
any other object-oriented Framework or API, should be written in Swift instead
of Objective-C. This also includes complete rewrites/refactors of existing
code. Plain C API usages may stay as C, but can be written in Swift. Existing
Objective-C code can stay as is, though Swift rewrites are welcome.
AI-assisted Contributions
-------------------------
If you have used an AI/LLM for your contribution, you must disclose this in the
PR description. Such contributions are not forbidden, but the submitter takes
full responsibility for the code changes. This includes having full
understanding of the code (knowing what was changed and why) and the ability to
participate in the code review process with human-written responses. This also
includes confirming that the code can be submitted under the same license as the
relevant files (usually LGPLv2 or GPLv2).
Clearly vibe-coded patches will not be considered.
Code of Conduct
---------------
+4 -2
View File
@@ -214,6 +214,9 @@ It provides following parameters change track metadata:
``byterate``
Number of bytes per second this stream uses. (Purely informational.)
``program_id``
Assign this track to a program (integer, default: -1 meaning unset).
``index``
The numeric index of the track this should map to (default: -1). This is
the 0-based index of the virtual stream as seen by the player, enumerating
@@ -366,8 +369,7 @@ tracks. In this case, it's not obvious, which virtual tracks the EDL show should
expose when being played.
Currently, mpv will apply an arbitrary heuristic which tracks the EDL file
should expose. (Before mpv 0.30.0, it always used the first source file in the
segment list.)
should expose.
You can set the ``layout`` option to ``this`` to make a specific entry define
the track layout.
+4 -9
View File
@@ -42,9 +42,7 @@ section::
oacopts-add = b=96k
It's also possible to define default encoding options by putting them into
the section named ``[encoding]``. (This behavior changed after mpv 0.3.x. In
mpv 0.3.x, config options in the default section / no section were applied
to encoding. This is not the case anymore.)
the section named ``[encoding]``.
One can then encode using this profile using the command::
@@ -97,12 +95,9 @@ Device targets
As the options for various devices can get complex, profiles can be used.
An example profile file for encoding is provided in
etc/encoding-profiles.conf in the source tree. This file is installed and loaded
by default. If you want to modify it, you can replace and it with your own copy
by doing::
mkdir -p ~/.mpv
cp /etc/mpv/encoding-profiles.conf ~/.mpv/encoding-profiles.conf
etc/encoding-profiles.conf in the source tree. mpv will read any file
named ``encoding-profiles.conf`` in either the local or system
configuration directories.
Keep in mind that the default profile is the playback one. If you want to add
options that apply only in encoding mode, put them into a ``[encoding]``
+310 -9
View File
@@ -17,8 +17,9 @@ a large part of the user interface and APIs.
Also see compatibility.rst.
This document lists changes to them. New options/commands/etc. are not always
listed.
Prior to 0.40.0, only changes had to be listed here and not necessarily new
additions. After 0.40.0, all changes and additions to options/commands/etc are
listed here.
**Never** write to this file directly except when making releases. New changes
are added in the interface-changes directory instead. See contribute.md for more
@@ -29,6 +30,302 @@ Interface changes
::
--- mpv 0.42.0 ---
--- mpv 0.41.0 ---
- the value of `--tls-ca-file` is now expanded as a path
- the value of `--tls-cert-file` is now expanded as a path
- the value of `--tls-key-file` is now expanded as a path
- the `--sub-sdh-enclosures` option is now a string list option
- rename `console-selected_color` script-opt to `console-focused_color`
- rename `console-selected_back_color` script-opt to `console-
focused_back_color`
- mediacodec_embed is no longer the default `vo` on Android. Set the option
explicitly if you want to use it and are aware of the limitations.
- change `--target-colorspace-hint` to `auto` by default. Auto mode will
also enable hint for SDR formats if target metadata is reported by current
output context.
- change `--prefetch-playlist` default to `no`
- add `--clipboard-xwayland` option
- add `video-params/prim-*` properties
- add `stats-plot_cache` script-opt
- disable `stats-plot_{perfdata,vsync_ratio,vsync_jitter}` by default
- add `scaled` and `osd` flags to screenshot commands
- add `forced` flag to track add commands
- add `default` flag to track add commands
- add `console-monospace_font` script-opt
- remove `console-font` script-opt
- add `console-gap` script-opt
- add `console-exact_match` script-opt
- make `console-case_sensitive` only affect exact searches and change the to
default to no on platforms other than Windows
- add `commands-remember_input` script-opt
- add `--wid=0` support for win32
- add `--vo-kitty-auto-multiplexer-passthrough=<yes|no>`
- add `--vf=format=transfer` alias
- add `--vf=format=min-luma`
- add `--vf=format=max-luma`
- add `--vf=format=max-cll`
- add `--vf=format=max-fall`
- add `--treat-srgb-as-power22`
- add `--sdr-adjust-gamma`
- add `--target-colorspace-hint-strict` option
- add `--target-colorspace-hint-mode` option
- add `--sub-hdr-peak` option
- add `--sub-fix-timing-threshold`
- add `--sub-fix-timing-keep`
- add `--register` and `--unregister`
- add `--osd-prune-delay`
- add `--osd-glyph-limit`
- add `--osd-bitmap-max-size`
- add `--sub-glyph-limit`
- add `--sub-bitmap-max-size`
- add `--osd-shaper`
- add `--input-tablet-emulate-mouse` option
- add `--image-subs-hdr-peak` option
- add `--hwdec-threads`
- add `--hdr-reference-white`
- add `--d3d11-output-mode` enable use specific output mode for creating the
D3D11 swapchain
- add `--d3d11-composition-size=<WxH>` support for d3d11 composition mode
- add `--border-background=blur`
- add `--background-blur-radius`
- add `--bluray-angle`
- add `--background-tile-size` option
- add `--background-tile-color-0` and `--background-tile-color-1` options
- add --audio-set-media-role, disabled by default. This effectively changes
the behavior for ao_pipewire
- `encoding-profiles.conf` is no longer installed by default into the system
configuration directory and is instead installed in the data directory
--- mpv 0.40.0 ---
- undeprecate list option suffixes that work with multiple items
- add `-del` to string list and keyvalue list options
- add `-clr` to keyvalue list options
- undeprecate `--gamma-factor`
- the `path` and `track-list/N/external-filename` properties now always
return a full, absolute path
- rename `--vd-lavc-software-fallback` to `--hwdec-software-fallback`
- rename `--sub-ass-line-spacing` to `--sub-line-spacing`
- rename `--sub-ass-shaper` to `--sub-shaper`
- rename `--sub-ass-hinting` to `--sub-hinting`
- rename `--load-osd-console` to `--load-console`
- remove `stats-term_width_limit` script-opt
- add `stats-term_clip` script-opt
- remove `stats-term_height_limit` script-opt
- remove `player` argument form `--media-controls`, it's handled internally
now.
- make `script-binding` command scalable; add `nonscalable` command prefix
to restore the old behavior
- deprecate `osc-message` script message in favor of `show-text` command
- deprecate `osc-chapterlist` script message in favor of `show-text
${chapter-list}`
- deprecate `osc-playlist` script message in favor of `show-text
${playlist}`
- deprecate `osc-tracklist` script message in favor of `show-text ${track-
list}`
- add `visibility_modes` script-opt to osc
- deprecate `--wayland-disable-vsync`
- add `--wayland-internal-vsync` as a replacement for `--wayland-disable-
vsync`
- deprecate `--cdda-span-a` and `--cdda-span-b`
- commands.lua is split out of console.lua. commands.lua runs and completes
commands and adds mpv's log entries to the console's log, while
console.lua handles the UI for other scripts
- add `--load-commands` option
- `script-binding console/enable` becomes `script-binding commands/open`,
though the console one is kept as an alias
- `script-message-to console type` becomes `script-message-to commands
type`, though the console one is kept as an alias. This also now
automatically closes the console after running the command.
- change the underlying type of the `aspect`, `par`, and `sar` sub-
properties to double from float
- add `--video-aspect-method=ignore`
- change `--video-aspect-override=no` to respect `--video-aspect-method`
option
- deprecate setting `--video-aspect-override` to `0` and `-1`
- change several OSC mouse bindings to select.lua functions
- add script-opts to configure what OSC buttons do when clicked
- remove `osc-playlist_osd` script-opt and behave as if it was off by
default; `playlist_osd=yes` can be replicated with `osc-
playlist_prev_mbtn_left_command=playlist-prev; show-text ${playlist} 3000`
and `osc-playlist_next_mbtn_left_command=playlist-next; show-text
${playlist} 3000`
- remove `osc-chapters_osd` script-opt and behave as if it was off by
default; `chapter_osd=yes` can be replicated with `osc-
chapter_prev_mbtn_left_command=no-osd add chapter -1; show-text ${chapter-
list} 3000` and `osc-chapter_next_mbtn_left_command=no-osd add chapter 1;
show-text ${chapter-list} 3000`
- add script-opts to define custom buttons
- change `--prefetch-playlist`'s default to `yes`
- change `--osd-back-color` and `--sub-back-color` defaults to #AF000000
- change `--geometry` so that it no longer unconditionally moves the window
on platforms where that is possible. Use `--force-window-position` or add
`+50%+50%` to your geometry command to get the old behavior back.
- all options that take filepaths as values are now properly expanded (i.e.
~/ -> /home/$USER)
- all commands that take filepaths as arguments are now properly expanded
(i.e. ~/ -> /home/$USER)
- add `ytdl_hook-include` script-opt
- add `video-frame-info/gop-timecode`, `video-frame-info/smpte-timecode` and
`video-frame-info/estimated-smpte-timecode`
- add `term-clip-cc`
- add `sub-ass-prune-delay` option to control libass automatic pruning of
past
- events
- add `slimbottombar` and `slimtopbar` OSC layouts optimized for viewing
images
- add `osc-fadein` script-opt
- add `mpv://` protocol
- add `metadata` sub-property for `track-list`
- add `keep_open` flag to `mp.input.get()` and `mp.input.select()`
- `mp.input.get()` now closes automatically on submit, pass `keep_open =
true` to restore the old behavior
- add `autoselect_completion` flag to `mp.input.get()`
- add `history_path` key to `mp.input.get()`
- add `hearing-impaired`, `visual-impaired` and `attached-picture` flags to
track add command
- add `format` argument to `screenshot-raw` command
- add `display-page-n-toggle` script bindings to stats.lua, where n is a
page number
- add `demuxer-mkv-crop-compat` option
- add `current-watch-later-dir` property
- add `console-scale_with_window` script-opt
- add `console-margin-x` and `console-margin-y` script-opts
- add `console-background_alpha` `console-menu_outline_size` `console-
menu_outline_color` `console-corner_radius` `console-selected_color` and
`console-selected_back_color` script-opts
- add `--video-recenter` option
- add `nvidia-true-hdr` mode to vf_d3d11vpp
- add `--sub-scale-signs` to allow `--sub-scale` to also scale events
detected to be signs by libass
- add `--script-opt` alias for `--script-opts-append`
- add `--save-watch-history` and `--watch-history-path` options
- add `--osd-selected-color` and `--osd-selected-outline-color` options
- add `--osd-bar-marker-scale` and `--osd-bar-marker-min-size` options
- add `--osd-bar-marker-style` option
- add `--input-ime` to enable or disable the IME on supported VOs (Windows,
Wayland)
- add `--clipboard-monitor` option
- add `clipboard` property
- add `current-clipboard-backend` property
- add `--clipboard-backends` option
- add `--archive-exts`
- add `archive` to `--directory-filter-types`' default
- add `--playlist-exts`
- add `playlist` to `--directory-filter-types`' default
- add --audio-exclusive option support for ao=audiounit and make non-
exclusive the new default
- `sub-blur` is now applied by `sub-ass-override=force` with new enough
libass
- `stats-font_size`, `stats-border_size`, `stats-shadow_x_offset`, `stats-
shadow_y_offset` and `stats-plot_bg_border_width` script-opt values result
in 2.5 times smaller sizes in order to have the same sizes as the values
of equivalent OSD options like `--osd-font-size`. If you customized these
sizes, multiply them by 2.5 to get the previous sizes.
- ``glsl-shader-opts`` now has predefined parameters that can be used. See
the documentation for available values.
- `--hwdec=auto` now behaves like `--hwdec=auto-safe`; use `--hwdec=auto-
unsafe` to get the old behavior back
- Change auto profiles hook priority from 50 to 5
- add optional `frames` and `flags` arguments to `frame-step` command
controlling the direction and amount of frames mpv steps through
- add optional `mute` flag to `frame-step` command which mutes the player
during the duration of the frame step
--- mpv 0.39.0 ---
- turn `--cover-art-whitelist` into a list option
- reserve `user-data/osc` and `user-data/mpv` sub-paths for internal use
- remove deprecated `packet-video-bitrate` `packet-audio-bitrate` and
`packet-sub-bitrate` properties
- remove deprecated `--cache-dir` option alias
- remove deprecated `--cache-unlink-files` option alias
- remove deprecated `--demuxer-cue-codepage` option alias
- remove deprecated `--fps` option alias
- remove deprecated `--cdrom-device` option alias
- remove deprecated `--sub-forced-only` option alias
- remove deprecated `--vo-sixel-exit-clear` option alias
- remove deprecated `--cdda-toc-bias` option
- remove deprecated `--drm-atomic` option
- remove `sub-ass-vsfilter-aspect-compat`: use `sub-ass-use-video-data=none`
for disabling aspect compat
- remove `sub-ass-vsfilter-blur-compat`: use `sub-ass-use-video-data=aspect-
ratio` for disabling blur compat
- add `sub-ass-use-video-data`
- add `sub-ass-video-aspect-override`
- change default V keybind to cycle `sub-ass-use-video-data` instead of the
now removed `sub-ass-vsfilter-aspect-compat`
- remove `console-scale` script-opt
- remap numpad `+ - * /` keys to `KP_ADD/KP_SUBTRACT/KP_MULTIPLY/KP_DIVIDE`;
keybinds which require these numpad keys to function need to use the new
names instead
- numerical values of `--loop-file` no longer decrease on each iteration
- add `remaining-file-loops` property as a replacement to get the remaining
loop count
- numerical values of `--ab-loop-count` no longer decrease on each iteration
- add `remaining-ab-loops` property as a replacement to get the remaining
loop count
- move 'scale' above 'force' for `sub-ass-override` in documentation as well
as code. This more accurately reflects destructiveness of these options.
- change `sub-ass-override` default from 'yes' to 'scale'. This should
result in no effective changes because 'yes' used to unintentionally do
what 'scale' should've done.
- change 'u' binding to cycle between 'force' and 'scale', instead of
'force' and 'yes'
- deprecate `sub-text-ass` property; add `sub-text/ass` sub-property
- change type of `sub-start` and `sub-end` properties to time
- change `vidscale` script option type to string for osc.lua
- change `vidscale` script option type to string for stats.lua
- change `vidscale` default from `yes` to `auto` for osc.lua and stats.lua
- change `mp.add_key_binding` so that by default, the callback is not
invoked if the event is canceled; clients should now use the `complex`
option to detect this situation
- add `canceled` entry to `mp.add_key_binding` callback argument
- add the `normalize-path` command
- add `user-data/mpv/ytdl/path` and `user-data/mpv/ytdl/json-subprocess-
result` properties
- add `track-list/N/dolby-vision-profile` and `track-list/N/dolby-vision-
level`
- add `track-list/N/decoder`
- add `sub-text/ass-full` sub-property
- add `osc-show` script message
- add `nonrepeatable` input command prefix
- add `mp.input.select()`
- add `--wasapi-exclusive-buffer` option
- add `--vf=d3d11vpp=scaling-mode`
- add `--vf=d3d11vpp=scale`
- add `--sub-border-style` and `--osd-border-style` options
- the border style does not depend on `--(sub/osd)-border-color` and
`--(sub/osd)-shadow-color`; now it depends solely on `--(sub/osd)-border-
style`
- make `--(sub/osd)-border-color` an alias of `--(sub/osd)-outline-color`
- make `--(sub/osd)-border-size` an alias of `--(sub/osd)-outline-size`
- make `--(sub/osd)-shadow-color` an alias of `--(sub/osd)-back-color`; they
cannot both be set now
- make `--osd-bar-border-size` an alias of `--osd-bar-outline-size`
- add `--show-in-taskbar` option
- add `--pitch` option
- add `--osd-playlist-entry` option
- remove `osc-playlist_media_title` script-opt
- add `--native-touch` option
- add `--input-touch-emulate-mouse` option
- add `touch-pos` property
- add `--media-controls` option
- add `--input-dragging-deadzone` option
- add `--input-builtin-dragging` option
- add `--egl-config-id` option
- add `--egl-output-format` option
- add `--directory-filter-types`
- By default, opening a directory will create a playlist with only the media
types "video, audio, image". To restore the previous behavior, use
`--directory-filter-types-clr`.
- add `--autocreate-playlist`
- add `--video-exts`
- add `--audio-exts`
- add `--image-exts`
- add `option-info/<name>/expects-file` sub-property
- Bump dependency of VapourSynth to utilize its API version 4. New minimum
VapourSynth version for runtime is R56. Some functions and plugins are
changed or removed. For details, refer to VapourSynth documentation
<http://www.vapoursynth.com/2021/09/r55-audio-support-and-improved-performance/> and
<https://github.com/vapoursynth/vapoursynth/blob/R68/APIV4%20changes.txt>
--- mpv 0.38.0 ---
- add `term-size` property
- add the `escape-ass` command
@@ -44,7 +341,7 @@ Interface changes
- add `current-gpu-context` property
- add `--secondary-sub-ass-override` option
- add `--input-preprocess-wheel` option
- remove shared-script-properties (user-data is a replacement)
- remove `shared-script-properties` (`user-data` is a replacement)
- add `--secondary-sub-delay`, decouple secondary subtitles from
`--sub-delay`
- add the `--osd-bar-border-size` option
@@ -64,7 +361,11 @@ Interface changes
- change `--hidpi-window-scale` default to `no`
- add `insert-next`, `insert-next-play`, `insert-at`, and `insert-at-play`
actions to `loadfile` and `loadlist` commands
- add `index` argument to `loadfile` and `loadlist` commands
- add `index` argument to `loadlist` command
- add `index` argument to `loadfile` command. This breaks all existing
uses of this command which make use of the argument to include the list of
options to be set while the file is playing. To address this problem, the
third argument now needs to be set to -1 if the fourth argument needs to be used.
- move the `options` argument of the `loadfile` command from the third
parameter to the fourth (after `index`)
- add `--drag-and-drop=insert-next` option
@@ -212,12 +513,12 @@ Interface changes
- `--save-position-on-quit` and its associated commands now store state files in
the XDG_STATE_HOME directory by default. This only has an effect on linux/bsd
systems.
- mpv now implictly saves cache files in XDG_CACHE_HOME by default. This only has
- mpv now implicitly saves cache files in XDG_CACHE_HOME by default. This only has
an effect if the user enables options that would lead to cache being stored and
only makes a difference on linux/bsd systems.
- `--cache-on-disk` no longer requires explictly setting the `--cache-dir` option
- `--cache-on-disk` no longer requires explicitly setting the `--cache-dir` option
- add `--icc-cache` and `--gpu-shader-cache` options to control whether or not to
save cache files for these features; explictly setting `--icc-cache-dir` and
save cache files for these features; explicitly setting `--icc-cache-dir` and
`--gpu-shader-cache` is no longer required
- remove the `--tone-mapping-crosstalk` option
- add `--gamut-mapping-mode=perceptual|relative|saturation|absolute|linear`
@@ -359,7 +660,7 @@ Interface changes
- deprecate --input-file (there are no plans to remove this short-term,
but it will probably eventually go away <- that was a lie)
- deprecate --video-sync=display-adrop (might be removed if it's in the way;
undeprecated or readded if it's not too much of a problem)
undeprecated or re-added if it's not too much of a problem)
- deprecate all input section commands (these will be changed/removed, as
soon as mpv internals do not require them anymore)
- remove deprecated --playlist-pos alias (use --playlist-start)
@@ -551,7 +852,7 @@ Interface changes
(such as "sub-file"), deprecated in mpv 0.26.0
- deprecate the old command based hook API, and introduce a proper C API
(the high level Lua API for this does not change)
- rename the the lua-settings/ config directory to script-opts/
- rename the lua-settings/ config directory to script-opts/
- the way the player waits for scripts getting loaded changes slightly. Now
scripts are loaded in parallel, and block the player from continuing
playback only in the player initialization phase. It could change again in
+1
View File
@@ -0,0 +1 @@
change `ytdl_hook-all_formats` default to `yes`
@@ -0,0 +1 @@
make `--autocreate-playlist` only activate for regular files
@@ -0,0 +1 @@
make the `metadata/by-key` property writable
+1
View File
@@ -0,0 +1 @@
'command-list' now also returns a default value and available choices where applicable for each command argument.
+1
View File
@@ -0,0 +1 @@
make `mpv_command_node` accept `_name` for command name
@@ -0,0 +1 @@
add `--demuxer-hysteresis-bytes`
+2
View File
@@ -0,0 +1,2 @@
add `--input-builtin-drag-and-drop` option
add `dropped-file` property
@@ -0,0 +1 @@
remove the deprecated `error` field from `end-file`
+1
View File
@@ -0,0 +1 @@
add `env` property that can be used to retrieve environment variables
@@ -0,0 +1 @@
the `expand-properties` command modifier also applies to string lists now
@@ -0,0 +1 @@
`--geometry` x/y position is now applied only on initial window creation, unless `--force-window-position=yes` is set.
+1
View File
@@ -0,0 +1 @@
add libcurl-based stream backend (http, https, ftp, ftps), with new options `--curl-enabled`, `--curl-http-version`, `--curl-max-redirects`, `--curl-max-retries`, `--curl-connect-timeout`, `--curl-buffer-size` and `--curl-max-request-size`
@@ -0,0 +1 @@
add `libplacebo-version` property
@@ -0,0 +1 @@
the `loadfile` and `loadlist` commands can now take multiple flags (i.e. `append+play`)
+1
View File
@@ -0,0 +1 @@
deprecate `mp.input.log_error()`
+1
View File
@@ -0,0 +1 @@
stop searching the deprecated `lua-settings` directory for script config files
+1
View File
@@ -0,0 +1 @@
add `user-data/mpv/context-menu/open` sub-property
@@ -0,0 +1,4 @@
`mp.input.get()` `complete` callbacks are now passed a second argument,
a function which can be passed the completion values, which allows generating
completions asynchronously. The old method of returning completions from
the callback is now deprecated.
@@ -0,0 +1 @@
add `console_opt_overrides` argument to `mp.input.get()` and `mp.input.select()`
@@ -0,0 +1,2 @@
add `mp.utils.terminal_display_width()` function that measures the width of
a string in terminal cells
+1
View File
@@ -0,0 +1 @@
add `on_loaded` hook
+1
View File
@@ -0,0 +1 @@
add `audioonlyscreen` script option to osc
+2
View File
@@ -0,0 +1,2 @@
add `boxwidth` script option to osc
add `slimboxwidth` script option to osc
+2
View File
@@ -0,0 +1,2 @@
add `skip_{backward,forward}_mbtn_*_down_command` script-opt for osc
add `{close,minimize,maximize}_mbtn_*_command` script-opt for osc
@@ -0,0 +1 @@
add `osc-icon_style` option
+3
View File
@@ -0,0 +1,3 @@
add `osc-dynamic_margins` option
add `osc-sub-margin` option
add `osc-osd-margin` option
+1
View File
@@ -0,0 +1 @@
add `osc-windowcontrols_independent` script-opt
@@ -0,0 +1 @@
remove `windowcontrols_title` script-opt from osc, use `title` mpv option instead
@@ -0,0 +1 @@
make `player-operation-mode` readable as a property
@@ -0,0 +1 @@
add `preserve-options` flag to `playlist-play-index`
@@ -0,0 +1,6 @@
``track-list`` is now filtered by the currently selected edition
add ``edition-list/N/metadata`` sub-property
add ``program_id`` support to EDL ``!track_meta`` header
add ``--flatten-editions`` option to disable program-based edition grouping
add ``track-list/N/program-ids`` sub-property
deprecate ``track-list/N/program-id`` in favor of ``track-list/N/program-ids``
@@ -0,0 +1 @@
change `%tX` format specifier of `--screenshot-template` option to only accept C11 strftime specifiers or `%s` specifier
+1
View File
@@ -0,0 +1 @@
add `--target-trc=scrgb`
@@ -0,0 +1,2 @@
``track-list`` now hides dependent tracks (e.g. tile sub-streams, IAMF audio element layers, LCEVC enhancement streams) by default
add ``--show-dependent-tracks`` option to expose them
@@ -0,0 +1 @@
effective `--image-display-duration` takes `--speed` into consideration now
+2
View File
@@ -0,0 +1,2 @@
add `track_info_selected_only` script option for stats
add `track-list/N/demux-duration` property
+1
View File
@@ -0,0 +1 @@
add `sub-lines` and `secondary-sub-lines` properties
@@ -0,0 +1 @@
`--target-gamut` now accepts custom CIE xy primaries as comma-separated values (Rx,Ry,Gx,Gy,Bx,By,Wx,Wy) in addition to named primary sets
+1
View File
@@ -0,0 +1 @@
remove the deprecated `time-start` property
@@ -0,0 +1 @@
change `--tls-verify` default to `yes`
@@ -0,0 +1,2 @@
add `update-clipboard` command
change `clipboard` property to require `update-clipboard` command when clipboard monitoring is disabled
+1
View File
@@ -0,0 +1 @@
add `--vf=amf_frc`
@@ -0,0 +1 @@
rename `d3d11vpp=mode=ivctc` to `d3d11vpp=mode=ivtc`
+1
View File
@@ -0,0 +1 @@
deprecate `--vf=format=sig-peak`
@@ -0,0 +1 @@
deprecate `--vo=vaapi`
@@ -0,0 +1 @@
add support for (a subset of) tunable parameter for `vo=gpu`
@@ -0,0 +1,2 @@
add `--wayland-session=<string>`
restore the mpv window on wayland using xdg-session-management-v1
+3 -4
View File
@@ -8,6 +8,8 @@ syntax is:
Setup a chain of audio filters. See ``--vf`` (`VIDEO FILTERS`_) for the
full syntax.
This is an object settings list option. See `List Options`_ for details.
.. note::
To get a full list of available audio filters, see ``--af=help``.
@@ -226,10 +228,7 @@ Available filters are:
using the standard ``speed`` property, not ``af-command``.
``multiply-pitch <factor>``
Multiply the current value of ``<pitch-scale>`` dynamically. For
example: 0.5 to go down by an octave, 1.5 to go up by a perfect fifth.
If you want to go up or down by semi-tones, use 1.059463094352953 and
0.9438743126816935
Multiply the current value of ``<pitch-scale>`` dynamically.
``lavfi=graph``
Filter audio using FFmpeg's libavfilter.
+24
View File
@@ -10,11 +10,17 @@ syntax is:
If the list has a trailing ',', mpv will fall back on drivers not contained
in the list.
This is an object settings list option. See `List Options`_ for details.
.. note::
See ``--ao=help`` for a list of compiled-in audio output drivers sorted by
autoprobe order.
Note that the default audio output driver is subject to change, and must
not be relied upon. If a certain AO needs to be used, it must be
explicitly specified.
Available audio output drivers are:
``alsa``
@@ -153,6 +159,9 @@ Available audio output drivers are:
if mpv is not started out of the bundle,
though playback with spatial audio off always works.
``audiounit`` (iOS only)
Native iOS audio output driver using ``AudioUnits`` and AudioToolbox.
``openal``
OpenAL audio output driver.
@@ -297,3 +306,18 @@ Available audio output drivers are:
``wasapi``
Audio output to the Windows Audio Session API.
The following global options are supported by this audio output:
``--wasapi-exclusive-buffer=<default|min|1-2000000>``
Set buffer duration in exclusive mode (i.e., with
``--audio-exclusive=yes``). ``default`` and ``min`` use the default and
minimum device period reported by WASAPI, respectively. You can also
directly specify the buffer duration in microseconds, in which case a
duration shorter than the minimum device period will be rounded up to
the minimum period.
The default buffer duration should provide robust playback in most
cases, but reportedly on some devices there are glitches following
stream resets under the default setting. In such cases, specifying a
shorter duration might help.
+58
View File
@@ -0,0 +1,58 @@
COMMANDS
========
This script allows running and completing input commands in the console
interactively, and also adds mpv's log to the console's log.
Keybindings
-----------
\`
Open the console to enter commands.
Commands
--------
``script-binding commands/open``
Open the console to enter commands.
``script-message-to commands type <text> [<cursor_pos>]``
Show the console and pre-fill it with the provided text, optionally
specifying the initial cursor position as a positive integer starting from
1. The console is automatically closed after running the command.
.. admonition:: Examples for input.conf
``% script-message-to commands type "seek absolute-percent" 6``
Enter a percent position to seek to.
``Ctrl+o script-message-to commands type "loadfile ''" 11``
Enter a file or URL to play, with autocompletion of paths in the
filesystem.
Configuration
-------------
This script can be customized through a config file ``script-opts/commands.conf``
placed in mpv's user directory and through the ``--script-opts`` command-line
option. The configuration syntax is described in `mp.options functions`_.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
``persist_history``
Default: no
Whether to save the command history to a file and load it.
``history_path``
Default: ``~~state/command_history.txt``
The file path for ``persist_history`` (see `FILES`_).
``remember_input``
Default: yes
Whether to remember the input line and cursor position when closing the
console, and prefill it the next time it is opened.
+111 -49
View File
@@ -1,21 +1,23 @@
CONSOLE
=======
The console is a REPL for mpv input commands. It is displayed on the video
window. It also shows log messages. It can be disabled entirely using the
``--load-osd-console=no`` option.
This script provides the ability to process the user's textual input to other
scripts through the ``mp.input`` API. It can be displayed on both the video
window and the terminal. It can be disabled entirely using the
``--load-console=no`` option.
Keybindings
-----------
Console can either process free-form text or select from a predefined list of
items.
\`
Show the console.
Free-form text mode keybindings
-------------------------------
ESC and Ctrl+[
Hide the console.
ENTER, Ctrl+j and Ctrl+m
Run the typed command.
Select the first completion if one wasn't already manually selected, and run
the typed command.
Shift+ENTER
Type a literal newline character.
@@ -76,6 +78,15 @@ PGUP
PGDN
Stop navigating the command history.
Ctrl+r
Search the command history. See `SELECT`_ for the key bindings in this mode.
Shift+UP
Scroll the log one line up.
Shift+DOWN
Scroll the log one line down.
INSERT
Toggle insert mode.
@@ -85,9 +96,11 @@ Ctrl+v
Shift+INSERT
Paste text (uses the primary selection on X11 and Wayland).
Ctrl+y
Copy the current line to the clipboard.
TAB and Ctrl+i
Complete the text at the cursor. The first press inserts the longest common
prefix of the completions, and subsequent presses cycle through them.
Cycle through completions.
Shift+TAB
Cycle through the completions backwards.
@@ -95,26 +108,18 @@ Shift+TAB
Ctrl+l
Clear all log messages from the console.
Commands
--------
MBTN_MID
Paste text (uses the primary selection on X11 and Wayland).
``script-message-to console type <text> [<cursor_pos>]``
Show the console and pre-fill it with the provided text, optionally
specifying the initial cursor position as a positive integer starting from
1.
WHEEL_UP
Move back in the command history.
.. admonition:: Examples for input.conf
``% script-message-to console type "seek absolute-percent; keypress ESC" 6``
Enter a percent position to seek to and close the console.
``Ctrl+o script-message-to console type "loadfile ''; keypress ESC" 11``
Enter a file or URL to play. Tab completes paths in the filesystem.
WHEEL_DOWN
Move forward in the command history.
Known issues
------------
- Pasting text is slow on Windows
- Non-ASCII keyboard input has restrictions
- The cursor keys move between Unicode code-points, not grapheme clusters
@@ -123,55 +128,112 @@ Configuration
This script can be customized through a config file ``script-opts/console.conf``
placed in mpv's user directory and through the ``--script-opts`` command-line
option. The configuration syntax is described in `ON SCREEN CONTROLLER`_.
option. The configuration syntax is described in `mp.options functions`_.
Key bindings can be changed in a standard way, see for example stats.lua
documentation.
Note that ``mp.input`` clients can selectively override these options.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
``scale``
Default: 1
``monospace_font``
Default: platform dependent
All drawing is scaled by this value, including the text borders and the
cursor.
The monospace font used when there are completions to align in a grid.
If the VO backend in use has HiDPI scale reporting implemented, the option
value is scaled with the reported HiDPI scale.
``font``
Default: unset (picks a hardcoded font depending on detected platform)
Set the font used for the REPL and the console.
This has to be a monospaced font for the completion suggestions to be
aligned correctly.
When there are no completions, ``--osd-font`` is used.
``font_size``
Default: 16
Default: 24
Set the font size used for the REPL and the console. This will be
multiplied by "scale".
The font size. This will be multiplied by ``display-hidpi-scale`` when the
console is not scaled with the window.
``border_size``
Default: 1
Default: 1.65
Set the font border size used for the REPL and the console.
The font border size.
``background_alpha``
Default: 80
The transparency of the menu's background. Ranges from 0 (opaque) to 255
(fully transparent).
``gap``
Default: 0.2
The gap between menu items, specified as a percentage the font size.
``padding``
Default: 10
The padding of the menu.
``menu_outline_size``
Default: 0
The size of the menu's border.
``menu_outline_color``
Default: #FFFFFF
The color of the menu's border.
``corner_radius``
Default: 8
The radius of the menu's corners.
``margin_x``
Default: same as ``--osd-margin-x``
The margin from the left of the window.
``margin_y``
Default: same as ``--osd-margin-y``
The margin from the bottom of the window.
``scale_with_window``
Default: ``auto``
Whether to scale the console with the window height. Can be ``yes``, ``no``,
or ``auto``, which follows the value of ``--osd-scale-by-window``.
``focused_color``
Default: ``#222222``
The color of the focused item.
``focused_back_color``
Default: ``#FFFFFF``
The background color of the focused item.
``match_color``
Default: ``#0088FF``
The color of characters that match the searched string.
``exact_match``
Default: no
Whether to match menu search queries exactly instead of fuzzily. Without
this option, prefixing queries with ``'`` enables exact matching.
``case_sensitive``
Default: no on Windows, yes on other platforms.
Default: no
Whether Tab completion is case sensitive. Only works with ASCII characters.
Whether exact searches are case sensitive. Only works with ASCII characters.
``history_dedup``
Default: true
Remove duplicate entries in history as to only keep the latest one.
multiplied by "scale."
``font_hw_ratio``
Default: auto
The ratio of font height to font width.
Adjusts table width of completion suggestions.
Adjusts grid width of completions.
Values in the range 1.8..2.5 make sense for common monospace fonts.
+142
View File
@@ -0,0 +1,142 @@
CONTEXT MENU
============
The context menu is a menu that pops up on the video window. By default, it is
bound to right click.
menu.conf
---------
You can define your own menu in ``~~/menu.conf`` (see `FILES`_), or an
alternative path specified with ``--script-opt=select-menu_conf_path``. It is
recommended to use the default ``menu.conf`` from
https://github.com/mpv-player/mpv/blob/master/etc/menu.conf as an example to get
started.
Each line of ``menu.conf`` is a menu item with fields separated by 1 or more
tabs. The first field is the text shown in the menu. The second field is usually
the command that is run when that item is selected. Fields from the third
onwards can specify ``checked=``, ``disabled=`` and ``hidden=`` states in the
same way as `Conditional auto profiles`_.
When there is no command, the item will open a submenu. Fields below indented
with leading whitespace are added to this submenu. Nested submenu items are
defined by adding more leading whitespace than the parent menu entry.
Empty lines are interpreted as separators.
The second field can also be one of the following tokens to make that entry a
submenu with the relative items: ``$playlist``, ``$tracks``, ``$video-tracks``,
``$audio-tracks``, ``$sub-tracks``, ``$secondary-sub-tracks``, ``$chapters``,
``$editions``, ``$audio-devices``, ``$profiles``. These menus are automatically
disabled when empty.
To use the native context menu, you need to fill the ``menu-data`` property with
menu definition data, and call the ``context-menu`` command. In builtin scripts,
this is done by ``select.lua``, which parses ``menu.conf`` to populate
``menu-data``. It then calls the ``context-menu`` command on platforms where
integration with the native context menu is implemented, while on platforms
where it is not, it opens ``context_menu.lua``.
On platforms without integration with the native context menu,
``context_menu.lua`` can be disabled entirely using the
``--load-context-menu=no`` option. On platforms where the integration is
implemented, it is already disabled by default, and ``--load-context-menu=yes``
will make ``select.lua`` use it.
Script messages
---------------
``open``
Show the context menu.
``select``
Select the focused item when there is one.
Configuration
-------------
This script can be customized through a config file
``script-opts/context_menu.conf`` placed in mpv's user directory and through
the ``--script-opts`` command-line option. The configuration syntax is
described in `mp.options functions`_.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
``font_size``
Default: 14
The font size.
``gap``
Default: 0.2
The gap between menu items, specified as a percentage the font size.
``padding_x``
Default: 8
The horizontal padding of the menu.
``padding_y``
Default: 4
The vertical padding of the menu.
``menu_outline_size``
Default: 0
The size of the menu's border.
``menu_outline_color``
Default: ``#FFFFFF``
The color of the menu's border.
``background_alpha``
Default: ``0``
The transparency of the menu's background. Ranges from 0 (opaque) to 255
(fully transparent).
``corner_radius``
Default: 5
The radius of the menu's corners.
``scale_with_window``
Default: auto
Whether to scale sizes with the window height. Can be ``yes``, ``no``, or
``auto``, which follows the value of ``--osd-scale-by-window``.
When sizes aren't scaled with the window, they are scaled by
``display-hidpi-scale``.
``focused_color``
Default: ``#222222``
The color of the focused item.
``focused_back_color``
Default: ``#FFFFFF``
The background color of the focused item.
``disabled_color``
Default: ``#555555``
The color of disabled items and separators.
``seconds_to_open_submenus``
Default: 0.2
The number of seconds to open submenus after the cursor enters items
associated with one.
``seconds_to_close_submenus``
Default: 0.2
The number of seconds to close submenus after the cursor enters a parent
menu.
+2 -2
View File
@@ -8,7 +8,7 @@ You can encode files from one format/codec to another using this facility.
``--of=<format>``
Specifies the output format (overrides autodetection by the file name
extension of the file specified by ``-o``). See ``--of=help`` for a full
extension of the file specified by ``--o``). See ``--of=help`` for a full
list of supported formats.
``--ofopts=<options>``
@@ -102,5 +102,5 @@ You can encode files from one format/codec to another using this facility.
.. admonition:: Example
"``--oremove-metadata=comment,genre``"
excludes copying of the the comment and genre tags to the output
excludes copying of the comment and genre tags to the output
file.
+1464 -773
View File
File diff suppressed because it is too large. Load diff
+4 -2
View File
@@ -3,8 +3,10 @@ JSON IPC
mpv can be controlled by external programs using the JSON-based IPC protocol.
It can be enabled by specifying the path to a unix socket or a named pipe using
the option ``--input-ipc-server``. Clients can connect to this socket and send
commands to the player or receive events from it.
the option ``--input-ipc-server``, or the file descriptor number of a unix socket
or a named pipe using ``--input-ipc-client``.
Clients can connect to this socket and send commands to the player or receive
events from it.
.. warning::
+5 -9
View File
@@ -196,16 +196,18 @@ meta-paths like ``~~/foo`` (other JS file functions do expand meta paths).
``mp.options.read_options(obj [, identifier [, on_update]])`` (types:
string/boolean/number)
``mp.input.get(obj)`` (LE)
``mp.input.get(obj)``
``mp.input.select(obj)``
``mp.input.terminate()``
``mp.input.log(message, style)``
``mp.input.log_error(message)``
``mp.input.set_log(log)``
``exit()`` (global)
Additional utilities
--------------------
@@ -254,10 +256,6 @@ text content only.
``mp.get_script_file()``
Returns the file name of the current script.
``exit()`` (global)
Make the script exit at the end of the current event loop iteration.
Note: please remove added key bindings before calling ``exit()``.
``mp.utils.compile_js(fname, content_str)``
Compiles the JS code ``content_str`` as file name ``fname`` (without loading
anything from the filesystem), and returns it as a function. Very similar
@@ -352,8 +350,6 @@ paths - like ``<script-dir>/modules`` for scripts which load from a directory).
The custom-init file is ignored if mpv is invoked with ``--no-config``.
Before mpv 0.34, the file name was ``.init.js`` (with dot) at the same dir.
The event loop
--------------
+6 -5
View File
@@ -2,14 +2,14 @@ EMBEDDING INTO OTHER PROGRAMS (LIBMPV)
======================================
mpv can be embedded into other programs as video/audio playback backend. The
recommended way to do so is using libmpv. See ``libmpv/client.h`` in the mpv
recommended way to do so is using libmpv. See ``include/mpv/client.h`` in the mpv
source code repository. This provides a C API. Bindings for other languages
might be available (see wiki).
Since libmpv merely allows access to underlying mechanisms that can control
mpv, further documentation is spread over a few places:
- https://github.com/mpv-player/mpv/blob/master/libmpv/client.h
- https://github.com/mpv-player/mpv/blob/master/include/mpv/client.h
- https://mpv.io/manual/master/#options
- https://mpv.io/manual/master/#list-of-input-commands
- https://mpv.io/manual/master/#properties
@@ -22,7 +22,7 @@ You can write C plugins for mpv. These use the libmpv API, although they do not
use the libmpv library itself.
They are enabled by default if compiler supports linking with the ``-rdynamic``
flag on Linux/BSD platforms. On Windows the are always enabled.
flag on Linux/BSD platforms. On Windows they are always enabled.
C plugins location
------------------
@@ -38,7 +38,7 @@ A C plugin must export the following function::
int mpv_open_cplugin(mpv_handle *handle)
The plugin function will be called on loading time. This function does not
The plugin function will be called on loading time. This function must not
return as long as your plugin is loaded (it runs in its own thread). The
``handle`` will be deallocated as soon as the plugin function returns.
@@ -52,7 +52,8 @@ behavior.
Within the plugin function, you can call libmpv API functions. The ``handle``
is created by ``mpv_create_client()`` (or actually an internal equivalent),
and belongs to you. You can call ``mpv_wait_event()`` to wait for things
happening, and so on.
happening, and so on. However do not call ``mpv_destroy()`` or
``mpv_terminate_destroy()`` on this handle.
Note that the player might block until your plugin calls ``mpv_wait_event()``
for the first time. This gives you a chance to install initial hooks etc.
+186 -57
View File
@@ -7,7 +7,6 @@ mpv provides the built-in module ``mp``, which contains functions to send
commands to the mpv core and to retrieve information about playback state, user
settings, file information, and so on.
These scripts can be used to control mpv in a similar way to slave mode.
Technically, the Lua code uses the client API internally.
Example
@@ -62,8 +61,7 @@ that uses the ``.foo`` file extension.
mpv also appends the top level directory of the script to the start of Lua's
package path so you can import scripts from there too. Be aware that this will
shadow Lua libraries that use the same package path. (Single file scripts do not
include mpv specific directories in the Lua package path. This was silently
changed in mpv 0.32.0.)
include mpv specific directories in the Lua package path.)
Using a script directory is the recommended way to package a script that
consists of multiple source files, or requires other files (you can use
@@ -86,7 +84,8 @@ own event handlers which you have registered with ``mp.register_event``, or
timers added with ``mp.add_timeout`` or similar. Note that since the
script starts execution concurrently with player initialization, some properties
may not be populated with meaningful values until the relevant subsystems have
initialized.
initialized. Rather than retrieving these properties at the top of scripts, you
should use ``mp.observe_property`` or read them within event handlers.
When the player quits, all scripts will be asked to terminate. This happens via
a ``shutdown`` event, which by default will make the event loop return. If your
@@ -100,17 +99,14 @@ The event loop will wait for events and dispatch events registered with
``mp.register_event``. It will also handle timers added with ``mp.add_timeout``
and similar (by waiting with a timeout).
Since mpv 0.6.0, the player will wait until the script is fully loaded before
continuing normal operation. The player considers a script as fully loaded as
soon as it starts waiting for mpv events (or it exits). In practice this means
the player will more or less hang until the script returns from the main chunk
(and ``mp_event_loop`` is called), or the script calls ``mp_event_loop`` or
The player will wait until the script is fully loaded before continuing normal
operation. The player considers a script as fully loaded as soon as it starts
waiting for mpv events (or it exits). In practice this means the player will
more or less hang until the script returns from the main chunk (and
``mp_event_loop`` is called), or the script calls ``mp_event_loop`` or
``mp.dispatch_events`` directly. This is done to make it possible for a script
to fully setup event handlers etc. before playback actually starts. In older
mpv versions, this happened asynchronously. With mpv 0.29.0, this changes
slightly, and it merely waits for scripts to be loaded in this manner before
starting playback as part of the player initialization phase. Scripts run though
initialization in parallel. This might change again.
to fully setup event handlers etc. before playback actually starts. Scripts run
though initialization in parallel.
mp functions
------------
@@ -159,11 +155,14 @@ The ``mp`` module is preloaded, although it can be loaded manually with
``mp.commandv()`` (but can be a native type instead of a string).
If the table contains string keys, it's interpreted as command with named
arguments. This requires at least an entry with the key ``name`` to be
present, which must be a string, and contains the command name. The special
entry ``_flags`` is optional, and if present, must be an array of
`Input Command Prefixes`_ to apply. All other entries are interpreted as
arguments.
arguments. This requires at least an entry with the key ``_name`` to be
present, which must be a string, and contains the command name.
For compatibility, if the key ``_name`` does not exist, then the entry with
the key ``name`` will be used instead. The special entry ``_flags`` is
optional, and if present, must be an array of `Input Command Prefixes`_ to
apply. All other entries are interpreted as arguments. Note that some
commands have arguments named ``name``, and can only be used if the command
name is specified with key ``_name`` instead of ``name``.
Returns a result table on success (usually empty), or ``def, error`` on
error. ``def`` is the second parameter provided to the function, and is
@@ -174,7 +173,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
as possible), and upon completion, fn is called. fn has three arguments:
``fn(success, result, error)``:
``success``
``success``
Always a Boolean and is true if the command was successful,
otherwise false.
@@ -292,6 +291,18 @@ The ``mp`` module is preloaded, although it can be loaded manually with
After calling this function, key presses will cause the function ``fn`` to
be called (unless the user remapped the key with another binding).
However, if the key binding is canceled , the function will not be called,
unless ``complex`` flag is set to ``true``, where the function will be
called with the ``canceled`` entry set to ``true``.
For example, a canceled key binding can happen in the following situations:
- If key A is pressed while key B is being held down, key B is logically
released ("canceled" by key A), which stops the current autorepeat
action key B has.
- If key A is pressed while a mouse button is being held down, the mouse
button is logically released, but the mouse button's action will not be
called, unless ``complex`` flag is set to ``true``.
The ``name`` argument should be a short symbolic string. It allows the user
to remap the key binding via input.conf using the ``script-message``
@@ -303,13 +314,20 @@ The ``mp`` module is preloaded, although it can be loaded manually with
or pass the ``fn`` argument in place of the name. The latter is not
recommended and is handled for compatibility only.)
The last argument is used for optional flags. This is a table, which can
have the following entries:
The ``flags`` argument is used for optional parameters. This is a table,
which can have the following entries:
``repeatable``
If set to ``true``, enables key repeat for this specific binding.
This option only makes sense when ``complex`` is not set to ``true``.
``scalable``
If set to ``true``, enables key scaling for this specific binding.
This option only makes sense when ``complex`` is set to ``true``.
Note that this has no effect if the key binding is invoked by
``script-binding`` command, where the scalability of the command
takes precedence.
``complex``
If set to ``true``, then ``fn`` is called on key down, repeat and up
events, with the first argument being a table. This table has the
@@ -318,10 +336,14 @@ The ``mp`` module is preloaded, although it can be loaded manually with
``event``
Set to one of the strings ``down``, ``repeat``, ``up`` or
``press`` (the latter if key up/down/repeat can't be
tracked).
tracked), which indicates the key's logical state.
``is_mouse``
Boolean Whether the event was caused by a mouse button.
Boolean: Whether the event was caused by a mouse button.
``canceled``
Boolean: Whether the event was canceled.
Not all types of cancellations set this flag.
``key_name``
The name of they key that triggered this, or ``nil`` if
@@ -333,6 +355,15 @@ The ``mp`` module is preloaded, although it can be loaded manually with
description of ``script-binding`` command for details (this
field is equivalent to the 5th argument).
``scale``
The scale of the key, such as the ones produced by ``WHEEL_*``
keys. The scale is 1 if the key is nonscalable.
``arg``
User-provided string in the ``arg`` argument in the
``script-binding`` command if the key binding is invoked
by that command.
Internally, key bindings are dispatched via the ``script-message-to`` or
``script-binding`` input commands and ``mp.register_script_message``.
@@ -387,7 +418,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
and the function fn is a Lua function value.
Some events have associated data. This is put into a Lua table and passed
as argument to fn. The Lua table by default contains a ``name`` field,
as argument to fn. The Lua table by default contains a ``event`` field,
which is a string containing the event name. If the event has an error
associated, the ``error`` field is set to a string describing the error,
on success it's not set.
@@ -413,7 +444,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
the property will be passed as second argument to ``fn``, using
``mp.get_property_<type>`` to retrieve it. This means if ``type`` is for
example ``string``, ``fn`` is roughly called as in
``fn(name, mp.get_property_string(name))``.
``fn(name, mp.get_property(name))``.
If possible, change events are coalesced. If a property is changed a bunch
of times in a row, only the last change triggers the change function. (The
@@ -458,6 +489,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
the timer is re-added after the function fn is run.
Returns a timer object. The timer object provides the following methods:
``stop()``
Disable the timer. Does nothing if the timer is already disabled.
This will remember the current elapsed time when stopping, so that
@@ -502,7 +534,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
seconds = 0
timer = mp.add_periodic_timer(1, function()
print("called every second")
# stop it after 10 seconds
-- stop it after 10 seconds
seconds = seconds + 1
if seconds >= 10 then
timer:kill()
@@ -630,6 +662,20 @@ are useful only in special situations.
May return invalid/nonsense values if OSD is not initialized yet.
``exit()`` (global)
Make the script exit at the end of the current event loop iteration. This
does not terminate mpv itself or other scripts.
This can be polyfilled to support mpv versions older than 0.40 with:
::
if not _G.exit then
function exit()
mp.keep_running = false
end
end
mp.msg functions
----------------
@@ -803,7 +849,7 @@ strictly part of the guaranteed API.
- rename ``cancellable`` field to ``playback_only``
- rename ``max_size`` to ``capture_size``
- set ``capture_stdout`` field to ``true`` if unset
- set ``name`` field to ``subprocess``
- set ``_name`` field to ``subprocess``
- call ``mp.command_native(copied_t)``
- if the command failed, create a dummy result table
- copy ``error_string`` to ``error`` field if the string is non-empty
@@ -866,8 +912,7 @@ strictly part of the guaranteed API.
mp.input functions
--------------------
This module lets scripts get textual input from the user using the console
REPL.
This module lets scripts get textual input from the user using the console.
``input.get(table)``
Show the console to let the user enter text.
@@ -879,27 +924,45 @@ REPL.
``submit``
A callback invoked when the user presses Enter. The first argument is
the text in the console. You can close the console from within the
callback by calling ``input.terminate()``. If you don't, the console
stays open and the user can input more text.
the text in the console.
``keep_open``
Whether to keep the console open on submit, allowing further input.
Defaults to ``false``.
If calling ``input.get()`` or ``input.select()`` again from inside the
``submit`` callback, setting this option to ``true`` allows a seamless
transition without the console closing and reopening.
``opened``
A callback invoked when the console is shown. This can be used to
present a list of options with ``input.set_log()``.
override keybinds set by the console with ``mp.add_forced_key_binding()``.
``edited``
A callback invoked when the text changes. This can be used to filter a
list of options based on what the user typed with ``input.set_log()``,
like dmenu does. The first argument is the text in the console.
A callback invoked when the text changes. The first argument is the text
in the console.
``complete``
A callback invoked when the user presses TAB. The first argument is the
text before the cursor. The callback should return a table of the string
candidate completion values and the 1-based cursor position from which
the completion starts. console.lua will filter the suggestions beginning
with the the text between this position and the cursor, sort them
alphabetically, insert their longest common prefix, and show them when
there are multiple ones.
A callback invoked when the user edits the text or moves the cursor. The
first argument is the text before the cursor, and the second argument is
a response function which can be called to present completion values to
the user.
The first argument to the response function is a table of the string
candidate completion values, and the second argument is the 1-based cursor
position from which the completion starts. console will show the
completions that fuzzily match the text between this position and the
cursor, which the user can select with ``TAB``. The completions will only
be shown to the user if the text before the cursor has not since changed.
The response function should be called with an empty table if there are no
completion values to display.
The third and optional argument to the response function is a string that
will be appended to the input line without displaying it in the completions.
``autoselect_completion``
Whether to automatically select the first completion on submit if one
wasn't already manually selected. Defaults to ``false``.
``closed``
A callback invoked when the console is hidden, either because
@@ -913,27 +976,32 @@ REPL.
``cursor_position``
The initial cursor position, starting from 1.
``history_path``
If specified, the path to save and load the history of the entered
lines.
``id``
An identifier that determines which input history and log buffer to use
among the ones stored for ``input.get()`` calls. The input histories
and logs are stored in memory and do not persist across different mpv
invocations. Defaults to the calling script name with ``prompt``
appended.
among the ones stored for ``input.get()`` calls. Defaults to the calling
script name with ``prompt`` appended.
``console_opt_overrides``
A table containing configuration overrides for the console script.
Can be used to change the visual style of the text input, among other things.
See `CONSOLE`_ for the full list of options.
``input.terminate()``
Close the console.
Closes any currently active input request. This will not close
requests made by other scripts.
``input.log(message, style, terminal_style)``
Add a line to the log buffer. ``style`` can contain additional ASS tags to
apply to ``message``, and ``terminal_style`` can contain escape sequences
that are used when the console is displayed in the terminal.
``input.log_error(message)``
Helper to add a line to the log buffer with the same color as the one the
console uses for errors. Useful when the user submits invalid input.
Add a line to the log buffer of the latest ``input.get()`` request.
``style`` can contain additional ASS tags to apply to ``message``,
and ``terminal_style`` can contain escape sequences that are used
when the console is displayed in the terminal.
``input.set_log(log)``
Replace the entire log buffer.
Replace the entire log buffer of the latest ``input.get()`` request.
``log`` is a table of strings, or tables with ``text``, ``style`` and
``terminal_style`` keys.
@@ -951,6 +1019,67 @@ REPL.
}
})
``input.select(table)``
Specify a list of items that are presented to the user for selection.
The following entries of ``table`` are read:
``prompt``
The string to be displayed before the input field.
``items``
The table of the entries to choose from.
``default_item``
The 1-based integer index of the preselected item.
``submit``
The callback invoked when the user presses Enter. The first argument is
the 1-based index of the selected item.
``keep_open``
Whether to keep the console open on submit, allowing further input.
Defaults to ``false``.
If calling ``input.get()`` or ``input.select()`` again from inside the
``submit`` callback, setting this option to ``true`` allows a seamless
transition without the console closing and reopening.
``opened``
A callback invoked when the console is shown. This can be used to
override keybinds set by the console with ``mp.add_forced_key_binding()``.
``closed``
A callback invoked when the console is hidden, either because
``input.terminate()`` was invoked from the other callbacks, or because
the user closed it with a key binding. The first argument is the text in
the console, and the second argument is the cursor position.
``default_text``
A string to pre-fill the input field with.
``cursor_position``
The initial cursor position, starting from 1.
``console_opt_overrides``
A table containing configuration overrides for the console script.
Can be used to change the visual style of the select window, among other things.
See `CONSOLE`_ for the full list of options.
Example:
::
input.select({
items = {
"First playlist entry",
"Second playlist entry",
},
submit = function (id)
mp.commandv("playlist-play-index", id - 1)
end,
})
Events
------
+280 -101
View File
@@ -47,7 +47,8 @@ See `COMMAND INTERFACE`_ and `Key names`_ sections for more details on
configuring keybindings.
See also ``--input-test`` for interactive binding details by key, and the
`stats`_ built-in script for key bindings list (including print to terminal).
`stats`_ built-in script for key bindings list (including print to terminal). By
default, the ? key toggles the display of this list.
Keyboard Control
----------------
@@ -65,7 +66,7 @@ Ctrl+LEFT and Ctrl+RIGHT
might not always work; see ``sub-seek`` command.
Ctrl+Shift+LEFT and Ctrl+Shift+RIGHT
Adjust subtitle delay so that the next or previous subtitle is displayed
Adjust subtitle delay so that the previous or next subtitle is displayed
now. This is especially useful to sync subtitles to audio.
[ and ]
@@ -94,6 +95,9 @@ Shift+Ctrl+BACKSPACE
ENTER
Go forward in the playlist.
Shift+HOME and Shift+END
Go to the first/last playlist entry.
p and SPACE
Pause (pressing again unpauses).
@@ -116,6 +120,9 @@ Q
/ and *
Decrease/increase volume.
KP_DIVIDE and KP_MULTIPLY
Decrease/increase volume.
9 and 0
Decrease/increase volume.
@@ -142,7 +149,8 @@ T
w and W
Decrease/increase pan-and-scan range. The ``e`` key does the same as
``W`` currently, but use is discouraged.
``W`` currently, but use is discouraged. See ``--panscan`` for more
information.
o and P
Show progression bar, elapsed time and total duration on the OSD.
@@ -153,11 +161,14 @@ O
v
Toggle subtitle visibility.
Alt+v
Toggle secondary subtitle visibility.
j and J
Cycle through the available subtitles.
z and Z
Adjust subtitle delay by +/- 0.1 seconds. The ``x`` key does the same as
Adjust subtitle delay by -/+ 0.1 seconds. The ``x`` key does the same as
``Z`` currently, but use is discouraged.
l
@@ -169,7 +180,10 @@ L
Ctrl++ and Ctrl+-
Adjust audio delay (A/V sync) by +/- 0.1 seconds.
Shift+g and Shift+f
Ctrl+KP_ADD and Ctrl+KP_SUBTRACT
Adjust audio delay (A/V sync) by +/- 0.1 seconds.
G and F
Adjust subtitle font size by +/- 10%.
u
@@ -178,8 +192,8 @@ u
style. See ``--sub-ass-override`` for more info.
V
Toggle subtitle VSFilter aspect compatibility mode. See
``--sub-ass-vsfilter-aspect-compat`` for more info.
Cycle through which video data gets used for ASS rendering.
See ``--sub-ass-use-video-data`` for more info.
r and R
Move subtitles up/down. The ``t`` key does the same as ``R`` currently, but
@@ -196,6 +210,9 @@ Ctrl+s
Take a screenshot, as the window shows it (with subtitles, OSD, and scaled
video).
HOME
Seek to the beginning of the file.
PGUP and PGDWN
Seek to the beginning of the previous/next chapter. In most cases,
"previous" will actually go to the beginning of the current chapter; see
@@ -223,6 +240,9 @@ Alt+LEFT, Alt+RIGHT, Alt+UP, Alt+DOWN
Alt++ and Alt+-
Change video zoom.
Alt+KP_ADD and Alt+KP_SUBTRACT
Change video zoom.
Alt+BACKSPACE
Reset the pan/zoom settings.
@@ -232,11 +252,24 @@ F8
F9
Show the list of audio and subtitle streams.
Ctrl+v
Append the file or URL in the clipboard to the playlist. If nothing is
currently playing, it is played immediately. Only works on platforms that
support the ``clipboard`` property.
Ctrl+r
Reload the current file, preserving the time position and any changed
option. Empties any network cache.
i and I
Show/toggle an overlay displaying statistics about the currently playing
file such as codec, framerate, number of dropped frames and so on. See
`STATS`_ for more information.
?
Toggle an overlay displaying the active key bindings. See `STATS`_ for more
information.
DEL
Cycle OSC visibility between never / auto (mouse-move) / always
@@ -270,6 +303,68 @@ Alt+2 (and Command+2 on macOS)
Command + f (macOS only)
Toggle fullscreen (see also ``--fs``).
(The following keybindings open a menu in the console that lets you choose from
a list of items by typing part of the desired item, by clicking the desired
item, or by navigating them with keybindings: ``Down`` and ``Ctrl+n`` go down,
``Up`` and ``Ctrl+p`` go up, ``Page down`` and ``Ctrl+f`` scroll down one page,
and ``Page up`` and ``Ctrl+b`` scroll up one page.)
In track menus, selecting the current tracks disables it.
g-p
Select a playlist entry.
g-s
Select a subtitle track.
g-S
Select a secondary subtitle track.
g-a
Select an audio track.
g-v
Select a video track.
g-t
Select a track of any type.
g-c
Select a chapter.
g-e
Select an MKV edition or DVD/Blu-ray title.
g-l
Select a subtitle line to seek to.
g-L
Select a secondary subtitle line to seek to.
g-d
Select an audio device.
g-h
Select a file from the watch history. Requires ``--save-watch-history``.
g-w
Select a file from watch later config files (see `RESUMING PLAYBACK`_) to
resume playing. Requires ``--write-filename-in-watch-later-config``.
g-b
Select a defined input binding.
g-r
Show the values of all properties.
g-m, Ctrl+p
Show a menu with miscellaneous entries.
See `SELECT`_ for more information.
MENU, Shift+F10
Show the context menu (see `CONTEXT MENU`_).
(The following keys are valid if you have a keyboard with multimedia keys.)
PAUSE
@@ -290,6 +385,10 @@ in the mpv git repository.
Mouse Control
-------------
Ctrl+left click
Pan while holding the button, keeping the clicked part of the video under
the cursor.
Left double click
Toggle fullscreen on/off.
@@ -306,22 +405,8 @@ Wheel left/right
Seek forward/backward 10 seconds.
Ctrl+Wheel up/down
Change video zoom.
Context Menu
-------------
.. warning::
This feature is experimental. It may not work with all VOs. A libass based
fallback may be implemented in the future.
Context Menu is a menu that pops up on the video window on user interaction
(mouse right click, etc.).
To use this feature, you need to fill the ``menu-data`` property with menu
definition data, and add a keybinding to run the ``context-menu`` command,
which can be done with a user script.
Change video zoom keeping the part of the video hovered by the cursor under
it.
USAGE
=====
@@ -357,12 +442,10 @@ because ``--fs`` is a flag option that requires no parameter. If an option
changes and its parameter becomes optional, then a command line using the
alternative syntax will break.
Until mpv 0.31.0, there was no difference whether an option started with ``--``
or a single ``-``. Newer mpv releases strictly expect that you pass the option
value after a ``=``. For example, before ``mpv --log-file f.txt`` would write
a log to ``f.txt``, but now this command line fails, as ``--log-file`` expects
an option value, and ``f.txt`` is simply considered a normal file to be played
(as in ``mpv f.txt``).
For options starting with ``--``, mpv expects that you pass the option value
after a ``=``. For example, ``mpv --log-file f.txt`` will fail, as
``--log-file`` expects an option value, and ``f.txt`` is simply considered a
normal file to be played (as in ``mpv f.txt``).
The future plan is that ``-option value`` will not work anymore, and options
with a single ``-`` behave the same as ``--`` options.
@@ -401,9 +484,9 @@ quotes.
The ``[...]`` form of quotes wraps everything between ``[`` and ``]``. It's
useful with shells that don't interpret these characters in the middle of
an argument (like bash). These quotes are balanced (since mpv 0.9.0): the ``[``
and ``]`` nest, and the quote terminates on the last ``]`` that has no matching
``[`` within the string. (For example, ``[a[b]c]`` results in ``a[b]c``.)
an argument (like bash). These quotes are balanced: the ``[`` and ``]`` nest,
and the quote terminates on the last ``]`` that has no matching ``[`` within the
string. (For example, ``[a[b]c]`` results in ``a[b]c``.)
The fixed-length quoting syntax is intended for use with external
scripts and programs.
@@ -442,6 +525,13 @@ UNIX path. To avoid problems with arbitrary paths, you should be sure that
absolute paths passed to mpv start with ``/``, and prefix relative paths with
``./``.
URLs that are passed to mpv should be percent-encoded for it to work reliably.
There are some heuristics in place that tries to automatically do it, but these
heuristics are not foolproof. For example, in order to play a file literally
named ``foo%20.mp4``, using ``http://localhost/foo%20.mp4`` without any
percent-encoding will not work. Percent-encoding it as
``http://localhost/foo%2520.mp4`` will work as expected.
Using the ``file://`` pseudo-protocol is discouraged, because it involves
strange URL unescaping rules.
@@ -451,41 +541,62 @@ console controls. (Which makes it suitable for playing data piped to stdin.)
The special argument ``--`` can be used to stop mpv from interpreting the
following arguments as options.
When using the client API, you should strictly avoid using ``mpv_command_string``
For paths passed to mpv suboptions (options that have multiple `:` and
`,`-separated values), the situation is further complicated by the need to
escape special characters. To work around this, the path can instead be wrapped
in the "fixed-length" syntax, e.g. ``%n%string_of_length_n`` (see above).
When using the libmpv API, you should strictly avoid using ``mpv_command_string``
for invoking the ``loadfile`` command, and instead prefer e.g. ``mpv_command``
to avoid the need for filename escaping.
For paths passed to suboptions, the situation is further complicated by the
need to escape special characters. To work this around, the path can be
additionally wrapped in the fixed-length syntax, e.g. ``%n%string_of_length_n``
(see above).
The same applies when you're using the scripting API, where you should avoid using
``mp.command``, and instead prefer using "separate parameter" APIs, such as
``mp.commandv`` and ``mp.command_native``.
Some mpv options interpret paths starting with ``~``.
Currently, the prefix ``~~home/`` expands to the mpv configuration directory
(usually ``~/.config/mpv/``).
``~/`` expands to the user's home directory. (The trailing ``/`` is always
required.) The following paths are currently recognized:
Some mpv options will interpret special meanings for paths starting with ``~``,
making it easy to dynamically find special directories, such as referring to the
current user's home directory or the mpv configuration directory.
When using the special ``~`` prefix, there must always be a trailing ``/`` after
the special path prefix. In other words, ``~`` doesn't work, but ``~/`` will work.
The following special paths/keywords are currently recognized:
.. warning::
Beware that if ``--no-config`` is used, all of the "config directory"-based
paths (``~~/``, ``~~home/`` and ``~~global/``) will be empty strings.
This means that ``~~home/`` would expand to an empty string, and that
sub-paths such as ``~~home/foo/bar"`` would expand to a relative path
(``foo/bar``), which may not be what you expected.
Furthermore, any commands that search in config directories will fail
to find anything, since there won't be any directories to search in.
Be sure that your scripts can handle these "no config" scenarios.
================ ===============================================================
Name Meaning
================ ===============================================================
``~~/`` If the subpath exists in any of the mpv's config directories
``~/`` The current user's home directory (equivalent to ``~/`` and
``$HOME/`` in terminal environments).
``~~/`` If the sub-path exists in any of mpv's config directories, then
the path of the existing file/dir is returned. Otherwise this
is equivalent to ``~~home/``.
Note that if --no-config is used ``~~/foobar`` will resolve to
``foobar`` which can be unexpected.
``~/`` user home directory root (similar to shell, ``$HOME``)
``~~home/`` mpv config dir (for example ``~/.config/mpv/``)
``~~global/`` the global config path, if available (not on win32)
``~~osxbundle/`` the macOS bundle resource path (macOS only)
``~~desktop/`` the path to the desktop (win32, macOS)
``~~exe_dir/`` win32 only: the path to the directory containing the exe (for
config file purposes; ``$MPV_HOME`` overrides it)
``~~cache/`` the path to application cache data (``~/.cache/mpv/``)
``~~home/`` mpv's config dir (for example ``~/.config/mpv/``).
``~~global/`` The global config path (such as ``/etc/mpv``), if available
(not on win32).
``~~osxbundle/`` The macOS bundle resource path (macOS only).
``~~desktop/`` The path to the desktop.
``~~exe_dir/`` The path to the directory containing ``mpv.exe`` (for config
file purposes, ``$MPV_HOME`` will override this) (win32 only).
``~~cache/`` The path to application cache data (``~/.cache/mpv/``).
On some platforms, this will be the same as ``~~home/``.
``~~state/`` the path to application state data (``~/.local/state/mpv/``)
``~~state/`` The path to application state data (``~/.local/state/mpv/``).
On some platforms, this will be the same as ``~~home/``.
``~~old_home/`` do not use
``~~old_home/`` Do not use.
================ ===============================================================
@@ -556,8 +667,9 @@ Suffix Meaning
-add Append 1 or more items (same syntax as -set)
-pre Prepend 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-del Delete 1 or more items if present (same syntax as -set)
-remove Delete item if present (does not interpret escapes)
-toggle Append an item, or remove if if it already exists (no escapes)
-toggle Append an item, or remove it if it already exists (no escapes)
============= ===============================================
``-append`` is meant as a simple way to append a single item without having
@@ -578,6 +690,8 @@ Suffix Meaning
-set Set a list of items (using ``,`` as separator)
-append Append a single item (escapes for the key, no escapes for the value)
-add Append 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-del Delete 1 or more keys if present (same syntax as -set)
-remove Delete item by key if present (does not interpret escapes)
============= ===============================================
@@ -589,25 +703,24 @@ recommended to use the ``-append`` variant. When using libmpv, prefer using
``MPV_FORMAT_NODE_MAP``; when using a scripting backend or the JSON IPC, use an
appropriate structured data type.
Prior to mpv 0.33, ``:`` was also recognized as separator by ``-set``.
Object settings list options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Filter options
~~~~~~~~~~~~~~
This is a very complex option type for some options, such as ``--af`` and ``--vf``.
They often require complicated escaping. See `VIDEO FILTERS`_ for details.
This is a very complex option type for the ``--af`` and ``--vf`` options only.
They often require complicated escaping. See `VIDEO FILTERS`_ for details. They
support the following operations:
They support the following operations:
============= ===============================================
Suffix Meaning
============= ===============================================
-set Set a list of filters (using ``,`` as separator)
-append Append single filter
-add Append 1 or more filters (same syntax as -set)
-pre Prepend 1 or more filters (same syntax as -set)
-clr Clear the option (remove all filters)
-remove Delete filter if present
-toggle Append a filter, or remove if if it already exists
-set Set a list of items (using ``,`` as separator)
-append Append single item
-add Append 1 or more items (same syntax as -set)
-pre Prepend 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-remove Delete 1 or items if present (same syntax as -set)
-toggle Append an item, or remove it if it already exists
-help Pseudo operation that prints a help text to the terminal
============= ===============================================
@@ -616,10 +729,9 @@ General
Without suffix, the operation used is normally ``-set``.
Although some operations allow specifying multiple items, using this is strongly
discouraged and deprecated, except for ``-set``. There is a chance that
operations like ``-add`` and ``-pre`` will work like ``-append`` and accept a
single, unescaped item only (so the ``,`` separator will not be interpreted and
Some operations like ``-add`` and ``-pre`` specify multiple items, but be
aware that you may need to escape the arguments. ``-append`` accepts a single,
unescaped item only (so the ``,`` separator will not be interpreted and
is passed on as part of the value).
Some options (like ``--sub-file``, ``--audio-file``, ``--glsl-shader``) are
@@ -630,6 +742,8 @@ Options of this type can be changed at runtime using the ``change-list``
command, which takes the suffix (without the ``-``) as separate operation
parameter.
An object settings list can hold up to 100 elements.
CONFIGURATION FILES
===================
@@ -746,7 +860,7 @@ or at runtime with the ``apply-profile <name>`` command.
[network]
demuxer-max-back-bytes=512MiB
# reference a builtin profile
profile=fast
profile=low-latency
Runtime profiles
----------------
@@ -991,17 +1105,17 @@ There are three choices for using mpv from other programs or scripts:
Your code should work even if you pass ``--terminal=no``. Do not attempt
to simulate user input by sending terminal control codes to mpv's stdin.
If you need interactive control, using ``--input-ipc-server`` is
recommended. This gives you access to the `JSON IPC`_ over unix domain
sockets (or named pipes on Windows).
If you need interactive control, using ``--input-ipc-server`` or
``--input-ipc-client`` is recommended. This gives you access to the
`JSON IPC`_ over unix domain sockets (or named pipes on Windows).
Depending on what you do, passing ``--no-config`` or ``--config-dir`` may
be a good idea to avoid conflicts with the normal mpv user configuration
intended for CLI playback.
Using ``--input-ipc-server`` is also suitable for purposes like remote
control (however, the IPC protocol itself is not "secure" and not
intended to be so).
Using ``--input-ipc-server`` or ``--input-ipc-client`` is also suitable for
purposes like remote control (however, the IPC protocol itself is not
"secure" and not intended to be so).
2. Using libmpv. This is generally recommended when mpv is used as playback
backend for a completely different application. The provided C API is
@@ -1163,6 +1277,12 @@ More options to configure this functionality are listed in `Watch Later`_.
PROTOCOLS
=========
``mpv://...``
mpv protocol. This is used for starting mpv from URL handler. The protocol
is stripped and the rest is passed to the player as a normal open argument.
Only safe network protocols are allowed to be opened this way.
``http://...``, ``https://``, ...
Many network protocols are supported, but the protocol prefix must always
@@ -1235,9 +1355,20 @@ PROTOCOLS
``image-2.jpg`` and ``image-10.jpg``, provided that there are no big gaps
between the files.
``cdda://[device]`` ``--cdrom-device=PATH`` ``--cdda-...``
``cdda://[device]`` ``--cdda-device=PATH``
Play CD.
Play CD. You can select a specific range of tracks to play by using the
``--start`` and ``--end`` options and specifying chapters. Navigating
forwards and backwards through tracks can also be done by navigating through
chapters (``PGUP`` and ``PGDOWN`` in the default keybinds).
.. admonition:: Example
::
mpv cdda:// --start=#4 --end=#6
This will start from track 4, play track 5, and then end.
``lavf://...``
@@ -1310,22 +1441,28 @@ PROTOCOLS
Only works with seekable streams.
Examples::
.. admonition:: Example
mpv slice://1g-2g@cap.ts
::
This starts reading from cap.ts after seeking 1 GiB, then
reads until reaching 2 GiB or end of file.
mpv slice://1g-2g@cap.ts
mpv slice://1g-+2g@cap.ts
This starts reading from cap.ts after seeking 1 GiB, then
reads until reaching 2 GiB or end of file.
This starts reading from cap.ts after seeking 1 GiB, then
reads until reaching 3 GiB or end of file.
::
mpv slice://100m@appending://cap.ts
mpv slice://1g-+2g@cap.ts
This starts reading from cap.ts after seeking 100MiB, then
reads until end of file.
This starts reading from cap.ts after seeking 1 GiB, then
reads until reaching 3 GiB or end of file.
::
mpv slice://100m@appending://cap.ts
This starts reading from cap.ts after seeking 100MiB, then
reads until end of file.
``null://``
@@ -1341,6 +1478,20 @@ PROTOCOLS
Like ``memory://``, but the string is interpreted as hexdump.
``archive://[ARCHIVE PATH]|[FILE PATH IN ARCHIVE]``
Open a file at the specified path inside an archive. Requires libarchive
feature enabled. The archive path must have all ``%`` and ``|`` characters
URL escaped. The file path should not be URL escaped.
.. admonition:: Example
::
mpv "archive://file.zip|video.mkv"
This will play ``video.mkv`` in the archive file ``file.zip``.
PSEUDO GUI MODE
===============
@@ -1369,7 +1520,7 @@ The profile is currently defined as follows:
[builtin-pseudo-gui]
terminal=no
force-window=yes
idle=once
idle=yes
screenshot-directory=~~desktop/
The ``pseudo-gui`` profile exists for compatibility. The options in the
@@ -1385,10 +1536,15 @@ works like in older mpv releases:
.. warning::
Currently, you can extend the ``pseudo-gui`` profile in the config file the
normal way. This is deprecated. In future mpv releases, the behavior might
change, and not apply your additional settings, and/or use a different
profile name.
normal way. This is deprecated and will be removed in future mpv releases.
As an alternative, a conditional autoprofile can be used instead:
::
[gui]
profile-cond=p["player-operation-mode"]=="pseudo-gui"
idle=once
.. include:: options.rst
@@ -1410,6 +1566,14 @@ works like in older mpv releases:
.. include:: console.rst
.. include:: commands.rst
.. include:: select.rst
.. include:: context_menu.rst
.. include:: positioning.rst
.. include:: lua.rst
.. include:: javascript.rst
@@ -1444,10 +1608,7 @@ behavior of mpv.
``MPV_LEAK_REPORT``
If set to ``1``, enable internal talloc leak reporting. If set to another
value, disable leak reporting. If unset, use the default, which normally is
``0``. If mpv was built with ``--enable-ta-leak-report``, the default is
``1``. If leak reporting was disabled at compile time (``NDEBUG`` in
custom ``CFLAGS``), this environment variable is ignored.
value, disable leak reporting.
``LADSPA_PATH``
Specifies the search path for LADSPA plugins. If it is unset, fully
@@ -1547,12 +1708,30 @@ Note that quitting the player manually will always lead to exit code 0,
overriding the exit code that would be returned normally. Also, the ``quit``
input command can take an exit code: in this case, that exit code is returned.
OPTICAL DRIVES
==============
Depending on the OS, mpv will choose a different disc device by default.
This applies for all optical disc playback (CDDA, DVD, and BD).
======= =============
OS Default Drive
======= =============
Linux /dev/sr0
Windows D:
macOS /dev/disk1
FreeBSD /dev/cd0
OpenBSD /dev/rcd0c
======= =============
FILES
=====
Note that this section assumes Linux/BSD. On other platforms the paths may be different.
For Windows-specifics, see `FILES ON WINDOWS`_ section.
All configuration files should be encoded in UTF-8.
``/usr/local/etc/mpv/mpv.conf``
mpv system-wide settings (depends on ``--prefix`` passed to configure - mpv
in default configuration will use ``/usr/local/etc/mpv/`` as config
@@ -1697,5 +1876,5 @@ FILES ON MACOS
On macOS the watch later directory is located at ``~/.config/mpv/watch_later/``
and the cache directory is set to ``~/Library/Caches/io.mpv/``. These directories
can't be overwritten by enviroment variables.
can't be overwritten by environment variables.
Everything else is the same as `FILES`_.
+1594 -438
View File
File diff suppressed because it is too large. Load diff
+410 -78
View File
@@ -20,35 +20,44 @@ The Interface
::
+---------+----------+------------------------------------------+----------+
| pl prev | pl next | title | cache |
+------+--+---+------+---------+-----------+------+-------+-----+-----+----+
+------+---------+---------+-----------------------------------------------+
| menu | pl prev | pl next | title cache |
+------+------+------+---------+-----------+------+-------+-----+-----+----+
| play | skip | skip | time | seekbar | time | audio | sub | vol | fs |
| | back | frwd | elapsed | | left | | | | |
+------+------+------+---------+-----------+------+-------+-----+-----+----+
menu
============= ================================================
left-click open the menu
============= ================================================
pl prev
============= ================================================
left-click play previous file in playlist
right-click show playlist
shift+L-click show playlist
shift+L-click show the playlist
middle-click show the playlist
right-click open the playlist menu
============= ================================================
pl next
============= ================================================
left-click play next file in playlist
right-click show playlist
shift+L-click show playlist
shift+L-click show the playlist
middle-click show the playlist
right-click open the playlist menu
============= ================================================
title
| Displays current media-title, filename, custom title, or target chapter
name while hovering the seekbar.
| Displays the current playlist position and media-title, filename or custom
title, or the target chapter name while hovering the seekbar.
============= ================================================
left-click show playlist position and length and full title
right-click show filename
left-click show file and track info
shift+L-click show the path
middle-click show the path
right-click open the history menu
============= ================================================
cache
@@ -57,20 +66,25 @@ cache
play
============= ================================================
left-click toggle play/pause
shift+L-click toggle infinite looping of the playlist
middle-click toggle infinite looping of the playlist
right-click toggle infinite looping of the current file
============= ================================================
skip back
============= ================================================
left-click go to beginning of chapter / previous chapter
right-click show chapters
shift+L-click show chapters
middle-click show chapters
right-click open the chapter menu
============= ================================================
skip frwd
============= ================================================
left-click go to next chapter
right-click show chapters
shift+L-click show chapters
middle-click show chapters
right-click open the chapter menu
============= ================================================
time elapsed
@@ -85,6 +99,7 @@ seekbar
============= ================================================
left-click seek to position
right-click seek to the nearest chapter
mouse wheel seek forward/backward
============= ================================================
@@ -100,22 +115,30 @@ audio and sub
============= ================================================
left-click cycle audio/sub tracks forward
right-click cycle audio/sub tracks backwards
shift+L-click show available audio/sub tracks
shift+L-click cycle audio/sub tracks backwards
middle-click cycle audio/sub tracks backwards
right-click open the audio/sub track menu
mouse wheel cycle audio/sub tracks forward/backwards
============= ================================================
vol
============= ================================================
left-click toggle mute
right-click open the audio device menu
mouse wheel volume up/down
============= ================================================
fs
============= ================================================
left-click toggle fullscreen
right-click toggle whether the window is maximized
============= ================================================
Since mpv 0.40.0, it is possible to configure the commands to run with mouse
actions on some interface elements, and the default behaviors of several
elements were changed. If you miss some older behaviors, look at
``etc/restore-osc-bindings.conf`` in the mpv git repository.
Key Bindings
~~~~~~~~~~~~
@@ -130,22 +153,9 @@ del Cycles visibility between never / auto (mouse-move) / always
Configuration
-------------
The OSC offers limited configuration through a config file
``script-opts/osc.conf`` placed in mpv's user dir and through the
``--script-opts`` command-line option. Options provided through the command-line
will override those from the config file.
Config Syntax
~~~~~~~~~~~~~
The config file must exactly follow the following syntax::
# this is a comment
optionA=value1
optionB=value2
``#`` can only be used at the beginning of a line and there may be no
spaces around the ``=`` or anywhere else.
This script can be customized through a config file ``script-opts/osc.conf``
placed in mpv's user directory and through the ``--script-opts`` command-line
option. The configuration syntax is described in `mp.options functions`_.
Command-line Syntax
~~~~~~~~~~~~~~~~~~~
@@ -165,7 +175,7 @@ Configurable Options
Default: bottombar
The layout for the OSC. Currently available are: box, slimbox,
bottombar and topbar. Default pre-0.21.0 was 'box'.
bottombar, topbar, slimbottombar, slimtopbar and floating.
``seekbarstyle``
Default: bar
@@ -207,7 +217,7 @@ Configurable Options
seekbar or separately if ``seekbarstyle`` is set to ``bar``.
``seekrangealpha``
Default: 200
Default: 20
Alpha of the seekable ranges, 0 (opaque) to 255 (fully transparent).
@@ -219,7 +229,7 @@ Configurable Options
Set to ``no`` to disable any special mouse wheel behavior.
``deadzonesize``
Default: 0.5
Default: 0.75
Size of the deadzone. The deadzone is an area that makes the mouse act
like leaving the window. Movement there won't make the OSC show up and
@@ -227,13 +237,13 @@ Configurable Options
at the window border opposite to the OSC and the size controls how much
of the window it will span. Values between 0.0 and 1.0, where 0 means the
OSC will always popup with mouse movement in the window, and 1 means the
OSC will only show up when the mouse hovers it. Default pre-0.21.0 was 0.
OSC will only show up when the mouse hovers it. Default pre-0.42.0 was 0.5.
``minmousemove``
Default: 0
Minimum amount of pixels the mouse has to move between ticks to make
the OSC show up. Default pre-0.21.0 was 3.
the OSC show up.
``showwindowed``
Default: yes
@@ -250,6 +260,11 @@ Configurable Options
Show the mpv logo and message when idle
``audioonlyscreen``
Default: no
Show the mpv logo when no video track is present or selected.
``scalewindowed``
Default: 1.0
@@ -260,31 +275,29 @@ Configurable Options
Scale factor of the OSC when fullscreen
``scaleforcedwindow``
Default: 2.0
Scale factor of the OSC when rendered on a forced (dummy) window
``vidscale``
Default: yes
Default: auto
Scale the OSC with the video
``no`` tries to keep the OSC size constant as much as the window size allows
Scale the OSC with the video.
``no`` tries to keep the OSC size constant as much as the window size allows.
``auto`` scales the OSC with the OSD, which is scaled with the window or kept at a
constant size, depending on the ``--osd-scale-by-window`` option.
``valign``
Default: 0.8
Vertical alignment, -1 (top) to 1 (bottom)
Vertical alignment in box and slimbox layouts, -1 (top) to 1 (bottom).
``halign``
Default: 0.0
Horizontal alignment, -1 (left) to 1 (right)
Horizontal alignment in box and slimbox layouts, -1 (left) to 1 (right).
``barmargin``
Default: 0
Margin from bottom (bottombar) or top (topbar), in pixels
Margin from bottom (bottombar, slimbottombar) or top (topbar, slimtopbar),
in pixels.
``boxalpha``
Default: 80
@@ -300,10 +313,15 @@ Configurable Options
``fadeduration``
Default: 200
Duration of fade out in ms, 0 = no fade
Duration of fade effects in ms, 0 = no fade.
``fadein``
Default: no
Enable fade-in.
``title``
Default: ${media-title}
Default: ${!playlist-count==1:[${playlist-pos-1}/${playlist-count}] }${media-title}
String that supports property expansion that will be displayed as
OSC title.
@@ -344,6 +362,22 @@ Configurable Options
Also supports ``never`` and ``always``
``visibility_modes``
Default: never_auto_always
The list of visibility modes to cycle through when calling the
osc-visibility cycle script message. Modes are separated by ``_``.
``boxwidth``
Default: 550
Width of the ``box`` layout.
``slimboxwidth``
Default: 660
Width of the ``slimbox`` layout.
``boxmaxchars``
Default: 80
@@ -359,27 +393,50 @@ Configurable Options
within the areas not covered by the osc (``yes``). If this option is set,
the osc may overwrite the ``--video-margin-ratio-*`` options, even if the
user has set them. (It will not overwrite them if all of them are set to
default values.) Additionally, ``visibility`` must be set to ``always``.
Otherwise, this option does nothing.
default values.) By default, ``visibility`` must be set to ``always``.
Use ``dynamic_margins`` to allow margins to update with OSC visibility
instead.
Currently, this is supported for the ``bottombar`` and ``topbar`` layout
only. The other layouts do not change if this option is set. Separately,
if window controls are present (see below), they will be affected
regardless of which osc layout is in use.
Currently, this is supported for the ``bottombar``, ``slimbottombar``,
``topbar`` and ``slimtopbar`` layouts only. The other layouts do not change
if this option is set. Separately, if window controls are present (see
below), they will be affected regardless of which osc layout is in use.
The border is static and appears even if the OSC is configured to appear
only on mouse interaction. If the OSC is invisible, the border is simply
filled with the background color (black by default).
This currently still makes the OSC overlap with subtitles (if the
``--sub-use-margins`` option is set to ``yes``, the default). This may be
fixed later.
Subtitles may still overlap with the OSC when ``--sub-use-margins`` is set
to ``yes`` (the default), as they are allowed to extend into the margin
area. Setting ``--sub-use-margins=no`` confines subtitles to the video
area.
This does not work correctly with video outputs like ``--vo=xv``, which
render OSD into the unscaled video.
``dynamic_margins``
Default: no
When set to ``yes``, margins follow the actual OSC visibility: they are
applied when the OSC appears and removed when it hides. Without this
option, margins are only applied when ``visibility`` is set to ``always``.
``sub_margins``
Default: no
Whether to adjust the subtitle margin so that subtitles do not overlap
with the OSC. Requires ``dynamic_margins`` or ``visibility=always`` to
take effect. Uses ``--sub-margin-y-offset`` to apply the adjustment.
With ``boxvideo`` enabled and ``--sub-use-margins=no``, subtitles are
already confined to the video area and this option has no additional
effect.
``osd_margins``
Default: yes
Whether to adjust the OSD margin so that OSD text does not overlap
with the OSC. Requires ``dynamic_margins`` or ``visibility=always`` to
take effect. Uses ``--osd-margin-y-offset`` to apply the adjustment.
``windowcontrols``
Default: auto (Show window controls if there is no window border)
Default: auto (Show window controls if there is no window border/title-bar)
Whether to show window management controls over the video, and if so,
which side of the window to place them. This may be desirable when the
@@ -391,6 +448,12 @@ Configurable Options
and ``quit``. Not all platforms implement ``minimize`` and ``maximize``,
but ``quit`` will always work.
``windowcontrols_independent``
Default: yes
Whether to show window controls independently of the OSC, or show them
together.
``windowcontrols_alignment``
Default: right
@@ -407,6 +470,30 @@ Configurable Options
windowcontrols title.
ASS tags are escaped, and newlines and trailing slashes are stripped.
``floatingtitle``
Default: yes
Whether to show the title row in the ``floating`` layout. When enabled,
window controls are rendered as compact buttons without a full-width
background bar.
``floatingwidth``
Default: 700
Width of the ``floating`` layout.
``floatingalpha``
Default: 105
Alpha of the ``floating`` layout background, 0 (opaque) to 255 (fully
transparent).
``tracknumberswidth``
Default: 35
Width of the track number labels next to the audio/subtitle track selector
icons. Set to ``0`` to hide track numbers and show only the icons.
``greenandgrumpy``
Default: no
@@ -418,12 +505,6 @@ Configurable Options
Update chapter markers positions on duration changes, e.g. live streams.
The updates are unoptimized - consider disabling it on very low-end systems.
``chapters_osd``, ``playlist_osd``
Default: yes
Whether to display the chapters/playlist at the OSD when left-clicking the
next/previous OSC buttons, respectively.
``chapter_fmt``
Default: ``Chapter: %s``
@@ -437,6 +518,225 @@ Configurable Options
Use a Unicode minus sign instead of an ASCII hyphen when displaying
the remaining playback time.
``icon_style``
Default: layout
Selects the icon set used for OSC buttons. Both sets are bundled in the
mpv-osd-symbols font.
``layout``
Select the icon set based on the current layout.
``classic``
The original mpv icon set.
``fluent``
Icons based on Microsoft's Fluent UI System Icons.
``background_color``
Default: #000000
Sets the background color of the OSC.
``timecode_color``
Default: #FFFFFF
Sets the color of the timecode and seekbar, of the OSC.
``title_color``
Default: #FFFFFF
Sets the color of the video title. Formatted as #RRGGBB.
``time_pos_color``
Default: #FFFFFF
Sets the color of the timecode at hover position in the seekbar.
``time_pos_outline_color``
Default: #FFFFFF
Sets the color of the timecode's outline at hover position in the seekbar.
Also affects the timecode in the slimbox layout.
``buttons_color``
Default: #FFFFFF
Sets the colors of the big buttons.
``top_buttons_color``
Default: #FFFFFF
Sets the colors of the top buttons.
``small_buttonsL_color``
Default: #FFFFFF
Sets the colors of the small buttons on the left in the box layout.
``small_buttonsR_color``
Default: #FFFFFF
Sets the colors of the small buttons on the right in the box layout.
``held_element_color``
Default: #999999
Sets the colors of the elements that are being pressed or held down.
``tick_delay``
Default: 1/60
Sets the minimum interval between OSC redraws in seconds. This can be
decreased on fast systems to make OSC rendering smoother.
Ignored if ``tick_delay_follow_display_fps`` is set to yes and the VO
supports the ``display-fps`` property.
``tick_delay_follow_display_fps``
Default: no
Use display fps to calculate the interval between OSC redraws.
``max_thumb_size``
Default: 200
Maximum display size of the preview thumbnail. Only meaningful when a
Thumbnailer is active. See the `OSC Preview API`_ section.
The following options configure what commands are run when the buttons are
clicked. ``mbtn_mid`` commands are also triggered with ``shift+mbtn_left``.
An option that ends with ``_down_command`` means that the command is
continuously called while the mouse button is held down.
``menu_mbtn_left_command=script-binding select/menu; script-message-to osc osc-hide``
``menu_mbtn_mid_command=``
``menu_mbtn_right_command=``
``playlist_prev_mbtn_left_command=playlist-prev; show-text ${playlist} 3000``
``playlist_prev_mbtn_mid_command=show-text ${playlist} 3000``
``playlist_prev_mbtn_right_command=script-binding select/select-playlist; script-message-to osc osc-hide``
``playlist_next_mbtn_left_command=playlist-next; show-text ${playlist} 3000``
``playlist_next_mbtn_mid_command=show-text ${playlist} 3000``
``playlist_next_mbtn_right_command=script-binding select/select-playlist; script-message-to osc osc-hide``
``title_mbtn_left_command=script-binding stats/display-page-5``
``title_mbtn_mid_command=show-text ${path}``
``title_mbtn_right_command=script-binding select/select-watch-history; script-message-to osc osc-hide``
``play_pause_mbtn_left_command=cycle pause``
``play_pause_mbtn_mid_command=cycle-values loop-playlist inf no``
``play_pause_mbtn_right_command=cycle-values loop-file inf no``
``chapter_prev_mbtn_left_command=osd-msg add chapter -1``
``chapter_prev_mbtn_mid_command=show-text ${chapter-list} 3000``
``chapter_prev_mbtn_right_command=script-binding select/select-chapter; script-message-to osc osc-hide``
``chapter_next_mbtn_left_command=osd-msg add chapter 1``
``chapter_next_mbtn_mid_command=show-text ${chapter-list} 3000``
``chapter_next_mbtn_right_command=script-binding select/select-chapter; script-message-to osc osc-hide``
``audio_track_mbtn_left_command=cycle audio``
``audio_track_mbtn_mid_command=cycle audio down``
``audio_track_mbtn_right_command=script-binding select/select-aid; script-message-to osc osc-hide``
``audio_track_wheel_down_command=cycle audio``
``audio_track_wheel_up_command=cycle audio down``
``sub_track_mbtn_left_command=cycle sub``
``sub_track_mbtn_mid_command=cycle sub down``
``sub_track_mbtn_right_command=script-binding select/select-sid; script-message-to osc osc-hide``
``sub_track_wheel_down_command=cycle sub``
``sub_track_wheel_up_command=cycle sub down``
``volume_mbtn_left_command=no-osd cycle mute``
``volume_mbtn_mid_command=``
``volume_mbtn_right_command=script-binding select/select-audio-device; script-message-to osc osc-hide``
``volume_wheel_down_command=add volume -5``
``volume_wheel_up_command=add volume 5``
``fullscreen_mbtn_left_command="cycle fullscreen"``
``fullscreen_mbtn_mid_command=``
``fullscreen_mbtn_right_command="cycle window-maximized"``
``skip_backward_mbtn_left_down_command=seek -5``
``skip_backward_mbtn_mid_down_command=frame-back-step``
``skip_backward_mbtn_right_down_command=seek -30``
``skip_forward_mbtn_left_down_command=seek 10``
``skip_forward_mbtn_mid_down_command=frame-step``
``skip_forward_mbtn_right_down_command=seek 60``
``close_mbtn_left_command=quit``
``close_mbtn_mid_command=``
``close_mbtn_right_command=``
``minimize_mbtn_left_command=cycle window-minimized``
``minimize_mbtn_mid_command=``
``minimize_mbtn_right_command=``
``maximize_mbtn_left_command=cycle ${?fullscreen==yes:fullscreen}${!fullscreen==yes:window-maximized}``
``maximize_mbtn_mid_command=``
``maximize_mbtn_right_command=``
Custom Buttons
~~~~~~~~~~~~~~
Additional script-opts are available to define custom buttons in ``bottombar``
and ``topbar`` layouts.
.. admonition:: Example to add loop, shuffle and speed buttons
::
custom_button_1_content=🔁
custom_button_1_mbtn_left_command=cycle-values loop-file inf no
custom_button_1_mbtn_right_command=cycle-values loop-playlist inf no
custom_button_2_content=🔀
custom_button_2_mbtn_left_command=playlist-shuffle
custom_button_3_content=⏱
custom_button_3_mbtn_left_command=add speed 1
custom_button_3_mbtn_right_command=set speed 1
custom_button_3_wheel_up_command=add speed 0.25
custom_button_3_wheel_down_command=add speed -0.25
Script Commands
~~~~~~~~~~~~~~~
@@ -444,13 +744,16 @@ Script Commands
The OSC script listens to certain script commands. These commands can bound
in ``input.conf``, or sent by other scripts.
``osc-message``
Show a message on screen using the OSC. First argument is the message,
second the duration in seconds.
``osc-visibility``
Controls visibility mode ``never`` / ``auto`` (on mouse move) / ``always``
and also ``cycle`` to cycle between the modes
and also ``cycle`` to cycle between the modes. If a second argument is
passed (any value), then the output on the OSD will be silenced.
``osc-show``
Triggers the OSC to show up, just as if user moved mouse.
``osc-hide``
Hide the OSC when ``visibility`` is ``auto``.
Example
@@ -462,9 +765,38 @@ to set auto mode (the default) with ``b``::
``osc-idlescreen``
Controls the visibility of the mpv logo on idle. Valid arguments are ``yes``,
``no``, and ``cycle`` to toggle between yes and no.
``no``, and ``cycle`` to toggle between yes and no. If a second argument is
passed (any value), then the output on the OSD will be silenced.
``osc-playlist``, ``osc-chapterlist``, ``osc-tracklist``
Shows a limited view of the respective type of list using the OSC. First
argument is duration in seconds.
OSC Preview API
~~~~~~~~~~~~~~~
The OSC supports displaying preview thumbnails when hovering over the seekbar if
a compatible thumbnailer script is installed. It communicates with a thumbnailer
script via the following ``user-data`` properties:
``user-data/osc/draw-preview``
Set by the OSC to request a thumbnail within the currently playing file.
The ``draw-preview`` property is a table with the following fields:
``x``, ``y``
Top-left coordinates (positive integers) to draw the thumbnail at.
``w``, ``h``
Width and height (positive non-zero integers) of the area to draw the
thumbnail in. Note that this only specifies the drawing width and
height, the actual backing thumbnail size may differ.
``hover-sec``
Requested thumbnail timestamp in seconds.
``ass``
Optional ASS string to render alongside the thumbnail, using OSD
coordinates. This can be used for decorations such as a thumbnail
border.
The OSC sets this property to ``nil`` to signal the thumbnailer to clear
the displayed thumbnail.
Avoid installing/enabling multiple thumbnailer script since this api expects
only one to be active at a time.
+60
View File
@@ -0,0 +1,60 @@
POSITIONING
===========
This script provides script bindings to pan videos and images. It can be
disabled using the ``--load-positioning=no`` option.
Script bindings
---------------
``pan-x <amount>``
Adjust ``--video-align-x`` relatively to the OSD width, rather than
relatively to the video width like the option. This is useful to pan large
images consistently.
``amount`` is a number such that an amount of 1 scrolls as much as the OSD
width.
``pan-y <amount>``
Adjust ``--video-align-y`` relatively to the OSD height, rather than
relatively to the video height like the option.
``amount`` is a number such that an amount of 1 scrolls as much as the OSD
height.
``drag-to-pan``
Pan the video while holding a mouse button, keeping the clicked part of the
video under the cursor.
``align-to-cursor``
Pan through the whole video while holding a mouse button, or after clicking
once if ``toggle_align_to_cursor`` is ``yes``.
``cursor-centric-zoom <amount>``
Increase ``--video-zoom`` by ``amount`` while keeping the part of the video
hovered by the cursor under it, or the average position of touch points if
known.
Configuration
-------------
This script can be customized through a config file
``script-opts/positioning.conf`` placed in mpv's user directory and through the
``--script-opts`` command-line option. The configuration syntax is described in
`mp.options functions`_.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
``toggle_align_to_cursor``
Default: no
Whether ``align-to-cursor`` requires holding down a mouse button to pan. If
``no``, dragging pans. If ``yes``, clicking the first time makes pan follow
the cursor, and clicking a second time disables this.
``suppress_osd``
Default: no
Whether to not print the new value of ``--video-zoom`` when using
``cursor-centric-zoom``.
+197
View File
@@ -0,0 +1,197 @@
SELECT
======
console can present a list of items to browse and select from with the
``mp.input.select`` API. ``select.lua`` is a builtin client of this API
providing script bindings that gather and format the data to be selected in the
console and do operations on the selected item. It can be disabled using the
``--load-select=no`` option.
This script is also used to populate the context menu.
Key bindings
------------
When using ``mp.input.select``, the key bindings listed in `CONSOLE`_ are
extended with the following:
ENTER, Ctrl+j and Ctrl+m
Select the focused item.
UP and Ctrl+p
Focus the item above, or the last one when the first item is selected.
DOWN and Ctrl+n
Focus the item below, or the first one when the last item is selected.
PGUP and Ctrl+b
Scroll up one page.
PGDN and Ctrl+f
Scroll down one page.
Shift+LEFT
Scroll left.
Shift+RIGHT
Scroll right.
Ctrl+y
Copy the focused item to the clipboard.
MBTN_LEFT
Select the item under the cursor, or close the console if clicking outside
of the menu rectangle.
WHEEL_UP
Scroll up.
WHEEL_DOWN
Scroll down.
WHEEL_LEFT and Shift+WHEEL_DOWN
Scroll left.
WHEEL_RIGHT and Shift+WHEEL_UP
Scroll right.
Typing printable characters does a fuzzy search of the presented items.
If the query starts with ``'``, only exact matches are filtered. You can also
specify multiple search terms delimited by spaces, and only items matching all
terms are filtered.
Script bindings
---------------
By default select.lua's script bindings are bound to key sequences starting with
``g`` listed in `Keyboard Control`_. The names of the script bindings listed
below can be used to bind them to different keys.
.. admonition:: Example to rebind playlist selection in input.conf
Ctrl+p script-binding select/select-playlist
Available script bindings are:
``select-playlist``
Select a playlist entry. ``--osd-playlist-entry`` determines how playlist
entries are formatted.
``select-sid``
Select a subtitle track, or disable the current one.
``select-secondary-sid``
Select a secondary subtitle track, or disable the current one.
``select-aid``
Select an audio track, or disable the current one.
``select-vid``
Select a video track, or disable the current one.
``select-track``
Select a track of any type, or disable a selected track.
``select-chapter``
Select a chapter.
``select-edition``
Select an MKV edition or DVD/Blu-ray title.
``select-subtitle-line``
Select a subtitle line to seek to. This doesn't work with image subtitles.
``select-audio-device``
Select an audio device.
``select-watch-history``
Select a file from the watch history. Requires ``--save-watch-history``.
If you don't already use ``--autocreate-playlist``, it is recommended to
enable it with this script binding to populate the playlist with the other
files in the entry's directory.
.. admonition:: Example for input.conf to play files adjacent to the history entry
g-h script-binding select/select-watch-history; no-osd set autocreate-playlist filter
``select-watch-later``
Select a file from watch later config files (see `RESUMING PLAYBACK`_) to
resume playing. Requires ``--write-filename-in-watch-later-config``. This
doesn't work with ``--ignore-path-in-watch-later-config``.
If you don't already use ``--autocreate-playlist``, it is recommended to
enable it with this script binding to populate the playlist with the other
files in the entry's directory.
.. admonition:: Example for input.conf to play files adjacent to the watch later entry
g-w script-binding select/select-watch-later; no-osd set autocreate-playlist filter
``select-binding``
List the defined input bindings. You can also select one to run the
associated command.
``show-properties``
List the names and values of all properties. You can also select one to
print its value on the OSD, which is useful for long values that get
clipped.
``edit-config-file``
Open ``mpv.conf`` in the system text editor, creating it if it doesn't
already exist.
``edit-input-conf``
Open ``input.conf`` in the system text editor, creating it if it doesn't
already exist.
``open-docs``
Open mpv's online documentation in the browser.
``open-chat``
Open mpv's chat in the browser.
``menu``
Show a menu with miscellaneous entries.
``context-menu``
Show the context menu.
Configuration
-------------
This script can be customized through a config file ``script-opts/select.conf``
placed in mpv's user directory and through the ``--script-opts`` command-line
option. The configuration syntax is described in `mp.options functions`_.
Configurable options
~~~~~~~~~~~~~~~~~~~~
``history_date_format``
Default: %Y-%m-%d %H:%M:%S
The format of dates of history entries. This is passed to Lua's ``os.date``,
which uses the same formats as ``strftime(3)``.
``hide_history_duplicates``
Default: yes
Whether to show only the last of history entries with the same path.
``menu_conf_path``
Default: ~~/menu.conf (see `FILES`_).
The path from which to read the custom context menu definition (see `CONTEXT
MENU`_).
``max_playlist_items``
Default: 25
The maximum number of playlist entries in the context menu.
``populate_menu_data``
Default: yes, except for libmpv
Whether observe the properties referenced in ``menu.conf`` and update
``menu-data`` with suitable menu items after mpv's window is created.
+92 -28
View File
@@ -14,6 +14,7 @@ already bound to them:
==== ==============================================
i Show stats for a fixed duration
I Toggle stats (shown until toggled again)
? Toggle displaying the key bindings
==== ==============================================
While the stats are visible on screen the following key bindings are active,
@@ -25,14 +26,27 @@ stats:
2 Show frame timings (scroll)
3 Input cache stats
4 Active key bindings (scroll)
5 Selected Tracks Info (scroll)
0 Internal stuff (scroll)
==== ==================
If stats were displayed by toggling, these key bindings are also active:
==== ==================
ESC Close the stats
==== ==================
On pages which support scroll, these key bindings are also active:
==== ==================
UP Scroll one line up
DOWN Scroll one line down
UP Scroll one line up
DOWN Scroll one line down
==== ==================
On page 4, these key bindings are also active:
==== ==================
/ Search key bindings
==== ==================
Configuration
@@ -40,7 +54,7 @@ Configuration
This script can be customized through a config file ``script-opts/stats.conf``
placed in mpv's user directory and through the ``--script-opts`` command-line
option. The configuration syntax is described in `ON SCREEN CONTROLLER`_.
option. The configuration syntax is described in `mp.options functions`_.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
@@ -53,8 +67,12 @@ Configurable Options
Default: 3
``key_page_4``
Default: 4
``key_page_5``
Default: 5
``key_page_0``
Default: 0
``key_exit``
Default: ESC
Key bindings for page switching while stats are displayed.
@@ -62,6 +80,8 @@ Configurable Options
Default: UP
``key_scroll_down``
Default: DOWN
``key_scroll_search``
Default: /
``scroll_lines``
Default: 1
@@ -85,30 +105,44 @@ Configurable Options
respective duration. This can result in overlapping text when multiple
scripts decide to print text at the same time.
``term_width_limit``
Default: -1
``file_tag_max_length``
Default: 128
Sets the terminal width.
A value of 0 means the width is infinite, -1 means it's automatic.
Only show file tags shorter than this length, in bytes.
``term_height_limit``
Default: -1
``file_tag_max_count``
Default: 16
Sets the terminal height.
A value of 0 means the height is infinite, -1 means it's automatic.
Only show the first specified amount of file tags.
``term_clip``
Default: yes
Whether to clip lines to the terminal width.
``track_info_selected_only``
Default: yes
Show track info for selected tracks only instead of all tracks.
``plot_perfdata``
Default: yes
Default: no
Show graphs for performance data (page 2).
``plot_vsync_ratio``
Default: yes
Default: no
``plot_vsync_jitter``
Default: yes
Default: no
Show graphs for vsync and jitter values (page 1). Only when toggled.
``plot_cache``
Default: yes
Show graphs for cache values (page 3). Only when toggled.
``plot_tonemapping_lut``
Default: no
@@ -120,7 +154,7 @@ Configurable Options
Clear data buffers used for drawing graphs when toggling.
``font``
Default: sans-serif
Default: same as ``osd-font``
Font name. Should support as many font weights as possible for optimal
visual experience.
@@ -132,35 +166,57 @@ Configurable Options
text. Currently, monospaced digits are sufficient.
``font_size``
Default: 8
Default: 20
Font size used to render text.
``font_color``
Default: FFFFFF
Default: same as ``osd-color``
Font color.
Color of the text.
``border_size``
Default: 0.8
Default: 1.65
Size of border drawn around the font.
``border_color``
Default: 262626
Default: same as ``osd-border-color``
Color of drawn border.
Color of the text border.
``shadow_x_offset``
Default: same as ``--osd-shadow-offset``
The horizontal distance from the text to position the shadow at.
``shadow_y_offset``
Default: same as ``--osd-shadow-offset``
The vertical distance from the text to position the shadow at.
``shadow_color``
Default: same as ``osd-shadow-color``
Color of the text shadow.
``alpha``
Default: 11
Transparency for drawn text.
Transparency of text when ``font_color`` is specified, of text borders when
``border_color`` is specified, and of text shadows when ``shadow_color`` is
specified.
``plot_bg_border_color``
Default: 0000FF
Border color used for drawing graphs.
``plot_bg_border_width``
Default: 1.25
Border width used for drawing graphs.
``plot_bg_color``
Default: 262626
@@ -171,6 +227,14 @@ Configurable Options
Color used for drawing graphs.
``vidscale``
Default: auto
Scale the text and graphs with the video.
``no`` tries to keep the sizes constant.
``auto`` scales the text and graphs with the OSD, which is scaled with the
window or kept at a constant size, depending on the ``--osd-scale-by-window`` option.
Note: colors are given as hexadecimal values and use ASS tag order: BBGGRR
(blue green red).
@@ -185,7 +249,7 @@ Additional keys can be configured in ``input.conf`` to display the stats::
And to display a certain page directly::
i script-binding stats/display-page-1
e script-binding stats/display-page-2
h script-binding stats/display-page-4-toggle
Active key bindings page
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -198,11 +262,11 @@ The keys are grouped automatically using a simple analysis of the command
string, and one should not expect documentation-level grouping accuracy,
however, it should still be reasonably useful.
Using ``--idle --script-opts=stats-bindlist=yes`` will print the list to the
terminal and quit immediately. By default long lines are shortened to 79 chars,
and terminal escape sequences are enabled. A different length limit can be
set by changing ``yes`` to a number (at least 40), and escape sequences can be
disabled by adding ``-`` before the value, e.g. ``...=-yes`` or ``...=-120``.
Using ``--idle --script-opt=stats-bindlist=yes`` will print the list to
the terminal and quit immediately. Long lines are clipped to the terminal width
unless this is disabled with ``--script-opt=stats-term_clip=no``. Escape
sequences can be disabled by adding ``-`` before ``yes``, i.e.
``--script-opt=stats-bindlist=-yes``.
Like with ``--input-test``, the list includes bindings from ``input.conf`` and
from user scripts. Use ``--no-config`` to list only built-in bindings.
+153 -24
View File
@@ -23,6 +23,8 @@ The exact syntax is:
See the ``vf`` command (and ``toggle`` sub-command) for further explanations
and examples.
This is an object settings list option. See `List Options`_ for details.
The general filter entry syntax is:
``["@"<label-name>":"] ["!"] <filter-name> [ "=" <filter-parameter-list> ]``
@@ -33,7 +35,7 @@ The exact syntax is:
and the ``filter-parameter-list``:
``<filter-parameter> | <filter-parameter> "," <filter-parameter-list>``
``<filter-parameter> | <filter-parameter> ":" <filter-parameter-list>``
and ``filter-parameter``:
@@ -103,7 +105,7 @@ filter list.
compared. (Passing multiple filters is currently still possible, but
deprecated.)
``-vf-toggle=filter``
``--vf-toggle=filter``
Add the given filter to the list if it was not present yet, or remove it
from the list if it was present. Matching of filters works as described in
``--vf-remove``.
@@ -192,7 +194,7 @@ Available mpv-only filters are:
space if the system video driver supports it, but not input and output
levels. The ``scale`` video filter can configure color space and input
levels, but only if the output format is RGB (if the video output driver
supports RGB output, you can force this with ``-vf scale,format=rgba``).
supports RGB output, you can force this with ``--vf=scale,format=rgba``).
If this option is set to ``auto`` (which is the default), the video's
color space flag will be used. If that flag is unset, the color space
@@ -259,15 +261,15 @@ Available mpv-only filters are:
:dci-p3: DCI-P3 (Digital Cinema)
:v-gamut: Panasonic V-Gamut primaries
``<gamma>``
Gamma function the source file was encoded with. Normally this should be set
``<transfer>`` or ``<gamma>``
Transfer function the source file was encoded with. Normally this should be set
in the file header, but when playing broken or mistagged files this can be
used to override the setting.
This option only affects video output drivers that perform color management.
If this option is set to ``auto`` (which is the default), the gamma will
be set to BT.1886 for YCbCr content, sRGB for RGB content and Linear for
be set to BT.1886 for YCbCr content, sRGB for RGB content and st428 for
XYZ content.
Available gamma functions are:
@@ -288,6 +290,7 @@ Available mpv-only filters are:
:v-log: Panasonic V-Log transfer curve
:s-log1: Sony S-Log1 transfer curve
:s-log2: Sony S-Log2 transfer curve
:st428: Digital Cinema Distribution Master (XYZ)
``<sig-peak>``
Reference peak illumination for the video file, relative to the
@@ -320,19 +323,40 @@ Available mpv-only filters are:
Whether or not to include HDR10+ metadata (default: yes). If
disabled, any HDR10+ metadata will be stripped from frames.
``<min-luma>``
Set the minimum luminance value for the mastering display metadata.
This is a float value in nits (cd/m²).
.. note::
0.0 means undefined, which is the default. To set 0.0 as actual value,
use a very small value like 1e-6.
``<max-luma>``
Set the maximum luminance value for the mastering display metadata.
This is a float value in nits (cd/m²).
``<max_cll>``
Set the maximum content light level for the mastering display
metadata. This is a float value in nits (cd/m²).
``<max_fall>``
Set the maximum frame-average light level for the mastering
display metadata. This is a float value in nits (cd/m²).
``<film-grain=yes|no>``
Whether or not to include film grain metadata (default: yes). If
disabled, any film grain metadata will be stripped from frames.
``<chroma-location>``
Set the chroma loc of the video. Use
``--vf=format:chroma-location=help`` to list all available modes.
``<stereo-in>``
Set the stereo mode the video is assumed to be encoded in. Use
``--vf=format:stereo-in=help`` to list all available modes. Check with
the ``stereo3d`` filter documentation to see what the names mean.
``<stereo-out>``
Set the stereo mode the video should be displayed as. Takes the
same values as the ``stereo-in`` option.
``<rotate>``
Set the rotation the video is assumed to be encoded with in degrees.
The special value ``-1`` uses the input format.
@@ -355,13 +379,14 @@ Available mpv-only filters are:
Force a specific scaler backend, if applicable. This is a debug option
and could go away any time.
``<alpha=auto|straight|premul>``
``<alpha=auto|straight|premul|none>``
Set the kind of alpha the video uses. Undefined effect if the image
format has no alpha channel (could be ignored or cause an error,
depending on how mpv internals evolve). Setting this may or may not
cause downstream image processing to treat alpha differently, depending
on support. With ``convert`` and zimg used, this will convert the alpha.
libswscale and other FFmpeg components completely ignore this.
``none`` is available only starting from libplacebo vN.344.0.
``lavfi=graph[:sws-flags[:o=opts]]``
Filter video using FFmpeg's libavfilter.
@@ -433,7 +458,7 @@ Available mpv-only filters are:
subtitle colors and video under the influence of the video equalizer
settings.
``vapoursynth=file:buffered-frames:concurrent-frames``
``vapoursynth=file:buffered-frames:concurrent-frames:user-data``
Loads a VapourSynth filter script. This is intended for streamed
processing: mpv actually provides a source filter, instead of using a
native VapourSynth video source. The mpv source will answer frame
@@ -559,6 +584,10 @@ Available mpv-only filters are:
By default, this uses the special value ``auto``, which sets the option
to the number of detected logical CPU cores.
``user-data``
Optional arbitrary string that is passed to the script. Default to empty
string if not set.
The following ``.vpy`` script variables are defined by mpv:
``video_in``
@@ -585,10 +614,14 @@ Available mpv-only filters are:
``display_res``
Resolution of the current display. This is an integer array with the
first entry corresponding to the width and the second entry coresponding
first entry corresponding to the width and the second entry corresponding
to the height. These values can be 0. Note that this will not respond to
monitor changes and may not work on all platforms.
``user_data``
User data passed from the filter. This variable always exists, and defaults
to empty string.
``vavpp``
VA-API video post processing. Requires the system to support VA-API,
i.e. Linux/BSD only. Works with ``--vo=vaapi`` and ``--vo=gpu`` only.
@@ -679,19 +712,106 @@ Available mpv-only filters are:
Apply high quality VDPAU scaling (needs capable hardware).
``d3d11vpp``
Direct3D 11 video post processing. Currently requires D3D11 hardware
decoding for use.
Direct3D 11 video post-processing. Requires a D3D11 context and works best
with hardware decoding. Software frames are automatically uploaded to hardware
for processing.
``format``
Convert to the selected image format, e.g., nv12, p010, etc. (default: don't change).
Format names can be queried with ``--vf=d3d11vpp=format=help``.
Note that only a limited subset is supported, and actual support depends
on your hardware. Normally, this shouldn't be changed unless some
processing only works with a specific format, in which case it can be
selected here.
``deint=<yes|no>``
Whether deinterlacing is enabled (default: no).
``scale``
Scaling factor for the video frames (default: 1.0).
``scaling-mode=<standard,intel,nvidia>``
Select the scaling mode to be used. Note that this only enables the
appropriate processing extensions; whether it actually works or not
depends on your hardware and the settings in your GPU driver's control
panel (default: standard).
standard
Default scaling mode as decided by d3d11vpp implementation.
intel
Intel Video Super Resolution.
nvidia
NVIDIA RTX Super Resolution.
``interlaced-only=<yes|no>``
If ``yes``, only deinterlace frames marked as interlaced (default: no).
``mode=<blend|bob|adaptive|mocomp|ivctc|none>``
``mode=<blend|bob|adaptive|mocomp|ivtc|none>``
Tries to select a video processor with the given processing capability.
If a video processor supports multiple capabilities, it is not clear
which algorithm is actually selected. ``none`` always falls back. On
most if not all hardware, this option will probably do nothing, because
a video processor usually supports all modes or none.
If a video processor supports multiple capabilities, it is not guaranteed
which algorithm will actually be selected, this is left to the driver.
However, ``blend`` and ``bob`` modes are enforced by not passing reference
frames and adjusting the output frame rate. The other modes are used to
select an appropriate video processor, but the algorithm chosen depends
on the driver and the content. ``ivtc`` mode outputs at the half rate.
.. note::
``ivtc`` mode only performs field matching and does not drop duplicate
frames. Duplicated frames can be removed manually using the ``decimate``
filter: ``--vf=d3d11vpp="deint:mode=ivtc,format=nv12,decimate=5"`` for
3:2 pulldown cadence. ``format=nv12`` is required to download frames back
to the CPU for decimation, the format should match the underlying format
of the d3d11 frame.
``nvidia-true-hdr``
Enable NVIDIA RTX Video HDR processing.
``amf_frc``
AMD Frame Rate Conversion filter. Requires AMD hardware and drivers
supporting AMF FRC.
AMF FRC is a technique for achieving high-end video frame rate conversion
results from lower frame rate video inputs. The filter doubles the input
frame rate by generating intermediate frames.
AMF FRC only supports D3D11 input currently. Use `--hwdec=d3d11va` or
`--vf-pre=format=d3d11` to upload the data. `--d3d11va-zero-copy` is also
recommended for better performance.
``profile=<auto|low|high|super>``
Selects the quality profile for frame rate conversion.
``auto`` (default)
Select profile based on input resolution. Uses ``high`` for
resolutions up to 1440p, and ``super`` for 1440p and higher.
``low``
Less levels of hierarchical motion search. Only recommended for
extremely low resolutions.
``high``
Recommended for any resolution up to 1440p.
``super``
More levels of hierarchical motion search. Recommended for
resolutions 1440p or higher.
``mv-search=<native|performance>``
Selects the motion vector search mode.
``native`` (default)
Conduct motion search on the full resolution of source images.
``performance``
Conduct motion search on the down scaled source images.
Recommended for APU or low end GPU for better performance.
``fallback``
In case confidence is too low to do interpolation, fall back to simple
frame blending. If not set, the filter will repeat the last frame instead.
(default: no)
``indicator``
Specifies whether or not the FRC indicator square is shown in the top
left corner of the video. (default: no)
``future-frame``
When enabled, the information contained in the next frame in the
sequence will be used in FRC interpolation calculations, in addition to
the current pair of frames. This will introduce one extra frame time of
latency. (default: yes)
``fingerprint=...``
Compute video frame fingerprints and provide them as metadata. Actually, it
@@ -765,12 +885,22 @@ Available mpv-only filters are:
read information from this filter instead.
``gpu=...``
Convert video to RGB using the OpenGL renderer normally used with
``--vo=gpu``. This requires that the EGL implementation supports off-screen
rendering on the default display. (This is the case with Mesa.)
Convert video to RGB using the Vulkan or OpenGL renderer normally used with
``--vo=gpu``. In case of OpenGL, this requires that the EGL implementation
supports off-screen rendering on the default display. (This is the case with
Mesa.)
Sub-options:
``api=<type>``
The value ``type`` selects the rendering API. You can also pass
``help`` to get a complete list of compiled in backends.
egl
EGL (default if available)
vulkan
Vulkan
``w=<pixels>``, ``h=<pixels>``
Size of the output in pixels (default: 0). If not positive, this will
use the size of the first filtered input frame.
@@ -798,4 +928,3 @@ Available mpv-only filters are:
Do not use this with ``--vo=gpu``. It will apply filtering twice, since
most ``--vo=gpu`` options are unconditionally applied to the ``gpu``
filter. There is no mechanism in mpv to prevent this.
Loaded 100 of 737 files, more files were not shown because too many files have changed in this diff. Show more