[pulseaudio-commits] src/modules
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Mon Jul 9 00:30:16 PDT 2012
src/modules/macosx/module-coreaudio-device.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
New commits:
commit d3cd82d411f9b574678870d8ccd836032a238684
Author: Sjors Gielen <pulseaudio at sjorsgielen.nl>
Date: Sun Jul 8 23:24:18 2012 +0200
osx: Add a single "On" profile to coreaudio devices. Fixes crash on OS X.
Since commit 12af302a last month, cards always have at least one
profile, so there is also always an active_profile (this makes the code
more simple). However, module-coreaudio-device did not create a profile
yet, causing a crash of PulseAudio when used on OS X. This patch fixes
this crash, by adding a single "On" profile. I've also added a TODO for
adding an "Off" profile which removes all sinks and sources -- I can
work on resolving this TODO later on.
diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c
index 47fd1e6..6d39158 100644
--- a/src/modules/macosx/module-coreaudio-device.c
+++ b/src/modules/macosx/module-coreaudio-device.c
@@ -22,6 +22,7 @@
/* TODO:
- implement hardware volume controls
- handle audio device stream format changes (will require changes to the core)
+ - add an "off" mode that removes all sinks and sources
*/
#ifdef HAVE_CONFIG_H
@@ -43,6 +44,7 @@
#include <pulsecore/strbuf.h>
#include <pulsecore/thread.h>
#include <pulsecore/thread-mq.h>
+#include <pulsecore/i18n.h>
#include <CoreAudio/CoreAudio.h>
#include <CoreAudio/CoreAudioTypes.h>
@@ -125,6 +127,10 @@ struct coreaudio_source {
PA_LLIST_FIELDS(coreaudio_source);
};
+static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
+ return 0;
+}
+
static OSStatus io_render_proc (AudioDeviceID device,
const AudioTimeStamp *now,
const AudioBufferList *inputData,
@@ -686,6 +692,7 @@ int pa__init(pa_module *m) {
pa_modargs *ma = NULL;
char tmp[64];
pa_card_new_data card_new_data;
+ pa_card_profile *p;
coreaudio_sink *ca_sink;
coreaudio_source *ca_source;
AudioObjectPropertyAddress property_address;
@@ -733,6 +740,10 @@ int pa__init(pa_module *m) {
if (!err)
u->vendor_name = pa_xstrdup(tmp);
+ /* add on profile */
+ p = pa_card_profile_new("on", _("On"), 0);
+ pa_hashmap_put(card_new_data.profiles, p->name, p);
+
/* create the card object */
u->card = pa_card_new(m->core, &card_new_data);
if (!u->card) {
@@ -742,6 +753,7 @@ int pa__init(pa_module *m) {
pa_card_new_data_done(&card_new_data);
u->card->userdata = u;
+ u->card->set_profile = card_set_profile;
u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
More information about the pulseaudio-commits
mailing list