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