Commit Graph

52653 Commits

Author SHA1 Message Date
der richter 88db2d0b61 mac/menu: add option to disable default shortcuts
Fixes #14305
2024-06-25 20:14:38 +02:00
Kacper Michajłow 95ac32220e m_option: parse the timestamp as unsigned value
The sign is handled manually. This allows us to skip the check for
negative integers.
2024-06-25 05:29:46 +02:00
Kacper Michajłow 7fb7e1dd73 various: add more format specifiers checks 2024-06-25 05:29:46 +02:00
Dudemanguy 0db6abadd4 playlist: let playlist-next go to first item if player is idle
Similar to the previous commit but the other way around. If you start
mpv as idle, load up a playlist without immediately hitting play and
then try to go to the next item, nothing happens. Naturally, you would
expect this to go to the first item. Fix this detecting if the playlist
has not started yet, the direction, and going to the first item in the
list.
2024-06-25 02:19:08 +00:00
Dudemanguy 0f76848e5f playlist: let playlist-prev go to last item in playlist
Previously, playlist-prev didn't work if you played a playlist to
completion using --idle and tried to go back. Naturally, one would
expect this to bring up the last item in the playlist, but nothing
happens. This is just because playlist_get_next is stupid and doesn't
take this into account since pl->current is NULL and thus returns NULL.
Fix this by considering the direction, checking if the playlist was
played to completion and grabbing the last entry in the index.
2024-06-25 02:19:08 +00:00
Dudemanguy 111571bd05 options: remove some options with .deprecation_message
In both cases, setting these options did nothing other than give you a
warning that they may be removed in the future. Remove them now.
2024-06-25 02:18:58 +00:00
Dudemanguy 4d7e440533 options: remove various OPT_REMOVED usage
Most of these are pretty obscure things that were replaced a long time
ago. The special messages they were printing are also not really useful
at all so just remove them.
2024-06-25 02:18:58 +00:00
Dudemanguy 6e3d90d72a options: remove some deprecated OPT_REPLACED option mapping
These were all deprecated in mpv 0.37.0 or earlier and are not
considered common enough options to warrant keeping the deprecated
mapping longer. Since demux_cue had only a single option in it, the
entire option substract is removed. This can be readded later if someone
wants to introduce a specific option to it again.
2024-06-25 02:18:58 +00:00
Kacper Michajłow 7eec246d56 fuzzer_load: seal the input fd after writing the data
Nothing should ever modify this data. Also, add CLOEXEC for good
measure.
2024-06-25 02:17:40 +02:00
Guido Cella 01330dba71 console.lua: assume non-ASCII characters span 2 cells for truncation
This prevents line wraps in select mode with terminal output which hide
the top items (OSD output no longer uses truncate_utf8 since the
previous commit). This is not ideal as even accented letters are assumed
to be 2 cells wide. The alternative is using \e[?7l and \e[?7h to
disable and enable text wrapping, but it won't work in Windows console
with VT processing disabled.
2024-06-24 21:30:14 +02:00
Guido Cella 06cfdc80a6 console.lua: let libass clip lines in select mode
In select mode and when printing the OSD, use \q2 to let libass clip
lines longer than the OSD. This works around having to leave a large
horizontal space unused due to libass subtracting the left margin from
the max text width even though the ASS event is anchored to the bottom
left. It also fixes truncating wide Unicode characters.
2024-06-24 21:30:14 +02:00
Guido Cella ad6bca9c31 console.lua: subtract --osd-margin-x in the max width calculation
Even if ass:pos() hardcodes the position at 6px from the left, we still
need to subtract the left --osd-margin-x from the available text width.
See how libass/ass_render.c:ass_render_event() subtracts it from
max_text_width without checking if the event is positioned.

The calculation is still not perfect as the width could be made a bit
larger before the text wraps.
2024-06-24 21:30:14 +02:00
Kacper Michajłow 22ca65a59d fuzzer_set_property: destroy mpv also on error
Shouldn't matter much and in fact even LSAN doesn't complain, but we
should clean it correctly.

Fixes: 1225bcbd41
2024-06-24 17:36:53 +02:00
Kacper Michajłow 8a5989628c meson: add fuzzers alias for all fuzzer targets
Makes it easier to build only fuzzer binaries and avoid building
unnecessary targets from subprojects.
2024-06-24 17:36:53 +02:00
Kacper Michajłow 893ea5e47b player/playloop: fix null dereference if filter_root does not exist
For example when `input-commands=drop-buffers` is added to the config.

Add a check inside mp_filter_reset().

Found by OSS-Fuzz.
2024-06-24 16:20:46 +02:00
Guido Cella 82ffe8f425 loadfile: update the format of terminal track information
Stop making unselected tracks and editions grey because they can be hard
to read over a dark background (\033[2m would be hard to differentiate
from regular text with a light theme instead), and because there is no
way to not print the escape sequences in --log-file.

Just use the same circles as the OSD and OSC. We need to print the empty
circles for alignment on mlterm with East Asian fonts (we could also
make them invisible with \033[8m but it would still get added to log
files).

Add back the space before tracks and editions when printed after
"Playing..." or "Track switched" and similar, so they look like a
sub-section of it, consistently with the metadata which starts with
space which makes it look like a sub-section of the "File tags" line.

Leave 2 spaces between track columns.

Make the lang options only as long as the longest language.

Place hls-bitrate within the same parentheses as the other data.

Replace the incomprehensible (*) (f) and [P] with textual descriptions
within []. Also place external there.

Stop converting Hz to kHz for consistency with other log messages, e.g.
AO: [pipewire] 48000Hz stereo 2ch floatp

Remove the space in "2 ch" so it doesn't look like 2 separate values (We
considered using mp_chmap_to_str(&s->codec->channels) but it prints
values like "unknown2").
2024-06-24 16:19:31 +02:00
Guido Cella f7c1461053 DOCS/input: document undocumented track-list sub-properties 2024-06-24 12:52:36 +00:00
Dudemanguy 26029cfbb0 m_option: add a way for aliases to use sub option prefix
Previously, using m_option_type_alias required that the alias have the
full name of the option value. This is limited if you are reusing the
same opts struct in different sub options. Fix this by add an additional
field to m_option to signal whether or not prefixes should be taken into
account for the alias option. Instead of blindly using whatever is
stored in opt->priv as the name, we can construct the desired option
name for either case (using the prefix or not).
2024-06-24 12:51:28 +00:00
Kacper Michajłow 1225bcbd41 fuzzer_set_property: don't run mpv if set property failed
We can avoid testing this cases, hopefully there are no side-effects
when set property fails.
2024-06-24 03:05:09 +02:00
Kacper Michajłow a5f2816278 fuzzer_load_{config_file,input_conf}: take into account file size limit
We are strict about load command errors, so we have to clamp the size.
2024-06-24 03:05:09 +02:00
Kacper Michajłow 103cae2591 m_option: ignore excessive elements only for obj_settings_list
It makes sense to allow the first part of the list. There are
warnings about excessive elements already. This also allows overriding
elements with the same label.
2024-06-24 03:05:09 +02:00
Kacper Michajłow 5b3b2273db player/command: limit user-data name splits to 100
It fixes stack-overflow with keys that contains hundreds of splits. 100
is more than enough for any valid use of user-data, normally key
shouldn't contain more than a few splits.

Found by OSS-Fuzz.
2024-06-24 03:05:09 +02:00
Kacper Michajłow 2b056c89cd m_config_frontend: disallow profile=default in config files
profile=default in config file causes infinite recursion. It triggers
reload of the default config, which contains the profile=default...
2024-06-24 03:05:09 +02:00
Kacper Michajłow a949e0c2d5 misc/random: set constant seed for fuzzing
Fuzzing expect deterministic behavior. While we don't use this random
generator for anything significant, still good to set the seed, in case
of future usage.
2024-06-24 03:05:09 +02:00
Kacper Michajłow 799137a87c fuzzers: disallow include command in more principal way
We should never allow include command for fuzzers and it can be
triggered also by direct set property.
2024-06-24 03:05:09 +02:00
Kacper Michajłow cd1b63f628 ad_{lavc,spdif}: initialize channel layout
It is not always available for the demuxer, so update it from decoder.
2024-06-23 05:09:13 +02:00
nanahi f7ed8c42d2 options: add secondary-{sid,sub-delay} to watch_later_options 2024-06-23 05:05:22 +02:00
Kacper Michajłow c3de4f04db fuzzer_load: disallow include option in config files
It produces undeterministic results, especially if it do
`include=fd://N` which starts loading external data.
2024-06-23 02:33:04 +02:00
Kacper Michajłow b4123826e5 input/keycodes: validate parsed value to avoid overflow 2024-06-23 02:33:04 +02:00
Kacper Michajłow 7fda885747 m_option: do float multiplication to avoid integer overflow
Huge values doesn't make much sense, but to avoid some arbitrary limits,
use double, as the output is already floating point value.

Found by OSS-Fuzz.
2024-06-23 02:33:04 +02:00
Kacper Michajłow 5534e0e1d9 common: validate parsed unicode codepoints value
Fixes UB when converting out of expected range values.

Found by OSS-Fuzz.
2024-06-23 02:33:04 +02:00
Kacper Michajłow 758019bf92 m_options: fix obj settings list leak on error
Fixes: b3b542af51
2024-06-23 02:33:04 +02:00
nanahi 265056fa54 vo_gpu: optimize pass_info_reset
No need to reset mp_pass_perf which is only read when desc.len > 0.
This avoids zeroing >16384 uint64_t's every time it's called.
Profiling shows that this reduces CPU usage for frame rendering by ~4%.
2024-06-22 22:48:40 +02:00
nanahi 940854c86f demux: allow refresh seek for non-video streams
Since d41f0a54b0, enabling a stream will
no longer perform a refresh seek, to fix issues with switching video
tracks. Additionally, 62e9a0c5f6 also
prevents refresh seek on track switching when it happens right after a
seek.

Unfortunately, when external audio files are loaded, preventing refresh
seeks can cause A-V sync issues. Since external tracks have separate demuxer
instances from the internal tracks, the demuxer instances from both
internal and external tracks are explicitly sought to the same pts when
seeking is performed. When enabling an external audio track for the first
time, the existing logic prevents refresh seek because no packets have ever
been read, so the track ends up not being sought. This means that switching
the track in the middle of playback results in a huge A-V desync.

To make it worse, unlike one demuxer instance with multiple tracks,
tracks from multiple demuxer instances are not synced in any meaningful
way beyond the separate explicit seeking. The only thing which keeps these
tracks synced is the generic A-V sync logic, which is unfit for such large
desync above. This means the audio is at the start position after the track
is switched, behind the video, so the audio is not considered ready, and
audio is continuously filtered sequentially until it is synced to the video.
While this is happening, the audio filtering exhausts all CPU resources.

There is also a case with cache enabled: if a seek causes some new data to
be cached, the demuxer is sought to the end of joined cache range.
If track is switched after this, the existing logic prevents a refresh seek,
so the demuxer is at a wrong position after the track is switched.

Fix this by allowing refresh seek for non-video streams, even when no packets
have been read yet or immediately after a seek.
2024-06-22 18:21:28 +00:00
Kacper Michajłow e5d85704a3 av_log: sort library version print and add missing libavdevice
Incidentally sorted list put more important libs to the top.
2024-06-22 16:12:14 +02:00
Kacper Michajłow 9e1271260f ad_spdif: fix lavf version check
Fixes: 62b1bad755
2024-06-22 16:12:14 +02:00
Kacper Michajłow 687eb4c875 various: remove no longer needed availability checks
image_writer: remove jpegxl availability check

meson: remove check for lavu vulkan support

image_writer: remove avif availability check

ad_spdif: remove no longer needed definitions

demux_lavf: remove side data extraction compatibility code

demux/packet: remove ITU T.35 availability check

filters/f_lavfi: remove avfilter_filter_pad_count availability check

image_writer: remove PNG cICP support check

mp_image: remove AV_FRAME_DATA_DOVI_METADATA availability check

mp_image: remove AV_FRAME_FLAG_INTERLACED availability check

vd_lavc: remove ctx->pic->duration availability check

sws_utils: remove av_chroma_location_enum_to_pos availability check

vd_lavc: remove AV_CODEC_EXPORT_DATA_FILM_GRAIN availability check

demux_lavf: always use io_close2
2024-06-22 16:12:14 +02:00
Kacper Michajłow 0d8f74231f misc/uuid: remove no longer needed vendored implementation 2024-06-22 16:12:14 +02:00
Kacper Michajłow 3c5a79300c various: remove av channel layout check 2024-06-22 16:12:14 +02:00
Kacper Michajłow b64521ae10 ci/openbsd: bump to 7.5 and remove libplacebo subproject
The available version is enough now.
2024-06-22 16:12:14 +02:00
Kacper Michajłow 2887b2e64c meson: increase FFmpeg minimum required version to 6.1 2024-06-22 16:12:14 +02:00
Guido Cella 8873beabc3 select.lua: consider --sub-delay for the subtitle line selector
Preselect and seek to the correct subtitle line when there is a
sub-delay.

Also slightly increase the offset without a video track else it
occasionally doesn't seek to the selected line with non-0 sub-delay and
no video. This now uses the same offset as sub/sd.h.
2024-06-22 13:42:27 +00:00
Guido Cella e3f496dbf5 select.lua: don't use sub-start to preselect subtitle lines
There is no need to compare sub-start now that we don't check for exact
matches with ffmpeg's timestamps. time-pos can always be used.

Comparing time-pos removes the need for the workaround of sub-start of
embedded subtitles being earlier than ffmpeg's timestamps, as time-pos
is always slightly after sub-start.

Removing this workaround also fixes a bug present since 4059d1832b,
which started comparing numerical values of timestamps instead of
strings to determine the preselected subtitle line, where the line after
the current one is preselected when sub-start is greater than ffmpeg's
timestamps because they have been rounded, e.g. sub-start 10.001 is >
than ffmpeg's 10.00.

This will also allow considering --sub-delay in the comparisons, as
comparing sub-start - sub-delay would preselect the wrong lines.
2024-06-22 13:42:27 +00:00
Kacper Michajłow 4ec060f946 vo_tct: clear backbuffer on reconfig
We were drawing garbage data after reconfig, if there is no video
frame ready or with --force-window without video track.

Found by OSS-Fuzz.
2024-06-22 00:50:38 +02:00
Dudemanguy 23ecfa9845 options: remove deprecated auto choice for --mute
Since 995c47da9a, setting --mute=auto has
been equivalent to --mute=no. It was formally documented later in
79e20ff485. This is an old legacy relic
and the auto choice popping up during auto completion could be confusing
to users who aren't aware of the history. Remove it for good and convert
the option to a proper boolean.
2024-06-21 21:29:33 +02:00
Dudemanguy bab9b2cf4e player/command: alias playback-time to time-pos
Since 7fc4bac29f, playback-time and
time-pos will now always have exactly the same values. Both properties
are commonly used, so just make playback-time an alias for
time-pos and document it.
2024-06-20 13:07:41 +00:00
Dudemanguy 42a4c306ec test/libmpv_test: fix some stray tabs 2024-06-19 23:04:21 -05:00
Dudemanguy 157566904f ao_pipewire: fix some stray tabs 2024-06-19 23:04:05 -05:00
Dudemanguy b402cc3248 test/libmpv_encode: avoid mktemp warning
Doesn't really matter but it's annoying so replace it with mkstemp
instead. For windows, just use _mktemp.
2024-06-19 13:55:54 +00:00
nanahi 8df4cb5e21 osc.lua: don't use legacy argument for seeking
Deprecated since mpv 0.9. Use the flags instead.
No need to specify flags for relative seek since it's the default.
2024-06-19 01:30:18 +00:00