Commit Graph

129 Commits

Author SHA1 Message Date
der richter 64aeb4273d mac/app: make const char pointers to const pointers
they were meant to be immutable. imported in swift as mutable pointer,
which leads to errors with the strict concurrency in swift 6.

make the pointers const.
2025-01-04 17:04:21 +01:00
der richter d03ce00127 mac/app: make re-assignment of complex macros const
they were never meant to be mutable and are imported as mutable vars
in swift. that causes errors with the strict concurrency in swift 6.

make them const/lets and immutable.
2025-01-04 17:04:21 +01:00
Kacper Michajłow 59d1dc43b9 various: fix typos 2025-01-04 15:59:49 +02:00
der richter c1e0e32453 mac/remote: use swift closure instead of obj-c selector bridging
it's unnecessary to use the overhead of an obj-c selector and the
resulting bridging.
2025-01-04 13:33:15 +01:00
der richter 8af05d4fa1 mac/swift: fix global variables for upcoming swift 6 concurrency
fixes problems with upcoming features DisableOutwardActorInference,
GlobalConcurrency and InferSendableFromCaptures for swift 6 strict
concurrency. enabled with -enable-upcoming-feature flag.
2025-01-02 15:12:28 +01:00
der richter 1551cef54e mac/remote: add Quick Look thumbnail as cover fallback
since we load covers/images directly in a our own thread and the quick
look thumbnailing also works asynchronously on its own thread, we need
sync/coordinate both threads. otherwise it would be possible that a
cover from a different file could overwrite the cover of the current
file.

to prevent this every cover generation has a unique timestamp and only
covers for the last cover timestamp will ever be shown.

we are also not interested in icon type thumbnails, since those are just
generic file type icons.

quick look thumbnails can only be generated if quick look can read those
files. files unknown to macOS don't work out of the box and you need to
install a quick look extension for this, "QuickLook Video" for mkv.
2024-12-31 14:44:16 +01:00
der richter 4dbf81c94c mac/title: use enum for material values instead of generic integers 2024-12-28 14:30:41 +01:00
der richter 4063cdf20b mac/title: use enum for appearance values instead of generic integers 2024-12-28 14:30:41 +01:00
der richter cd9fa6daf0 mac/title: remove old libmpv color setter fallback 2024-12-28 01:46:41 +01:00
der richter bba198a713 mac: use isBundle function instead of manually checking bundle usage 2024-12-26 15:00:57 +01:00
der richter 026f1fb61d clipboard-mac: add macOS clipboard backend 2024-12-24 16:11:45 +01:00
der richter e8ecc7d9d9 osdep/mac/meson.build: dynamically add features to swift build flags
similar to how our config.h is created the feature flags added to the
swift build should be generated from our features array, instead of
manually adding those when needed.

this prevents errors when forgetting to add any needed flags or remove
obsolete ones.
2024-12-24 16:10:52 +01:00
der richter e785296a1c cocoa-cb: use new ambient-light property and remove old libmpv usage 2024-12-21 16:15:44 +01:00
Kacper Michajłow baf528069a osdep/mac/meson.build: remove unused variables 2024-12-09 11:01:07 +01:00
Neko Asakura 8d20b72653 meson: use swiftc instead of swift for building 2024-12-07 14:27:16 +01:00
der richter 11186374a0 mac/option: explicitly include and define type of global init variable
the mpv_global struct is a public struct defined in common/global.h. in
the case that this header is included directly or indirectly into our
swift bridging header, code that uses that struct as an OpaquePointer
will fail to build, because swift would now be aware of its actual type.

preemptively include the header and properly define the type to prevent
such errors in the future.

i also checked all other usages of OpaquePointers and this is the only
case where this is relevant.

See e1d30c4 and 4ff9f50 as reference
2024-12-01 19:25:37 +01:00
der richter 45c1c58680 mac/compat: fix compatibility for deployment targets lower than SDK ver
the swift parts can't be nicely encapsulated in the compat file because
it lags proper target version compile time checks.

Fixes #15292
2024-11-18 19:28:35 +01:00
der richter 91d4e6f937 mac/type: change never mutated variable to let 2024-11-05 18:34:15 +01:00
der richter c80757d782 videotoolbox: silence OpenGL deprecation warnings 2024-11-05 18:34:15 +01:00
der richter 84adbd9d35 ao_coreaudio: fix CoreAudio deprecations 2024-11-05 18:34:15 +01:00
der richter 6f009a91a6 mac/common: fix light sensor deprecations 2024-11-05 18:34:15 +01:00
Guido Cella 99e4979b01 mac/menu: use show-text instead of old osc script messages
1a558bf5c2 made osc-*list script messages aliases to show-texting the
relative properties, so use show-text directly in the menu. Also
increase the duration to be the same as the OSC buttons because the
default of 1 second is too short.
2024-10-26 20:09:57 +02:00
der richter 37159a8ee0 mac/remote: show external covers in Now Playing Info Center 2024-10-19 17:20:43 +02:00
der richter 8cc3160f71 mac/event: add MPV_FORMAT_NODE handler 2024-10-19 17:20:43 +02:00
der richter f866893c9c mac/type: add mpv_node type conversion helpers 2024-10-19 17:20:43 +02:00
der richter 61a09501d6 mac/app: add option to adjust Bundle PATH variable
App Bundles operate in their own shell environment that is different
from the one in the terminal. the default PATH variable for all Bundles
is /usr/bin:/bin:/usr/sbin:/sbin. because of that mpv can not find
binaries installed by package manager that might be used in scripts for
example.

add an option to prepend paths to the Bundle PATH. we prepend to make
the order fully configurable, opposed to appending where the default
Bundle binaries would always take precedence.
2024-10-19 17:18:29 +02:00
der richter d6aef54adb mac/app: add homebrew ARM install paths to the bundle PATH environment
since the bundle operates in a different shell environment than the one
from the terminal, it only has a few default paths set.

add the homebrew ARM default install paths to the PATH environment
variable, so the bundle can also find the needed binaries like yt-dl.
2024-10-15 00:45:51 +02:00
der richter 94d034ed99 mac/swift: fix typo in mpv_event_id string representation
this didn't break anything but might be confusing in log outputs.
2024-10-06 21:53:08 +02:00
der richter 2fb8b00ac9 mac/app: fix building with swift disabled
Fixes #14931
2024-10-06 21:52:35 +02:00
nanahi f3a00ea131 various: handle numpad add/subtract/multiply/divide keycodes 2024-08-11 15:08:42 +02:00
Philip Langdale 7bbf132e20 vo: hwdec: add AVHWDeviceType property to hwdecs
As the first step towards handling scenarios where the are multiple hwdecs for
a given image format but backed by different AVHWDeviceTypes, let us annotate
the hwdecs with their corresponding device types.

From this, we can also see how all the existing hwdecs which match the same
image format also match the same device type.
2024-08-10 14:24:36 -07:00
Kacper Michajłow 6f619d5ef4 vo_libmpv: don't steal pointer provided by the API user
It won't be TA allocated and would fail on header check. Also
documentation doesn't mention that ownership is transfered to mpv, so it
is unexpected.

This will cause existing clients of this API leak this memory, but I
doubt anyone really used it in this broken state.

Fixes: #14633
2024-08-06 20:17:35 +02:00
der richter 88db2d0b61 mac/menu: add option to disable default shortcuts
Fixes #14305
2024-06-25 20:14:38 +02:00
der richter 55241da4ad cocoa-cb: guard color spaces that are only available on 10.15.4 upwards 2024-06-18 19:30:07 +02:00
der richter e3a290b618 mac/compat: fix broken CGColorSpace declaration on SDK 11 only
seems like apple missed those two colour spaces and didn't add a obj-c
to swift redeclaration of the CFStringRef kCGColorSpace* global
variables.
2024-06-18 19:30:07 +02:00
der richter 0f9630f28d mac/event: remove swift 5.6 language feature that is mandatory with 6.0
this can be tested with -enable-upcoming-feature ExistentialAny
2024-06-18 19:30:07 +02:00
der richter 1364c80e64 mac/compat: add withLock fallback for xcode older than 14
withLock is available for macOS versions starting from 10.10 but can
only be used on xcode 14+. xcode 14 introduced swift 5.7, so we guard it
behind a swift version check.
2024-06-18 19:30:07 +02:00
der richter b390ade709 mac/log: properly guard logger usage behind platform version check 2024-06-18 19:30:07 +02:00
der richter 8a61929eb8 cocoa-cb: add support for macOS color space transformation (EDR/HDR)
by default utilises the color space of the screen on which the window is
located. if a specific value is defined, it will instead be utilised.

depending on the chosen color space the macOS EDR (HDR) support is
activated and that OS's transformation (tone mapping) is used.

Fixes #7341
2024-05-05 19:02:50 +02:00
der richter 4a686dac6f mac: properly handle regular expressions without force unwrap 2024-04-28 20:21:18 +02:00
der richter 8f1189341f mac: code cleanup and consistency changes, fix linting issues 2024-04-28 20:21:18 +02:00
der richter 984c890661 mac/helper: make wakeup callback declaration consistent 2024-04-28 20:21:18 +02:00
der richter 6df06e5dc5 mac/touchbar: use KVO block API instead of old obj-c instance method 2024-04-28 20:21:18 +02:00
der richter 2e03e0305c mac/input: add support for dead key reporting
dead keys like tilde and accents were not reported because they returned
an empty string from the NSEvent.

try to retrieve dead key with alternative Carbon API when an empty key
is reported.
2024-04-24 20:35:53 +02:00
der richter f7a32b5f29 mac: make display-names unique to allow specific selection
the Screen property localizedName returns a none unique dynamic name
that doesn't allow a specific selection of a Screen on every OS boot.
the name consists of the vendor name and model name (eg DELL U2723QE).
if the same model display is connected to the system several times,
macOS starts to add numbers to the localizedName (eg DELL U2723QE (1)),
that may not be associated to the same Screen on every OS boot or
connecting the display. it also changes the name of the first connected
display by adding that numeration. this makes it impossible specify the
proper screen with the screen-name option every time.

to circumvent this we remove the enumeration from the name and instead
add the serial number to the display-names property. this makes the
actual Screen unique and none dynamic. furthermore the selection of a
screen by name will check for equality for the old localizedName, simple
name without enumeration, serial number and the combined name with
serial number. this makes it possible to select the screen by either of
those names and identifiers, and keeps backwards compatibility with the
old behaviour.

Examples:
localized name (System Settings name): DELL U2723QE, DELL U2723QE (1)
simple name: DELL U2723QE
serial number: 123456789
combined name: DELL U2723QE (123456789)
2024-04-24 20:35:38 +02:00
der richter e42a8d537f mac/log: fix use after free when freeing mpv handle
the mp_log is freed when the corresponding mpv_handle (ta_parent) is
freed in the EventHelper, though it could still be used from different
threads. instead don't use a ta_parent and manually free on manual
dereferencing. on app shutdown (memory cleanup) this is not called but
instead is freed by the usual cleanup and freeing.

the LogHelper is only able to be manually dereferenced in the AppHub,
so no race conditions are possible in all other cases (vo).in the AppHub
it's impossible to hit a race condition atm, because of how the init
process works and how/where the log is used. only manually forcing
logging in the exit process itself could theoretically trigger a use
after free.

Fixes #13823
2024-04-12 23:23:16 +02:00
der richter ee6794225d mac/vulkan: add support for frame timing via presentation feedback 2024-04-10 19:14:20 +02:00
der richter 2cbb13db9e mac/remote: use event type as key state for proper mapping in function
instead of using the MP_KEY events (Int32) and using a logical OR to
generate a key event for the mpv core, use the cocoa event type for key
states and pass those to the the function. in the function we properly
map those events to the right MP_KEY events.
2024-04-04 19:39:27 +02:00
der richter 70eba5e831 mac/apphub: fix opening several files at once via Finder or App icon
when dropping more than one file on the App icon or opening via Finder
the open(urls:) event might not pass all files at once in the array, but
may consecutivly call open(urls:) for each of the files or batched in
several arrays.

to fix this append any file passed to the open(urls:) event within 0.1
seconds of each other to the current playlist. the first event uses the
default behaviour.
2024-04-04 19:39:27 +02:00
der richter fe1de116f3 mac/app: add some verbose logging for app startup and file handling 2024-04-01 22:13:39 +02:00