On Mon, 2015-04-27 at 23:11 +0200, Mihai Moldovan wrote: > Signed-off-by: Mihai Moldovan <ionic at ionic.de> > --- > Â src/modules/macosx/module-coreaudio-detect.c | 23 > ++++++++++++++++++++--- > Â src/modules/macosx/module-coreaudio-device.c | 23 > ++++++++++++++++++++--- > Â 2 files changed, 40 insertions(+), 6 deletions(-) > > diff --git a/src/modules/macosx/module-coreaudio-detect.c > b/src/modules/macosx/module-coreaudio-detect.c > index d9c09da..a23aa2f 100644 > --- a/src/modules/macosx/module-coreaudio-detect.c > +++ b/src/modules/macosx/module-coreaudio-detect.c > @@ -39,10 +39,14 @@ PA_MODULE_AUTHOR("Daniel Mack"); > Â PA_MODULE_DESCRIPTION("CoreAudio device detection"); > Â PA_MODULE_VERSION(PACKAGE_VERSION); > Â PA_MODULE_LOAD_ONCE(true); > -PA_MODULE_USAGE("ioproc_frames=<passed on to module-coreaudio- > device> "); > +PA_MODULE_USAGE("ioproc_frames=<passed on to module-coreaudio- > device> " > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "record=<enable source?> " > +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "playback=<enable sink?> "); > Â > Â static const char* const valid_modargs[] = { > Â Â Â Â Â "ioproc_frames", > +Â Â Â Â "record", > +Â Â Â Â "playback", > Â Â Â Â Â NULL > Â }; > Â > @@ -58,6 +62,8 @@ struct userdata { > Â Â Â Â Â int detect_fds[2]; > Â Â Â Â Â pa_io_event *detect_io; > Â Â Â Â Â unsigned int ioproc_frames; > +Â Â Â Â bool record; > +Â Â Â Â bool playback; > Â Â Â Â Â PA_LLIST_HEAD(ca_device, devices); > Â }; > Â > @@ -87,9 +93,9 @@ static int ca_device_added(struct pa_module *m, > AudioObjectID id) { > Â Â Â Â Â Â Â Â Â return 0; > Â > Â Â Â Â Â if (u->ioproc_frames) > -Â Â Â Â Â Â Â Â args = pa_sprintf_malloc("object_id=%d ioproc_frames=%d", > (int) id, u->ioproc_frames); > +Â Â Â Â Â Â Â Â args = pa_sprintf_malloc("object_id=%d ioproc_frames=%d > record=%d playback=%d", (int) id, u->ioproc_frames, (int) u->record, > (int) u->playback); > Â Â Â Â Â else > -Â Â Â Â Â Â Â Â args = pa_sprintf_malloc("object_id=%d", (int) id); > +Â Â Â Â Â Â Â Â args = pa_sprintf_malloc("object_id=%d record=%d > playback=%d", (int) id, (int) u->record, (int) u->playback); > Â > Â Â Â Â Â pa_log_debug("Loading %s with arguments '%s'", > DEVICE_MODULE_NAME, args); > Â Â Â Â Â mod = pa_module_load(m->core, DEVICE_MODULE_NAME, args); > @@ -212,6 +218,7 @@ int pa__init(pa_module *m) { > Â Â Â Â Â pa_modargs *ma; > Â > Â Â Â Â Â pa_assert(m); > +Â Â Â Â pa_assert(m->core); > Â > Â Â Â Â Â m->userdata = u; > Â > @@ -220,6 +227,16 @@ int pa__init(pa_module *m) { > Â Â Â Â Â Â Â Â Â goto fail; > Â Â Â Â Â } > Â > +Â Â Â Â if (pa_modargs_get_value_boolean(ma, "record", &u->record) < 0 > || pa_modargs_get_value_boolean(ma, "playback", &u->playback) < 0) { > +Â Â Â Â Â Â Â Â pa_log("record= and playback= expect boolean argument."); > +Â Â Â Â Â Â Â Â goto fail; > +Â Â Â Â } > + > +Â Â Â Â if (!u->playback && !u->record) { > +Â Â Â Â Â Â Â Â pa_log("neither playback nor record enabled for device."); > +Â Â Â Â Â Â Â Â goto fail; > +Â Â Â Â } > + > Sorry about the super late review. Shouldn't u->record and u->playback be true by default? -- Arun