|
@@ -254,8 +254,10 @@ static inline void screen_stream_video_update(struct screen_capture *sc,
|
|
}
|
|
}
|
|
|
|
|
|
if (needs_to_update_properties) {
|
|
if (needs_to_update_properties) {
|
|
- [sc->stream_properties setWidth:sc->frame.size.width];
|
|
|
|
- [sc->stream_properties setHeight:sc->frame.size.height];
|
|
|
|
|
|
+ [sc->stream_properties
|
|
|
|
+ setWidth:(size_t)sc->frame.size.width];
|
|
|
|
+ [sc->stream_properties
|
|
|
|
+ setHeight:(size_t)sc->frame.size.height];
|
|
|
|
|
|
[sc->disp
|
|
[sc->disp
|
|
updateConfiguration:sc->stream_properties
|
|
updateConfiguration:sc->stream_properties
|
|
@@ -320,9 +322,9 @@ static inline void screen_stream_audio_update(struct screen_capture *sc,
|
|
audio_description->mBytesPerFrame /
|
|
audio_description->mBytesPerFrame /
|
|
audio_description->mChannelsPerFrame);
|
|
audio_description->mChannelsPerFrame);
|
|
audio_data.speakers = audio_description->mChannelsPerFrame;
|
|
audio_data.speakers = audio_description->mChannelsPerFrame;
|
|
- audio_data.samples_per_sec = audio_description->mSampleRate;
|
|
|
|
|
|
+ audio_data.samples_per_sec = (uint32_t)audio_description->mSampleRate;
|
|
audio_data.timestamp =
|
|
audio_data.timestamp =
|
|
- CMTimeGetSeconds(presentation_time) * NSEC_PER_SEC;
|
|
|
|
|
|
+ (uint64_t)(CMTimeGetSeconds(presentation_time) * NSEC_PER_SEC);
|
|
audio_data.format = AUDIO_FORMAT_FLOAT_PLANAR;
|
|
audio_data.format = AUDIO_FORMAT_FLOAT_PLANAR;
|
|
obs_source_output_audio(sc->source, &audio_data);
|
|
obs_source_output_audio(sc->source, &audio_data);
|
|
}
|
|
}
|
|
@@ -353,12 +355,13 @@ static bool init_screen_stream(struct screen_capture *sc)
|
|
};
|
|
};
|
|
|
|
|
|
void (^set_display_mode)(struct screen_capture *, SCDisplay *) = ^void(
|
|
void (^set_display_mode)(struct screen_capture *, SCDisplay *) = ^void(
|
|
- struct screen_capture *sc, SCDisplay *target_display) {
|
|
|
|
|
|
+ struct screen_capture *capture_data,
|
|
|
|
+ SCDisplay *target_display) {
|
|
CGDisplayModeRef display_mode =
|
|
CGDisplayModeRef display_mode =
|
|
CGDisplayCopyDisplayMode(target_display.displayID);
|
|
CGDisplayCopyDisplayMode(target_display.displayID);
|
|
- [sc->stream_properties
|
|
|
|
|
|
+ [capture_data->stream_properties
|
|
setWidth:CGDisplayModeGetPixelWidth(display_mode)];
|
|
setWidth:CGDisplayModeGetPixelWidth(display_mode)];
|
|
- [sc->stream_properties
|
|
|
|
|
|
+ [capture_data->stream_properties
|
|
setHeight:CGDisplayModeGetPixelHeight(display_mode)];
|
|
setHeight:CGDisplayModeGetPixelHeight(display_mode)];
|
|
CGDisplayModeRelease(display_mode);
|
|
CGDisplayModeRelease(display_mode);
|
|
};
|
|
};
|
|
@@ -398,9 +401,10 @@ static bool init_screen_stream(struct screen_capture *sc)
|
|
|
|
|
|
if (target_window) {
|
|
if (target_window) {
|
|
[sc->stream_properties
|
|
[sc->stream_properties
|
|
- setWidth:target_window.frame.size.width];
|
|
|
|
|
|
+ setWidth:(size_t)target_window.frame.size.width];
|
|
[sc->stream_properties
|
|
[sc->stream_properties
|
|
- setHeight:target_window.frame.size.height];
|
|
|
|
|
|
+ setHeight:(size_t)target_window.frame.size
|
|
|
|
+ .height];
|
|
}
|
|
}
|
|
|
|
|
|
} break;
|
|
} break;
|
|
@@ -441,7 +445,9 @@ static bool init_screen_stream(struct screen_capture *sc)
|
|
[sc->stream_properties setQueueDepth:8];
|
|
[sc->stream_properties setQueueDepth:8];
|
|
[sc->stream_properties setShowsCursor:!sc->hide_cursor];
|
|
[sc->stream_properties setShowsCursor:!sc->hide_cursor];
|
|
[sc->stream_properties setColorSpaceName:kCGColorSpaceDisplayP3];
|
|
[sc->stream_properties setColorSpaceName:kCGColorSpaceDisplayP3];
|
|
- [sc->stream_properties setPixelFormat:'l10r'];
|
|
|
|
|
|
+ FourCharCode l10r_type = 0;
|
|
|
|
+ l10r_type = ('l' << 24) | ('1' << 16) | ('0' << 8) | 'r';
|
|
|
|
+ [sc->stream_properties setPixelFormat:l10r_type];
|
|
|
|
|
|
if (@available(macOS 13.0, *)) {
|
|
if (@available(macOS 13.0, *)) {
|
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000
|
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000
|
|
@@ -463,17 +469,17 @@ static bool init_screen_stream(struct screen_capture *sc)
|
|
configuration:sc->stream_properties
|
|
configuration:sc->stream_properties
|
|
delegate:nil];
|
|
delegate:nil];
|
|
|
|
|
|
- NSError *error = nil;
|
|
|
|
|
|
+ NSError *addStreamOutputError = nil;
|
|
BOOL did_add_output = [sc->disp addStreamOutput:sc->capture_delegate
|
|
BOOL did_add_output = [sc->disp addStreamOutput:sc->capture_delegate
|
|
type:SCStreamOutputTypeScreen
|
|
type:SCStreamOutputTypeScreen
|
|
sampleHandlerQueue:nil
|
|
sampleHandlerQueue:nil
|
|
- error:&error];
|
|
|
|
|
|
+ error:&addStreamOutputError];
|
|
if (!did_add_output) {
|
|
if (!did_add_output) {
|
|
MACCAP_ERR(
|
|
MACCAP_ERR(
|
|
"init_screen_stream: Failed to add stream output with error %s\n",
|
|
"init_screen_stream: Failed to add stream output with error %s\n",
|
|
- [[error localizedFailureReason]
|
|
|
|
|
|
+ [[addStreamOutputError localizedFailureReason]
|
|
cStringUsingEncoding:NSUTF8StringEncoding]);
|
|
cStringUsingEncoding:NSUTF8StringEncoding]);
|
|
- [error release];
|
|
|
|
|
|
+ [addStreamOutputError release];
|
|
return !did_add_output;
|
|
return !did_add_output;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -483,14 +489,14 @@ static bool init_screen_stream(struct screen_capture *sc)
|
|
addStreamOutput:sc->capture_delegate
|
|
addStreamOutput:sc->capture_delegate
|
|
type:SCStreamOutputTypeAudio
|
|
type:SCStreamOutputTypeAudio
|
|
sampleHandlerQueue:nil
|
|
sampleHandlerQueue:nil
|
|
- error:&error];
|
|
|
|
|
|
+ error:&addStreamOutputError];
|
|
if (!did_add_output) {
|
|
if (!did_add_output) {
|
|
MACCAP_ERR(
|
|
MACCAP_ERR(
|
|
"init_screen_stream: Failed to add audio stream output with error %s\n",
|
|
"init_screen_stream: Failed to add audio stream output with error %s\n",
|
|
- [[error localizedFailureReason]
|
|
|
|
|
|
+ [[addStreamOutputError localizedFailureReason]
|
|
cStringUsingEncoding:
|
|
cStringUsingEncoding:
|
|
NSUTF8StringEncoding]);
|
|
NSUTF8StringEncoding]);
|
|
- [error release];
|
|
|
|
|
|
+ [addStreamOutputError release];
|
|
return !did_add_output;
|
|
return !did_add_output;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -595,8 +601,7 @@ fail:
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
-static void screen_capture_video_tick(void *data,
|
|
|
|
- float seconds __attribute__((unused)))
|
|
|
|
|
|
+static void screen_capture_video_tick(void *data, float seconds __unused)
|
|
{
|
|
{
|
|
struct screen_capture *sc = data;
|
|
struct screen_capture *sc = data;
|
|
|
|
|
|
@@ -628,8 +633,8 @@ static void screen_capture_video_tick(void *data,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static void screen_capture_video_render(void *data, gs_effect_t *effect
|
|
|
|
- __attribute__((unused)))
|
|
|
|
|
|
+static void screen_capture_video_render(void *data,
|
|
|
|
+ gs_effect_t *effect __unused)
|
|
{
|
|
{
|
|
struct screen_capture *sc = data;
|
|
struct screen_capture *sc = data;
|
|
|
|
|
|
@@ -648,7 +653,7 @@ static void screen_capture_video_render(void *data, gs_effect_t *effect
|
|
gs_enable_framebuffer_srgb(previous);
|
|
gs_enable_framebuffer_srgb(previous);
|
|
}
|
|
}
|
|
|
|
|
|
-static const char *screen_capture_getname(void *unused __attribute__((unused)))
|
|
|
|
|
|
+static const char *screen_capture_getname(void *unused __unused)
|
|
{
|
|
{
|
|
if (@available(macOS 13.0, *))
|
|
if (@available(macOS 13.0, *))
|
|
return obs_module_text("SCK.Name");
|
|
return obs_module_text("SCK.Name");
|
|
@@ -660,14 +665,14 @@ static uint32_t screen_capture_getwidth(void *data)
|
|
{
|
|
{
|
|
struct screen_capture *sc = data;
|
|
struct screen_capture *sc = data;
|
|
|
|
|
|
- return sc->frame.size.width;
|
|
|
|
|
|
+ return (uint32_t)sc->frame.size.width;
|
|
}
|
|
}
|
|
|
|
|
|
static uint32_t screen_capture_getheight(void *data)
|
|
static uint32_t screen_capture_getheight(void *data)
|
|
{
|
|
{
|
|
struct screen_capture *sc = data;
|
|
struct screen_capture *sc = data;
|
|
|
|
|
|
- return sc->frame.size.height;
|
|
|
|
|
|
+ return (uint32_t)sc->frame.size.height;
|
|
}
|
|
}
|
|
|
|
|
|
static void screen_capture_defaults(obs_data_t *settings)
|
|
static void screen_capture_defaults(obs_data_t *settings)
|
|
@@ -767,15 +772,13 @@ static bool build_display_list(struct screen_capture *sc,
|
|
|
|
|
|
[sc->shareable_content.displays enumerateObjectsUsingBlock:^(
|
|
[sc->shareable_content.displays enumerateObjectsUsingBlock:^(
|
|
SCDisplay *_Nonnull display,
|
|
SCDisplay *_Nonnull display,
|
|
- NSUInteger idx
|
|
|
|
- __attribute__((unused)),
|
|
|
|
- BOOL *_Nonnull stop
|
|
|
|
- __attribute__((unused))) {
|
|
|
|
- NSUInteger screen_index = [NSScreen.screens
|
|
|
|
- indexOfObjectPassingTest:^BOOL(
|
|
|
|
- NSScreen *_Nonnull screen,
|
|
|
|
- NSUInteger index __attribute__((unused)),
|
|
|
|
- BOOL *_Nonnull stop) {
|
|
|
|
|
|
+ NSUInteger idx __unused,
|
|
|
|
+ BOOL *_Nonnull _stop __unused) {
|
|
|
|
+ NSUInteger screen_index =
|
|
|
|
+ [NSScreen.screens indexOfObjectPassingTest:^BOOL(
|
|
|
|
+ NSScreen *_Nonnull screen,
|
|
|
|
+ NSUInteger index __unused,
|
|
|
|
+ BOOL *_Nonnull stop) {
|
|
NSNumber *screen_num =
|
|
NSNumber *screen_num =
|
|
screen.deviceDescription
|
|
screen.deviceDescription
|
|
[@"NSScreenNumber"];
|
|
[@"NSScreenNumber"];
|
|
@@ -824,10 +827,8 @@ static bool build_window_list(struct screen_capture *sc,
|
|
|
|
|
|
[sc->shareable_content.windows enumerateObjectsUsingBlock:^(
|
|
[sc->shareable_content.windows enumerateObjectsUsingBlock:^(
|
|
SCWindow *_Nonnull window,
|
|
SCWindow *_Nonnull window,
|
|
- NSUInteger idx
|
|
|
|
- __attribute__((unused)),
|
|
|
|
- BOOL *_Nonnull stop
|
|
|
|
- __attribute__((unused))) {
|
|
|
|
|
|
+ NSUInteger idx __unused,
|
|
|
|
+ BOOL *_Nonnull stop __unused) {
|
|
NSString *app_name = window.owningApplication.applicationName;
|
|
NSString *app_name = window.owningApplication.applicationName;
|
|
NSString *title = window.title;
|
|
NSString *title = window.title;
|
|
|
|
|
|
@@ -863,8 +864,7 @@ static bool build_application_list(struct screen_capture *sc,
|
|
[sc->shareable_content.applications
|
|
[sc->shareable_content.applications
|
|
enumerateObjectsUsingBlock:^(
|
|
enumerateObjectsUsingBlock:^(
|
|
SCRunningApplication *_Nonnull application,
|
|
SCRunningApplication *_Nonnull application,
|
|
- NSUInteger idx __attribute__((unused)),
|
|
|
|
- BOOL *_Nonnull stop __attribute__((unused))) {
|
|
|
|
|
|
+ NSUInteger idx __unused, BOOL *_Nonnull stop __unused) {
|
|
const char *name =
|
|
const char *name =
|
|
[application.applicationName UTF8String];
|
|
[application.applicationName UTF8String];
|
|
const char *bundle_id =
|
|
const char *bundle_id =
|
|
@@ -879,8 +879,7 @@ static bool build_application_list(struct screen_capture *sc,
|
|
}
|
|
}
|
|
|
|
|
|
static bool content_settings_changed(void *data, obs_properties_t *props,
|
|
static bool content_settings_changed(void *data, obs_properties_t *props,
|
|
- obs_property_t *list
|
|
|
|
- __attribute__((unused)),
|
|
|
|
|
|
+ obs_property_t *list __unused,
|
|
obs_data_t *settings)
|
|
obs_data_t *settings)
|
|
{
|
|
{
|
|
struct screen_capture *sc = data;
|
|
struct screen_capture *sc = data;
|