1
mirror of https://github.com/mpv-player/mpv synced 2025-03-26 22:42:47 +01:00

53959 Commits

Author SHA1 Message Date
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
Dudemanguy
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 .
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 d37521b5ef69f4793a05583d634de286709a6806, 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
b1ee92ad4aec81dd31408d0c1223f0e9ea3cb738.

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 v0.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.

8461143ed7c0088fe08379898e74a7fbcf0a9d1e 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 e98d3b62ec52fdad550a94635c38cc4bf22cc310.
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: 8798cec7fa14bbeb35c7b711db3a41d336f78a69
2025-03-23 17:58:19 +01:00
llyyr
b22a4da1df demux_lavf: disable extension_picky for hls demuxer globally
Added in 91d96dc8dd

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 .
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 a8f5beb5a38e0ed169a9fb9faff6c5ca0a43dfee.
2025-03-15 05:19:43 +00:00
verygoodlee
a8f5beb5a3 console.lua: disable cursor autohide while selector is open
This is an improvement on  .
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 d33e54250e6643bdd20879eae1921fe18aecccd5.
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 bbe63109cb)
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łow
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