Commit graph

191 commits

Author SHA1 Message Date
Yoshimasa Niwa 00c67e59e6 mac-capture: Improve various Objective-C code
Improve complicated Objective-C implementations in
mac-screen-capture implementation.

- Use `for` instead of overuse of block based iteration code.
- Use `YES` and `NO` for `BOOL` type instead of wrong `TRUE`, `FALSE`,
  `true`, `false`.
- Use `length` to check empty string, omit unnecessary `nil` checks.
2023-06-24 16:58:09 -07:00
Yoshimasa Niwa 36abf04afa mac-capture: Fix show hidden windows option
`screen_capture_build_content_list` or similar calls uses updated
`sc->show_hidden_windows` or similar flags, but these are not set
before calling these functions.
2023-06-24 16:56:40 -07:00
PatTheMav 59904a66a3 cmake: Update Framework link definition for macOS builds 2023-06-17 12:23:33 -04:00
PatTheMav 9805b706d1 cmake: Remove legacy files for macOS builds 2023-06-17 12:23:33 -04:00
PatTheMav 50a4e83251 cmake: Remove Info.plist template files for macOS builds
Creation of Info.plist files through Xcode is more canonical and
future-proof, as it will automatically pick up changes/updates
introduced by Apple. Non-standard keys can still be added via a
template file, which will then be extended by Xcode with the default
keys.
2023-06-17 12:23:33 -04:00
gxalpha fc6bbb73f2 mac-capture: Fix wrong CFString to NSNumber cast 2023-06-17 16:35:13 +02:00
gxalpha 59b5b07400 mac-capture: Add SCStreamDelegate to stream to log capture errors 2023-06-17 16:33:52 +02:00
PatTheMav 4c4a4f9d9f mac-capture: Fix clang warning about unreachable code 2023-06-16 14:12:58 -04:00
PatTheMav f8e00d6071 clang-format: Update formatting of all ObjC and ObjC++ files 2023-06-11 14:56:45 +02:00
gxalpha 2ea47bb65a mac-capture: Explicitly set clear background for SCK 2023-06-10 11:30:23 -07:00
gxalpha abd472cd31 mac-capture: Use system CGDisplayStream.h header on macOS 14 and newer
ee3c2d0 introduced a local copy of the CGDisplayStream.h header as the
macOS 13.3 SDK erroneously declared functions as unavailable on older
systems. This has been fixed in the macOS 14 SDK with the functions
correctly being declared as available on 10.8, so we can use the system
header again, and in the future remove the local copy once our minimum
compile version is new enough.
2023-06-06 19:07:13 -04:00
Colerar eab9cb0e49
mac-capture: Sort SCK application and window lists alphabetically 2023-06-04 13:11:04 +02:00
PatTheMav fb9b5c829a mac-capture: Switch to UUID-based display management
Using UUIDs to store display references in obs-studio's settings file
allows us to "rediscover" devices even between restarts
(as CGDirectDisplayID changes between those) and select the same device.
2023-05-20 16:50:16 -07:00
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
PatTheMav 585152c566 mac-capture: Add option to hide OBS windows in desktop capture 2023-05-13 16:55:11 -07:00
PatTheMav f20f788d0b mac-capture: Fix possible division by zero error
Possibility of `mChannelsPerFrame` being 0 is not properly covered by
current code, which will result in a division-by-zero error.
2023-05-06 16:15:30 -07:00
Translation Updater a0fbdc3c34 Update translations from Crowdin 2023-05-01 23:11:13 +00:00
PatTheMav ee3c2d0e8a CI: Fix build errors with Xcode 14.3 and platform SDK 13.3
Xcode 14.3 and the macOS 13.3 platform SDK introduced a few breaking
changes:

* Updated AppleClang emits warnings about unqualified std cast calls
  when using C++ - as `move` is too broad a word, developers are to use
  `std::move` to make this explicit. Alas this is exactly what `json11`
  uses and because that library is archived, there is no possibility
  of an upstream update.

* Apple guarded calls to old screen capture APIs as "available but
  deprecated", but seems to have chosen the wrong lower version
  boundary: The calls are flagged as being available for macOS 13 and
  macOS 14 only.

  To fix this, the existing macOS platform SDK header is replaced by a
  local copy that uses macOS 11 as the lower boundary (the oldest macOS
  version supported by obs-studio anyway)
2023-04-04 17:27:59 +00:00
gxalpha eaf6444236 mac-capture: Simplify coreaudio_get_device_id
The current method would enum though all devices looking for a matching
uid instead of directly asking for kAudioHardwarePropertyDeviceForUID.
Asking directly instead would also enable finding hidden devices that
can only be found directly via uid and not via enumerating (were we ever
to need to find such a device).
2023-04-01 16:13:17 -07:00
Translation Updater 7c5560bf1b Update translations from Crowdin 2023-03-27 13:39:03 +00:00
PatTheMav 349372b3b3 cmake: Add changes for CMake build framework 3.0
New code path only taken if OBS_CMAKE_VERSION is set to 3.0.0 or
greater, old functionality remains unchanged.
2023-03-26 18:20:38 -04:00
gxalpha 433c85bcd7 mac-capture: Fix various SCK memory leaks
Detected by clang analyzer.
2023-02-21 17:40:56 +01:00
PatTheMav f98c2d2514 mac-capture: Fix compiler warnings
CMake build framework 3.0 introduces more strict typing checks, which
require additional code fixes to silence.

* Fixes warnings about multi-character assignments
* Fixes warnings about implicit casts
* Fixes warnings about shadowing variables
2023-02-18 15:22:33 -08:00
Norihiro Kamae be2e082961 mac-capture: Remove unused macros 2023-01-28 19:03:55 -08:00
Translation Updater 783bd52197 Update translations from Crowdin 2023-01-08 04:10:37 +00:00
PatTheMav 7cedd324e1 mac-capture: Disable all SCK modes besides WindowCapture on macOS 12
SCK has too many open issues on macOS 12 to enable full functionality
on that version. Window Capture has the biggest performance uplift and
so far the least amount of quirks, so leave this variant (with the
"Beta" qualifier) for macOS versions before Ventura.
2022-11-12 18:17:49 -05:00
PatTheMav 826c602b84
mac-capture: Replace invocations of sprintf with snprintf
Fixes deprecation warnings in Xcode 14/clang on macOS and reduces
chance of buffer overflows.
2022-11-11 19:51:27 +01:00
jpark37 d84a9dad8a mac-capture: Support P3 for HDR recordings 2022-11-09 22:34:50 -08:00
Translation Updater f065f20ce1 Update translations from Crowdin 2022-10-25 22:32:14 +00:00
gxalpha 277dafab98 mac-capture: Log CoreAudio device sample rate 2022-10-09 17:09:07 -07:00
PatTheMav 6b56cfddb6 mac-capture: Allow fetching source properties without source
Per OBS API documentation, `get_properties` can be used to get the
properties of a source, but also of a source type. The latter would
pass a NULL pointer for a given source.

This adds the necessary change to avoid crashing OBS by passing such
a null pointer.
2022-09-21 14:28:59 -04:00
gxalpha 332c1b4176 mac-capture: Undeprecate traditional capture sources on macOS 12
SCK has too many bugs on macOS 12 that don't like they will get fixed or
backported for it to be the recommended capture source.
This commit removes the "Deprecated" flag from traditional capture
source if the user is on macOS 12 (even if SCK is available) and marks
SCK as Beta.
2022-09-20 18:49:13 +02:00
Translation Updater cc2d0791ca Update translations from Crowdin 2022-08-30 09:00:44 +00:00
gxalpha dbcafb62ff
mac-capture: Remove explicit call to setBackgroundColor
This was necessary since the default background color was meant to be
clear, but wasn't set properly. The bug is fixed in macOS 13 Beta 6, so
we can remove this statement.
2022-08-29 14:38:52 +02:00
jpark37 a9c68c4623 mac-capture: Replace false with 0
Param is uint32_t, not bool.
2022-08-27 08:37:44 -07:00
jpark37 38d8a844de mac-capture: Use cleaner render patterns
Render code seems unnecessarily custom. Use normal patterns.
2022-08-22 16:38:50 -07:00
jpark37 270d299258 mac-capture: Clip gamut to sRGB
Mac likes P3, but OBS only supports sRGB for SDR.
2022-08-20 16:39:37 -07:00
shiina424 d056dce428 mac-capture: Add missing locale text 2022-08-20 01:34:03 -07:00
Translation Updater 4aaa07f93d Update translations from Crowdin 2022-08-17 04:22:50 +00:00
gxalpha 6644fed7b1 mac-capture: Fix macOS 12 SCK Display Capture workaround
Adding all windows manually means that any windows opened after the
session was started won't appear. This instead excludes the Control
Center from Display Capture. While unfortunate, it seems to be the only
thing on the display that can't be disabled.
2022-08-09 16:18:28 +02:00
gxalpha 9f370bd36e mac-capture: Show "hidden" checkbox for app capture on update as well 2022-08-04 00:44:29 +02:00
Translation Updater 81734be37c Update translations from Crowdin 2022-07-31 23:40:53 +00:00
PatTheMav 43bdc627ea mac-capture: Remove display name code path for Mac OS X before 10.15 2022-07-31 12:21:35 +02:00
gxalpha 728d919bde mac-capture: Make background transparent in SCK App Capture on macOS 13+ 2022-07-31 11:22:48 +10:00
gxalpha 5f40084d25 mac-capture: Don't exclude desktop windows in SCK display capture
This fixes the desktop wallpaper missing on Display Capture on macOS 12
2022-07-30 15:24:35 +02:00
gxalpha 0207531910 mac-capture: Inline content_changed function 2022-07-30 15:24:35 +02:00
PatTheMav 93adc0a88c mac-capture: Fix creation of invalid window stream on source creation
When the ScreenCaptureKit-based source is generated, the window ID
read from the settings will be empty and interpreted as window ID "0".

This window ID doesn't represent a valid window, but the capture stream
is nevertheless successfully initialized with that value, but will not
generate any output.

Worse, the activated stream should be destroyed when a new stream is
created, but creation will throw an error.

This commit ensures that a valid window ID is used if no good default
value is available, ensuring a working (and destroyable) stream.

Also removes any remaining usage of the old window-utils.
2022-07-26 21:29:48 +02:00
PatTheMav 2bea178fb7 mac-capture: Fix issue with desktop capture introduced by macOS 12.5
Initializing a display stream with a content filter which excludes an
empty list of windows leads to a broken stream. Initializing with a list
of all available windows as a workaround re-enables functionality.
2022-07-26 21:29:48 +02:00
PatTheMav 2d2a5cad59 mac-capture: Cleanup code to improve efficiency
Reduces the amount of calls to the update callback (also reduces amount
of calls to check for available capture content).

Also moves some code to only update data for currently selected capture
type.
2022-07-26 21:29:48 +02:00
PatTheMav 790c5b66f6 mac-capture: Fix availability on macOS 12.5
Whereas the `availability` checks will correctly detect macOS 12.5,
the `__MAC_OS_X_VERSION_MAX_ALLOWED` macro is dependent on the platform
SDK. The most current platform SDK is 12.3, hence why this version
needs to be checked for.
2022-07-26 21:29:48 +02:00