Commit Graph

187 Commits

Author SHA1 Message Date
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
der richter 218d9e26d2 meson: add custom target for macOS App bundling
Fixes #10879
2024-02-24 20:04:16 +01:00
nanahi 4e73602ae5 options/path: move path utility functions to misc/path_utils
These utility functions have nothing to do with user and config dir/file.
Move them to a separate file.
2024-02-23 21:35:57 +01:00
nanahi 84015959cc osdep/io: move I/O utility functions to misc/io_utils
The purpose of osdep/io is to provide a wrapper for POSIX I/O functions
on Windows. The last 2 functions are utility functions which don't serve
this purpose.
Move them to a separate file.
2024-02-23 21:35:57 +01:00
llyyr a85efa64f0 meson: set default options for libplacebo if using subproject
This will prevent building demos and link statically with libplacebo by
default if system libplacebo is not found or isn't new enough and a
sufficiently new enough libplacebo exists in `subprojects/libplacebo`.
2024-02-12 11:04:22 +01:00
Dudemanguy 343a5fd345 player: remove all rpi-specific code
vo_rpi and its related code has pretty much historically been a
disaster in mpv. The build regularly gets broken and since nobody uses
it, it takes months for anyone to notice. There was also that time where
fullscreen was broken for about a year and a half. Also building in waf
was entirely broken for about a couple of years or so due to mysterious
reasons no one ever figured out (meson magically fixed it).

Anyways, once again the build is broken due to rpi being forgotten about
again, but instead of pretending to support this crap. Just drop it all.
Nowadays, mmal hwdec is a relic since these devices are better off using
the v4l2m2m ffmpeg fork instead which actually uses KMS properly. RPI 1
and 2 probably can't do this and will remain broken but oh well blame
Broadcom for being special snowflakes and not using standard APIs (my
rockpro worked out of the box; just saying). RPI 2 is nearly 10 years
old anyways, so I think you can afford a new SBC by now. If we were
nicer, there would be a deprecation period, but this is broken in the
last major release anyway so too late.

Closes #13402.
2024-02-05 17:41:06 +00:00
Kacper Michajłow 57d6826249 meson: bump libplacebo required version to 6.338.2 2024-01-31 15:38:21 +00:00
nanahi 7ffd947830 win32: move IME candidate window to video window
By default the IME candidate window appears on the top left corner
of the monitor. Move it to the video window for sane behavior.
2024-01-15 16:06:06 +00:00
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