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.
This commit is contained in:
PatTheMav
2022-09-21 14:28:59 -04:00
committed by Ryan Foster
parent 2a721d92b3
commit 6b56cfddb6
+33 -31
View File
@@ -986,41 +986,43 @@ static obs_properties_t *screen_capture_properties(void *data)
props, "show_hidden_windows",
obs_module_text("WindowUtils.ShowHidden"));
obs_property_set_modified_callback2(hidden, content_settings_changed,
sc);
obs_properties_add_bool(props, "show_cursor",
obs_module_text("DisplayCapture.ShowCursor"));
switch (sc->capture_type) {
case 0: {
obs_property_set_visible(display_list, true);
obs_property_set_visible(window_list, false);
obs_property_set_visible(app_list, false);
obs_property_set_visible(empty, false);
obs_property_set_visible(hidden, false);
break;
}
case 1: {
obs_property_set_visible(display_list, false);
obs_property_set_visible(window_list, true);
obs_property_set_visible(app_list, false);
obs_property_set_visible(empty, true);
obs_property_set_visible(hidden, true);
break;
}
case 2: {
obs_property_set_visible(display_list, true);
obs_property_set_visible(app_list, true);
obs_property_set_visible(window_list, false);
obs_property_set_visible(empty, false);
obs_property_set_visible(hidden, true);
break;
}
}
if (sc) {
obs_property_set_modified_callback2(
hidden, content_settings_changed, sc);
obs_property_set_modified_callback2(empty, content_settings_changed,
sc);
switch (sc->capture_type) {
case 0: {
obs_property_set_visible(display_list, true);
obs_property_set_visible(window_list, false);
obs_property_set_visible(app_list, false);
obs_property_set_visible(empty, false);
obs_property_set_visible(hidden, false);
break;
}
case 1: {
obs_property_set_visible(display_list, false);
obs_property_set_visible(window_list, true);
obs_property_set_visible(app_list, false);
obs_property_set_visible(empty, true);
obs_property_set_visible(hidden, true);
break;
}
case 2: {
obs_property_set_visible(display_list, true);
obs_property_set_visible(app_list, true);
obs_property_set_visible(window_list, false);
obs_property_set_visible(empty, false);
obs_property_set_visible(hidden, true);
break;
}
}
obs_property_set_modified_callback2(
empty, content_settings_changed, sc);
}
if (@available(macOS 13.0, *))
;