Commit Graph

231 Commits

Author SHA1 Message Date
jcm
506281e3f6 mac-capture: Fix incorrect enum comparison 2025-04-25 13:24:41 -04:00
PatTheMav
96e4d67242 clang-format: Update source code files with clang-format 19.1.1 2025-04-17 18:16:33 +02:00
Translation Updater
0b2c85845e Update translations from Crowdin 2024-12-06 23:21:55 +00:00
jcm
7979421cbf mac-capture: Don't read channels for disconnected audio device
Co-authored-by: PatTheMav <patthemav+github@gmail.com>
2024-11-08 13:14:34 -05:00
Translation Updater
e6d9f73736 Update translations from Crowdin 2024-10-05 05:02:27 +00:00
Ryan Foster
a1fbf1015f clang-format: Increase column limit from 80 to 120 2024-10-04 18:19:27 -04:00
PatTheMav
6c590805e8 cmake: Update supported CMake version range to 3.28 and 3.30 2024-09-13 14:42:32 -04:00
gxalpha
92d5b45a50 mac-capture: Remove disp_finished event
This event is only used within destroy_[audio]_screen_stream, and does
not appear to be necessary there. stopCaptureWithCompletionHandler holds
a reference to the SCStream object by itself (and the other objects
being held aren't used afterwards anyways), so there should be no harm
in releasing everything immediately without blocking.
2024-08-25 10:17:06 +10:00
PatTheMav
b8cfacaec3 Update formatting of CMake files 2024-08-14 12:07:47 -04:00
Translation Updater
e7d6707fa7 Update translations from Crowdin 2024-07-17 09:34:12 +00:00
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