Commit Graph
100 Commits
Author SHA1 Message Date
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
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
Kacper Michajłow 9546e0f7f8 vo_gpu_next: allow UINT upload if no other format is supported 2025-07-28 11:22:08 +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
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
Kacper Michajłow bd2118026b ci: add rust support 2025-07-12 20:40:04 +02: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
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
Kacper Michajłow e72bc1fefc video/out/d3d11/context: add missing white point and max fall metadata 2025-07-11 21:53:58 +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
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
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
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
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
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
Kacper Michajłow 47bc7b2a07 ytdl_hook.lua: add support for HEVC 2025-06-10 17:52:25 +02:00
Kacper Michajłow a418d21635 github/workflows/lint: exclude font.props from xml check 2025-06-06 10:45:52 +02:00
Kacper Michajłow 1d1535ff91 ci/openbsd: bump to 7.7 and remove ffmpeg subproject 2025-05-23 00:13:23 +02: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
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
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
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
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
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
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
Kacper Michajłow 0ab46993d8 video/out/gpu/context: enable debug_extra for Vulkan 2025-04-16 23:58:12 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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