mac-capture: Add update callbacks for coreaudio

Somehow managed to forget to add this function at an earlier point.
Allows the audio device to be changed via a simple update.
master
jp9000 2015-02-20 21:51:00 -08:00
parent 8bc2288dfe
commit 3c8a3d7866
1 changed files with 14 additions and 0 deletions

View File

@ -671,6 +671,18 @@ static void coreaudio_destroy(void *data)
} }
} }
static void coreaudio_update(void *data, obs_data_t *settings)
{
struct coreaudio_data *ca = data;
coreaudio_shutdown(ca);
bfree(ca->device_uid);
ca->device_uid = bstrdup(obs_data_get_string(settings, "device_id"));
coreaudio_try_init(ca);
}
static void coreaudio_defaults(obs_data_t *settings) static void coreaudio_defaults(obs_data_t *settings)
{ {
obs_data_set_default_string(settings, "device_id", "default"); obs_data_set_default_string(settings, "device_id", "default");
@ -759,6 +771,7 @@ struct obs_source_info coreaudio_input_capture_info = {
.get_name = coreaudio_input_getname, .get_name = coreaudio_input_getname,
.create = coreaudio_create_input_capture, .create = coreaudio_create_input_capture,
.destroy = coreaudio_destroy, .destroy = coreaudio_destroy,
.update = coreaudio_update,
.get_defaults = coreaudio_defaults, .get_defaults = coreaudio_defaults,
.get_properties = coreaudio_input_properties .get_properties = coreaudio_input_properties
}; };
@ -770,6 +783,7 @@ struct obs_source_info coreaudio_output_capture_info = {
.get_name = coreaudio_output_getname, .get_name = coreaudio_output_getname,
.create = coreaudio_create_output_capture, .create = coreaudio_create_output_capture,
.destroy = coreaudio_destroy, .destroy = coreaudio_destroy,
.update = coreaudio_update,
.get_defaults = coreaudio_defaults, .get_defaults = coreaudio_defaults,
.get_properties = coreaudio_output_properties .get_properties = coreaudio_output_properties
}; };