0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00
Commit Graph

52892 Commits

Author SHA1 Message Date
Kacper Michajłow
f8700c5a94 meson: check for vulkan headers
Vulkan dependency implies only vulkan loader, but some distributions
split vulkan-loader and vulkan-headers, so check if the headers are
actually there.
2024-07-29 20:59:46 +02:00
rtldg
05b964fdec DOCS/compile-windows.md: fix MSYS2 packages
Attempting to install `git` on the `pacboy` line fails with
`error: target not found: mingw-w64-clang-x86_64-git`
so move that to another spot.

`video_mp_image_pool.c` fails to build due to libavutil right now
because of missing vulkan headers so install those with `pacboy`.
(also improved in https://github.com/mpv-player/mpv/pull/14610 )

Simplify package lists since pacboy doesn't require `:p` anymore.
2024-07-29 20:59:22 +02:00
Brad Smith
a36f8ad162 build: detect VT_GETMODE on OpenBSD 2024-07-29 15:09:49 +00:00
Kacper Michajłow
051e2a8b7a github/issue_template: add a note about log file 2024-07-29 15:27:14 +02:00
Guido Cella
544240c829 player/command: fix --force-window=yes acting like immediate
player/main.c runs all option callbacks with a flag on init, so since
a5937ac7e3 which added UPDATE_VO, if --force-window=yes is passed, the
VO is immediately initialized, as if --force-window=immediate was
passed. Fix this by not running the UPDATE_VO code when there is no
video output.
2024-07-29 01:46:21 +00:00
Guido Cella
6107112b32 player: don't decrement --ab-loop-count=N and add remaining-ab-loops
Follow up to the previous commit. Stop decreasing --ab-loop-count=N on
each iteration so it is preserved across different loops. In particular
it is preserved between different files without adding it to
--reset-on-next-file. Add a property to expose the remaning A-B loop
count instead.

The current behavior of --ab-loop-count=N is even worse than --loop-file
since it also doesn't reset when defining a new A-B loop in the same
file. Defining it has no effect after --ab-loop-count has decreased to
0, and this can't be fixed by adding it to --reset-on-next-file. This
commit also resets remaining-ab-loops every time --ab-loop-a and
--ab-loop-b are set to fix this.
2024-07-26 20:09:19 +02:00
Guido Cella
f411f3145b player: don't decrement --loop-file=N and add remaining-file-loops
This stops decreasing numerical values of --loop-file on each iteration
so that loop-file=N loops every playlist entry without having to add
--loop-file to --reset-on-next-file.

The current behavior confuses users as seen in:

https://github.com/mpv-player/mpv/issues/2481
https://github.com/mpv-player/mpv/issues/5943
https://github.com/mpv-player/mpv/issues/11291
https://github.com/mpv-player/mpv/issues/13860
https://www.reddit.com/r/mpv/comments/rcwnrw/looping_each_file_n_times_in_a_playlist/

Also options are supposed to reflect the value configured by the user
and not change on their own.

A remaining-file-loops property is exposed as a replacement to check how
many loops are left.
2024-07-26 20:09:19 +02:00
Kacper Michajłow
397212ae15 player: remove empty line from --help
Follow-up after 127b6a3455.
2024-07-26 20:07:30 +02:00
Kacper Michajłow
77f1083098 options/m_config_frontend: remove empty line from --show-profile
Follow-up after 127b6a3455.
2024-07-26 20:07:30 +02:00
Dudemanguy
3c7b6db205 options: move all wayland specific options to vo_opts
Unlike most other platforming backends, wayland has its own specific
sub_options struct. 027ca4fb85 originally
introduced this and some more options were added later, but in
retrospect it's an unneccesary complication. There are already x11,
and windows-specific options within vo_opts. In fact, there actually is
a wayland one in there already as well (wayland-content-type) so it's
split btween two places. The wayland code already has to handle vo_opts
and it is already handles callbacks if needed. There is no advantage to
having a separate wayland-specific sub_options struct which is stuck
with whatever you set at init time.

So solve everything by deleting the old sub_options struct, moving it to
vo_opts and make some minor option naming changes for clarity (i.e.
adding a 'wl_' in front of the name). This simplifies the wayland common
code and also makes it have more functionality since you get runtime
updates for free.
2024-07-24 18:46:04 +00:00
Guido Cella
bde7cac447 various: allow changing GPU API options at runtime
Set UPDATE_VO to GPU API options that are only set on init.

To change multiple options without multiple reinits, use
set vo null; set opengl-foo 1; set opengl-bar 1; set vo gpu
2024-07-24 18:44:41 +00:00
Guido Cella
a5937ac7e3 m_option: add UPDATE_VO flag
This will allow reiniting the VO when more options are changed without
hardcoding them in options.c

Also reinit the VO when changing --gpu-debug and --gpu-sw.
2024-07-24 18:44:41 +00:00
Guido Cella
d384a6b793 external_files: allow specifying --cover-art-whitelist filenames
Fixes https://github.com/mpv-player/mpv/discussions/14520.
2024-07-23 14:12:11 +00:00
llyyr
e509ec0aaf DOCS/options: remove misdirection in sub-color
ARGB is in fact _not_ like web color. It's easy to skim over the
actual hexadecimal provided in the next sentence and just assume mpv
understands RGBA after reading the words "web colors"
2024-07-19 15:56:29 +02:00
nanahi
07acdf09b3 sd_ass: fix margin y scale with font size
--sub-margin-y is documented to scale with font size, which is scaled
"by" or "with" window depending on the options. However, when using
ass_set_font_scale to change font size, the y margin isn't scaled, so it is
still scaled to video size. This causes the y margin size becoming smaller
when the video becomes smaller, even when the font size isn't changing.

Fix this by also scale the MarginV with the font scale. Also use lrint
instead of round.
2024-07-18 23:03:02 +02:00
nanahi
b59ac04db9 DOCS/man/options: clarify subtitle scale options
The current documentation of sub-scale-by-window and sub-scale-with-window
doesn't sufficiently convey what these options do exactly. Specifically,
the described effects of disabling one option is only true when the other
option is not disabled. The "clarification" of sub-scale-with-window option
only adds more confusion, when the effect of that option is already told
in more detail before (it scaled with window instead of video).

Clarify this by listing the effects of all combinations of these options.
2024-07-18 23:03:02 +02:00
nanahi
42e9f302df sd_ass: fix sub scale with window when use_margins is enabled
By default, libass scales subtitle with video size.
When --sub-scale-with-window is enabled, mpv attempts to undo this scale
and use window size instead. However, the current bahavior is incorrect
when use_margins is enabled, because in this case libass uses the size
of video as if it's "fit" to the window, instead of the displayed size.
As a result, subtitle scale is broken when video-zoom is used in this case:
when zooming out video, the subtitle is scaled up.

Fix this by using the correct factor when use_margins is enabled.
2024-07-18 23:03:02 +02:00
Guido Cella
8110bdac6d command: remove deprecated packet-*-bitrate properties
These have been deprecated for 9 years so it's fine to remove them.

Using the replacement properties like video-bitrate in stats.lua will
convert big enough bitrates to Mbps.
2024-07-18 22:52:35 +02:00
Guido Cella
5f8ac5b862 loadfile,select.lua: print bitrates of tracks 2024-07-18 22:52:35 +02:00
Guido Cella
7bcd525dce various: sync shown track flags
Show the same flags in loadfile.c, select.lua and stats.lua. The only
differences are that only stats.lua prints both image and albumart
because it's supposed to show detailed track information, and select.lua
prints the image flag because pressing g-v doesn't show Video or Image
like in loadfile.c and stats.lua.
2024-07-18 22:52:35 +02:00
Guido Cella
2fd88ffbae various: print Image instead or Video for image tracks
Fixes #8561.
2024-07-18 22:52:35 +02:00
nanahi
21df853624 osc.lua: don't hide osc when touch is active
This lets touch events activate a separate timeout for osc hiding so that
the osc only hides when both mouse and touch timeout are expired.
This is the general expectation with touchscreen UI, and also fixes
platforms which reset the mouse position when all fingers leave the
touchscreen (e.g. sway).
2024-07-18 22:49:51 +02:00
llyyr
127b6a3455 player: remove empty line from --version 2024-07-18 22:49:28 +02:00
Kacper Michajłow
ed77616f29 fuzzer: stop player after 5 seconds of playback
Timeouts can happen with various conditions, big, slow to decode files
is one of them. Most of the time those timeouts are not really important
to "fix". While they may show some issues like we currently have with
audio EOF #14427 for ao-null-untimed. Most of the reports are completely
not important and we should focus on other topics.

Ignore the timeouts during file playback, note that this will still
report any timeouts that happen in other conditions.

5 seconds of playback should cover most of interesting mpv code, even
for strange samples.

This will likely be reverted at some point in the future, but let first
stabilize the OSS-Fuzz, without dozens of bogus timeouts.
2024-07-17 22:17:52 +02:00
nanahi
58f3009b80 playloop: move run_command_opts to command_event for playback-restart 2024-07-17 18:28:56 +00:00
nanahi
503a896d1a command: run input commands after idle state is ready
This makes sure that commands like show-text update the osd properly
with --idle=yes.
2024-07-17 18:28:56 +00:00
Kacper Michajłow
481a5c0dc1 workflows/fuzz: run all sanitizers 2024-07-17 20:21:15 +02:00
Dudemanguy
e3682f7f2b vo_gpu_next: support --gamma-factor
There's broad agreement that this option will be undeprecated, so just
factor in the multiplier for vo_gpu_next.
2024-07-17 14:09:00 +00:00
sfan5
3ab989e554 ci/mingw: update dependency versions 2024-07-16 23:04:36 +02:00
sfan5
d2e3e6f3bd test/libmpv_lifetime: don't re-define ASAN macro 2024-07-16 23:04:36 +02:00
Kacper Michajłow
607ad8943b player/command: don't return ill-formed node if there is no default val
option-info/<name>/default-value would be initialized with zeroed
object, which is not valid for string typed options, as the would be set
to NULL.

Found by OSS-Fuzz.
2024-07-16 22:59:23 +02:00
Kacper Michajłow
3cc42083aa fuzzer_set_property: reset sstep to 0 to avoid seeking loop
It would seek and keep player open. Not interesting to change this
behaviour, so just skip it for fuzzers.
2024-07-16 22:59:23 +02:00
der richter
05b0b7cf65 test/libmpv_lifetime: activate test on macOS 2024-07-16 11:20:40 +02:00
der richter
8fc557cc6e mac/vulkan: error out on context creation without an NSApplication
if no NSApplication has been initialized, applications using Appkit
functionality are not supposed to work properly or just deadlock
indefinitely. properly error out on macvk context creation in that case.
2024-07-16 11:20:40 +02:00
Kacper Michajłow
4764e41cac demux/ebml: bump ebml size limit to 512 MiB
While the code before 571f9b0f23 had a
typo and it was intended to be 100 MB, there are files that exceed this
limit, like 147 MiB. Increase the limit to 512 MiB which should be more
than enough for valid files.

From quick look ffmpeg limits to 1<<8 bytes, so we should be good with
our new limit.

In theory this limit could be removed, but it is better to play the
file, possibly with skipped some corrupted block of data, instead OOM.

Fixes: 571f9b0f23
2024-07-15 17:38:22 +02:00
Kacper Michajłow
202ecc17af ci: add fuzzing of pull requests for 20 minutes
To increase our testing coverage before merging. This uses already build
corpus and coverage info to test the modified code, if possible.

See: https://google.github.io/oss-fuzz/getting-started/continuous-integration
2024-07-14 01:18:51 +02:00
Kacper Michajłow
0018227b44 player/command: fix M_PROPERTY_KEY_ACTION for filter metadata
tag_property() expect metadata to not be NULL on M_PROPERTY_KEY_ACTION.
M_PROPERTY_GET_TYPE can be skipped only if key is not queried.

Fixes: a05b847879
2024-07-14 01:17:32 +02:00
Kacper Michajłow
bbbade7052 DOCS/input: fix filter name without label 2024-07-14 01:17:32 +02:00
Dudemanguy
d15660f4ed wayland: avoid potential floating point errors while scaling
Described in more detail in the upstream MR*. mpv naively rounds which
makes us susceptible to the mentioned error. Fix this by keeping
wl->scaling and wl->pending_scaling in the base 120 units. Use the
simple rounding algorithm when needed for calculating widths/heights.
Create a wl->scaling_factor as convenient shorthand for scale / 120
which is what wl->scaling used to previously be.

*: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/309
2024-07-12 20:48:51 +00:00
Kacper Michajłow
0aebcbcc19 player/{command,scripting}: log subprocess execution
Useful for debugging purposes and sanity checks.

Remove unused function while at it.
2024-07-12 22:40:02 +02:00
Kacper Michajłow
024c79a53c demux_mf: don't run glob() on urls
Not intended to be run on urls. Fixes stack-overflow in glob() when
unexpected data is passed.

Found by OSS-Fuzz.
2024-07-12 22:38:18 +02:00
Guido Cella
c2fc6503fb demux_mf: support URLs in @listfile and filemask
This allows playing arguments like
mf://https://foo.jpg,https://bar.jpg
and also URLs within @listfiles (files with 1 image per line).

URLs still don't work with globs and printf-formats.
2024-07-12 22:37:34 +02:00
nanahi
fea6adbc97 x11_common: handle runtime keepaspect/keepaspect-window change
On X11, aspect ratio constraint is applied on the window manager side,
so whenever keepaspect and keepaspect-window change, mpv should update
the size hint immediately, otherwise the new constraint isn't applied.
2024-07-12 20:19:11 +00:00
Misaki Kasumi
f2e7146cb1 sub: add (sub/osd)-border-style; renaming sub options 2024-07-12 20:17:38 +00:00
Kacper Michajłow
c0f5d2391b ytdl_hook.lua: fix hook triggering while it shouldn't
Fixes: acbd537dac
Fixes: #14522
2024-07-12 11:11:54 +02:00
Kacper Michajłow
f470b63a04 input.conf: add zoom, pan, scale and rotate keybinds for numpad 2024-07-11 21:57:11 +02:00
Kacper Michajłow
c505f77dda player/core: add core thread handle to MPContext
This change removes convoluted core thread extraction through dispatch
added in 500ce69a06.

Currently we fully control this thread, create it and join, there is no
reason not to keep the handle of it in the player context.

As a bonus to code simplification this also fixes thread handle leak on
Windows.

Fixes: #14472
2024-07-11 21:55:21 +02:00
Kacper Michajłow
09b25771e8 fuzzer_set_property: set duration to 0.1s
It looks like it is faster than 0.01s.
2024-07-11 21:55:21 +02:00
Kacper Michajłow
b3320ac64a test/libmpv_lifetime: add test to test libmpv ability to reinit itself
This test:
- Checks if libmpv can be loaded dynamically.
- Checks for leaks after mpv context destroy.
- Checks if libmpv can be reloads after dlclose()
2024-07-11 21:55:21 +02:00
Kacper Michajłow
6c56a413ab win32: unregister window class on dll detach
Window classes are global per process, but they are associated with the
module that registered them. Documentation is clear that it is the DLL's
responsibility to unregister its own classes:

No window classes registered by a DLL are unregistered when the DLL is
unloaded. A DLL must explicitly unregister its classes when it is
unloaded.

See: https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-registerclassw

Using a window class after the DLL is unloaded would result in access
violation errors. This is not that important for libmpv, where it is
unlikely someone would use the "mpv" window class externally. The real
issue comes from the fact that reloading libmpv would fail to register
the class (as it still exists) and consequently fail to create a window.

This commit fixes the operability of libmpv after reloading it.

Fixes: #11638
2024-07-11 21:55:21 +02:00