Commit Graph

52197 Commits

Author SHA1 Message Date
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 Kasumi 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