Commit Graph

179 Commits

Author SHA1 Message Date
karelrooted ea0e9b74a3 meson: use subprocess-dummy.c fallback when fork func doesn't exist 2023-12-03 22:28:45 +01:00
sfan5 67b75a3b34 meson: fix check for dvbin availability 2023-11-29 20:36:37 +01:00
Dudemanguy 60a31a8a28 build: only directly link shaderc and spirv-cross on windows
See 1b035402a6. This is only relevant if
you are using d3d11 on --vo=gpu which is windows-only. For all other
platforms, vulkan uses libplacebo which uses shaderc. mpv itself doesn't
need it in those cases.
2023-11-28 21:47:13 +00:00
Kacper Michajłow aea8a82478 meson: move mpv.com target after mpv.exe to avoid meson version warning
meson is able to detect blocks of code that are guarded with version
checks, but we did that in reverse order and mpv.exe was complaining.
2023-11-27 20:43:04 +00:00
Dudemanguy 0ea374b1c7 meson: generate .com in the same place as the .exe if possible
Meson was pretty strict about target ids and generating the mpv.com in
the same directory as mpv.exe wasn't possible. So as a workaround we
tucked it away in a subdirectory, but that's not really intuitive at
all. Well as of meson 1.3.0, this is now possible so leverage it since
it makes way more sense. We still keep the old workaround for anyone
using older meson versions.
2023-11-27 18:42:19 +00:00
Kacper Michajłow d0e609297f meson: add missing _GNU_SOURCE in check 2023-11-25 12:38:20 +01:00
Kacper Michajłow ed107c4116 meson: adjust win32 defines
- Don't define _GNU_SOURCE on Windows, no need
- Define WIN32_LEAN_AND_MEAN to strip some unneded headers from
  windows.h
- Define NOMINMAX and _USE_MATH_DEFINES as they are common for Windows
  headers
2023-11-25 12:38:20 +01:00
Kacper Michajłow dff48031a1 meson: don't define __USE_MINGW_ANSI_STDIO
It is defined automatically when needed, which is almost never we don't
support Windows XP.

See: bfd33f6c0e
2023-11-25 12:38:20 +01:00
Jan Beich e575ec4fc3 meson: also expose present_sync for VT-only after a96d04f19d
$ meson setup --auto-features=disabled -Ddrm=enabled -Degl=enabled -Dgbm=enabled -Degl-drm=enabled /tmp/mpv_build
$ meson compile -C /tmp/mpv_build
[...]
ld: error: undefined symbol: mp_present_initialize
>>> referenced by drm_common.c
>>>               libmpv.so.2.2.0.p/video_out_drm_common.c.o:(vo_drm_init)

ld: error: undefined symbol: present_sync_update_values
>>> referenced by drm_common.c
>>>               libmpv.so.2.2.0.p/video_out_drm_common.c.o:(drm_pflip_cb)

ld: error: undefined symbol: present_sync_swap
>>> referenced by drm_common.c
>>>               libmpv.so.2.2.0.p/video_out_drm_common.c.o:(drm_pflip_cb)

ld: error: undefined symbol: present_sync_get_info
>>> referenced by vo_drm.c
>>>               libmpv.so.2.2.0.p/video_out_vo_drm.c.o:(get_vsync)
2023-11-22 19:06:42 +00:00
Kacper Michajłow 67deebc5b5 vaapi: add support for vaapi-win32
Only vaapi-copy variant as nothing can map D3D12 resources currently.

And even if we would add resource sharing to D3D11 it would invoke copy
at some point, so there is no point really. Maybe in the future when
libplacebo get smarter about resource sharing on Windows, but practical
advantages are really small. I've tested it with Vulkan <-> D3D11
sharing and GPU <-> GPU copy is still invoked. Better than CPU memcpy,
something for the future.
2023-11-22 11:43:20 +01:00
rcombs ca45b71edc hwdec: support videotoolbox with libplacebo 2023-11-16 09:48:20 -08:00
der richter fc4db187d0 cocoa: remove OpenGL cocoa backend
the OpenGL cocoa backend was deprecated in 0.29, it has lot of bugs, is
completely unmaintained and can't properly playback anything anymore on
the newest macOS. it is time to remove it.
2023-11-10 14:54:37 +01:00
der richter 1c98ab6239 TOOLS/macos-sdk-version: remove legacy sdk version retrieval
older macOS dev tools were inconsistent with the way how SDK versions
were returned, some truncated the minor versions. in those cases the
SDK version had to be retrieved through the SDK build version.

recently the scheme for the SDK build version changed that our heuristic
for converting it to an SDK version produced wrong version strings.
the stride of the minor version changed from 1 to 2, so SDK versions
ended up higher than they actually were. furthermore macOS 11 was
hardcoded.

since Xcode 12 Apple fixed the SDK version retrieval and it is no longer
truncated when using Xcode as dev tools. Xcode 12 is also the latest
supported version on macOS 10.15, which is also our oldest supported
version. we can remove the old SDK build version conversation and use
the Xcode only tool to retrieve the SDK version in the case Xcode is
used as dev tools. furthermore this als keeps support for Xcode 11 where
the problem wasn't fixed yet, but is still a supported version on macOS
10.15.

Fixes #9907
2023-11-10 14:28:39 +01:00
Dudemanguy a5bf211e12 meson: remove several macos-10-* build options
These have been build options since the waf build, but that doesn't
really make sense. The build can detect whatever macOS sdk version is
available and then use that information to determine whether to enable
the features or not. Potentially disabling multiple sdk versions doesn't
really make any sense. Because f5ca11e12b
effectively made macOS 10.15 the minimum supported version, we can drop
all of these checks and bump the required sdk version to 10.15. The rest
of the build simplifies from there.
2023-11-09 18:12:25 +00:00
Kacper Michajłow add2f3c8c9 meson: add missing source file for UWP 2023-11-08 04:32:10 +00:00
Kacper Michajłow fa0929bf71 osdep/threads-posix: use CLOCK_MONOTONIC if supported 2023-11-08 04:32:10 +00:00
Kacper Michajłow f75fe33da7 threads: rename threads.c to threads-posix.c 2023-11-05 17:36:17 +00:00
Kacper Michajłow 1e0aaab78c threads: move pthread debug to threads-posix.h
And remove redundant define while at it.
2023-11-05 17:36:17 +00:00
Kacper Michajłow 56d35da180 mp_thread: add win32 implementation 2023-11-05 17:36:17 +00:00
Dudemanguy 18885917a7 meson: do the macos sdk version comparison in meson
Since we can no longer rely on distuils for a version comparison, let's
modify the macos-sdk-version script so it returns multiple potential
versions to meson. Then use meson's built-in version comparison to pick
the right one instead. This avoids the complication of needing certain
python packages installed since everything simply uses stdlib functions.
2023-10-29 19:48:43 +00:00
Dudemanguy 50187264fa Revert "meson: import python module"
Since distutils was dropped from python 3.12, we can't rely on a
standard library implementation for version comparison anymore hence
the switch to packaging instead which is essentially supposed to be the
replacement. This is problematic though because macOS can have several
ways of managing python can result in the build calling the wrong python
binary that doesn't have the actual packaging library installed. This
commit was a workaround for that since it would fetch the python used to
run the build (which is probably the one the user wants), but apparently
upstream doesn't like this and it's subject to change*. So instead,
let's solve try, and solve this a different way.

This reverts commit a57bd8e2b8.

*: https://github.com/mesonbuild/meson/pull/12116#pullrequestreview-1575846647
2023-10-29 19:48:43 +00:00
m154k1 a57bd8e2b8 meson: import python module
- Use import to find Python installation.
- Run macos-sdk-version.py with Python provided by meson.

This fixes an error when meson and python-packaging are installed from
Homebrew. Currently, the Python executable from python@3.12 is installed as
python3.12 so python3 is referring to system installation, which may not
have packaging module. meson can provide the correct executable via import.
2023-10-28 18:26:08 +00:00
Kacper Michajłow 032b7de97f osdep/timer-win2: rename to timer-win32 2023-10-25 19:30:39 +00:00
llyyr 486bb93dfa meson: remove libplacebo wrap
This causes more pain than it is worth
2023-10-25 16:40:02 +00:00
llyyr f5ca11e12b meson: make libplacebo a required dependency
Make it not possible to build mpv without the latest libplacebo anymore.
This will allow for less code duplication between mpv and libplacebo,
and in the future also let us delete legacy ifdefs and track libplacebo
better.
2023-10-23 13:03:29 +02:00
Dudemanguy 57fedcfcda meson: remove -D_ISOC99_SOURCE flag
The meson build has always compiled with c_std=c11. This was never
really needed.
2023-10-21 14:05:38 +00:00
NRK 2fa695c3f9 osdep: drop atomic fallback
even msvc (which mpv apparently doesn't support) supports C11 atomics
now. no need to carry around fallback with subtle semantic differences.
2023-10-20 21:31:09 +02:00
sfan5 af53ce18bd meson: streamline selection of certain osdep sources 2023-10-20 21:30:51 +02:00
Dudemanguy d5e5c2ce98 stream_cdda: remove fallback for ancient libcdio versions
CDIO_API_VERSION 6 has been around since libcdio 0.90. That was release
over a decade ago. There's literally no reason to keep the ugly mess of
the old api around so remove it.
2023-10-19 12:10:53 -05:00
Kacper Michajłow b9b58f122b ci: enable -Werror
For better feedback on build status and to keep mpv warning free.

Except for macos builds, there are more issue there that need fixing.
2023-10-19 14:03:23 +00:00
der richter 78d43740f5 vo_gpu/vo_gpu_next: add vulkan support for macOS
add support for vulkan through metal and a translation layer like
MoltenVK. also add the possibility to use different render timing modes
for testing.

i still consider this experimental atm.
2023-10-14 18:39:56 +02:00
Dudemanguy 5d44cf93df vo: use mp_poll wrapper in wait_events when applicable
On linux, several platforms poll for events over a fd. This has ms
accuracy, but mpv's timer is in ns now so lots of precision is lost. We
can use an mp_poll wrapper to use ppoll instead which takes a timespec
directly with nanosecond precision. On systems without ppoll this falls
back to old poll behavior. On wayland, we don't actually use this
because ppoll completely messes up the event loop for some unknown
reason.
2023-10-10 19:10:55 +00:00
Dudemanguy ba4b408b8b osdep: rename polldev to poll_wrapper
Originally, this was added as purely a shim for macOS. However since we
want to do high resolution polling which is not neccesarily available on
all platforms, making this a generic wrapper for poll functions is
useful so rename it.
2023-10-10 19:10:55 +00:00
Dudemanguy ace4d252e5 meson: declare libmpv as a dependency and override it
This allows libmpv users to build it as a subproject easily, i.e. meson
setup build --force-fallback-for=mpv -Dmpv:libmpv=true, if the mpv
source is in the subprojects directory. Mainly useful for development.
2023-10-03 15:46:14 +00:00
Kacper Michajłow cdfd5c280a win32/pthread: define _POSIX_TIMERS to notify they are not supported 2023-09-29 20:48:58 +00:00
Kacper Michajłow d263087713 meson: don't link pthreads when internal impl is used 2023-09-29 20:48:58 +00:00
Dudemanguy 6b74b55283 meson: don't require swift when checking macos sdk
It turns out that iOS doesn't actually need swift so this sdk check was
too strict and the build failed. Instead, only check this if we have
darwin and then make sure that the osdep subdir is only executed if
there are swift sources in the list. Fixes #12161.
2023-09-27 13:54:04 -05:00
Kacper Michajłow ec4683baa0 meson: enable cplugins on Windows
Fixes: #12185
2023-09-20 02:16:45 +00:00
syphyr 662650bde3 meson: check vulkan version
The symbol "vkGetPhysicalDeviceProperties2" was recently added
after refactoring context.c.
2023-09-13 00:00:57 +02:00
sfan5 329d94af41 meson: rename last feature with underscore
fixes: ecbaf34701
2023-09-11 15:20:22 +02:00
Kacper Michajłow bced1eec4e meson: add -Bsymbolic for libmpv
This is required when linking ffmpeg statically and generally good
practice to have on shared libraries anyway.

Prerequisit for fixes in mpv-build for:
https://github.com/mpv-player/mpv-build/issues/215
https://github.com/haasn/libplacebo/issues/198
2023-09-07 13:48:13 +00:00
Philip Langdale fb5273985c meson: include our local copy of libavutil uuid if ffmpeg is too old
In the previous change, I added the uuid files. In this change, we
check the libavutil version and if it's too old, we compile in our
local copy.

We have to change the include paths of the uuid code to find some other
libavutil headers, but nothing beyond that.
2023-09-04 15:22:20 -07:00
sfan5 ecbaf34701 meson: rename all features with underscores
The convention is to use dashes.
2023-08-20 21:13:37 +00:00
Philip Langdale d2074fee0a meson: remove redundant libplacebo version check for Vulkan interop
With the bump of the required base libplacebo version, we no longer
need to do an additional check for Vulkan interop - it will always be
new enough.
2023-08-19 21:16:20 -07:00
Dudemanguy 200992f90c x11: remove xinerama and refactor window geometry
mpv mixes xinerama and randr usage together which gets kind of
confusing and is also pretty stupid. Xinerama is completely unneccesary
today since randr can do everything it can do and much more. Remove it.
This reworks a lot of the window/geometry handling stuff to be centered
completely around xrandr_display plus some other tweaks to the geometry
handling. An important concept is that current_icc_screen is changed
into current_screen and used more generously since it is useful for
things besides just icc profiles.
2023-08-20 02:01:39 +00:00
Dudemanguy a0038504a3 x11: require randr 1.4
There really is no reason to not just hard require randr 1.4. xorg added
1.4 support in 2012 and someone somehow using an xorg server older than
that today surely has several other problems.
2023-08-20 02:01:39 +00:00
Niklas Haas 24dca265b4 meson: remove redundant libplacebo-next check
Now implied by the minimum libplacebo version.
2023-08-18 16:39:57 +02:00
Niklas Haas b1f9aa648a meson: bump minimum libplacebo dependency to v6.292
To remove a bunch of #ifdef templating.
2023-08-18 16:39:57 +02:00
Leonardo Taccari f19bafc0e4 build: check for SNDCTL_DSP_HALT for oss-audio
At least NetBSD ossaudio(3) right now has SNDCTL_DSP_SETPLAYVOL support
but does not support SNDCTL_DSP_HALT chocking at build time.

NFCI on platforms where oss audio output is supported.
2023-08-16 12:59:58 +00:00
Dudemanguy a177fb6188 vf_vapoursynth: save display resolution as a variable
mpv has a generic method for getting the display resolution, so we can
save it in vf_vapoursynth without too much trouble. Unfortunately, the
resolution won't actually be available in many cases (like my own)
because the windowing backend doesn't actually know it yet. It looks
like at least windows always returns the default monitor (maybe we
should do something similar for x11 and wayland), so there's at least
some value. Of course, this still has a bunch of pitfalls like not being
able to cope with multi monitor setups at all but so does display_fps.
As an aside, the vapoursynth API this uses apparently requires R26 (an
ancient version anyway), so bump the build to compensate for this.
Fixes #11510
2023-08-13 19:58:20 +00:00