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

51748 Commits

Author SHA1 Message Date
der richter
15c48f3dc1 cocoa-cb: render on main queue instead of dedicated queue
initially we drew on a dedicated render queue to circumvent certain
bottlenecks on the main queue, like concurrent events that could lead
to late drawing.

though due to the way cocoa works we need to draw an the main queue
otherwise we get undefined behaviour that could lead to crashes.

Fixes #10276
2024-02-29 16:40:52 +01:00
der richter
7758f6f50e mac/vulkan: set NSView as layer delegate like recommended by MoltenVK 2024-02-29 16:38:10 +01:00
der richter
9b301a0537 osxbundle: fix bundling when homebrew is not installed
Fixes #13603
2024-02-29 16:37:21 +01:00
der richter
be6c22f93b mac/vulkan: remove old deprecated VK_MVK_macos_surface extension remains 2024-02-29 14:06:14 +01:00
Kacper Michajłow
0897604298 various: avoid function pointer casts
The opt validator functions are casted to generic validator, which has
erased type for value. Calling function by pointer of different
definition is an UB.

Avoid that by generating wrapper function that does proper argument type
conversion and calls validator function. Type erased functions have
mangled type in the name.

Fixes UBSAN failures on Clang 17, which enabled fsanitize=function by
default.
2024-02-28 16:04:02 +00:00
sfan5
d955dfab29 misc/jni: reduce duplication in mapping struct
'name' was in fact unused when reading fields or methods, so it can be merged with 'method'.
Also changed the type of 'mandatory' to bool.
2024-02-28 16:11:54 +01:00
sfan5
5b1eaf3ff1 misc/jni: introduce macros for deleting references 2024-02-28 16:11:54 +01:00
sfan5
75ae44472b misc/jni: general code cleanup and refactor
Make it align with mpv's coding conventions in general and avoid unecessary Lavu use.
2024-02-28 16:11:54 +01:00
sfan5
1f3758adea ao_audiotrack: refactor JNI class retrieval
- split mapping from field struct
- mark field struct static
- define list of classes to reduce more repetitive code
2024-02-28 16:11:54 +01:00
sfan5
87d30899ff ao_audiotrack: remove two dead variables 2024-02-28 16:11:54 +01:00
sfan5
3c1c848c2b ao_audiotrack: fix missing check for passthrough support 2024-02-28 16:11:54 +01:00
der richter
86fa9b18a3 osdep/mac: make mac naming of files, folders and function consistent
rename all macOS namings (osx, macosx, macOS, macos, apple) to mac, to
make naming consistent.
2024-02-28 15:52:47 +01:00
Dudemanguy
661f45377a wayland: drop some unneeded curly braces (no-op)
Not sure why all of these single line if's were being braced. Probably
some cargo cult from years ago but might as well fix it now since it's
bothering me.
2024-02-27 22:18:12 +00:00
Dudemanguy
f0a6578259 wayland: drop buffer scale for cursor as well
Could have been done in e32554cd57, but I
skipped it there. However, using viewporter is actually a win here.
There's been a longstanding issue in upstream wayland* exactly related
to this. I even forgot about cd7a7a1de8
which was made for this exactly problem and explains the random
spawn_cursor calls. Anyways, just not using buffer scale and instead
scaling the cursor surface via viewporter works just fine and completely
sidesteps this problem. This means we can drop the random looking
spawn_cursor calls and some additional checks.

*: https://gitlab.freedesktop.org/wayland/wayland/-/issues/194
2024-02-27 22:18:12 +00:00
Dudemanguy
34c0a67ace wayland: rename configured to geometry_configured (no-op)
Makes it clearer.
2024-02-27 22:18:12 +00:00
Dudemanguy
7b03a2ff17 wayland: fix check for set_surface_scaling
We don't want to use this if we have fractional scaling or version 6 of
the wl_surface interface which has a preferred buffer scale event which
is superior to this. We were checking in the important place (surface
entrance events) but not technically in the output. So just move the
conditional to set_surface_scaling itself. Also through the VO_EVENT_DPI
in there for convenience.
2024-02-27 22:18:12 +00:00
Christoph Heinrich
505a08a37f sd_ass: don't wrongly recognize \pos as \p
An ass event like `{\p1\pos{1,1}}m 0 0 l -3 -7 l 11 -7 l 11 -2` ends
the drawing mode started with `\p1` due to `\pos` gets confused with
`\p`, and thus that line is wrongly considered to be visible text.
2024-02-27 19:50:03 +00:00
der richter
c7ff037fdd build: fix build when disabling cocoa-cb
the swift obj-c bridging header is only included when cocoa-cb is
enabled. cocoa-cb is not the only swift feature anymore and disabling
cocoa-cb leads to a runtime error that specific swift classes could not
be found.

include the swift obj-c bridging header in the case swift features are
enabled.
2024-02-27 14:04:30 +01:00
der richter
c15307244f mac: remove unnecessary metal layer colour space update
this logic was copied from the cocoa-cb opengl backend, since it was
assumed both layers work similar. apparently they don't and a nil value
on the metal layer means use the display colour profile, while on the
opengl layer it means undefined behaviour.

this also fixes a problem with the target-colorspace-hint option, since
moltenvk needs to set this colour space itself for a proper hint. both
mechanism would compete to set the colour space.
2024-02-27 14:03:15 +01:00
der richter
7a1b387aa9 mac: set layer content scale on init
usually the content scale updates automatically, though on init it is
possible the wrong scale is used for the initial rendering leading to a
wrongly sized surface.

properly set the initial content scale of the layer.
2024-02-27 14:02:08 +01:00
der richter
a7c4a113b8 cocoa-cb: remove pre-allocation and initialise only when used
cocoa-cb was always pre-allocated in the Application itself because
libmpv needs to be set up before usage, an opengl context has to be set
and because it was decided mac specific code should be kept out of
libmpv.

this means that a completely working libmpv and opengl renderer was set
up even if it wasn't used. leading to unnecessary log message, resources
being used or reserved on the system that might not be used, triggering
of dedicated GPU unnecessarily and many other things.

even if not optimal, this wasn't the biggest problem since we only had
that one working vo on macOS. though now that we have a vulkan
gpu(-next) backend on macOS that was made the default, we always have
that dangling cocoa-cb instance, which is completely unnecessary.

move the cocoa-cb initialisation into libmpv preinit function and only
init cocoa-cb when we are a standalone App and cocoa-cb support is build
into.
2024-02-27 14:01:38 +01:00
nanahi
3dcc661de7 console.lua: fix blurry cursor when --osd-blur is set
This is drawn with the same method as the stats.lua graphs so it's also
blurry. Fix this by using the "Default" style for cursor drawing.
2024-02-27 08:36:56 +01:00
nanahi
f4af7b683e stats.lua: fix blurry graphs when --osd-blur is set
When --osd-blur is set to a nonzero value, the graphs also become
blurry. This is because they are rendered by the osd-overlay command
with the "OSD" style which has OSD blur applied, and are treated no
differently from texts. Fix this by using the "Default" style for
these graphs which uses the default OSD options.
2024-02-27 08:36:56 +01:00
nanahi
64627855be DOCS/options: clarify --sub-blur and --osd-blur options
Clarify that these options only apply to the font borders,
not to the texts themselves.
2024-02-27 08:36:56 +01:00
Dudemanguy
fa0fccc2a7 vo_gpu_next: simplify pl_clear_mode enum mapping
No reason for there to be two columns and this also fixes a
-Wenum-conversion warning on clang.
2024-02-26 20:07:43 -06:00
sfan5
3e42139e13 ci: clone repos with shallow submodules 2024-02-26 23:16:48 +01:00
Dudemanguy
bc4003d219 vo_gpu_next: add --border-background option
Allow for setting the border background independently from the
background option.
2024-02-26 16:46:00 +00:00
Dudemanguy
be198c0f0a vo_gpu_next: support --background option
Requires using the new pl_clear_mode enum in libplacebo.
2024-02-26 16:46:00 +00:00
Dudemanguy
183f63c8c9 vo_gpu: pre-multiply alpha when dealing with background colors
This was simply wrong for who knows how long.
2024-02-26 16:46:00 +00:00
Dudemanguy
c72c47204d vo_gpu/vo_gpu_next: rework --alpha into --background option
The --alpha option currently covers two related but different concepts:
whether or not to ignore the alpha component and possibly blending it
with a background. Because of the way the option currently works, it is
impossible to have a transparent window (which requires setting
--alpha=yes) while blending it with the background at the same time. To
solve this, let's rework it so it it superseded by the background
option.

--background controls what kind of background to set for the image if
possible. It can be blended with the set background color, with tiles,
or not blended at all (the last one is still broken on X11/mesa except
for GLX, *sigh*). In this new paradigm, --alpha=no has no real purpose
because you can simply set the background to color and whatever color
you want for exactly the same effect. So the option is removed. Instead,
the hint set by windowing backends (i.e. setting
ra_ctx->opts.want_alpha) can by done with the --background option.

As an aside, the colors in vo_gpu are currently bugged due to not
pre-multiplying the alpha and it seems no one ever noticed. The next
commit fixes that. vo_gpu_next support happens latter since it requires
new things from libplacebo.

Fixes #9615.
2024-02-26 16:46:00 +00:00
Dudemanguy
c774b5f517 player: rename --background to --background-color
This better represents what it actually does. --background will be used
for another, related option in the next commit.
2024-02-26 16:46:00 +00:00
Dudemanguy
b7fd232524 vo_gpu/vo_gpu_next: set ctx->opts.want_alpha in specific functions
Currently this was being duplicated on init and on runtime updates
between both VOs. Since the conditions for setting this will get more
complicated in the future commits, it's better to just handle it in one
place. We could combine the vo_gpu and vo_gpu_next handling into one
single function but vo_gpu_next has an additional condition for
determining alpha that vo_gpu_does not, so we'll leave these separate
for simplicity. Also this technically fixes a memory leak where gl_opts
weren't being freed.
2024-02-26 16:46:00 +00:00
sfan5
bbbc0e248b hwdec/dmabuf_interop: reduce magic constant use 2024-02-26 17:37:20 +01:00
sfan5
73556036a2 hwdec/dmabuf_interop_gl: migrate to EXT_EGL_image_storage on desktop GL
As it turns out OES_EGL_image is only defined for OpenGL ES.
OpenGL drivers implement this extension anyway because it used to be
the only way of importing EGLImages into GL.

An equivalent extension for OpenGL was defined with EXT_EGL_image_storage.
The only difference is the interaction with immutability, which requires
textures to be recreated since they can be bound only once.

Note: this commit can in theory cause certain systems to lose vaapi / drmprime
support. Since EXT_EGL_image_storage is 7 years old this hopefully doesn't happen.
If it does, the init checks can be relaxed to still permit OES_EGL_image.
2024-02-26 17:37:20 +01:00
sfan5
1ae0282c1b hwdec/dmabuf_interop_gl: refactor texture creation
no functional changes in preparation for the next commit
2024-02-26 17:37:20 +01:00
sfan5
c294408ce0 hwdec/dmabuf_interop_gl: restyle macros to fit line length 2024-02-26 17:37:20 +01:00
sfan5
861e9566f6 video: don't define IMGFMT_VULKAN conditionally
We generally try to avoid that due to the #ifdef mess.
The equivalent format is defined in ffmpeg 4.4 while our interop code
requires a higher version, but that doesn't cause any problems.
2024-02-26 17:37:20 +01:00
Guido Cella
09f6f28cc2 osd_libass: update the OSD bar's dent and border size
Make the OSD bar markers bigger so we can default to a smaller,
better-looking border size, without sacrificing markers' visibility.
2024-02-26 16:01:21 +00:00
dokur0chan
1a194e149c DOCS/options: make --scale documentation more consistent
Beef up the barebones description for the Mitchell filter and make it
consistent with the other --scale examples. In addition to this, make
some wording changes to make the language in the documentation a bit
more unified.

Before this change it was pretty obvious that multiple authors
contributed to this part of the manual (at completely different
timeframes), so the language was somewhat disjointed. The Mitchell
description was also not very helpful.
2024-02-26 15:58:34 +00:00
Dudemanguy
76472e1ba8 wayland: remove old sway/wlroots hack
It's actually been like this for years, but wlroots doesn't keep track
of resizes a client does independent of the compositor. When using sway,
this leads to weird behavior with floating clients resizing themselves
back to the old size if you unfocus it. mpv has been working around this
for a long time, but it's really annoying to selectively ignore events
based on a weird heuristic. Since Sway finally fixed this bug, let's go
ahead and drop this crap. Note that other wlroots compositors may
possibly experience a regression if they didn't correct for this like
sway does, but it's for their own good.
2024-02-26 15:51:16 +00:00
Dudemanguy
4375a26e3c player/audio: remove misleading comment about delay
This came up in #13571. playing_audio_pts does not include mpctx->delay
contray to what that implies. The function is meant to only offset the
written audio pts by whatever the internal AO buffer may be.
mpctx->delay is a combination from both the audio and video code, so it
should not be used here. What is wanted is purely the audio pts.
b74c09efbf, a very controversial commit to
say the least, was what introduced this comment, so removing is probably
OK.
2024-02-26 15:41:34 +00:00
Dudemanguy
e3af545421 player: reset av state on speed changes
Playback speed changes should be treated as a discontinuity just like
seeking. Previously, this was being treated internally as just plain
normal playback, but that can't really work. The frame timings from
before the speed change and after the speed change are completely
different and shouldn't be compared to each other. This lead to frames
being adjusted to weird places and possibly even being skipped (as if
mpv was seeking) on speed changes. What we should do is clear out and
reset all av related fields like what happens when you seek, but it is
not quite as aggressive. No need to do a full video state reset or such.
We also wait an arbitrary amount of frames before adjusting for av sync
again. compute_audio_drift already used a magic number of 10 which
sounds reasonable enough so define that and use it here. Fixes #13513.
2024-02-26 15:41:34 +00:00
Dudemanguy
7051e94e4b player: remove speed adjustment from playing_audio_pts
When calculating the audio pts, mpv multiplies the ao delay by the
current audio speed and subtracts it from the written audio pts. This
doesn't really make sense though. mpctx->video_pts is never affected by
the playback speed, and this leads to weird behavior like the audio-pts
property changing values while paused merely because the playback speed
changes. Remove the multiplication and simply subtract the delay by a
factor of 1 instead. When updating the av_diff in player/video, this
does actually need to take in account the audio speed so we do the
calculation there.
2024-02-26 15:41:34 +00:00
LaserEyess
d5dc1e8025 ci: add explicit build test for ffmpeg 4.4
This uses an alpine 3.15 container, which should be one of the oldest
distros that mpv master can compile on and that uses ffmpeg 4.4. Some
functionality is missing due to library versions being too old on
alpine, e.g. wayland, mujs, and pipewire.

The alpine build is also explicitly minimal, to test builds in
conditions where many common mpv features may not be available.
2024-02-26 15:37:37 +00:00
nanahi
f493922e30 DOCS: move ALSA option documentation to ao.rst
All other ao options are documented there so make ALSA the same.
Also remove the (Linux only) wording since some systems (e.g. FreeBSD)
provide compatibility layer for it.
2024-02-26 15:36:37 +00:00
nanahi
3afc1678ba DOCS/options: clarify the impact of --audio-buffer
While making this larger do make audio filters react slower, it doesn't
always make softvol react slower. This is because the softvol reaction
speed is related to the ao buffer size which on many systems have an
upper limit, typically much lower than 200 ms. In this case the softvol
won't react slower. Change the wording to clarify this.
2024-02-26 15:36:37 +00:00
nanahi
0b4b6746b4 DOCS/options: remove lavrresample reference
lavrresample is removed in c8b8fe9981.
The replacement is the internal swresample filter.
2024-02-26 15:36:37 +00:00
nanahi
897d6249ee DOCS/options: remove --alsa-device
This option was removed in 809d160c1e.
2024-02-26 15:36:37 +00:00
nanahi
d49dd78e7f DOCS/ao: update SDL ao version reference
This hasn't been true since 1dcf511376.
2024-02-26 15:36:37 +00:00
nanahi
6ecdedabe5 vo_gpu_next: fix win32 io wrap
Fixes 84015959cc
2024-02-26 09:37:24 +01:00