summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2011-04-07 12:59:52 +0200
committerColin Guthrie <colin@mageia.org>2011-04-23 17:41:33 +0100
commit2a44304bee40135a9a90b9af176729f895b0d5e8 (patch)
tree71614a6329f8a733ee4a7151f9df98a5d8402994 /src/modules
parent575ba65714ab85d81b0e520f348d78c2ae80a6f9 (diff)
module-coreaudio-detect: Add 'ioproc_frames' parameter
This value is passed on to the instances of module-coreaudio-device that are loaded upon device detection. The value is purely optional, as the device module will fall back to to its default if it's not given.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/macosx/module-coreaudio-detect.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/modules/macosx/module-coreaudio-detect.c b/src/modules/macosx/module-coreaudio-detect.c
index 263fc72d..f4f2ee28 100644
--- a/src/modules/macosx/module-coreaudio-detect.c
+++ b/src/modules/macosx/module-coreaudio-detect.c
@@ -41,7 +41,12 @@ PA_MODULE_AUTHOR("Daniel Mack");
PA_MODULE_DESCRIPTION("CoreAudio device detection");
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE);
-PA_MODULE_USAGE("");
+PA_MODULE_USAGE("ioproc_frames=<passed on to module-coreaudio-device> ");
+
+static const char* const valid_modargs[] = {
+ "ioproc_frames",
+ NULL
+};
typedef struct ca_device ca_device;
@@ -54,7 +59,7 @@ struct ca_device {
struct userdata {
int detect_fds[2];
pa_io_event *detect_io;
-
+ unsigned int ioproc_frames;
PA_LLIST_HEAD(ca_device, devices);
};
@@ -83,7 +88,11 @@ static int ca_device_added(struct pa_module *m, AudioObjectID id) {
if (!err && strcmp(tmp, "pulseaudio.org") == 0)
return 0;
- args = pa_sprintf_malloc("object_id=%d", (int) id);
+ if (u->ioproc_frames)
+ args = pa_sprintf_malloc("object_id=%d ioproc_frames=%d", (int) id, u->ioproc_frames);
+ else
+ args = pa_sprintf_malloc("object_id=%d", (int) id);
+
pa_log_debug("Loading %s with arguments '%s'", DEVICE_MODULE_NAME, args);
mod = pa_module_load(m->core, DEVICE_MODULE_NAME, args);
pa_xfree(args);
@@ -203,11 +212,19 @@ static void detect_handle(pa_mainloop_api *a, pa_io_event *e, int fd, pa_io_even
int pa__init(pa_module *m) {
struct userdata *u = pa_xnew0(struct userdata, 1);
AudioObjectPropertyAddress property_address;
+ pa_modargs *ma;
pa_assert(m);
m->userdata = u;
+ if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
+ pa_log("Failed to parse module arguments.");
+ goto fail;
+ }
+
+ pa_modargs_get_value_u32(ma, "ioproc_frames", &u->ioproc_frames);
+
property_address.mSelector = kAudioHardwarePropertyDevices;
property_address.mScope = kAudioObjectPropertyScopeGlobal;
property_address.mElement = kAudioObjectPropertyElementMaster;