0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
Commit Graph

52302 Commits

Author SHA1 Message Date
Kacper Michajłow
f17ad792c6 vo_gpu_next: check if existing cache file has correct size 2024-05-10 22:54:25 +02:00
Guido Cella
1f69659a77 test: test mp_guess_lang_from_filename with [] and () 2024-05-10 22:54:12 +02:00
Kacper Michajłow
d79aef1425 meson: add link flags also to cpp
If subprojects are used, linking language of mpv might be upgraded to C++
add our flags there too.
2024-05-10 21:42:10 +02:00
Kacper Michajłow
0d18c1bfdc audio: change bps format to int64_t
Same as ffmpeg uses. Such big values does not make sense probably, but
let's not overflow values and maybe one day it will be useful.

Fixes signed integer overflow.
2024-05-10 05:16:27 +02:00
Kacper Michajłow
c1d5f0e9c8 fuzzers: set network-timeout to 1 second
We don't expect any data to actually access, so timeout as soon as
possible.
2024-05-10 04:15:10 +02:00
Kacper Michajłow
aa3cf6d57b command: add dolby-vision-profile and dolby-vision-level to track-list 2024-05-10 01:26:30 +02:00
Kacper Michajłow
c83c273400 demux_mkv: inject AV_PKT_DATA_DOVI_CONF to demuxed packets 2024-05-10 01:26:30 +02:00
Kacper Michajłow
a094971ce8 demux_mkv: demux Block Additional Mappings
Parse Dolby Vision configuration.
2024-05-10 01:26:30 +02:00
Guido Cella
63d820bd68 test: test mp_guess_lang_from_filename() 2024-05-10 01:22:31 +02:00
Guido Cella
20b8fe05bf misc/language: move mp_guess_lang_from_filename() here 2024-05-10 01:22:31 +02:00
Guido Cella
dffc37dcfa external_files: detect language tags with hyphens
This loads subtitle files like foo.en-US.srt with --sub-auto=exact.

To preserve the case of these locales and not convert them to e.g.
en-us, stop lower casing filenames, and instead use case insensitive
functions to check if the media filename is contained in the external
filenames. Extensions, whitelisted cover art filenames and idx files
were already being compared case insensitively.

Fixes #12372, fixes #13251.
2024-05-10 01:22:31 +02:00
Guido Cella
e451d9c21b external_files: rename variables in guess_lang_from_filename() 2024-05-10 01:22:31 +02:00
Kacper Michajłow
e175b3f685 lcms: check for null arg in gl_parse_3dlut_size
This fixes `icc-3dlut-size` validation in config which would crash if
set without argument.

Found by OSS-Fuzz.
2024-05-09 21:21:40 +02:00
Kacper Michajłow
4fe67933c2 misc/language: store string length instead of null terminator
Allows to construct bstr directly without strlen, while keeping language
table the same size.
2024-05-09 17:12:55 +02:00
Kacper Michajłow
5009e13431 player/loadfile: match language and subcodes 2024-05-09 17:12:55 +02:00
Kacper Michajłow
40ba63405f Revert "misc: add language-matching utilities"
This reverts commit 8c8d97c26c.
2024-05-09 17:12:55 +02:00
Kacper Michajłow
65c71b1643 Revert "loadfile: use mp_match_lang_single"
This reverts commit 76009bf7a6.
2024-05-09 17:12:55 +02:00
Kacper Michajłow
b7216d5d03 Revert "loadfile: compute audio lang for sub selection when using lavfi-complex"
This reverts commit 9e6c6c0897.
2024-05-09 17:12:55 +02:00
Kacper Michajłow
bf6d49cbd4 fuzzer_loadfile_direct: exclude paths also for file://
Loading external files makes little sense. Might disable this completely
later, but let see how it works, The idea is the same as for direct
load. Exclude paths starting with `file://.` and `file:///`. But still
fuzz any processing that other input might have. It shouldn't be a huge
problem if we do `file://mpv` for example. Not great, but also not
terrible.
2024-05-09 02:01:24 +02:00
Kacper Michajłow
d6803c4518 demux_edl: make protocol comparison case insensitive
Else nested edl protocol causes infinite recursion, when loading.

Found by OSS-Fuzz.
2024-05-08 18:52:40 +02:00
Kacper Michajłow
49cb039b8c fuzzer_set_property: fix for other types than string
I tested with string version, oops.
2024-05-08 18:52:40 +02:00
Kacper Michajłow
325abfeed7 dmabuf: fix warnings on 320-bit build 2024-05-08 18:52:40 +02:00
Kacper Michajłow
aa9cc72199 filter/vf_gpu_vulkan: fix Vulkan handle type 2024-05-08 18:52:40 +02:00
Kacper Michajłow
111d90d9e5 player/client: fix typo in description of MPV_ERROR_UNINITIALIZED 2024-05-08 18:52:40 +02:00
Kacper Michajłow
e1d1eb7ace fuzzers: add fuzzer for config parsers 2024-05-08 18:52:40 +02:00
nanahi
467c1e860a Revert "ao: in ao_play_data, wakeup core for untimed AO as well"
This problem does not exist with --demuxer=lavf. --demuxer=mkv just never
signals EOF for the problematic sample, so it needs to be fixed there, not
in AO.

This reverts commit 0cfd52074b.
2024-05-08 11:14:01 +02:00
Misaki Kasumi
0cfd52074b ao: in ao_play_data, wakeup core for untimed AO as well 2024-05-08 03:12:28 +02:00
Christoph Heinrich
e166ae0ed8 af_scaletempo: optimize overlap search
scaletempo2 has this optimization where it first uses a step size of 5
together with a quadratic interpolation to quickly get the approximate
position of the best overlap and then does a more thorough search aroun
that area.

Doing the same thing in scaletempo brought a 4.8x performance
improvement, however in my measurements a step size of 3 more
consistently finds good overlaps and it's still a 2.9x improvement for
this function.
I should note that while a step size of 3 produced better numbers,
I was not actually able to hear any difference in my test.

A step size of 3 was chosen just in case it actually makes an audible
difference in some cases and the cpu usage isn't really a problem
anymore, but that can be revisited in the future.

scaletempo2 is still faster then scaletempo with a step size of 5,
which I suspect is mostly because it uses some vectorized functions and
scaletempo does not.
2024-05-07 23:32:55 +02:00
Christoph Heinrich
18ed9e105a af_scaletempo: use taxicab distance for offset search
Cross correlation is the defualt method for correlating signals in
signal processing, but in this case the taxicab distance gets better
results.
2024-05-07 23:32:55 +02:00
Christoph Heinrich
3f6874f4d7 af_scaletempo: don't use a window for offset search
This might seem counter intuitive at first, but we want to change the
sound in total as little as possible, not only the middle part of the
overlap.

This also removes the loop unrolling from the integer path to keep it as
close to the float path as possible. The difference in performance is
fairly small and if such an optimization is deemed desirable in the
future it should be implemented for both float and integer
2024-05-07 23:32:55 +02:00
Christoph Heinrich
2287804739 af_scaletempo: use Hann function for overlap window
Better in theory, but not really noticable.
2024-05-07 23:32:55 +02:00
Christoph Heinrich
3a85fd97e5 af_scaletempo: add comment to overlap calculation
Also reduce pointer dereferences by one. That won't make much of a
difference (if at all), but since it already needs two lines we might
as well.
2024-05-07 23:32:55 +02:00
Guido Cella
ae7e7d07b8 js: fix defaults.js
Fixes 2354d876da.
2024-05-07 22:57:53 +02:00
Guido Cella
2354d876da scripting: add mp.input.select()
This allows scripts to make the user choose from a list of entries by
typing part of their text and/or by navigating them with keybindings,
like dmenu or fzf.

Closes #13964.
2024-05-07 22:34:22 +02:00
Kacper Michajłow
43b702d707 drm_prime: remove off by one when allocating new ref counter 2024-05-07 21:05:18 +02:00
repojohnray
d1e55a0e87 drm_prime: fix issue detected by valgrind
Conditional jump or move depends on uninitialised value(s)
   at 0x10FE22: drm_prime_remove_handle_ref (drm_prime.c:144)
   by 0x10FCCD: drm_prime_destroy_framebuffer (drm_prime.c:107)
   by 0x10FEB1: set_current_frame (hwdec_drmprime_drm.c:73)
   by 0x11054F: overlay_frame (hwdec_drmprime_drm.c:223)
   by 0xF1311: gl_video_render_frame (video.c:3315)
   by 0xFA015: draw_frame (vo_gpu.c:85)
   by 0xF8FDB: render_frame (vo.c:961)
   by 0xF943F: vo_thread (vo.c:1099)
   by 0x5EBE89B: start_thread (in /lib/libpthread-2.31.so)
 Uninitialised value was created by a heap allocation
   at 0x484713C: realloc (vg_replace_malloc.c:1437)
   by 0x10258B: ta_realloc_size (ta.c:195)
   by 0x10325D: ta_xrealloc_size (ta_utils.c:298)
   by 0x10FDBF: drm_prime_add_handle_ref (drm_prime.c:133)
   by 0x10FC57: drm_prime_create_framebuffer (drm_prime.c:87)
   by 0x1102FF: overlay_frame (hwdec_drmprime_drm.c:188)
   by 0xF1311: gl_video_render_frame (video.c:3315)
   by 0xFA015: draw_frame (vo_gpu.c:85)
   by 0xF8FDB: render_frame (vo.c:961)
   by 0xF943F: vo_thread (vo.c:1099)
   by 0x5EBE89B: start_thread (in /lib/libpthread-2.31.so)

Conditional jump or move depends on uninitialised value(s)
   at 0x10FCE4: drm_prime_destroy_framebuffer (drm_prime.c:109)
   by 0x10FEB1: set_current_frame (hwdec_drmprime_drm.c:73)
   by 0x11054F: overlay_frame (hwdec_drmprime_drm.c:223)
   by 0xF1311: gl_video_render_frame (video.c:3315)
   by 0xFA015: draw_frame (vo_gpu.c:85)
   by 0xF8FDB: render_frame (vo.c:961)
   by 0xF943F: vo_thread (vo.c:1099)
   by 0x5EBE89B: start_thread (in /lib/libpthread-2.31.so)
 Uninitialised value was created by a heap allocation
   at 0x484713C: realloc (vg_replace_malloc.c:1437)
   by 0x10258B: ta_realloc_size (ta.c:195)
   by 0x10325D: ta_xrealloc_size (ta_utils.c:298)
   by 0x10FDBF: drm_prime_add_handle_ref (drm_prime.c:133)
   by 0x10FC57: drm_prime_create_framebuffer (drm_prime.c:87)
   by 0x1102FF: overlay_frame (hwdec_drmprime_drm.c:188)
   by 0xF1311: gl_video_render_frame (video.c:3315)
   by 0xFA015: draw_frame (vo_gpu.c:85)
   by 0xF8FDB: render_frame (vo.c:961)
   by 0xF943F: vo_thread (vo.c:1099)
   by 0x5EBE89B: start_thread (in /lib/libpthread-2.31.so)
2024-05-07 21:05:18 +02:00
Mohammad AlSaleh
bb7a485c09 stream: don't try to read from all-sparse/no-data files
```
 dd if=/dev/zero of=/tmp/10g.empty bs=1 seek=10G count=0
 dd if=/dev/zero of=/tmp/10m.empty bs=1 seek=10M count=0
 time mpv /tmp/10{g,m}.empty
 ```

 I keep files with the name format `${name}-${hash}.${ext}.empty`
 around, where the original is removed, and a sparse file with
 the size of the original is created instead.

 A lot of time is wasted on such files when going through
 playlists/directories that include some of them.

 This admittedly may not be that common of a use-case.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2024-05-07 12:22:09 +02:00
nanahi
4e59a56896 various: fix comma style 2024-05-07 11:23:08 +02:00
nanahi
9f5edd4eed various: fix indentation 2024-05-07 11:23:08 +02:00
nanahi
f11002cef3 various: fix tabs in code 2024-05-07 11:23:08 +02:00
nanahi
bb88e4aeb5 various: fix trailing whitespace 2024-05-07 11:23:08 +02:00
Jrelvas
1759d73c83 hwdec_cuda: reduce nesting in check functions
This simplifies the code and makes it easier to read.
2024-05-07 00:34:46 +02:00
Jrelvas
58f50c8e49 hwdec_cuda: avoid gpu wakeup by deferring cuInit
`cuInit` wakes up the nvidia dgpu on nvidia laptops. This is bad news because the wake up process
is blocking and takes a few seconds. It also needlessly increases power consumption.

Sometimes, a VO loads several hwdecs (like `dmabuf_wayland`). When `cuda` is loaded, it calls
`cuInit` before running all interop inits. However, the first checks in the interops do not
require cuda initialization, so we only need to call `cuInit` after those checks.

This commit splits the interop `init` function into `check` and `init`. `check` can be called without
initializing the Cuda backend, so cuInit is only called *after* the first interop check.

With these changes, there's no cuda initialization if no OpenGL/Vulkan backend is available. This prevents
`dmabuf_wayland` and other VOs which automatically load cuda from waking up the nvidia dgpu unnecessarily,
making them start faster and decreasing power consumption on laptops.

Fixes: https://github.com/mpv-player/mpv/issues/13668
2024-05-07 00:34:46 +02:00
Kacper Michajłow
f18ce7eca0 msg: print all messages to one stream
This reverts commit 4939570e17 and makes
it more strict about the output stream. Status message is also on the
same stream now.
2024-05-06 22:21:46 +02:00
Kacper Michajłow
414c47d1d8 player/main: select msg output stream early
This avoids printing any stray messages in encode output stream.

--o is already pre-parse cli option which is designed to be parsed
before anything else is printed to output. So we can use that to force
stderr output if needed for encode mode.
2024-05-06 22:21:46 +02:00
Kacper Michajłow
425c6d03d7 github/workflows: link MSVC artifacts in comments 2024-05-06 22:01:17 +02:00
Kacper Michajłow
0ffabf5d45 ci: add Windows native build
x86_64-pc-windows-msvc build without mingw dependency. For now it lacks
some key dependencies like lua or shaderc. Will be extended in the
future.
2024-05-06 22:01:17 +02:00
Kacper Michajłow
006c3ce9fe test: mark libmpv as expected fail if OSC is not available
This test is expected to fail without lua and osc.lua support.
2024-05-06 22:01:17 +02:00
Kacper Michajłow
cd12e923f8 test/libmpv_encode: minor adjustments for win32 build fix 2024-05-06 22:01:17 +02:00
Kacper Michajłow
4d5642887d win32: add WinMain 2024-05-06 22:01:17 +02:00