Commit Graph

50479 Commits

Author SHA1 Message Date
Niklas Haas cf01646c39 vo_gpu_next: add ability to use named hook params
Closes: https://github.com/mpv-player/mpv/issues/12093
2023-08-07 19:34:44 +02:00
Kacper Michajłow 1b10d9dd9c mp_image: properly infer color levels for some pixfmts
ffmpeg does not tag yuv levels for GRAY formats, but apparently they
should be infered as full range. Instead of defaulting to limited range
always. Fixes (M)JPEG playback.

This mimic ffmpeg's behaviour.

See: d295b6b693/libswscale/utils.c (L926-L962)
Fixes: #12089
2023-08-07 18:22:41 +02:00
Niklas Haas 35a6b26b78 vo_gpu_next: increase non-interpolation queue size
1 is not enough to prevent PL_QUEUE_MORE, because the pl_queue is
designed to always know the next frame (in addition to the current).
Before haasn/libplacebo@112bb886, this was was (wrongly) silently
omitted by the pl_queue code, but that fix exposed this.

While it's technically API misuse on mpv side, due to the mpv vo code
having its own internal queueing and timing control, it shouldn't
actually make any difference in practice (and likely, the error message
showing up is the only meaningful bug here - the issue is entirely
cosmetic).

Fixes: https://github.com/mpv-player/mpv/issues/12101
2023-08-07 10:42:08 +02:00
Niklas Haas f6de44dd6a vo_gpu_next: update for new pl_filter configuration API
Configuration of filter parameters was moved from pl_filter_function (of
which the user had to make a copy) to pl_filter_config, with the
pl_filter_function remaining immutable.

Implement this new logic in a way that can reasonably exist side-by-side
with the old configuration API. Once we drop support for PL_API_VER
below 303, we can drastically simplify this code.
2023-08-06 22:44:54 +02:00
Dudemanguy 8417804224 win32: signal VO_EVENT_DPI on dpi changes
The win32 code already updates itself on dpi changes. However, it never
signalled mpv's core when this happened which meant that the
display-hidpi-scale property never changed. Simply send the
VO_EVENT_DPI event when appropriate. Fixes #12081.
2023-08-06 19:09:44 +00:00
Jan Ekström 10087b4086 test/meson: add missing avutil dependency to chmap test
Found out with a CI image where FFmpeg is not located in the default
sysroot.
2023-08-06 20:36:12 +03:00
sfan5 38b59408c2 test: indicate test function ran in log 2023-08-06 18:49:54 +02:00
sfan5 b68491e9a6 test: enable log messages for libmpv test 2023-08-06 18:49:54 +02:00
sfan5 5d71f858c2 test: refactor helper methods to be universally usable 2023-08-06 18:49:54 +02:00
m154k1 a173b47748 options: fix relative time parsing
Currently relative time parsing is buggy when any of the non-leading
units are non zero. For example, "-1:30" should result in -90 but
currently it results in -30 (as a result of `-60 + 30`).

Also reject timestamps where non-leading units are out of range. E.g.
"1:100" would be rejected, but "100" will still be accepted as 100
seconds.
2023-08-06 13:48:17 +02:00
m154k1 8a7cd20480 options: rename variables in parse_timestring 2023-08-06 13:48:17 +02:00
Philip Langdale e8144ac231 vd_lavc: repeatedly attempt to fallback if hwdec fails in reinit
In the same way that fallback in receive_frame() needs to be repeated
until we get a working decoder, we have to do the same thing in
reinit(). Calling force_fallback() only once can still yield a non
functional decoder.

The reason why we have these multiple paths which each require their
own fallback logic is that we can fail at different stages:
* hwdec init
* decoder init <- repeated fallback was missing here
* frame decoding

Fixes #12084
2023-08-06 04:42:13 -07:00
Alexander Georgiadis 6729285502 DOCS/options: fix typo in hdr-peak-percentile 2023-08-05 16:46:28 +02:00
Dudemanguy 59ac302dff vo_gpu/vo_gpu_next: fix setting an empty dscale
The manual currently says that if dscale is unset, --scale will be
applied. However, this only works at init time. If you change the dscale
filter to be empty later, vo_gpu will segfault and vo_gpu_next will
throw an error and refuse the changes. That's because when the option is
unset at runtime, the value becomes "" not NULL and the vo's never
accounted for this. Fixes #12031.
2023-08-05 14:01:02 +00:00
Niklas Haas 65a95a721e builtin.conf: add --hdr-peak-percentile=99.995 to gpu-hq
This is higher quality but comes with a slight performance hit,
especially for weaker iGPUs, so I don't want to enable it out of the box
even when --hdr-compute-peak=auto.
2023-08-04 16:58:44 +02:00
Niklas Haas 45e95311b8 vo_gpu_next: add --hdr-peak-percentile 2023-08-04 16:58:44 +02:00
Kacper Michajłow 14504e0559 player/main: do not print build time, if it is unknown 2023-08-02 18:51:13 +00:00
Kacper Michajłow a39e75ad89 version: move NO_BUILD_TIMESTAMPS check to version.h.in 2023-08-02 18:51:13 +00:00
Kacper Michajłow df7a094765 build: remove version.py
After second thought version.py does not do anything useful. Meson has
built-in function vcs_tag that mostly replicate what version.py did. For
the build time we can just use __DATE__ and __TIME__. Of course this
changes time string format a little, but in my opinion it looks nicer in
fact.

Also it will use local time, instead UTC. But I would argue that date
string is only informative for users to check how old the specific mpv
build is. It doesn't have to be precise, it weren't for years anyway
before recent change.
2023-08-02 18:51:13 +00:00
billdoor1 30bf811a8f vo_vdpau: set hwdec image format 2023-08-02 18:51:02 +00:00
Dudemanguy af9eac654e test: bump libmpv test timeout
Get rid of the time during the while loop and just let this run forever
in case of a failure and also bump the timeout in meson to 60 seconds
since we know it is possible for msys to take a very long time on
occasion. That should be plenty of time for it to finish.
2023-08-01 15:04:36 +00:00
LaserEyess 3b19866882 drm: bump minimum version to 2.4.105
Debian 12 is out, with 2.4.114, and Ubuntu 22.04 has 2.4.110, this
 #ifdef is no longer needed
2023-07-31 21:40:10 +02:00
Dudemanguy 7adb56ccd9 ci: update the mpv.com path
Following the previous commit, it will now be in build/player.
2023-07-31 19:00:06 +00:00
Dudemanguy 0bed2a2263 build: remove outdated generated directory
This only existed as essentially a workaround for meson's behavior and
to maintain compatibility with the waf build. Since waf put everything
in a generated subdirectory, we had to put make a subdirectory called
"generated" in the source for meson so stuff could go to the right
place. Well now we don't need to do that anymore. Move the meson.build
files around so they go in the appropriate place in the subdirectory of
the source tree and change the paths of the headers accordingly. A
couple of important things to note.

1. mpv.com now gets made in build/player/mpv.com (necessary because of
   a meson limitation)
2. The macos icon generation path is shortened to
   TOOLS/osxbundle/icon.icns.inc.
2023-07-31 19:00:06 +00:00
Thomas Weißschuh b3b7ee8f4c ao_pipewire: set media role during init()
wireplumber uses the media role when the node is first created.
To have the property available at this point reliably we need to set it
directly when creating the stream/node.
2023-07-31 14:01:44 +02:00
Thomas Weißschuh 6e023547ea audio: add AO_INIT_MEDIA_ROLE_MUSIC
This allows the AO to set the media role directly during init().
2023-07-31 14:01:44 +02:00
Alexandre Ratchov 1bbc7a2cd0 ao_sndio: use sio_flush() to improve controls responsiveness
Use sio_flush() instead of sio_stop() to improve controls responsiveness.
2023-07-30 19:28:14 +00:00
Dudemanguy b7bf5e619f draw_bmp: fix overflowing coordinates in mark_rcs
This is yet another unfortunate side effect of the width % SLICE_W == 0
special case. While looping through these rectangles, the rc->x1 value
on the final loop can be greater than the actual total width. This will
cause a buffer overflow if using the mp_draw_sub_overlay API. 2 of the
current VOs that use that work around it by adjusting the values
returned, but the better fix is to correct what's actually given in the
rectangles so you can safely use the values. As for the fix, it's simply
ensuring that rc->x1 doesn't extend beyond p->w with a MPCLAMP.
Previously, the code would always naively add SLICE_W (256) to rc->x0
which would easily extend past the actual width in many cases. The
adjustments in vo_vaapi and vo_dmabuf_wayland are dropped and in theory
vo_direct3d should work now since we can just trust the values given to
us in the rectangles. How nice.
2023-07-30 20:06:20 +02:00
Thomas Weißschuh 1608059d64 Revert "audio: add AOCONTROL_UPDATE_MEDIA_ROLE"
The only user of these APIs was ao_pipewire and the logic there got
converted so drop the now dead code.

This reverts commit 3167a77aa3.
2023-07-30 19:48:35 +02:00
Thomas Weißschuh 0fb7ab62c5 Revert "ao_pipewire: handle AOCONTROL_UPDATE_MEDIA_ROLE"
As the role property is interpreted by wireplumber it can only be
evaluated when creating the stream. The current, dynamic mechanism is
racy so revert it.

See: #11253
Fixes: #12041
This reverts commit 535cd6f313.
2023-07-30 19:48:35 +02:00
Jan Beich 3bdf702b1d meson: look for linux/input-event-codes.h with libwayland flags
On DragonFly and FreeBSD native evdev headers are not not be used
outside of base system. Linux-compatible headers are provided by
evdev-proto package but require extra flags. As evdev-proto lacks
pkg-config support use libwayland prefix as approximation.

meson.build:974:0: ERROR: C header 'linux/input-event-codes.h' not usable
2023-07-29 19:43:28 -05:00
Kacper Michajłow 13b7d7771f version.py: fix build date
- Use ctime() instead manual format string. Fixes 12-hour format (%I)
  without AM/PM (%p) specified. It is 24-hours now, as it should be.
- Avoid naive datetime object.
- Fix timestamp type, it is float in Python.
- Remove dummy fallback branch.
- Use f-strings for readability.
- Always rebuild version.h if repository is dirty.
2023-07-30 00:38:45 +00:00
Dudemanguy a2dd78fbc0 options: restore old default sub selection behavior
1669c4698d notably flipped the default of
--subs-with-matching-audio from yes to no as part of a series of changes
that gave more control over sub selection behavior. While the increased
amount of options is definitely nice, changing the default to no results
in very unintuitive behavior. For example, setting alang=en and slang=en
in your config will not show any subtitles since the audio stream is
English as well so --subs-with-matching-audio being no causes the subs
to not be be selected. This is very weird for users who reasonably
expect slang being set to actually result in showing subs and this is
what mpv did for the past decade.

The other case is when a subtitle does not have a language tag but is
flagged as default. Because --subs-fallback (a new option), defaults to
no, these subtitles also will not be loaded. This is also strange for
users since mpv previously loaded these and they would need to change
the value of this option. It's also inconsistent because audio tracks
that are tagged as default are also loaded by default.

The new behavior seems to have mostly just confused users, and it also
regresses their configs for unclear reasons. Let's just set the options
to be back in line with the old behavior with is what most users expect.
--subs-with-matching-audio goes back to being yes and the new option
--subs-fallback should be default. Fixes #11854.
2023-07-29 22:22:37 +02:00
Niklas Haas 3bf1d22879 vo_gpu_next: fix assertion on wayland
This code failed to handle the case of the swapchain submission being
skipped because the window was invisible.

Fixes: f9dc695b58
2023-07-29 19:09:45 +02:00
Niklas Haas f9dc695b58 vo_gpu_next: delay swapchain submit until flip_frame()
Presents frames at the correct time when DS is disabled.
2023-07-29 17:09:59 +02:00
Kacper Michajłow 5fc305fa17 path-win: move state directory to %LOCALAPPDATA%
%LOCALAPPDATA% is where the local application state belongs.
2023-07-29 14:27:59 +00:00
Kacper Michajłow aa05c06873 path-win: add subdirectory for cache
To not polute %LOCALAPPDATA%/mpv as it may be used for other things too.
2023-07-29 14:27:59 +00:00
Kacper Michajłow 089a8480a2 Revert "ci/msys2: double down on running meson through python3.11"
Python 3.11 will be released soon as default Python package, and
actually python3.11 package already disappeared from the repository.

This reverts commit c637beb522.
2023-07-29 12:33:50 +03:00
sfan5 4c3ed843dc ad_spdif: fix segfault due to early deallocation
The avpkt was created once on decoder init but destroyed each time the
filter was destroyed, this obviously can't work. Move the packet alloc
to the filter init function instead.

fixes: 4574dd5dc6
2023-07-27 22:56:37 +02:00
Dudemanguy bb17d44835 test: enhance libmpv test
We already have a libmpv test, but it's really basic and barely does
anything. In an effort to hopefully prevent future breakage, lets expand
this to do more stuff. First of all, it simply tests setting a bunch of
properties/options. Secondly, it tries to load a file (the mpv icon that
we already have in the source tree). And then finally it tries the
lavfi-complex filter since this is a known special case where weird
things can happen.
2023-07-27 14:48:09 +00:00
Dudemanguy 65840f8889 player/video: check for track and decoder existence
The track during lavfi-complex can actually be NULL which meant that
ca4192e2df regressed lavfi-complex by
causing mpv to crash during runtime changes of the filter. Additionally,
it's possible for the decoder wrapper to also be NULL. check_framedrop
within write_video checks this, but check_for_hwdec_fallback does not.
Perhaps, it's impossible for this to happen, but we might as well add
the check here to be on the safe side since mp_decoder_wrapper_control
is not designed to handle a NULL.
2023-07-27 16:30:26 +02:00
sfan5 bc96b23ef6 video_writer: fix gamma for YUV screenshots
reproduction steps: take any lossy WebP screenshot and check the colors
(or JPEG without libjpeg support, or AVIF with tag-colorspace=no)
fixes: 6d9e72cd89
2023-07-26 11:26:36 +02:00
sfan5 90410cc17e image_writer: log pixfmt conversion 2023-07-26 11:26:36 +02:00
sfan5 e01ff88c83 encode_lavc: fix leak of codecpar 2023-07-26 11:26:36 +02:00
sfan5 ee25d0d2e0 zimg: fix abort on subsampled input with odd heights
We make the assumption that there is more buffer available
than indicated, this needs to be considered in this specific
location too as mp_image_crop understandably checks whether
we're about to do something unsafe.

minimal reproducer: mpv av://lavfi:testsrc -vf crop=320:239,format=yuv420p -o test.png

fixes #10469
2023-07-26 11:26:36 +02:00
sfan5 3bc75d02e0 demux_mkv: add missing space to log msg 2023-07-26 11:26:36 +02:00
Dudemanguy de112a7932 build: remove unneeded libdl requirement for vaapi
Curiously, vaapi requiring libdl has always existed ever since support
was added to mpv (2827295703). After some
investigation in IRC from uau and JEEB, it was concluded that the libdl
requirement was blindly copied from the vdpau check above it. At the
time, the vdpau code actually used dlsym so it was needed. The check was
later dropped when waf support was added
(7e2edad8ef). However, the requirement in
vaapi lived on, and actually it was never needed. libva does use dl when
building its libraries unsurprisingly, but this isn't relevant to mpv in
any way. Just drop it.
2023-07-25 20:04:54 +00:00
Gusar321 4332553db5 build: refactor vaapi handling 2023-07-25 19:20:40 +00:00
Kacper Michajłow 38ad2467a4 ci/mingw: reduce git clone depth to 1 2023-07-25 11:34:59 +02:00
Kacper Michajłow 95a2d5b044 ci/mingw: use ccache
Can significantly reduce build time, most of dependencies have fixed
versions, so they can be cached fully. Others will be incrementally
build.

Cache is saved on every run and restored from the newest one. Size is
limited to 500M (compressed) to keep cache save/restore fast. Clean
cached build is little over 100M, so we have a headroom as things will
grow. ccache will automatically evict least recently used entries.

It is unlikely that clean build will exceed the limit anytime soon, but
it is something to keep in mind, as we do not want to evict cache
entries from current build, so the cache size need to be set correctly.
2023-07-25 11:34:59 +02:00