Commit graph

221 commits

Author SHA1 Message Date
Translation Updater 8999d9fef9 Update translations from Crowdin 2024-06-07 09:47:58 +00:00
tytan652 7824e164b1 mac-capture: Replace pragmas with availability markers
Also changes clang-format SeparateDefinitionBlocks to Leave on ObjC
files, which avoid having an empty new line after API_AVAIABLE and the
declaration.
2024-05-16 15:25:53 -04:00
Florian Zwoch 823e968a71 mac-capture: Fix string length when duplicated 2024-03-19 16:20:31 -04:00
jcm 7fab3d03e0 mac-capture: Standardize early return behavior in init_screen_stream() 2024-03-15 15:26:09 -04:00
PatTheMav f4733ec6a2 Update source code formatting with clang-format 17.0.3
Added SCDisplayRef type alias to fix a quirk of this specific
clang-format version with ObjC block syntax.
2024-03-11 15:55:30 -04:00
Vainock 7ae66c72fd Update translations from Crowdin 2024-02-28 14:20:05 -05:00
PatTheMav 50a19c5219 mac-capture: Fix crash in device reconnect handler
The uninit function prematurely released the memory allocated for the
channel map setting, which exists in the scope of source life cycle
(compared to channel names which are valid during the life cycle of a
configured device).

Splitting up the clean-up for both (memory for channel names is
released when the device is uninitialized, memory for channel map
setting is released when the source is removed) ensures that the memory
is released but pointers don't become unexpectedly invalid.
2024-02-20 14:18:46 -05:00
PatTheMav 5a7478d562 mac-capture: Limit number of copied audio channels to libobs limits
OBS handles up to 8 channels of audio, which requires the CoreAudio
input callback to omit/ignore any audio data from channels above that
count and also report a maximum amount of 8 channels to match the
speaker setup given to swresample by libobs.
2024-02-20 14:04:28 -05:00
Translation Updater ac484a066f Update translations from Crowdin 2024-01-29 20:47:38 +00:00
gxalpha 0aaf2e518b mac-capture: Remove macOS 14 ifdef and custom CGDisplayStream header
ec9809bd43 increased the minimum macOS SDK
to 14.2, meaning that the ifdef (and as a result the custom header) is
no longer needed.
2024-01-08 20:40:33 -05:00
PatTheMav 2457d83e0f mac-capture: Update capture to include menu bar and child windows
macOS 14.2 changed internal defaults of SCK requiring the inclusion
of the menu bar and child windows to be enabled explicitly.

This will have a slight negative impact on capture performance but is
required to restore behavior of prior macOS versions.
2024-01-06 18:09:06 -06:00
PatTheMav 5697b085da mac-capture: Switch AudioUnits to use canonical format on output bus 2023-12-19 18:33:53 -05:00
Robert Wittams 73e9561633 mac-capture: Allow selection of channels on core audio devices 2023-12-19 18:33:53 -05:00
PatTheMav be7ac828de mac-capture: Fix ScreenCaptureKit deadlock when using nil display ID
In some scenarios ScreenCaptureKit will not call our completion handler
when an internal ReplayKit error occurred. This seems to be more common
when a <nil> display id is provided as the content filter for
ScreenCaptureKit.

The issue was reported to Apple as FB13455947, but it is good practice
for us to check for an invalid display ID before even attempting to start
a capture stream.
2023-12-09 17:34:33 -06:00
Translation Updater f674d17168 Update translations from Crowdin 2023-12-05 22:04:31 +00:00
jcm a89719a2d2 mac-capture: Add handling for nil target window 2023-11-11 17:06:25 -06:00
gxalpha ba4467199c plugins: Remove old macOS version ifdefs
8dd20dfd33 introduced an explicit check
for the available macOS SDK, meaning that we can be sure that the macOS
13.1 SDK is available. As such, we do not require ifdef guards for the
availability of functions that are older than 13.1.
2023-10-27 16:00:42 -04:00
gxalpha 3d2df1c6d7 mac-capture: Replace kAudioObjectPropertyElementMaster with Main 2023-10-17 16:45:36 -04:00
Translation Updater 0d450a34a0 Update translations from Crowdin 2023-10-10 13:34:41 +00:00
gxalpha 23bfb625ce mac-capture: Don't crash when migrating unknown display IDs
The current code assumes that a display UUID can be created with the
stored ID, but that's not always the case, e.g. when the user doesn't
have the display connected. As such, we need to null check this, and
fall back to the invalid ID (0) when the ID cannot be migrated.

The current code also only migrates on source creation, which yields
weird behaviour where if the user opens properties and then cancels it
would still show the first display, but only for the session. This is
why the code was factored out of the creation function and now is always
used when an ID needs to be acquired from OBS Data settings, including
when the source is updated.
2023-09-28 14:25:55 -04:00
Translation Updater ecf914dd67 Update translations from Crowdin 2023-08-13 14:09:15 +00:00
gxalpha 8f4848a2b0 mac-capture: Set correct default type for application data 2023-07-16 02:00:39 +02:00
gxalpha 8fa84e874b mac-capture: Remove internal display settings from SCK Audio Capture 2023-07-15 16:19:02 -07:00
gxalpha 290570b819 mac-capture: Use error code constant instead of magic number 2023-07-03 16:52:50 +02:00
gxalpha e8602897d7 mac-capture: Add button to reactivate stopped capture 2023-07-03 15:35:04 +02:00
gxalpha 89124e223e mac-capture: Remove unneeded debug log
This log line was introduced in 239e9273d and looks like it was for
debugging purposes. It always prints an error message when an SCK audio
capture source was successfully created.
2023-07-02 23:57:48 +02:00
gxalpha 38f63473fc mac-capture: Mark CoreAudio output capture source as deprecated 2023-07-01 16:51:28 +02:00
jcm 239e9273dc mac-capture: Add macOS Audio Capture 2023-06-30 23:59:20 +02:00
jcm 1152173742 mac-capture: Rename 'mac-screen-capture.m' 2023-06-30 23:59:20 +02:00
jcm ce5f391c73 mac-capture: Refactor macOS Screen Capture 2023-06-30 23:59:20 +02:00
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