1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-16 12:17:12 +00:00
Commit Graph

52625 Commits

Author SHA1 Message Date
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
der richter
bc5ab97d9a ao_avfoundation: guard features only available on macOS 11.3 and 12
build time and runtime checks.
2024-06-18 19:30:07 +02:00
der richter
55241da4ad cocoa-cb: guard color spaces that are only available on 10.15.4 upwards 2024-06-18 19:30:07 +02:00
der richter
e3a290b618 mac/compat: fix broken CGColorSpace declaration on SDK 11 only
seems like apple missed those two colour spaces and didn't add a obj-c
to swift redeclaration of the CFStringRef kCGColorSpace* global
variables.
2024-06-18 19:30:07 +02:00
der richter
0f9630f28d mac/event: remove swift 5.6 language feature that is mandatory with 6.0
this can be tested with -enable-upcoming-feature ExistentialAny
2024-06-18 19:30:07 +02:00
der richter
1364c80e64 mac/compat: add withLock fallback for xcode older than 14
withLock is available for macOS versions starting from 10.10 but can
only be used on xcode 14+. xcode 14 introduced swift 5.7, so we guard it
behind a swift version check.
2024-06-18 19:30:07 +02:00
der richter
b390ade709 mac/log: properly guard logger usage behind platform version check 2024-06-18 19:30:07 +02:00
Diederik de Haas
1acb49f9c6 bash-completion: remove hashbang
Hashbangs are meant for scripts that are executed, but a bash completion
script is meant to be sourced and therefor shouldn't have a hashbang.

Remarked by Debian's ``lintian`` tool with the
``bash-completion-with-hashbang`` tag.
2024-06-18 16:06:02 +00:00
Kacper Michajłow
8e7d442f08 fuzzers: enable edl, file and lavf protocols
To close already fixes issues on OSS-Fuzz.

Hopefully there is enough space for those. There is no way of checking
that, except that it stops working.
2024-06-18 03:11:14 +02:00
Kacper Michajłow
b3b542af51 m_options: limit list entries to 100
Limit list entries to 100. obj_settings_list is not designed to hold
more items, and it quickly starts taking ages to add all items. 100 is
more than enough.

Fixes 30s timeout on OSS-Fuzz and generally fixes possible DoS on mpv.
2024-06-18 03:11:14 +02:00
Kacper Michajłow
783150722d m_options: fix mark_del leak on error
Found by OSS-Fuzz.
2024-06-18 03:11:14 +02:00
Kacper Michajłow
ee2be6dc82 fuzzer_set_property: force untimed and pause state
We don't want to accidentally set those options and timeout in pause
state.

Remove video-osd as there is no reason to set it in fact.
2024-06-18 03:11:14 +02:00
Kacper Michajłow
c194f2dc32 demux_edl: fix infinite loop on empty EDL files
"file" is implicit key, it is always available, so we have to check if
it is not empty.

Found by OSS-Fuzz.

Fixes: 96ef62161ac8edb3c111bde7a79cb07dd6db813c
2024-06-18 03:11:14 +02:00
Kacper Michajłow
71d3f4157b fuzzers: disable some targets as we hit out of space errors
To test if this resolves issues with oss-fuzz.
2024-06-16 05:42:34 +02:00
Crend King
c9ea2798a4 osc.lua: add script message to show up the OSC
Add a way to briefly show the OSC, which is useful to check file name,
playback progress and time left, etc.

Fix issue #3826
2024-06-16 01:23:38 +02:00
Kacper Michajłow
df6b16c0ca stream: don't exit on first iteration if there is no match
Fixes: f921b64ed7
2024-06-16 01:22:30 +02:00
Kacper Michajłow
3b3604e162 ad_spdif: add an assert for lavf_ctx
To suppress forward null warning.
2024-06-16 01:22:30 +02:00
nanahi
3840c98b36 editorconfig: punish tab usage
This makes tab width to 7 on GitHub web UI and supported editors, making it
impossible to use tabs to match the existing 4 space indentation.
2024-06-16 01:22:13 +02:00
Guido Cella
eae74bdb7a osc.lua: replace tabs with spaces
Fixes b6d7f778b8.
2024-06-16 01:21:55 +02:00
Kacper Michajłow
9b935c9076 fuzzers/meson: set link language to cpp 2024-06-16 01:21:16 +02:00
Kacper Michajłow
6c908363cd demux_lavf: fix null derefence of stream variable
demux_stream_is_selected() already checks if stream is valid, so move
the image format hack check after that.

Fixes: 4ef7931266
2024-06-15 18:08:16 +02:00
Kacper Michajłow
ab0a50874b d3d11: return minimum bitdepth for display output and swapchain
If the output display reports high bitdepth, 12-bit and 10-bit swapchain
is used the value returned from d3d11_color_depth needs to take it into
account.
2024-06-15 01:18:44 +02:00
nanahi
3fa09458da demux_lavf: add format hack entry for jpeg metadata frames 2024-06-14 17:16:19 +00:00
nanahi
daa3264d3f demux_lavf: fix null derefence in io_open callback
The options parameter here can be NULL. It's NULL checked a few lines down,
but not for the propagate_opts loop. This results in null derefence with
--demuxer-lavf-format=image2.

Fixes: b6413f82b2
2024-06-14 17:16:19 +00:00
Kacper Michajłow
a41cdf0289 stats.lua: align 100% correctly on page 2
It is not common to have one pass with 100% usage, but it is not
impossible, so handle this case too.
2024-06-14 00:26:04 +02:00
Crend King
6031a0e173 vf_vapoursynth: upgrade to VapourSynth API v4
VapourSynth introduced their version 4 API in R55, 3 years ago. mpv is
still using the deprecated version 3. I think it is good to migrate
before VapourSynth completely removes it.

The most impacted area is the video format. Previously we have a fixed
table of supported formats, each represented by an integer. In v4, the
integer is replaced by pointer to the full struct of the format.

Second, the way to create video filter is changed. Previously caller
needs to supply a "initialization" callback to `createFilter()`, which
sets up video info etc. In v4, video info is prepared first, passed to
the `createVideoFilter2()` and we get back the node.

Also, previously mpv was using the `fmSerial` filter mode, which means
VapourSynth 1) can only request one frame from mpv at a time, and 2) the
order of frames requested must be sequential. I propose to change it to
the parallel request mode, which requests multiple frames at a time in
semi random order. The reasons are, for 1), the get frame function,
`infiltGetFrame()`, unlocks the mutex during output image generation,
thus can benefit from parallel requests. For 2) thanks to the frame
buffer, unordered frame requests are acceptable. Just make sure the
buffer is large enough.

Third, the way VapourSynth scripting environment works change. In v4,
the scripting API is operated through struct pointer, much like the
exist `vsapi` pointer. The "finalize" function is also no longer needed.
2024-06-14 00:25:18 +02:00
Dudemanguy
4ef7931266 demux_lavf: drop jpeg frames that are at a nonzero pos
There are jpg files out there that have extra embedded metadata
(pictures from smartphones commonly have an embedded gain map). ffmpeg
doesn't currently support this, so mpv currently sees the extra metadata
as essentially another frame. This results in weird video-like behavior.
Until ffmpeg support this more properly, we can work around this by
simply discarding extra packets and not sending the new frame to the
internal playloop. If demux_lavf detects that the stream is a
single-frame jpg, then we only accepts the packet at pos 0. Anything
else is discarded. Ref #13192.
2024-06-13 19:12:29 +00:00
Dudemanguy
a900d41b1e Revert "demux_lavf: pass jpg filenames to ffmpeg for probing"
Passing jpg filenames to ffmpeg is actually quite bad. This causes all
jpg images (at least in my testing) to be probed as image2 which is
blacklisted in demux_lavf since it's completely broken (see commit
74e62ed2d1 for some details). What happens
in practice is that the lavf demxuer fails and the it opens in the mf
demuxer instead. This is OK for simple viewing, but because that demuxer
is limited, many specific file properities and other things are
completely unavailable which breaks any script that may depend on them
(e.g. width, height, etc.) For the small subset of files that this
commit appeared to "fix" (in reality, it just fell back to the mf
demuxer) is not worth breaking property usage in the vast majority of
normal proper files. Ideally ffmpeg should fix this but some other
workaround on our end can be used instead.

This reverts commit d0aeca5918.
2024-06-13 19:12:29 +00:00
Kacper Michajłow
b4bbc27d9c input: map Num 5 to distinct value when numlock is off
Until now both numlock on and off were mapped to KP5.
2024-06-13 20:42:24 +02:00