Commit Graph
53940 Commits
Author SHA1 Message Date
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 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.

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