Commit Graph

49970 Commits

Author SHA1 Message Date
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
Aaron Boxer 865a159244 vo_dmabuf_wayland: support panscan and panning 2023-01-11 18:10:40 +00:00
Max Dunbar 05bc366d18 ta/README: update link to talloc documentation 2023-01-10 17:06:38 +00:00
Dudemanguy 4beb1bcae7 vo_wlshm: properly support video panscan
Turns out it was already doing this under the hood the entire time. The
only catch is that the vo just needed a resize.
2023-01-09 19:30:26 -06:00
Dudemanguy 6471afecd0 player: don't force saving start in watch-later-options
The watch-later mechanism has always unconditionally wrote start to
files to save the playback position. When this was later expanded to
watch-later-options, this logic was kept in place. But we don't actually
have to unconditionally write this and can allow users to remove the
option from the list if they want to. The start value still requires
some special handling; it should always be written if possible
regardless of the value changing. However, we can just place it within
the default set of options for watch-later-options so it can be removed
like any other.
2023-01-09 16:37:14 +00:00
Christoph Heinrich c4ec47a65e player: add video-sync=display-tempo
So far there was no way to sync video to display and have audio sync to
video without changes in pitch.

With this option the audio does not get resampled (pitch change) and
instead the corrected audio speed is applied to audio filters.
2023-01-09 15:17:09 +00:00
Christoph Heinrich 67321b1440 player: choose speed of smallest acceptable factor for display sync
Instead of choosing based on smallest deviation from set speed,
use the speed change from the smallest factor that does not
exceed `video-sync-max-video-change`.
2023-01-09 15:03:30 +00:00
Christoph Heinrich de9f375a23 TOOLS/lua/autoload: optimize performance of natural sorting
Formatting the string on each comparison is wasteful.
Formatting strings beforehand and then comparing the already formatted
ones leads to a huge performance gain.
2023-01-09 15:01:17 +00:00