Commit Graph

49977 Commits

Author SHA1 Message Date
Kacper Michajłow bc1af592db ci: migrate MSYS2 build to GitHub Actions 2023-01-28 01:03:12 +00:00
Kacper Michajłow c3149d9fc2 wscript: remove MSVC from compiler lookup
MSVC is not supported and waf doesn't respect CC environment value like
any sane buildsystem.
2023-01-28 01:03:12 +00:00
Thomas Weißschuh c25682f09e meson: reuse libmpv objects for cplayer
When building both cplayer and libmpv in the same build previously all
sources were built twice.
By reusing the objects from libmpv in cplayer we can thus save 50%
percent of the build steps.
2023-01-26 21:39:04 -08:00
Thomas Weißschuh fb137e8d88 ao_pipewire: align thread name with general conventions 2023-01-25 15:56:36 -08:00
Thomas Weißschuh 870512eb84 audio: simplify implementation of property ao-volume
ao-volume is represented in the code with a `struct ao_control_vol_t`
which contains volumes for two channels, left and right.

However the code implementing this property in command.c never treats
these values individually. They are always averaged together.
On the other hand the code in the AOs handling these values also has to
handle the case where *not* exactly two channels are handled.

So let's remove the `struct ao_control_vol_t` and replace it with a
simple float.
This makes the semantics clear to AO authors and allows us to drop some code from the AOs and command.c.
2023-01-25 15:49:21 -08:00
Dudemanguy 5510d9f663 stream/dvb: remove some unused variables
Missed in b6b8380518.
2023-01-24 21:21:02 -06:00
Sultan Alsawaf 0d44ae319d x11: remove PresentNotifyMSC from egl/glx/vulkan to fix xpresent timing
PresentNotifyMSC turns out to be not only redundant, but also harmful with
mesa-backed egl/glx/vulkan VOs because for all of them, mesa uses
PresentPixmap behind the scenes when DRI3 is available, which already
spawns a PresentCompleteNotify event when the buffer swap actually
finishes. This is important because without using the timing information
from these PresentCompleteKindPixmap events, there's no way for mpv to know
exactly when a frame becomes visible on the display.

By using PresentNotifyMSC in conjunction with DRI3-enabled mesa, two
problems are created:
1. mpv assumes that a vblank won't elapse (i.e., it assumes the current MSC
   won't change) between the time when mesa enqueues the buffer swap and
   the time when mpv calls PresentNotifyMSC to ask xorg for a notification
   at the next MSC, relative to the current MSC at the time that xorg reads
   it for the PresentNotifyMSC call. This means that mpv could get a
   notification one or more vblanks later than it expects, since the
   intention here is for mpv to get a notification at the MSC that the
   buffer swap completes.
2. mpv assumes that a buffer swap always takes one vblank to complete,
   which isn't always true. A buffer swap (i.e., a page flip) could take
   longer than that depending on hardware conditions (if the GPU is running
   slowly or needs to exit a low-power state), scheduling delays (under
   heavy system or GPU load), or unfortunate timing (if the raster scan
   line happens to be at one of the last few rows of pixels and a vblank
   elapses just before the buffer swap is enqueued).

This causes mpv to have a faulty assumption of when frames become visible.

Since mpv already receives the PresentCompleteNotify events generated by
mesa's buffer swaps under the hood, the PresentNotifyMSC usage is unneeded
and just throws a wrench in mpv's vsync timing when xpresent is enabled.

Simply removing the PresentNotifyMSC usage from the egl, glx, and vulkan
VOs fixes the xpresent vsync timing.
2023-01-25 03:13:23 +00:00
Dudemanguy 879824a47f wayland: add wp-fractional-scale-v1 support
This protocol is pretty important since it finally lets us solve the
longstanding issue of fractional scaling in wayland (no more mpv doing
rendering over the target resolution and then being scaled down). This
protocol also can completely replace the buffer_scale usage that we are
currently using for integer scaling so hopefully this can be removed
sometime in the future. Note that vo_dmabuf_wayland is omitted from the
fractional scale handling because we want the compositor to handle all
the scaling for that VO.

Fixes #9443.
2023-01-24 00:04:39 +00:00
Dudemanguy 006ec9ce43 wayland: rewrite geometry and scaling handling
This is in preparation for fractional scaling support. Basically, redo
all the coordinates in wayland so that wl->geometry is equal exactly to
what is being put out to the screen (no extra wl->scaling multiplication
required). The wl->vdparams variable is also eliminated for simplicity.
This changes mpv's behavior on wayland with hidpi scaling but that will
be addressed in more detail with the next commit.
2023-01-24 00:04:39 +00:00
sfan5 9b59d39a3a vo_gpu: implement VO_DR_FLAG_HOST_CACHED
For OpenGL, this is based on simply comparing GL_VENDOR strings against
a list of allowed vendors.

Co-authored-by: Nicolas F. <ovdev@fratti.ch>
Co-authored-by: Niklas Haas <git@haasn.dev>
2023-01-23 14:13:34 +01:00
Niklas Haas 2531a89fcb vo_gpu_next: implement VO_DR_FLAG_HOST_CACHED
For sufficiently new versions of libplacebo.
2023-01-23 14:13:34 +01:00
sfan5 c7ea0cd68f vd_lavc: add "auto" choice for vd-lavc-dr
--vd-lavc-dr defaulted to "yes", which caused issues on certain
hardware. Instead of disabling it, add a new "auto" value and
make it the default.

The "auto" choice will enable DR only when we can request host-cached
buffers (as signalled by the new VO_DR_FLAG_HOST_CACHED).

Co-authored-by: Nicolas F. <ovdev@fratti.ch>
Co-authored-by: Niklas Haas <git@haasn.dev>
2023-01-23 14:13:34 +01:00
Niklas Haas f8c17f55f9 vo: add `int flags` to the get_image signature
This is a huge disgusting mess to thread through everywhere. Maybe I'm
stupid for attempting to solve the problem this way.
2023-01-23 14:13:34 +01:00
Avi Halachmi (:avih) 8eb7a00fa1 msg: log-file set at mpv.conf: don't ignore early messages
Previously, if log-file was set not via a CLI option (e.g. set via
mpv.conf or other config file, or set from a script init phase),
then meaningful early log messages were thrown away because the log
file name was unknown initially.

Such early log messages include the command line arguments, any
options set from mpv.conf, and possibly more.

Now we store up to 5000 early messages before the log file name is
known, and flush them once/if it becomes known, or destroy this
buffer once mpv init is complete.

The implementation is similar and adjacent, but not identical, to an
existing early log system for mpv clients which request a log buffer.
2023-01-23 11:05:08 +02:00
Avi Halachmi (:avih) 17baa00e02 msg: log-file buffer size: don't use magic number (no-op) 2023-01-23 11:05:08 +02:00
Dudemanguy 92a6f2d687 drm: rewrite based around vo_drm_state
A longstanding pain point of the drm VOs is the relative lack of state
sharing. While drm_common does provide some sharing, it's far less than
other platforms like x11 or wayland. What we do here is essentially copy
them by creating a new vo_drm_state struct and using it in vo_drm and
context_drm_egl. Much of the functionality that was essentially
duplicated in both VOs/contexts is now reduced simple functions in
drm_common. The usage of the term 'kms' was also mostly eliminated since
this is libdrm nowadays from a userspace perspective.
2023-01-21 17:08:29 +00:00
Niklas Haas 8c617765fe mp_image: fix XYZ primaries default
This was incorrectly set to BT.2020, when it should be DCI-P3 for pretty
much all real-world XYZ content (which is digital cinema content).
2023-01-21 13:03:33 +01:00
Dudemanguy 25d02e88d3 meson: skip some unneeded macos-specific checks
A couple of programs were always unconditionally searched for, but we
don't have to do this if we're not on darwin.
2023-01-20 21:42:49 +01:00
Thomas Weißschuh 67dbe2a8f4 meson: drop feature plain-gl 2023-01-19 22:15:14 +00:00
Thomas Weißschuh 44179398b0 ci: run meson tests 2023-01-19 22:15:14 +00:00
Thomas Weißschuh e09bab90ce meson: limit vaapi checks 2023-01-19 22:15:14 +00:00
Thomas Weißschuh ede8d29408 meson: don't add libmpv and cplayer features to conf_data
Core code should not use these features as it would mean that a libmpv
build could change an mpv executable and vice-versa.
Also changing one of them should not force a full recompile of the other
one through a change to config.h.
2023-01-19 22:15:14 +00:00
Thomas Weißschuh 491aaacca6 meson: remove dependency from libmpv to plain-gl
The libmpv feature should not have any impact on the built core code.
Otherwise a mpv executable compiled in a build together with libmpv has
different features than one from a build without.

The gl feature doesn't hurt, so always enable it.
2023-01-19 22:15:14 +00:00
Thomas Weißschuh 2056bf1b4e meson: add simple test executable for libmpv
This can be used to make sure that the built libmpv is functional.
2023-01-19 22:15:14 +00:00
Thomas Weißschuh fd2f1a6f9a stream: remove trailing NULL element from stream list 2023-01-17 14:01:47 +01:00
Niklas Haas b091dfda71 hwdec_cuda: drop support for PL_HANDLE_WIN32_KMT
This handle type was only needed for backwards compatibility with
windows 7. Dropping it allows us to simplify the code: there is no
longer a need for runtime checks, as the handle type can now be
statically assigned based on the platform.

The motivating usecase here, apart from code simplification, is a
desired switch to timeline semaphores, which (in the CUDA API) only
supports the non-KMT win32 handles.

It's worth pointing out that we need no runtime check for
IsWindows8OrGreater(), because the `export_caps.sync` check will already
fail on versions of windows not supporting PL_HANDLE_WIN32.
2023-01-17 11:38:46 +01:00
Thomas Weißschuh f52cfdabca wayland: only warn when actually missing idle inhibit support 2023-01-16 19:26:09 +00:00
Thomas Weißschuh 2bbf880d96 vo: make driver list static 2023-01-16 19:25:54 +00:00
Thomas Weißschuh f66c5404f4 vo: remove trailing NULL element from driver array 2023-01-16 19:25:54 +00:00
Thomas Weißschuh 98c2fa095d ao: remove trailing NULL element from driver array 2023-01-16 19:25:54 +00:00
LaserEyess 50169e05d8 DOCS/compile-windows.md: update with meson instructions
No need to encourage waf here.

Note: minor edits by Dudemanguy to update some dead links and such.
2023-01-15 16:46:11 +00:00
Dudemanguy 3858a8102b build: officially deprecate waf
While the waf build has served us well for many years, it's time to
officially consider it deprecated. The meson build was added fully with
the intention to eventually replace waf and its current state is more
than good enough to do that. Let's start the deprecation period now to
give users a heads up to switch before we remove waf for good.
2023-01-15 16:46:11 +00:00
Christoph Heinrich 7b09bf7ffc TOOLS/lua/autoload: improve alphanumeric sorting
Currently filenames like `EP.1.v0.1080p.mp4` do not get sorted correctly
(e.g. episode 11 right after episode 1). That is caused by the `.` in
front of the episode number, making it get sorted as if it were
decimals.

The solution is to match the whole real number or integer instead of
matching the integer part and the fractional part separately.

This will regress sorting of numbers with multiple commas where the
length of the individual segments differs between filenames.
Since those are rather uncommon, that is unlikely to be a problem (for
anyone ever).
2023-01-15 16:45:24 +00:00
Dudemanguy 6cdce9e18e wayland: store presentation feedbacks in a pool
Officially, the most cursed part of the wayland code in mpv (third or
fourth try now?) This time, let's allocate a pool during init
(arbitrarily set to the maximum swapchain length mpv allows, 8; don't
even know if this actually works in wayland). Then we add/remove
feedbacks from the pool during the lifecycle of the VO, and clean it up
all at the end. Hopefully, this does the trick for good this time.
2023-01-13 22:24:11 -06:00
Dudemanguy f32c5586d6 Revert "wayland: dispatch and wait for compositor events in uninit"
This ended up being a bad idea. The problem is that it introduces
ordering when destroying events (something we weren't worried about
before) and Lynne pointed out a problem with the callback not also being
destroyed before the surface in IRC. Just undo this and go with a
different approach (next commit). P.S. the wayland_dispatch_events name
change is kept though because I like that better.

This reverts commit aa8ddfcdf3.
2023-01-13 22:23:49 -06:00
Dudemanguy 73581d8fe6 TOOLS/docutils-wrapper: make executable + alphabetize
I should have caught this during review but the feature was too cool and
I didn't really pay attention (sorry). For consistency with the rest of
the scripts here.
2023-01-13 10:13:39 -06:00
Dudemanguy 9a9039deb2 audio: fix crash during uninit on ao_lavc
The buffer state can be null when using --ao=lavc, so just check it
first. Fixes #10175.
2023-01-13 16:02:38 +00:00
Ionen Wolkens 95a76f0692 meson: also search for rst2html with .py extension
This allows using rst2html.py from docutils if present, this
was already done for rst2man.py (unneeded for rst2pdf).
2023-01-13 16:01:15 +00:00
sfan5 1201d59f0b various: replace abort() with MP_ASSERT_UNREACHABLE() where appropriate
In debug mode the macro causes an assertion failure.
In release mode it works differently and tells the compiler that it can
assume the codepath will never execute. For this reason I was conversative
in replacing it, e.g. in mpv-internal code that exhausts all valid values
of an enum or when a condition is clear from directly preceding code.
2023-01-12 22:02:07 +01:00
sfan5 7b03cd367d various: replace if + abort() with MP_HANDLE_OOM()
MP_HANDLE_OOM also aborts but calls assert() first, which
will result in an useful message if compiled in debug mode.
2023-01-12 22:02:07 +01:00
sfan5 b6b8380518 stream/dvb: drop support for DVB API before 5.8
There is really no reason to keep the #ifdef mess around given
that version is available since December 2012 (Linux 3.7).
2023-01-12 22:02:07 +01:00
sfan5 1e00e3119f ao_audiotrack: replace malloc with talloc 2023-01-12 22:02:07 +01:00
sfan5 d54f22f8b6 stream/cookies: use stream_read_file()
No need for this redundant implementation.
2023-01-12 22:02:07 +01:00
sfan5 833bff8738 {video,audio}: adjust unsafe strncpy usages 2023-01-12 22:02:07 +01:00
sfan5 f4280e5238 video/x11: replace sprintf usage 2023-01-12 22:02:07 +01:00
sfan5 2703a2c8ff video: replace sprintf usage 2023-01-12 22:02:07 +01:00
sfan5 57f00a0372 demux_mf: replace unsafe string functions 2023-01-12 22:02:07 +01:00
sfan5 356096b954 ra_d3d11: fix incorrect type
As it happens, `SIZE_T` and `size_t` are not the same length on 32-bit Windows
2023-01-12 22:02:07 +01:00
sfan5 9196abf111 DOCS: clarify wid casting on Windows
The situation here is that HWND is always a 32-bit value but the
win32 API also accepts sign-extended values as valid. The trouble
starts when the numeric value is negative, as mpv ignores those.
Apparently this only happens after a while (related to uptime
or number of handles created), which meant this problem was rare.

addresses #10189
2023-01-12 22:02:07 +01:00
Dudemanguy a5b9d529ee vo_dmabuf_wayland: drop support for linux-dmabuf-v2
The only real reason this was ever supported is because it was
dramatically simpler than v4, so it was put in as an initial
implementation. Later, v4 support was added and we left v2 for
compatibility, but let's just drop it. Compositors all use v4 nowadays,
and v2 is significantly limited (no modifier support for example). It's
better to just remove this dead code for simplicity.
2023-01-12 17:42:35 +00:00