[pulseaudio-discuss] [PATCH] osx: pass -headerpad_max_install_names to the linker, too
This option won't make it to the actual libtool command which does the linking when not prefixed with -Wl, --- src/Makefile.am |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 23d809d..881f806 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -81,7 +81,7 @@ WINSOCK_LIBS=-lwsock32 -lws2_32 -lwininet endif if OS_IS_DARWIN -AM_LDFLAGS+=-headerpad_max_install_names +AM_LDFLAGS+=-Wl,-headerpad_max_install_names -headerpad_max_install_names endif FOREIGN_CFLAGS = -w -- 1.7.2 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] More patches for better OS X support
On Sat, Apr 23, 2011 at 7:21 PM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Colin Guthrie at 23/04/11 17:51 did gyre and gimble: 'Twas brillig, and Daniel Mack at 22/04/11 13:27 did gyre and gimble: Here goes another round of patches for PulseAudio on OS X. Most patches are small, and none of them should affect other systems than OSX. Thanks as always Daniel. I grabbed all the patches but tweaked the commit messages a little bit, so you'll need a rebase for the next batch. Hope that's OK :) Of course. Thanks for merging! 2. I found that HAVE_PTHREAD_SETNAME_NP was indeed defined on my system, but that it takes two arguments here, not one. This caused build errors for me. That's a shame. I though I could implement it for al platforms which have these functions in a generic way. Oh well. I'll test the changes you pushed, and let you know if I see any problem. Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Semaphore lockup when using threaded mainloops excessively
On Fri, Apr 22, 2011 at 10:58 AM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Colin Guthrie at 01/04/11 14:25 did gyre and gimble: I've pushed this to git master now so that more people can test. I've just be revisiting this one after your pa_poll changes. I tried running two at once and both bailed quite quickly with: Connection (23 of 1000) established. Stream error: Too large Aborted Connection (15 of 1000) established. Stream error: Too large Aborted That is likely a different issue. The abort happened at the same time so both tests aborted at the same time. But I rant it again, and both instances happily ran up to 500 connections each. The only (relevant) place I can see this error occurring is in sink-input.c in pa_sink_input_new() But this should only happen when 32 streams are played on a a sink as each test can use 16 streams I guess there are times when 32 is possible. Perhaps the test should limit it to 15 streams such that this likelyhood is reduced? Anyway a run up to ~500 is pretty good. Is this more or less fixed now do you think? It is indeed fixed by Lennart in commit 575ba65714 (memblockq: decode unset chunks as NULL chunks again) from last night. We had a little session, were able to reproduce it and he fixed it within an hour or so :) Another fix for OSX (only) is in my tree now, I'll send a pull request soon. Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] More patches for better OS X support
Here goes another round of patches for PulseAudio on OS X. Most patches are small, and none of them should affect other systems than OSX. Thanks, Daniel The following changes since commit 575ba65714ab85d81b0e520f348d78c2ae80a6f9: memblockq: decode unset chunks as NULL chunks again (2011-04-21 21:05:58 +0200) are available in the git repository at: git://github.com/zonque/pulseaudio.git osx Daniel Mack (8): osx: add 'ioproc_frames' parameter to module-coreaudio-detect util: implement pa_get_binary_name() for Mac OS X core-rtclock.c: define _POSIX_C_SOURCE locally thread-posix: use pthread_(get|set)name_np() if available module-coreaudio-device: dispatch sink/source state messages from main loop module-coreaudio-device.c: set the thread name to device name module-coreaudio-device.c: fix two build warnings OSX, configure.ac: Make -isysroot and -mmacosx-version-min configurable configure.ac | 21 -- src/modules/macosx/module-coreaudio-detect.c | 23 ++- src/modules/macosx/module-coreaudio-device.c | 94 ++--- src/pulse/util.c | 26 +++ src/pulsecore/core-rtclock.c |4 + src/pulsecore/thread-posix.c | 15 +++- 6 files changed, 130 insertions(+), 53 deletions(-) ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 1/8] osx: add 'ioproc_frames' parameter to module-coreaudio-detect
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. --- src/modules/macosx/module-coreaudio-detect.c | 23 --- 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 263fc72..f4f2ee2 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; -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 2/8] util: implement pa_get_binary_name() for Mac OS X
--- src/pulse/util.c | 26 ++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/src/pulse/util.c b/src/pulse/util.c index c5cfc8c..e44a864 100644 --- a/src/pulse/util.c +++ b/src/pulse/util.c @@ -49,6 +49,11 @@ #include sys/prctl.h #endif +#ifdef OS_IS_DARWIN +#include libgen.h +#include sys/sysctl.h +#endif + #include pulse/xmalloc.h #include pulse/timeval.h @@ -221,6 +226,27 @@ char *pa_get_binary_name(char *s, size_t l) { } #endif +#if OS_IS_DARWIN +{ +int mib[] = { CTL_KERN, KERN_PROCARGS, getpid(), 0 }; +size_t len, nmib = (sizeof(mib) / sizeof(mib[0])) - 1; +char *buf; + +sysctl(mib, nmib, NULL, len, NULL, 0); +buf = (char *) pa_xmalloc(len); + +if (sysctl(mib, nmib, buf, len, NULL, 0) == 0) { +pa_strlcpy(s, basename(buf), l); +pa_xfree(buf); +return s; +} + +pa_xfree(buf); + +/* fall thru */ +} +#endif /* OS_IS_DARWIN */ + errno = ENOENT; return NULL; } -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 3/8] core-rtclock.c: define _POSIX_C_SOURCE locally
Defining this macro on a global level is disadvantageous for other APIs, and as we need it for clock_gettime() only on Mac OS X, define it locally in pulsecore/core-rtclock.c only. --- configure.ac |1 - src/pulsecore/core-rtclock.c |4 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index 5b41bb4..e2b5a6a 100644 --- a/configure.ac +++ b/configure.ac @@ -89,7 +89,6 @@ case $host in AC_DEFINE(__EXTENSIONS__, 1, Needed to get declarations for msg_control and msg_controllen on Solaris) ;; *-*-darwin* ) - AC_DEFINE([_POSIX_C_SOURCE], [200112L], [Needed to get clock_gettime on Mac OS X]) AC_DEFINE([_DARWIN_C_SOURCE], [200112L], [Needed to get NSIG on Mac OS X]) ;; esac diff --git a/src/pulsecore/core-rtclock.c b/src/pulsecore/core-rtclock.c index 331ac11..6632cc6 100644 --- a/src/pulsecore/core-rtclock.c +++ b/src/pulsecore/core-rtclock.c @@ -24,6 +24,10 @@ #include config.h #endif +#ifdef OS_IS_DARWIN +#define _POSIX_C_SOURCE 1 +#endif + #include stddef.h #include time.h #include sys/time.h -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 4/8] thread-posix: use pthread_(get|set)name_np() if available
Newer generations of libpthread have functions to set and get the thread names. If available, use them. --- configure.ac |4 +++- src/pulsecore/thread-posix.c | 15 --- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index e2b5a6a..6f262fb 100644 --- a/configure.ac +++ b/configure.ac @@ -448,6 +448,8 @@ AC_SEARCH_LIBS([shm_open], [rt]) AC_SEARCH_LIBS([inet_ntop], [nsl]) AC_SEARCH_LIBS([timer_create], [rt]) AC_SEARCH_LIBS([pthread_setaffinity_np], [pthread]) +AC_SEARCH_LIBS([pthread_getname_np], [pthread]) +AC_SEARCH_LIBS([pthread_setname_np], [pthread]) # BSD AC_SEARCH_LIBS([connect], [socket]) @@ -489,7 +491,7 @@ AC_FUNC_SELECT_ARGTYPES AC_CHECK_FUNCS_ONCE([chmod chown fstat fchown fchmod clock_gettime getaddrinfo getgrgid_r getgrnam_r \ getpwnam_r getpwuid_r gettimeofday getuid mlock nanosleep \ pipe posix_fadvise posix_madvise posix_memalign setpgid setsid shm_open \ -sigaction sleep symlink sysconf uname pthread_setaffinity_np]) +sigaction sleep symlink sysconf uname pthread_setaffinity_np pthread_getname_np pthread_setname_np]) AC_CHECK_FUNCS([mkfifo], [HAVE_MKFIFO=1], [HAVE_MKFIFO=0]) AM_CONDITIONAL(HAVE_MKFIFO, test x$HAVE_MKFIFO = x1) diff --git a/src/pulsecore/thread-posix.c b/src/pulsecore/thread-posix.c index 7d5252d..ae73267 100644 --- a/src/pulsecore/thread-posix.c +++ b/src/pulsecore/thread-posix.c @@ -71,7 +71,9 @@ static void* internal_thread_func(void *userdata) { pa_thread *t = userdata; pa_assert(t); -#ifdef __linux__ +#ifdef HAVE_PTHREAD_SETNAME_NP +pthread_setname_np(t-name); +#elif defined(__linux__) prctl(PR_SET_NAME, t-name); #endif @@ -175,7 +177,9 @@ void pa_thread_set_name(pa_thread *t, const char *name) { pa_xfree(t-name); t-name = pa_xstrdup(name); -#ifdef __linux__ +#ifdef HAVE_PTHREAD_SETNAME_NP +pthread_setname_np(name); +#elif defined(__linux__) prctl(PR_SET_NAME, name); #endif } @@ -183,7 +187,12 @@ void pa_thread_set_name(pa_thread *t, const char *name) { const char *pa_thread_get_name(pa_thread *t) { pa_assert(t); -#ifdef __linux__ +#ifdef HAVE_PTHREAD_GETNAME_NP +if (!t-name) { +t-name = pa_xmalloc0(17); +pthread_getname_np(t-id, t-name, 16); +} +#elif defined(__linux__) if (!t-name) { t-name = pa_xmalloc(17); -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 5/8] module-coreaudio-device: dispatch sink/source state messages from main loop
This fixes a long standing race condition when tearing down streams on Mac OS X. --- src/modules/macosx/module-coreaudio-device.c | 88 +++--- 1 files changed, 50 insertions(+), 38 deletions(-) diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c index cc4600b..0fad9c5 100644 --- a/src/modules/macosx/module-coreaudio-device.c +++ b/src/modules/macosx/module-coreaudio-device.c @@ -297,26 +297,6 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse *((pa_usec_t *) data) = get_latency_us(PA_OBJECT(o)); return 0; } - -case PA_SINK_MESSAGE_SET_STATE: -switch ((pa_sink_state_t) PA_PTR_TO_UINT(data)) { -case PA_SINK_SUSPENDED: -case PA_SINK_IDLE: -sink-active = FALSE; -break; - -case PA_SINK_RUNNING: -sink-active = TRUE; -break; - -case PA_SINK_UNLINKED: -case PA_SINK_INIT: -case PA_SINK_INVALID_STATE: -; -} - -ca_device_check_device_state(sink-userdata); -break; } return pa_sink_process_msg(o, code, data, offset, chunk); @@ -355,29 +335,34 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off *((pa_usec_t *) data) = get_latency_us(PA_OBJECT(o)); return 0; } +} -case PA_SOURCE_MESSAGE_SET_STATE: -switch ((pa_source_state_t) PA_PTR_TO_UINT(data)) { -case PA_SOURCE_SUSPENDED: -case PA_SOURCE_IDLE: -source-active = FALSE; -break; - -case PA_SOURCE_RUNNING: -source-active = TRUE; -break; - -case PA_SOURCE_UNLINKED: -case PA_SOURCE_INIT: -case PA_SOURCE_INVALID_STATE: -; -} +return pa_source_process_msg(o, code, data, offset, chunk);; +} -ca_device_check_device_state(source-userdata); +static int ca_sink_set_state(pa_sink *s, pa_sink_state_t state) +{ +coreaudio_sink *sink = s-userdata; + +switch (state) { +case PA_SINK_SUSPENDED: +case PA_SINK_IDLE: +sink-active = FALSE; +break; + +case PA_SINK_RUNNING: +sink-active = TRUE; break; + +case PA_SINK_UNLINKED: +case PA_SINK_INIT: +case PA_SINK_INVALID_STATE: +; } -return pa_source_process_msg(o, code, data, offset, chunk); +ca_device_check_device_state(sink-userdata); + +return 0; } static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx) { @@ -461,6 +446,7 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx sink-parent.process_msg = sink_process_msg; sink-userdata = ca_sink; +sink-set_state = ca_sink_set_state; pa_sink_set_asyncmsgq(sink, u-thread_mq.inq); pa_sink_set_rtpoll(sink, u-rtpoll); @@ -473,6 +459,31 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx return 0; } +static int ca_source_set_state(pa_source *s, pa_source_state_t state) +{ +coreaudio_source *source = s-userdata; + +switch (state) { +case PA_SOURCE_SUSPENDED: +case PA_SOURCE_IDLE: +source-active = FALSE; +break; + +case PA_SOURCE_RUNNING: +source-active = TRUE; +break; + +case PA_SOURCE_UNLINKED: +case PA_SOURCE_INIT: +case PA_SOURCE_INVALID_STATE: +; +} + +ca_device_check_device_state(source-userdata); + +return 0; +} + static int ca_device_create_source(pa_module *m, AudioBuffer *buf, int channel_idx) { OSStatus err; UInt32 size; @@ -554,6 +565,7 @@ static int ca_device_create_source(pa_module *m, AudioBuffer *buf, int channel_i source-parent.process_msg = source_process_msg; source-userdata = ca_source; +source-set_state = ca_source_set_state; pa_source_set_asyncmsgq(source, u-thread_mq.inq); pa_source_set_rtpoll(source, u-rtpoll); -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 6/8] module-coreaudio-device.c: set the thread name to device name
This makes gdb's info threads better understandable --- src/modules/macosx/module-coreaudio-device.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c index 0fad9c5..7a1f177 100644 --- a/src/modules/macosx/module-coreaudio-device.c +++ b/src/modules/macosx/module-coreaudio-device.c @@ -759,7 +759,7 @@ int pa__init(pa_module *m) { ca_device_create_streams(m, TRUE); /* create the message thread */ -if (!(u-thread = pa_thread_new(coreaudio, thread_func, u))) { +if (!(u-thread = pa_thread_new(u-device_name, thread_func, u))) { pa_log(Failed to create thread.); goto fail; } -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 7/8] module-coreaudio-device.c: fix two build warnings
--- src/modules/macosx/module-coreaudio-device.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c index 7a1f177..393ce7f 100644 --- a/src/modules/macosx/module-coreaudio-device.c +++ b/src/modules/macosx/module-coreaudio-device.c @@ -393,7 +393,7 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx size = sizeof(tmp); err = AudioObjectGetPropertyData(u-object_id, property_address, 0, NULL, size, tmp); if (err || !strlen(tmp)) -snprintf(tmp, sizeof(tmp), Channel %d, property_address.mElement); +snprintf(tmp, sizeof(tmp), Channel %d, (int) property_address.mElement); if (i 0) pa_strbuf_puts(strbuf, , ); @@ -512,7 +512,7 @@ static int ca_device_create_source(pa_module *m, AudioBuffer *buf, int channel_i size = sizeof(tmp); err = AudioObjectGetPropertyData(u-object_id, property_address, 0, NULL, size, tmp); if (err || !strlen(tmp)) -snprintf(tmp, sizeof(tmp), Channel %d, property_address.mElement); +snprintf(tmp, sizeof(tmp), Channel %d, (int) property_address.mElement); if (i 0) pa_strbuf_puts(strbuf, , ); -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 8/8] OSX, configure.ac: Make -isysroot and -mmacosx-version-min configurable
--- configure.ac | 16 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 6f262fb..980d148 100644 --- a/configure.ac +++ b/configure.ac @@ -172,6 +172,13 @@ AC_ARG_ENABLE(mac-universal, AS_HELP_STRING([--enable-mac-universal], [Build Mac universal binaries]), enable_mac_universal=$enableval, enable_mac_universal=no) +AC_ARG_WITH(mac-version-min, +AS_HELP_STRING([--with-mac-version-min=version], [Defines the earliest version of MacOS X that the executables will run on.]), + mac_version_min=$withval, mac_version_min=10.5) + +AC_ARG_WITH(mac-sysroot, +AS_HELP_STRING([--with-mac-sysroot=path], [SDK basedir to use as the logical root directory for headers and libraries.]), + mac_sysroot=$withval, mac_sysroot=/Developer/SDKs/MacOSX10.5.sdk) AC_MSG_CHECKING([target operating system]) case $host in @@ -183,12 +190,13 @@ case $host in AC_MSG_RESULT([darwin]) pulse_target_os=darwin +LDFLAGS=$LDFLAGS -isysroot $mac_sysroot -mmacosx-version-min=$mac_version_min +CFLAGS=$CFLAGS -isysroot $mac_sysroot -mmacosx-version-min=$mac_version_min + if test x$enable_mac_universal = xyes ; then - mac_version_min=-mmacosx-version-min=10.5 mac_arches=-arch i386 -arch x86_64 -mac_sysroot=-isysroot /Developer/SDKs/MacOSX10.5.sdk -LDFLAGS=$LDFLAGS $mac_arches $mac_sysroot $mac_version_min -CFLAGS=$CFLAGS $CFLAGS $mac_arches $mac_sysroot $mac_version_min +LDFLAGS=$LDFLAGS $mac_arches +CFLAGS=$CFLAGS $mac_arches fi ;; *) -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] pa_poll(): Simplify detectin of invalid fds in select() emulation mode
On Thu, Apr 14, 2011 at 7:07 PM, Sean McNamara smc...@gmail.com wrote: Hi, On Thu, Apr 14, 2011 at 9:57 AM, Daniel Mack zon...@gmail.com wrote: On Thu, Apr 14, 2011 at 3:53 PM, Maarten Bosmans mkbosm...@gmail.com wrote: 2011/4/14 Daniel Mack zon...@gmail.com: On Thu, Apr 14, 2011 at 12:46 AM, Maarten Bosmans mkbosm...@gmail.com wrote: return (fd = 0) (fcntl(fd, F_GETFL) != -1); For Windows, both fcntl and F_GETFL are not available. Sigh. Ok, thanks for the feedback. Attached is a new patch which keeps things as they are for Windows but fixes the problem for OS X. That should do it, yes. +#else /* !OS_IS_WINDOWS */ Minor: this is not exactly the symbol used in the #ifdef. Ok. Anyway, isn't the #else only supposed to be used for OSX? In that case the comment should probably say so. No, it's actually really a workaround for Windows as we don't have fcntl() there. (Just curious - the header file does exist, right? I saw it being included by quite a lot of other source files in the PA tree ...) The fcntl.h header *does* exist in MSVC (and in MingW...) but the core Microsoft C Runtime doesn't actually export the fcntl function. On Windows, fcntl header only exists to expose the O_* hexadecimal #defines for the flags for the open() call, which *is* supported. The only fcntl on Windows comes if you use an alternative C library, such as Cygwin's port of newlib or glibc. The native stack doesn't supply it. Ok, thanks for expaining. Colin, can you pick the latest patch from this thread then and apply? Or do you want me to push it and send a pull request? Thanks, everone. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] pa_poll(): Simplify detectin of invalid fds in select() emulation mode
On Thu, Apr 14, 2011 at 3:53 PM, Maarten Bosmans mkbosm...@gmail.com wrote: 2011/4/14 Daniel Mack zon...@gmail.com: On Thu, Apr 14, 2011 at 12:46 AM, Maarten Bosmans mkbosm...@gmail.com wrote: return (fd = 0) (fcntl(fd, F_GETFL) != -1); For Windows, both fcntl and F_GETFL are not available. Sigh. Ok, thanks for the feedback. Attached is a new patch which keeps things as they are for Windows but fixes the problem for OS X. That should do it, yes. +#else /* !OS_IS_WINDOWS */ Minor: this is not exactly the symbol used in the #ifdef. Ok. Anyway, isn't the #else only supposed to be used for OSX? In that case the comment should probably say so. No, it's actually really a workaround for Windows as we don't have fcntl() there. (Just curious - the header file does exist, right? I saw it being included by quite a lot of other source files in the PA tree ...) Daniel 0001-pa_poll-Simplify-detection-of-invalid-fds-in-select-.patch Description: Binary data ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Please help me to understand this
On Wed, Apr 13, 2011 at 6:03 PM, Claude Frantz claudefrantzx...@lavabit.com wrote: Hello ! While running a program, it entered a fatal error state. See about the backtrace when running under gdb. I'm not sure if this is an error in pulseaudio and if this bug is known. AFAIK, this bug is not known, and I haven't seen any such effects yet. Which program is that? Can you reproduce the bug? To me, it smells like a memory corruption outside the PulseAudio code, but that's just guessing. Could you try running the binary in valgrind? Maybe that shows anything. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Please help me to understand this
On Wed, Apr 13, 2011 at 7:15 PM, Claude Frantz claudefrantzx...@lavabit.com wrote: On 04/13/2011 06:32 PM, Daniel Mack wrote: AFAIK, this bug is not known, and I haven't seen any such effects yet. Which program is that? The program is wspr. It is started whith python and it includes some modules in FORTRAN and C. Can you reproduce the bug? Yes ! To me, it smells like a memory corruption outside the PulseAudio code, but that's just guessing. Could you try running the binary in valgrind? Maybe that shows anything. I have tried it. You will find attached some extract from the output. The invalid write sounds suspicious. I assume the test binaries from the PulseAudio source tree work fine for you? I think you need to put some more efford in debugging this. IOW, go ahead and build a minimal PortAudio tool and see if it also shows the bug. Or go the other way around and strip down the program you use and see if you can get it to the point where it doesn't crash anymore. Sorry I can't provide more information at this point, but please keep us posted about anything you find. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] pa_poll(): Simplify detectin of invalid fds in select() emulation mode
Attached is a patch to fix for one out of the few problems I still fight with on OS X. I'm not sure whether this change breaks Windows support, so I'd be happy if someone could give it a try. Thanks, Daniel 0001-pa_poll-Simplify-detectin-of-invalid-fds-in-select-e.patch Description: Binary data ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] keys for raop server
2011/4/11 Rémi Denis-Courmont r...@remlab.net: On Mon, 11 Apr 2011 12:39:38 +0200, Tomasz Torcz to...@pipebreaker.pl wrote: Some interested in adding server functionality to PA, using attached key? On a side note, I understood (from an Apple AirPort engineer) that there is no need to do the cryptographic stuff to SEND to an ApEx. If it's true, then many hoops in PulseAudio and VLC's RAOP outputs are nasically redumdant. Of course, for an RAOP input, you do need the cryptography (if the remote client asks). I'm not sure how well this fits into PulseAudio though? It does not have a decoder for Apple Lossless, does it? That's true. Streaming from another Mac would also only be interesting for iTunes, as all other applications are not (natively) able to stream to an Airport Express. However, a thing that really could be cool is streaming Music from an iPhone to a computer running PulseAudio. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] LAC2011: Linux Audio Conference - Are you going?
On Thu, Apr 7, 2011 at 5:18 PM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and David Henningsson at 07/04/11 12:52 did gyre and gimble: On 2011-04-06 23:46, Kurt Taylor wrote: It looks like I might be able to go to LAC. I can see about scheduling a PulseAudio workgroup time and space with the LAC folks or nearby. If so, you should coordinate with Colin Guthrie (coling on IRC). So, I need a headcount ASAP, are you going? I'll be going, I'll arrive Thursday evening and leave Sunday afternoon. Ditto on the timings. Lennart is also going but not yet sure of his schedule. Would you be interested in a PulseAudio meetup and working session? Yes. If so, what agenda items? Everything :-) Continuation on what and when for master/PA 1.0. FWIW, I'll be there, giving a talk about PulseAudio on Mac OS X. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] pa_simple_free
On Thu, Apr 7, 2011 at 7:15 PM, patrick pured...@11h11.com wrote: more informations about our problem: in thread-mainloop.c void pa_threaded_mainloop_stop(pa_threaded_mainloop *m) { ... // freeze here: pa_mutex_lock(m-mutex); ... } what would be the cause? it stop at pa_mutex_lock(m-mutex). what can i do to fix this problem? any advice is more than welcome. Are your calling pa_threaded_mainloop_stop() while the mainloop is locked? IOW, did you call pa_threaded_mainloop_lock() without pa_threaded_mainloop_unlock() before? Quoting the documentation: void pa_threaded_mainloop_stop( pa_threaded_mainloop * m ) Terminate the event loop thread cleanly. Make sure to unlock the mainloop object before calling this function. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] alignment trap and pulseaudio being kiled
On Mon, Apr 4, 2011 at 8:45 PM, Baek Chang baek...@ccrma.stanford.edu wrote: Hi, Trying to debug pulseaudio 0.9.22 and I am seeing some alignment trap warnings from kernel [ 1564.095562] Alignment trap: alsa-sink (5580) PC=0x2ab2ca3c Instr=0xe1ca00d0 Address=0x2af9302a FSR 0x011 [ 1564.095597] Alignment trap: alsa-sink (5580) PC=0x2ab2ca68 Instr=0xe0ca00f8 Address=0x2af9302a FSR 0x811 [ 1564.113377] Alignment trap: alsa-sink (5580) PC=0x2ab2ca3c Instr=0xe1ca00d0 Address=0x2af93032 FSR 0x011 [ 1564.122811] Alignment trap: alsa-sink (5580) PC=0x2ab2ca68 Instr=0xe0ca00f8 Address=0x2af93032 FSR 0x811 [ 1564.132240] Alignment trap: alsa-sink (5580) PC=0x2ab2ca3c Instr=0xe1ca00d0 Address=0x2af9303a FSR 0x011 [ 1564.141703] Alignment trap: alsa-sink (5580) PC=0x2ab2ca68 Instr=0xe0ca00f8 Address=0x2af9303a FSR 0x811 [ 1564.151195] Alignment trap: alsa-sink (5580) PC=0x2ab2ca3c Instr=0xe1ca00d0 Address=0x2af93042 FSR 0x011 [ 1564.160625] Alignment trap: alsa-sink (5580) PC=0x2ab2ca68 Instr=0xe0ca00f8 Address=0x2af93042 FSR 0x811 [ 1564.170065] Alignment trap: alsa-sink (5580) PC=0x2ab2ca3c Instr=0xe1ca00d0 Address=0x2af9304a FSR 0x011 I tried connecting to gdb and reproducing the issue, the problem is that pulseaudio doesn't crash, but eventually terminates. Any ideas on how to debug this? You can tell your kernel to terminate processes which cause an alignment trap immediately: echo 5 /proc/cpu/alignment. That should make gdb stop right at the instruction causing it. Also see $kernelsrc/Documentation/arm/mem_alignment. But note that this setting is for your whole system, and not done on a per-process level. However, I dare to doubt that the alignment trap is your problem after all. Such exceptions are normally just silently fixed in the background, and the only effect you could possibly see is performance drawbacks. Anyway, it would be nice to fix them. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Semaphore lockup when using threaded mainloops excessively
On Fri, Apr 1, 2011 at 1:02 PM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Daniel Mack at 31/03/11 18:16 did gyre and gimble: Could you try to run multiple instances of the test binary at the same time? Yeah, I should be able to get around to this on Sunday... doubt I will manage before then sadly. Does anyone else have any idea about the startup backtrace Daniel has... this is obviously rather worrying... (just out of curiosity, I presume there is no chance you're accidentally using your system PA's modules or similar wierdness? (especially libpulsecommon.so which is unversioned - perhaps stracing will help double check). No, this is certainly not the reason. On OS X, there is no PulseAudio preinstalled of course, and on Linux, I called libtool --mode exec gdb pulseaudio to make sure the correct libs are used at runtime. Despite the fact that the daemon shouldn't crash regardless what the client throws at it, I wonder whether my example test is actually valid. Does it do anything bogus? Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Semaphore lockup when using threaded mainloops excessively
Hi Colin, On Fri, Apr 1, 2011 at 2:28 PM, Colin Guthrie gm...@colin.guthr.ie wrote: Oh jeez... I just realised I misread on of your mails (it was a long day, I was tired better excuse goes here). No worries :) I thought you were saying your daemon crashed on *startup* on linux... before your test was run :s No, the startup is fine. The bug is about some sort of race condition when starting up and tearing down runloops, contexts and streams in a wild manner and very excessively from a client. I happend to trigger these category of bugs during my development of the PulseAudio driver for OS X, and I wrote the test to minimize the amount of code it needs to reproduce it. Even though the test results in slightly different effects (on the daemon's side) for OS X and Linux, I think it could be the same kind of bug after all. From the backtrace on Linux, it looks like a message is not fully queued or dequeued, and hence the payload is corrupted. A similar thing could have caused a semaphore not to be posted which makes the daemon hang on OS X. I'll debug this further, but I still know too less about the internal async messages that are being passed around, the queues and all the locking theory. Maybe Lennart can shed some light? Will take a look at your test to see if I can reproduce here, but as I said before, it may not be until Sunday... hopefully some of the others can chime in. No hurries, and thanks for caring :) Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Semaphore lockup when using threaded mainloops excessively
On Fri, Apr 1, 2011 at 3:25 PM, Colin Guthrie gm...@colin.guthr.ie wrote: I've now run the test twice all the way through and not had a crash. This is either good or bad news depending on your take on it. Could be that the faster your machine, the less likely you are to trigger the bug. Maybe more instances of the test running concurrently might help? I tested on a Netbook featuring an Atom CPU. I've pushed this to git master now so that more people can test. Great, thank you. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] Semaphore lockup when using threaded mainloops excessively
Hi, I'm experiencing a strange sort of a race condition or a stale semaphore when using threaded mainloops excessively. It's somehow tricky to debug as it might take hunderts of iterations to trigger. I wrote a little test that might help hunt this issue. What it does is: it continuously creates new threaded mainloops, connects to the local PulseAudio server instance, creates some streams and starts them. Asynchronously, from the main thread, it tears down the streams, the context and the mainloop and starts over again, all based on random timing. After a while, the server refuses new connections and hangs, and its backtrace reads as follows: #0 0x7fff86d912ee in semaphore_timedwait_trap () #1 0x7fff80f831de in MPWaitOnSemaphore () #2 0x0001001a5ca3 in pa_semaphore_wait (s=0x10081b4b0) at pulsecore/semaphore-osx.c:61 #3 0x00010001fd9b in pa_asyncmsgq_send (a=0x100c295c0, object=0x101861400, code=11, userdata=0x1, offset=0, chunk=0x0) at pulsecore/asyncmsgq.c:169 #4 0x00010005dc5e in sink_set_state (s=0x101861400, state=PA_SINK_IDLE) at pulsecore/sink.c:415 #5 0x00010005f58c in pa_sink_update_status (s=0x101861400) at pulsecore/sink.c:672 #6 0x0001000557db in pa_sink_input_unlink (i=0x101886e00) at pulsecore/sink-input.c:540 #7 0x000100bb38e5 in playback_stream_unlink (s=0x100c33ac0) at pulsecore/protocol-native.c:731 #8 0x000100bb5432 in native_connection_unlink (c=0x10081b4d0) at pulsecore/protocol-native.c:1241 #9 0x000100bc10ef in pstream_die_callback (p=0x10081c3f0, userdata=0x10081b4d0) at pulsecore/protocol-native.c:4537 #10 0x000100190de6 in do_something (p=0x10081c3f0) at pulsecore/pstream.c:196 #11 0x000100190f64 in io_callback (io=0x100c2f770, userdata=0x10081c3f0) at pulsecore/pstream.c:209 #12 0x00010017 in callback (m=0x100809be8, e=0x100c31700, fd=9, f=PA_IO_EVENT_HANGUP, userdata=0x100c2f770) at pulsecore/iochannel.c:161 #13 0x000100112642 in dispatch_pollfds (m=0x100809b90) at pulse/mainloop.c:681 #14 0x0001001133e0 in pa_mainloop_dispatch (m=0x100809b90) at pulse/mainloop.c:931 #15 0x00010011355e in pa_mainloop_iterate (m=0x100809b90, block=1, retval=0x7fff5fbff614) at pulse/mainloop.c:962 #16 0x0001001135ba in pa_mainloop_run (m=0x100809b90, retval=0x7fff5fbff614) at pulse/mainloop.c:977 #17 0x000100010336 in main (argc=5, argv=0x7fff5fbff768) at daemon/main.c:1135 #18 0x0001695c in start () I'm on Mac OS X, so it could be a platform specific issue, but maybe more test coverage shows the problem on other platforms as well. I also exchanged the semaphore implementation for an alternative, but that didn't help. Attached is a patch to add the test to the tree. Am I doing anything wrong? Thanks for trying this test on your machines and for sharing your ideas :) Daniel 0001-tests-add-a-connection-stress-test.patch Description: Binary data ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Semaphore lockup when using threaded mainloops excessively
On Thu, Mar 31, 2011 at 3:02 PM, Daniel Mack zon...@gmail.com wrote: I'm on Mac OS X, so it could be a platform specific issue, but maybe more test coverage shows the problem on other platforms as well. I also exchanged the semaphore implementation for an alternative, but that didn't help. Attached is a patch to add the test to the tree. Am I doing anything wrong? I tried this test on a Linux machine now, with PulseAudio built from the current git HEAD. Interestingly, the daemon (started with -vvv) crashes reproducible, and the last lines of debug output are: D: alsa-sink.c: Latency set to 371.52ms D: alsa-sink.c: hwbuf_unused=4 D: alsa-sink.c: setting avail_min=15503 E: mcalign.c: Assertion 'l 0' failed at pulsecore/mcalign.c:202, function pa_mcalign_csize(). Aborting. Does that ring a bell to anyone? I'll try to debug this further, but hope for some input :) Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Semaphore lockup when using threaded mainloops excessively
Hi Colin, On Thu, Mar 31, 2011 at 6:20 PM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Daniel Mack at 31/03/11 17:08 did gyre and gimble: On Thu, Mar 31, 2011 at 3:02 PM, Daniel Mack zon...@gmail.com wrote: I'm on Mac OS X, so it could be a platform specific issue, but maybe more test coverage shows the problem on other platforms as well. I also exchanged the semaphore implementation for an alternative, but that didn't help. Attached is a patch to add the test to the tree. Am I doing anything wrong? I tried this test on a Linux machine now, with PulseAudio built from the current git HEAD. Interestingly, the daemon (started with -vvv) crashes reproducible, and the last lines of debug output are: D: alsa-sink.c: Latency set to 371.52ms D: alsa-sink.c: hwbuf_unused=4 D: alsa-sink.c: setting avail_min=15503 E: mcalign.c: Assertion 'l 0' failed at pulsecore/mcalign.c:202, function pa_mcalign_csize(). Aborting. Does that ring a bell to anyone? I'll try to debug this further, but hope for some input :) Hmm, not seen this one. I'm running git master as of a couple commits back and I certainly don't get that :s A backtrace from the assertion would be useful... It takes a lot longer to trigger in gdb, but here we go: #0 0xb7fe1424 in __kernel_vsyscall () #1 0xb7a4c941 in raise () from /lib/libc.so.6 #2 0xb7a4fe42 in abort () from /lib/libc.so.6 #3 0xb7c97dbc in pa_mcalign_csize (m=0xae33cb38, l=0) at pulsecore/mcalign.c:202 #4 0xb7ca07c4 in pa_memblockq_push_align (bq=0xae31fde8, chunk=0xb34ab1ec) at pulsecore/memblockq.c:779 #5 0xb7fb1d06 in sink_input_process_msg (o=0xae30f380, code=11, userdata=0x0, offset=8192, chunk=0xb34ab1ec) at pulsecore/protocol-native.c:1381 #6 0xb7ce2a92 in pa_asyncmsgq_dispatch (object=0xae30f380, code=11, userdata=0x0, offset=8192, memchunk=0xb34ab1ec) at pulsecore/asyncmsgq.c:324 #7 0xb7d06944 in asyncmsgq_read_work (i=0x808df68) at pulsecore/rtpoll.c:565 #8 0xb7d05592 in pa_rtpoll_run (p=0x808c5b0, wait_op=true) at pulsecore/rtpoll.c:239 #9 0xb7e3bc93 in thread_func (userdata=0x808cf48) at modules/alsa/alsa-sink.c:1550 #10 0xb7cbc4b3 in internal_thread_func (userdata=0x809ae90) at pulsecore/thread-posix.c:83 #11 0xb7bb8cc9 in start_thread () from /lib/libpthread.so.0 #12 0xb7af269e in clone () from /lib/libc.so.6 $ ./pulseaudio --version pulseaudio 1.0-dev-227-g6041 $ uname -a Linux wok 2.6.38-020638-generic #201103151303 SMP Tue Mar 15 14:33:40 UTC 2011 i686 GNU/Linux Could you try to run multiple instances of the test binary at the same time? Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Race condition in threaded mainloop
Replying to myself. On Mon, Mar 28, 2011 at 12:21 PM, Daniel Mack zon...@gmail.com wrote: As this seems so obvious, and the code has been around for some years, I wonder whether I miss anything obvious here. Is there any mutex (which doesn't work yet on OS X) that should protect the mainloop from this race? I attached a patch ready to fix this issue for me, but I'm not sure whether there is more code left which fails for similar assumptions. Forget about this patch. My assumption of what the threaded mainloop API is in charge for was wrong. There is only one single execution path in the whole thing and the API is not thread safe. The documentation also states that. So I need to dig deeper. Sorry for the confusion. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] Race condition in threaded mainloop
Hi, when developing PulseAudio clients with a threaded mainloop (on OS X in my case), I came across an effect which causes my client to crash out early with a failed assertion like Assertion 'c-defer_event == e' failed at pulsecore/socket-client.c:172, function connect_defer_cb(). Aborting. Searching for this issue didn't reveal much, except that there has been other people seeing this: https://bugzilla.redhat.com/show_bug.cgi?id=497650 Looking at the code, it seems obvious that this is a simple race condition. In do_connect(), pulsecore/socket-client.c:210, we have this: c-defer_event = c-mainloop-defer_new(c-mainloop, connect_defer_cb, c); and defer_new() calls pa_mainloop_wakeup() before it returns. So in a threaded mainloop, it could be that the defered event has already been dispatched before defer_new() returns. However, c-defer_event is assigned *after* defer_new() returns, and hence the assertion fails consequently. The same counts for defer_enable() in some cases, as the event is enabled by default and could have been executed already, so disabling it after the mainloop was woken up has no effect. As this seems so obvious, and the code has been around for some years, I wonder whether I miss anything obvious here. Is there any mutex (which doesn't work yet on OS X) that should protect the mainloop from this race? I attached a patch ready to fix this issue for me, but I'm not sure whether there is more code left which fails for similar assumptions. Thanks, Daniel 0001-mainloop-api-fix-race-condition-in-defer_new.patch Description: Binary data ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Help with pulsaudio
On Thu, Mar 24, 2011 at 6:39 PM, Yousif, Amgad (UK) amgad.you...@baesystems.com wrote: Hi I wanted some help with using pulsaudio to getting sound from a server machine to a client machine. Please let me know the best person to contact for this. This should help you: http://pulseaudio.org/wiki/NetworkSetup Thanks Amgad This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. I wouldn't expect anyone to answer to your email with such a disclaimer. You sent the mail to a list and not to individual people, so how can I know whether I am priviledged? Please drop such footers when posting to public mailing lists. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] More patches for OS X
On Sun, Mar 20, 2011 at 6:39 PM, Daniel Mack zon...@gmail.com wrote: Hi, I'm catching up with my work on PulseAudio for OS X and have some patches ready I would like to get merged. Ok, I fixed all the minor issues that were reported and pushed out again. Same URL: git://github.com/zonque/pulseaudio.git osx Many thanks for the feedback! Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] More patches for OS X
On Mon, Mar 21, 2011 at 12:39 AM, Daniel Mack zon...@gmail.com wrote: On Sun, Mar 20, 2011 at 6:39 PM, Daniel Mack zon...@gmail.com wrote: Hi, I'm catching up with my work on PulseAudio for OS X and have some patches ready I would like to get merged. Ok, I fixed all the minor issues that were reported and pushed out again. Same URL: git://github.com/zonque/pulseaudio.git osx Does anybody want me to resend the patches to the list or are you fine with checking them from the repository? Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] More patches for OS X
Hi, I'm catching up with my work on PulseAudio for OS X and have some patches ready I would like to get merged. Feedback welcome, as always. Thanks, Daniel The following changes since commit f7acd4bdab7092700a9386802a0ec86d4362e58c: log: Add a new log target to a file descriptor (2011-03-18 12:32:51 +) are available in the git repository at: git://github.com/zonque/pulseaudio.git osx Daniel Mack (5): module-coreaudio-detect: fix pa__done() osx: re-order module locations osx: add -headerpad_max_install_names to LDFLAGS configure.ac: add --mac-universal directive for OS X osx: add routines for real-time thread scheduling configure.ac | 13 +++ src/Makefile.am| 11 -- src/modules/{ = macosx}/module-bonjour-publish.c |0 .../module-coreaudio-detect.c |5 +-- .../module-coreaudio-device.c |0 src/pulsecore/core-util.c | 37 +++- 6 files changed, 58 insertions(+), 8 deletions(-) rename src/modules/{ = macosx}/module-bonjour-publish.c (100%) rename src/modules/{coreaudio = macosx}/module-coreaudio-detect.c (98%) rename src/modules/{coreaudio = macosx}/module-coreaudio-device.c (100%) ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 1/5] module-coreaudio-detect: fix pa__done()
From: Daniel Mack dan...@caiaq.de This would have crashed when unloading the module. --- src/modules/coreaudio/module-coreaudio-detect.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/src/modules/coreaudio/module-coreaudio-detect.c b/src/modules/coreaudio/module-coreaudio-detect.c index 1d26b84..fda1f17 100644 --- a/src/modules/coreaudio/module-coreaudio-detect.c +++ b/src/modules/coreaudio/module-coreaudio-detect.c @@ -231,13 +231,10 @@ fail: } void pa__done(pa_module *m) { -struct userdata *u; +struct userdata *u = m-userdata; struct ca_device *dev = u-devices; AudioObjectPropertyAddress property_address; -pa_assert(m); -pa_assert_se(u = m-userdata); - property_address.mSelector = kAudioHardwarePropertyDevices; property_address.mScope = kAudioObjectPropertyScopeGlobal; property_address.mElement = kAudioObjectPropertyElementMaster; -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 5/5] osx: add routines for real-time thread scheduling
Code sniplets are based on examples provided by Apple. See http://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html --- src/pulsecore/core-util.c | 37 - 1 files changed, 36 insertions(+), 1 deletions(-) diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index a713cae..5747f6e 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -107,6 +107,10 @@ #ifdef __APPLE__ #include xlocale.h +#include mach/mach_init.h +#include mach/thread_act.h +#include mach/thread_policy.h +#include sys/sysctl.h #endif #ifdef HAVE_DBUS @@ -685,7 +689,38 @@ static int set_scheduler(int rtprio) { * the thread is already realtime, don't do anything. */ int pa_make_realtime(int rtprio) { -#ifdef _POSIX_PRIORITY_SCHEDULING +#if defined(OS_IS_DARWIN) +struct thread_time_constraint_policy ttcpolicy; +uint64_t freq = 0; +size_t size = sizeof(freq); +int ret; + +ret = sysctlbyname(hw.cpufrequency, freq, size, NULL, 0); +if (ret 0) { +pa_log_info(Unable to read CPU frequency using sysctlbyname()); +return 0; +} + +pa_log_debug(sysctl for hw.cpufrequency: %llu, freq); + +/* See http://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html */ +ttcpolicy.period = freq / 160; +ttcpolicy.computation = freq / 3300; +ttcpolicy.constraint = freq / 2200; +ttcpolicy.preemptible = 1; + +ret = thread_policy_set(mach_thread_self(), +THREAD_TIME_CONSTRAINT_POLICY, +(thread_policy_t) ttcpolicy, +THREAD_TIME_CONSTRAINT_POLICY_COUNT); +if (ret) +pa_log_info(Unable to set real-time thread priority (%d)., ret); +else +pa_log_info(Successfully set real-time thread priority.); + +return ret; + +#elif _POSIX_PRIORITY_SCHEDULING int p; if (set_scheduler(rtprio) = 0) { -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 4/5] configure.ac: add --mac-universal directive for OS X
On a system with all depency libs built as multi-arch binaries, this option can now be used to build fat Mach-O binaries for multiple architectures. --- configure.ac | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index 5a78ffb..78b37c4 100644 --- a/configure.ac +++ b/configure.ac @@ -169,6 +169,11 @@ AC_ARG_ENABLE([atomic-arm-memory-barrier], esac ],) +AC_ARG_ENABLE(mac-universal, +AS_HELP_STRING([--enable-mac-universal], [Build Mac universal binaries]), + enable_mac_universal=$enableval, enable_mac_universal=no) + + AC_MSG_CHECKING([target operating system]) case $host in *-*-linux*) @@ -178,6 +183,14 @@ case $host in *-*-darwin*) AC_MSG_RESULT([darwin]) pulse_target_os=darwin + +if test x$enable_mac_universal = xyes ; then + mac_version_min=-mmacosx-version-min=10.5 +mac_arches=-arch i386 -arch x86_64 +mac_sysroot=-isysroot /Developer/SDKs/MacOSX10.5.sdk +LDFLAGS=$LDFLAGS $mac_arches $mac_sysroot $mac_version_min +CFLAGS=$CFLAGS $CFLAGS $mac_arches $mac_sysroot $mac_version_min +fi ;; *) AC_MSG_RESULT([unknown]) -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 3/5] osx: add -headerpad_max_install_names to LDFLAGS
This is needed for sufficient padding of library names in linked binaries. --- src/Makefile.am |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index ff98ddb..c182483 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -82,6 +82,11 @@ FOREIGN_CFLAGS = -w MODULE_LDFLAGS = $(AM_LDFLAGS) -module -disable-static -avoid-version $(LDFLAGS_NOUNDEFINED) MODULE_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINOR@.la libpulsecommon-@PA_MAJORMINOR@.la libpulse.la +if OS_IS_DARWIN +AM_LDFLAGS+=-headerpad_max_install_names +MODULE_LDFLAGS+=-headerpad_max_install_names +endif + ### # Extra files# ### -- 1.7.1 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 1/5] module-coreaudio-detect: fix pa__done()
On Mar 20, 2011 7:15 PM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Daniel Mack at 20/03/11 17:39 did gyre and gimble: From: Daniel Mack dan...@caiaq.de This would have crashed when unloading the module. --- src/modules/coreaudio/module-coreaudio-detect.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/src/modules/coreaudio/module-coreaudio-detect.c b/src/modules/coreaudio/module-coreaudio-detect.c index 1d26b84..fda1f17 100644 --- a/src/modules/coreaudio/module-coreaudio-detect.c +++ b/src/modules/coreaudio/module-coreaudio-detect.c @@ -231,13 +231,10 @@ fail: } void pa__done(pa_module *m) { -struct userdata *u; +struct userdata *u = m-userdata; struct ca_device *dev = u-devices; AudioObjectPropertyAddress property_address; -pa_assert(m); -pa_assert_se(u = m-userdata); - property_address.mSelector = kAudioHardwarePropertyDevices; property_address.mScope = kAudioObjectPropertyScopeGlobal; property_address.mElement = kAudioObjectPropertyElementMaster; From what I can see, most modules are still calling pa_assert(m) so it's probably better to keep the assert in there and just move the dev = u-devices line lower. Other than that the other patches are all fine. Ok, can you add it back and amend the patch? I think that would be easier than resending :-) Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] add two more ALSA audio card profiles
From: Daniel Mack dan...@caiaq.de This adds profiles for Native Instruments recently announced Audio 6 DJ and Audio 10DJ. --- src/Makefile.am|2 + .../profile-sets/native-instruments-audio10dj.conf | 131 .../profile-sets/native-instruments-audio6dj.conf | 92 ++ 3 files changed, 225 insertions(+), 0 deletions(-) create mode 100644 src/modules/alsa/mixer/profile-sets/native-instruments-audio10dj.conf create mode 100644 src/modules/alsa/mixer/profile-sets/native-instruments-audio6dj.conf diff --git a/src/Makefile.am b/src/Makefile.am index 2ab6355..b5d20a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1107,7 +1107,9 @@ dist_alsaprofilesets_DATA = \ modules/alsa/mixer/profile-sets/default.conf \ modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf \ modules/alsa/mixer/profile-sets/native-instruments-audio4dj.conf \ + modules/alsa/mixer/profile-sets/native-instruments-audio6dj.conf \ modules/alsa/mixer/profile-sets/native-instruments-audio8dj.conf \ + modules/alsa/mixer/profile-sets/native-instruments-audio10dj.conf \ modules/alsa/mixer/profile-sets/native-instruments-traktorkontrol-s4.conf \ modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf diff --git a/src/modules/alsa/mixer/profile-sets/native-instruments-audio10dj.conf b/src/modules/alsa/mixer/profile-sets/native-instruments-audio10dj.conf new file mode 100644 index 000..4deb65d --- /dev/null +++ b/src/modules/alsa/mixer/profile-sets/native-instruments-audio10dj.conf @@ -0,0 +1,131 @@ +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +; Native Instruments Audio 10 DJ +; +; This card has five stereo pairs of input and five stereo pairs of +; output +; +; We knowingly only define a subset of the theoretically possible +; mapping combinations as profiles here. +; +; See default.conf for an explanation on the directives used here. + +[General] +auto-profiles = no + +[Mapping analog-stereo-out-main] +description = Analog Stereo Main +device-strings = hw:%f,0,0 +channel-map = left,right + +[Mapping analog-stereo-out-a] +description = Analog Stereo Channel A +device-strings = hw:%f,0,1 +channel-map = left,right +direction = output + +[Mapping analog-stereo-out-b] +description = Analog Stereo Channel B +device-strings = hw:%f,0,1 +channel-map = left,right +direction = output + +[Mapping analog-stereo-out-c] +description = Analog Stereo Channel C +device-strings = hw:%f,0,2 +channel-map = left,right +direction = output + +[Mapping analog-stereo-out-d] +description = Analog Stereo Channel D +device-strings = hw:%f,0,3 +channel-map = left,right +direction = output + +[Mapping analog-stereo-in-main] +description = Analog Stereo Main +device-strings = hw:%f,0,0 +channel-map = left,right + +[Mapping analog-stereo-in-a] +description = Analog Stereo Channel A +device-strings = hw:%f,0,1 +channel-map = left,right +direction = input + +[Mapping analog-stereo-in-b] +description = Analog Stereo Channel B +device-strings = hw:%f,0,1 +channel-map = left,right +direction = input + +[Mapping analog-stereo-in-c] +description = Analog Stereo Channel C +device-strings = hw:%f,0,2 +channel-map = left,right +direction = input + +[Mapping analog-stereo-in-d] +description = Analog Stereo Channel D +device-strings = hw:%f,0,3 +channel-map = left,right +direction = input + + + + +[Profile output:analog-stereo-all+input:analog-stereo-all] +description = Analog Stereo Duplex Channels Main, A, B, C, D +output-mappings = analog-stereo-out-main analog-stereo-out-a analog-stereo-out-b analog-stereo-out-c analog-stereo-out-d +input-mappings = analog-stereo-in-main analog-stereo-in-a analog-stereo-in-b analog-stereo-in-c analog-stereo-in-d +priority = 100 +skip-probe = yes + +[Profile output:analog-stereo-main+input:analog-stereo-main] +description = Analog Stereo Duplex Main +output-mappings = analog-stereo-out-main +input-mappings = analog-stereo-in-main +priority = 50 +skip-probe = yes + +[Profile output:analog-stereo-a+input:analog-stereo-a] +description = Analog Stereo Duplex Channel A +output-mappings = analog-stereo-out-a +input
[pulseaudio-discuss] [PATCH] add two more ALSA audio card profiles
From: Daniel Mack dan...@caiaq.de This adds profiles for Native Instruments recently announced Trator Audio 6 and Traktor Audio 10. --- Forget the other patch - it was missing the 90-pulseaudio.rules changes and the name of the two new sound cards weren't correct. src/Makefile.am|2 + .../alsa/mixer/profile-sets/90-pulseaudio.rules|2 + .../native-instruments-traktor-audio10.conf| 131 .../native-instruments-traktor-audio6.conf | 92 ++ 4 files changed, 227 insertions(+), 0 deletions(-) create mode 100644 src/modules/alsa/mixer/profile-sets/native-instruments-traktor-audio10.conf create mode 100644 src/modules/alsa/mixer/profile-sets/native-instruments-traktor-audio6.conf diff --git a/src/Makefile.am b/src/Makefile.am index 2ab6355..b5d20a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1107,7 +1107,9 @@ dist_alsaprofilesets_DATA = \ modules/alsa/mixer/profile-sets/default.conf \ modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf \ modules/alsa/mixer/profile-sets/native-instruments-audio4dj.conf \ + modules/alsa/mixer/profile-sets/native-instruments-audio6dj.conf \ modules/alsa/mixer/profile-sets/native-instruments-audio8dj.conf \ + modules/alsa/mixer/profile-sets/native-instruments-audio10dj.conf \ modules/alsa/mixer/profile-sets/native-instruments-traktorkontrol-s4.conf \ modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf diff --git a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules index f964b00..0329340 100644 --- a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules +++ b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules @@ -24,6 +24,8 @@ SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==1978, ENV{PULSE_ SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==0839, ENV{PULSE_PROFILE_SET}=native-instruments-audio4dj.conf SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==baff, ENV{PULSE_PROFILE_SET}=native-instruments-traktorkontrol-s4.conf SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==4711, ENV{PULSE_PROFILE_SET}=native-instruments-korecontroller.conf +SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==1011, ENV{PULSE_PROFILE_SET}=native-instruments-traktor-audio6.conf +SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==1021, ENV{PULSE_PROFILE_SET}=native-instruments-traktor-audio10.conf SUBSYSTEMS==usb, ATTRS{idVendor}==0763, ATTRS{idProduct}==2012, ENV{PULSE_PROFILE_SET}=maudio-fasttrack-pro.conf LABEL=pulseaudio_end diff --git a/src/modules/alsa/mixer/profile-sets/native-instruments-traktor-audio10.conf b/src/modules/alsa/mixer/profile-sets/native-instruments-traktor-audio10.conf new file mode 100644 index 000..4deb65d --- /dev/null +++ b/src/modules/alsa/mixer/profile-sets/native-instruments-traktor-audio10.conf @@ -0,0 +1,131 @@ +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +; Native Instruments Audio 10 DJ +; +; This card has five stereo pairs of input and five stereo pairs of +; output +; +; We knowingly only define a subset of the theoretically possible +; mapping combinations as profiles here. +; +; See default.conf for an explanation on the directives used here. + +[General] +auto-profiles = no + +[Mapping analog-stereo-out-main] +description = Analog Stereo Main +device-strings = hw:%f,0,0 +channel-map = left,right + +[Mapping analog-stereo-out-a] +description = Analog Stereo Channel A +device-strings = hw:%f,0,1 +channel-map = left,right +direction = output + +[Mapping analog-stereo-out-b] +description = Analog Stereo Channel B +device-strings = hw:%f,0,1 +channel-map = left,right +direction = output + +[Mapping analog-stereo-out-c] +description = Analog Stereo Channel C +device-strings = hw:%f,0,2 +channel-map = left,right +direction = output + +[Mapping analog-stereo-out-d] +description = Analog Stereo Channel D +device-strings = hw:%f,0,3 +channel-map = left,right +direction = output + +[Mapping analog-stereo-in-main] +description = Analog Stereo Main +device-strings = hw:%f
Re: [pulseaudio-discuss] MacOS X Support
On Mar 2, 2011 8:16 AM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Maarten Bosmans at 02/03/11 09:51 did gyre and gimble: 2011/2/27 Stephen Lee sl33...@gmail.com: I git clone'd master yesterday, successfully compiled, and ran PA on my MacOS X machine. I was pleasantly surprised to see the Coreaudio modules! I successfully tunnelled audio from one of my Linux machines to my MacOS X w/o using esound, but I noticed that iTunes wasn't included as a client when I was playing it and then checking list-clients from the PA cli. That is of course expected, as iTunes and other mac apps are not pulse clients. So you have several applications playing audio connected to the CoreAudio subsystem and PulseAudio is one of them. This is the same situation as on Linux, where pulse connects to ALSA and applications that don't use libpulse but connect directly to ALSA cannot be manipulated by pulse. There is however a way to make PulseAudio your default ALSA device, so that even apps that only use libasound are connected to pulse, all be it in a bit of a roundabout way. IIRC Daniel Mack (who wrote most of the OSX support in recent years in PA) was intending on writing (perhaps intending is too strong a word tho'!) a virtual CoreAudio device that is PulseAudio that would work in the same way that the ALSA-Pulse stuff work on Linux. I'm not sure if he ever got around to that or not. IIRC he's still rather active on the alsa-devel mailing list. It may be worth asking him? Actually I've CC'ed him. Perhaps he can reply with more accurate comments. Jep, I have plans to continue my work on the OS X port, and finish the virtual audio driver I was working on. Currently, this is all just prove of concept, but I'm confident that it will be really useful once it's finished. At the moment, I am travelling, but once I'm back in some weeks, I will hopefully find some time to catch up with this project. I'll post updates on this list, of course. Generally, what's the plan for being able to manipulate native MacOS X clients/streams via PA? It'd be great to replace the AirTunes (AirPlay) functionality that Apple offers. If this functionality is still a work in progress, is there a workaround? The workaround would be to use an audio player that output to PulseAudio, like vlc, rhythmbox, banshee, amarok, though I don't have a clue whether these are ported to OSX and are able to use libpulse there. While I don't know, I strongly suspect that VLC on mac is not compiled with PA support No, that would't make sense either. What we need is generic way to get audio from all CoreAudio applications, without modifing them. I'm working on this, stay tuned :-) Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Windows binaries
On Feb 26, 2011 10:00 PM, Sean McNamara smc...@gmail.com wrote: Hi, On Fri, Feb 25, 2011 at 8:28 AM, Maarten Bosmans mkbosm...@gmail.com wrote: As the patches that make it possible to build pulse on win32 should land in master any moment now, I thought it would be a good time to make the binaries available for download. This is amazing work! I'm able to play audio from Ubuntu to Win32 over a gigabit ethernet crossover cable (to spare the latency of the router), using Ubuntu 11.04 on the Linux side. No dropouts. I remember doing this a long time ago, but it wasn't nearly as reliable or robust. I've tested several simultaneous streams, with no detectable problems, with Synergy desktop sharing going over the same connection. Interesting! As I'm currently working on a port to Mac OS X, I'm curious if anyone has plans to add a way to redirect audio from native Windows applications (ASIO, WDM) to PulseAudio. I believe it would be mandatory to hack a kernel driver to provide a virtual sound card for sinks and sources, just like on OS X. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Windows binaries
On Mar 2, 2011 9:32 PM, Sean McNamara smc...@gmail.com wrote: On Wed, Mar 2, 2011 at 7:10 PM, Daniel Mack zon...@gmail.com wrote: On Feb 26, 2011 10:00 PM, Sean McNamara smc...@gmail.com wrote: Hi, On Fri, Feb 25, 2011 at 8:28 AM, Maarten Bosmans mkbosm...@gmail.com wrote: As the patches that make it possible to build pulse on win32 should land in master any moment now, I thought it would be a good time to make the binaries available for download. This is amazing work! I'm able to play audio from Ubuntu to Win32 over a gigabit ethernet crossover cable (to spare the latency of the router), using Ubuntu 11.04 on the Linux side. No dropouts. I remember doing this a long time ago, but it wasn't nearly as reliable or robust. I've tested several simultaneous streams, with no detectable problems, with Synergy desktop sharing going over the same connection. Interesting! As I'm currently working on a port to Mac OS X, I'm curious if anyone has plans to add a way to redirect audio from native Windows applications (ASIO, WDM) to PulseAudio. I believe it would be mandatory to hack a kernel driver to provide a virtual sound card for sinks and sources, just like on OS X. Or you can use the fact that module-waveout supports a source, coupled with a pre-existing Windows device driver that provides a loopback, to do something like this: But such a driver doesn't exist yet, correct? Windows audio app (DSound, WinMM, WaveOut, KS, WASAPI-Shared, etc.) == playback of device which supports loopback Loopback comes out of kernel as a capture channel == captured in PA server on Windows via module-waveout == module-loopback == module-tunnel-sink == (network) == remote PA server on another computer. Admittedly this is less efficient, but mucking around in the Windows kernel carries around a lot more baggage than with other kernels. You have to get it digitally signed if you want to run it on 64-bit OSes. You have to test it to make sure it works on Windows XP 32-bit, XP 64-bit, Vista/7 32-bit and Vista/7 64-bit. And 99.% of Windows users have no idea how to build kernel code (nor do they have the tools to do so), so you have to ship binaries. All in all, a really ugly task that will be difficult to maintain. I know, Windows is a total disaster, especially in kernel space. We had so much trouble with driver development already, it's unbelievable. However, it would maybe suffice to just support some versions of Windows, and skip the legacy. If you do decide to go the kernel route, make the actual kernel bits as lightweight as possible to be resilient against PA protocol changes and such. Hopefully the kernel bits would be write once, use with any version of PA for a long time to come. It should be completely independent from PA and just function as a loop-trough virtual device which communicates with the userspace via a simple protocol (for sample rate configuration etc) and exports its audio buffers as shared memory. A userspace part would then be in charge to connect this interface to PulseAudio. I personally have no clue about Windows development, and I would like to keep it that way. Any volounteers with appropriate knowledge? :-) Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] alsa-mixer: add profile for Native Instruments Korecontroller
On Fri, Oct 15, 2010 at 7:06 PM, zon...@gmail.com wrote: From: Daniel Mack dan...@caiaq.de --- src/Makefile.am|3 +- .../alsa/mixer/profile-sets/90-pulseaudio.rules|3 + .../native-instruments-korecontroller.conf | 85 3 files changed, 90 insertions(+), 1 deletions(-) create mode 100644 src/modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf Just wanted to make sure this isn't lost. Can anyone apply that patch? Thanks, Daniel diff --git a/src/Makefile.am b/src/Makefile.am index e55c31c..87f1178 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1100,7 +1100,8 @@ dist_alsaprofilesets_DATA = \ modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf \ modules/alsa/mixer/profile-sets/native-instruments-audio4dj.conf \ modules/alsa/mixer/profile-sets/native-instruments-audio8dj.conf \ - modules/alsa/mixer/profile-sets/native-instruments-traktorkontrol-s4.conf + modules/alsa/mixer/profile-sets/native-instruments-traktorkontrol-s4.conf \ + modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf if HAVE_UDEV dist_udevrules_DATA = \ diff --git a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules index 7a425b5..2c3821b 100644 --- a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules +++ b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules @@ -22,7 +22,10 @@ KERNEL!=card*, GOTO=pulseaudio_end SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==1978, ENV{PULSE_PROFILE_SET}=native-instruments-audio8dj.conf SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==0839, ENV{PULSE_PROFILE_SET}=native-instruments-audio4dj.conf +SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==1010, ENV{PULSE_PROFILE_SET}=native-instruments-audio6dj.conf +SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==1021, ENV{PULSE_PROFILE_SET}=native-instruments-audio10dj.conf SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==baff, ENV{PULSE_PROFILE_SET}=native-instruments-traktorkontrol-s4.conf +SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==4711, ENV{PULSE_PROFILE_SET}=native-instruments-korecontroller.conf SUBSYSTEMS==usb, ATTRS{idVendor}==0763, ATTRS{idProduct}==2012, ENV{PULSE_PROFILE_SET}=maudio-fasttrack-pro.conf LABEL=pulseaudio_end diff --git a/src/modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf b/src/modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf new file mode 100644 index 000..904357d --- /dev/null +++ b/src/modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf @@ -0,0 +1,85 @@ +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +; Native Instruments Kore Controller +; +; This card has one stereo pairs of input and two stereo pairs of +; output, named Master and Headphone. The master channel has +; an additional Coax S/PDIF connector which is always on. +; +; We knowingly only define a subset of the theoretically possible +; mapping combinations as profiles here. +; +; See default.conf for an explanation on the directives used here. + +[General] +auto-profiles = no + +[Mapping analog-stereo-master-out] +description = Analog Stereo Master Channel +device-strings = hw:%f,0,0 +channel-map = left,right + +[Mapping analog-stereo-headphone-out] +description = Analog Stereo Headphone Channel +device-strings = hw:%f,0,1 +channel-map = left,right +direction = output + +[Mapping analog-stereo-input] +description = Analog Stereo +device-strings = hw:%f,0,0 +channel-map = left,right +direction = input + +[Profile output:analog-stereo-all+input:analog-stereo-all] +description = Analog Stereo Duplex Master Output, Headphones Output +output-mappings = analog-stereo-master-out analog-stereo-headphone-out +input-mappings = analog-stereo-input +priority = 100 +skip-probe = yes + +[Profile output:analog-stereo-master+input:analog-stereo-input] +description = Analog Stereo Duplex Master Output +output-mappings = analog-stereo-master-out +input-mappings = analog-stereo-input +priority = 40 +skip-probe = yes
[pulseaudio-discuss] [PATCH] alsa-mixer: add profile for Native Instruments Korecontroller
--- src/Makefile.am|3 +- .../alsa/mixer/profile-sets/90-pulseaudio.rules|3 + .../native-instruments-korecontroller.conf | 85 3 files changed, 90 insertions(+), 1 deletions(-) create mode 100644 src/modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf diff --git a/src/Makefile.am b/src/Makefile.am index e55c31c..87f1178 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1100,7 +1100,8 @@ dist_alsaprofilesets_DATA = \ modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf \ modules/alsa/mixer/profile-sets/native-instruments-audio4dj.conf \ modules/alsa/mixer/profile-sets/native-instruments-audio8dj.conf \ - modules/alsa/mixer/profile-sets/native-instruments-traktorkontrol-s4.conf + modules/alsa/mixer/profile-sets/native-instruments-traktorkontrol-s4.conf \ + modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf if HAVE_UDEV dist_udevrules_DATA = \ diff --git a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules index 7a425b5..2c3821b 100644 --- a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules +++ b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules @@ -22,7 +22,10 @@ KERNEL!=card*, GOTO=pulseaudio_end SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==1978, ENV{PULSE_PROFILE_SET}=native-instruments-audio8dj.conf SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==0839, ENV{PULSE_PROFILE_SET}=native-instruments-audio4dj.conf +SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==1010, ENV{PULSE_PROFILE_SET}=native-instruments-audio6dj.conf +SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==1021, ENV{PULSE_PROFILE_SET}=native-instruments-audio10dj.conf SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==baff, ENV{PULSE_PROFILE_SET}=native-instruments-traktorkontrol-s4.conf +SUBSYSTEMS==usb, ATTRS{idVendor}==17cc, ATTRS{idProduct}==4711, ENV{PULSE_PROFILE_SET}=native-instruments-korecontroller.conf SUBSYSTEMS==usb, ATTRS{idVendor}==0763, ATTRS{idProduct}==2012, ENV{PULSE_PROFILE_SET}=maudio-fasttrack-pro.conf LABEL=pulseaudio_end diff --git a/src/modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf b/src/modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf new file mode 100644 index 000..904357d --- /dev/null +++ b/src/modules/alsa/mixer/profile-sets/native-instruments-korecontroller.conf @@ -0,0 +1,85 @@ +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +; Native Instruments Kore Controller +; +; This card has one stereo pairs of input and two stereo pairs of +; output, named Master and Headphone. The master channel has +; an additional Coax S/PDIF connector which is always on. +; +; We knowingly only define a subset of the theoretically possible +; mapping combinations as profiles here. +; +; See default.conf for an explanation on the directives used here. + +[General] +auto-profiles = no + +[Mapping analog-stereo-master-out] +description = Analog Stereo Master Channel +device-strings = hw:%f,0,0 +channel-map = left,right + +[Mapping analog-stereo-headphone-out] +description = Analog Stereo Headphone Channel +device-strings = hw:%f,0,1 +channel-map = left,right +direction = output + +[Mapping analog-stereo-input] +description = Analog Stereo +device-strings = hw:%f,0,0 +channel-map = left,right +direction = input + +[Profile output:analog-stereo-all+input:analog-stereo-all] +description = Analog Stereo Duplex Master Output, Headphones Output +output-mappings = analog-stereo-master-out analog-stereo-headphone-out +input-mappings = analog-stereo-input +priority = 100 +skip-probe = yes + +[Profile output:analog-stereo-master+input:analog-stereo-input] +description = Analog Stereo Duplex Master Output +output-mappings = analog-stereo-master-out +input-mappings = analog-stereo-input +priority = 40 +skip-probe = yes + +[Profile output:analog-stereo-headphone-out+input:analog-stereo-input] +description = Analog Stereo Headphones Output +output-mappings = analog-stereo-headphone-out +input-mappings = analog-stereo-input +priority =
Re: [pulseaudio-discuss] Two identical USB sound-cards - second card fails to load because card-name found in hashmap.
On Sun, Aug 22, 2010 at 04:12:43PM +0200, Ivar Mossin wrote: On Sun, Aug 22, 2010 at 2:52 AM, Daniel Mack dan...@caiaq.de wrote: Can you post the output of lsusb -v with both cards connected? Thanks, Daniel Daniel: I'm not sure how the output of lsusb -v will help the issue as both cards are working in ALSA, What it shows is that these cards don't offer a serial number string. If they did, the behaviour would be different IIRC. BTW, just out of curiosity: did you ever try to connect these two cards to a Windows machine? At least years ago, Microsoft's insanely ugly-smelling low-level USB stack would completely freak out for two identical devices with no serial number. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Two identical USB sound-cards - second card fails to load because card-name found in hashmap.
On Sat, Aug 21, 2010 at 09:51:17PM +0200, Ivar Mossin wrote: I'm having problems loading two identical sound-cards in my computer. I'm using Ubuntu 9.10 and PulseAudio 0.9.19 coming with this release. Can you post the output of lsusb -v with both cards connected? Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] modules/coreaudio: replace deprecated functions
Hi Lennart, I'm afraid this is getting lost. Can you apply? Thanks, Daniel On Fri, Mar 19, 2010 at 05:32:21PM +0100, Daniel Mack wrote: All API calls are now consolidated in AudioObject* calls, the old model has been deprecated in 10.6. Follow that change. --- src/modules/coreaudio/module-coreaudio-detect.c | 66 +--- src/modules/coreaudio/module-coreaudio-device.c | 126 +++--- 2 files changed, 135 insertions(+), 57 deletions(-) diff --git a/src/modules/coreaudio/module-coreaudio-detect.c b/src/modules/coreaudio/module-coreaudio-detect.c index 872678e..6172a18 100644 --- a/src/modules/coreaudio/module-coreaudio-detect.c +++ b/src/modules/coreaudio/module-coreaudio-detect.c @@ -1,7 +1,7 @@ /*** This file is part of PulseAudio. - Copyright 2009 Daniel Mack dan...@caiaq.de + Copyright 2009,2010 Daniel Mack dan...@caiaq.de PulseAudio is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -46,7 +46,7 @@ PA_MODULE_USAGE(); typedef struct ca_device ca_device; struct ca_device { -AudioDeviceID id; +AudioObjectID id; unsigned int module_index; PA_LLIST_FIELDS(ca_device); }; @@ -58,15 +58,31 @@ struct userdata { PA_LLIST_HEAD(ca_device, devices); }; -static int ca_device_added(struct pa_module *m, AudioDeviceID id) { +static int ca_device_added(struct pa_module *m, AudioObjectID id) { +AudioObjectPropertyAddress property_address; +OSStatus err; pa_module *mod; struct userdata *u = m-userdata; struct ca_device *dev; -char *args; +char *args, tmp[64]; +UInt32 size; pa_assert(u); -args = pa_sprintf_malloc(device_id=%d, (int) id); +/* To prevent generating a black hole that will suck us in, + don't create sources/sinks for PulseAudio virtual devices */ + +property_address.mSelector = kAudioDevicePropertyDeviceManufacturer; +property_address.mScope = kAudioObjectPropertyScopeGlobal; +property_address.mElement = kAudioObjectPropertyElementMaster; + +size = sizeof(tmp); +err = AudioObjectGetPropertyData(id, property_address, 0, NULL, size, tmp); + +if (!err strcmp(tmp, pulseaudio.org) == 0) +return 0; + +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); @@ -87,26 +103,30 @@ static int ca_device_added(struct pa_module *m, AudioDeviceID id) { } static int ca_update_device_list(struct pa_module *m) { +AudioObjectPropertyAddress property_address; OSStatus err; UInt32 i, size, num_devices; -Boolean writable; AudioDeviceID *device_id; struct ca_device *dev; struct userdata *u = m-userdata; pa_assert(u); +property_address.mSelector = kAudioHardwarePropertyDevices; +property_address.mScope = kAudioObjectPropertyScopeGlobal; +property_address.mElement = kAudioObjectPropertyElementMaster; + /* get the number of currently available audio devices */ -err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, size, writable); +err = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, property_address, 0, NULL, size); if (err) { -pa_log(Unable to get info for kAudioHardwarePropertyDevices.); +pa_log(Unable to get data size for kAudioHardwarePropertyDevices.); return -1; } num_devices = size / sizeof(AudioDeviceID); device_id = pa_xnew(AudioDeviceID, num_devices); -err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, size, device_id); +err = AudioObjectGetPropertyData(kAudioObjectSystemObject, property_address, 0, NULL, size, device_id); if (err) { pa_log(Unable to get kAudioHardwarePropertyDevices.); pa_xfree(device_id); @@ -140,7 +160,7 @@ scan_removed: } if (!found) { -pa_log_debug(device id %d has been removed (module index %d) %p, (unsigned int) dev-id, dev-module_index, dev); +pa_log_debug(object id %d has been removed (module index %d) %p, (unsigned int) dev-id, dev-module_index, dev); pa_module_unload_request_by_index(m-core, dev-module_index, TRUE); PA_LLIST_REMOVE(ca_device, u-devices, dev); pa_xfree(dev); @@ -153,15 +173,17 @@ scan_removed: return 0; } -static OSStatus property_listener_proc(AudioHardwarePropertyID property, void *data) { -struct userdata *u = data; +static OSStatus property_listener_proc(AudioObjectID objectID, UInt32 numberAddresses, + const AudioObjectPropertyAddress inAddresses[], + void *clientData) +{ +struct
Re: [pulseaudio-discuss] Pulse and Ipod Touch?
On Tue, Mar 30, 2010 at 08:41:47AM -0400, Ken Mandelberg wrote: Is there a way to use pulseaudio on a Linux box to send its audio to an Ipod Touch over wifi? Implementing PA for the iPhone app and for Android is on my list of things to do when I'm really bored. If you find time to help, that would be much appreciated ;) I think you would need to re-implement the native protocol on Apple's/Google's API - using a full libpulse version seems imposible to me. But I might be mistaken, I never tried that. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] modules/coreaudio: replace deprecated functions
All API calls are now consolidated in AudioObject* calls, the old model has been deprecated in 10.6. Follow that change. --- src/modules/coreaudio/module-coreaudio-detect.c | 66 +--- src/modules/coreaudio/module-coreaudio-device.c | 126 +++--- 2 files changed, 135 insertions(+), 57 deletions(-) diff --git a/src/modules/coreaudio/module-coreaudio-detect.c b/src/modules/coreaudio/module-coreaudio-detect.c index 872678e..6172a18 100644 --- a/src/modules/coreaudio/module-coreaudio-detect.c +++ b/src/modules/coreaudio/module-coreaudio-detect.c @@ -1,7 +1,7 @@ /*** This file is part of PulseAudio. - Copyright 2009 Daniel Mack dan...@caiaq.de + Copyright 2009,2010 Daniel Mack dan...@caiaq.de PulseAudio is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -46,7 +46,7 @@ PA_MODULE_USAGE(); typedef struct ca_device ca_device; struct ca_device { -AudioDeviceID id; +AudioObjectID id; unsigned int module_index; PA_LLIST_FIELDS(ca_device); }; @@ -58,15 +58,31 @@ struct userdata { PA_LLIST_HEAD(ca_device, devices); }; -static int ca_device_added(struct pa_module *m, AudioDeviceID id) { +static int ca_device_added(struct pa_module *m, AudioObjectID id) { +AudioObjectPropertyAddress property_address; +OSStatus err; pa_module *mod; struct userdata *u = m-userdata; struct ca_device *dev; -char *args; +char *args, tmp[64]; +UInt32 size; pa_assert(u); -args = pa_sprintf_malloc(device_id=%d, (int) id); +/* To prevent generating a black hole that will suck us in, + don't create sources/sinks for PulseAudio virtual devices */ + +property_address.mSelector = kAudioDevicePropertyDeviceManufacturer; +property_address.mScope = kAudioObjectPropertyScopeGlobal; +property_address.mElement = kAudioObjectPropertyElementMaster; + +size = sizeof(tmp); +err = AudioObjectGetPropertyData(id, property_address, 0, NULL, size, tmp); + +if (!err strcmp(tmp, pulseaudio.org) == 0) +return 0; + +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); @@ -87,26 +103,30 @@ static int ca_device_added(struct pa_module *m, AudioDeviceID id) { } static int ca_update_device_list(struct pa_module *m) { +AudioObjectPropertyAddress property_address; OSStatus err; UInt32 i, size, num_devices; -Boolean writable; AudioDeviceID *device_id; struct ca_device *dev; struct userdata *u = m-userdata; pa_assert(u); +property_address.mSelector = kAudioHardwarePropertyDevices; +property_address.mScope = kAudioObjectPropertyScopeGlobal; +property_address.mElement = kAudioObjectPropertyElementMaster; + /* get the number of currently available audio devices */ -err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, size, writable); +err = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, property_address, 0, NULL, size); if (err) { -pa_log(Unable to get info for kAudioHardwarePropertyDevices.); +pa_log(Unable to get data size for kAudioHardwarePropertyDevices.); return -1; } num_devices = size / sizeof(AudioDeviceID); device_id = pa_xnew(AudioDeviceID, num_devices); -err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, size, device_id); +err = AudioObjectGetPropertyData(kAudioObjectSystemObject, property_address, 0, NULL, size, device_id); if (err) { pa_log(Unable to get kAudioHardwarePropertyDevices.); pa_xfree(device_id); @@ -140,7 +160,7 @@ scan_removed: } if (!found) { -pa_log_debug(device id %d has been removed (module index %d) %p, (unsigned int) dev-id, dev-module_index, dev); +pa_log_debug(object id %d has been removed (module index %d) %p, (unsigned int) dev-id, dev-module_index, dev); pa_module_unload_request_by_index(m-core, dev-module_index, TRUE); PA_LLIST_REMOVE(ca_device, u-devices, dev); pa_xfree(dev); @@ -153,15 +173,17 @@ scan_removed: return 0; } -static OSStatus property_listener_proc(AudioHardwarePropertyID property, void *data) { -struct userdata *u = data; +static OSStatus property_listener_proc(AudioObjectID objectID, UInt32 numberAddresses, + const AudioObjectPropertyAddress inAddresses[], + void *clientData) +{ +struct userdata *u = clientData; char dummy = 1; pa_assert(u); /* dispatch module load/unload operations in main thread */ -if (property == kAudioHardwarePropertyDevices) -write(u-detect_fds[1], dummy, 1); +write(u-detect_fds[1], dummy, 1
[pulseaudio-discuss] PulseAudio 'git describe'
Hi, on a freshly clones pulseaudio.git, I see this: $ git log --pretty=one | head -1 5248a584a36d49b745c1891954e9aa5e689e89a2 build-sys: Mention dbus support in the summary $ git describe v0.9.19-492-g5248a58 But: $ grep LIBPULSE_VERSION_INFO configure.ac AC_SUBST(LIBPULSE_VERSION_INFO, [12:2:12]) The commit for that v0.9.21 (06327b1e67a) is not part of the master branch. Am I missing anything? Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] don't build the once-test binary on OS X
--- src/Makefile.am |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 2978b8f..6c0b4d8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -294,7 +294,6 @@ TESTS_BINARIES = \ hook-list-test \ memblock-test \ thread-test \ - once-test \ flist-test \ asyncq-test \ asyncmsgq-test \ @@ -340,6 +339,11 @@ TESTS_BINARIES += \ alsa-time-test endif +if !OS_IS_DARWIN +TESTS_BINARIES += \ + once-test +endif + if BUILD_TESTS_DEFAULT noinst_PROGRAMS = $(TESTS_BINARIES) else -- 1.6.6 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] osx: add native zeroconf implementation via Bonjour
On Tue, Jan 05, 2010 at 10:55:11PM +0100, Lennart Poettering wrote: On Thu, 10.12.09 15:21, Daniel Mack (dan...@caiaq.de) wrote: --- configure.ac |4 + src/Makefile.am | 13 + src/modules/module-bonjour-publish.c | 516 ++ 3 files changed, 533 insertions(+), 0 deletions(-) create mode 100644 src/modules/module-bonjour-publish.c This patch is also available at git://github.com/zonque/pulseaudio.git topic/bonjour but note that this applies on top of the coreaudio patches I sent around. I figure the topic/osx branch carries this, too, right? Yes, that happend during one of my rebasing session, sorry for not mentioning. And thanks for merging the whole thing. Unless I caused any bad regression, nobody should currently bother as I appear to be the only user of my code ;) Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] osx: add native zeroconf implementation via Bonjour
Avahi and dbus is too heavy for OSX just for the sake of publishing our services via mDNS/Zeroconf. Apple has its own Zeroconf implementation called Bonjour, and this patch adds a module that implements service announcement with that API. All data gathering is copied from module-zeroconf-publish.c, but unfortunately the code there is too specifically made for avahi, so I couldn't factor it out to reuse it. --- configure.ac |4 + src/Makefile.am | 13 + src/modules/module-bonjour-publish.c | 516 ++ 3 files changed, 533 insertions(+), 0 deletions(-) create mode 100644 src/modules/module-bonjour-publish.c diff --git a/configure.ac b/configure.ac index 11af89b..6b540e4 100644 --- a/configure.ac +++ b/configure.ac @@ -423,8 +423,12 @@ if test x$os_is_darwin = x1 ; then AC_MSG_RESULT([ok]) AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Using clock_gettime() replacement]) +HAVE_BONJOUR=1 fi +AC_SUBST(HAVE_BONJOUR) +AM_CONDITIONAL([HAVE_BONJOUR], [test x$HAVE_BONJOUR = x1]) + Check for functions # ISO diff --git a/src/Makefile.am b/src/Makefile.am index fa5d170..0224cb3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1123,6 +1123,11 @@ modlibexec_LTLIBRARIES += \ module-zeroconf-discover.la endif +if HAVE_BONJOUR +modlibexec_LTLIBRARIES += \ + module-bonjour-publish.la +endif + if HAVE_LIRC modlibexec_LTLIBRARIES += \ module-lirc.la @@ -1231,6 +1236,7 @@ SYMDEF_FILES = \ modules/module-esound-sink-symdef.h \ modules/module-zeroconf-publish-symdef.h \ modules/module-zeroconf-discover-symdef.h \ + modules/module-bonjour-publish-symdef.h \ modules/module-lirc-symdef.h \ modules/module-mmkbd-evdev-symdef.h \ modules/module-http-protocol-tcp-symdef.h \ @@ -1548,6 +1554,13 @@ module_zeroconf_discover_la_LDFLAGS = $(MODULE_LDFLAGS) module_zeroconf_discover_la_LIBADD = $(AM_LIBADD) $(AVAHI_LIBS) libavahi-wrap.la libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la module_zeroconf_discover_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS) +# Bonjour + +module_bonjour_publish_la_SOURCES = modules/module-bonjour-publish.c +module_bonjour_publish_la_LDFLAGS = $(MODULE_LDFLAGS) \ + -Wl,-framework -Wl,CoreFoundation -framework CoreFoundation +module_bonjour_publish_la_LIBADD = libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la + # LIRC module_lirc_la_SOURCES = modules/module-lirc.c diff --git a/src/modules/module-bonjour-publish.c b/src/modules/module-bonjour-publish.c new file mode 100644 index 000..81b5976 --- /dev/null +++ b/src/modules/module-bonjour-publish.c @@ -0,0 +1,516 @@ +/*** + This file is part of PulseAudio. + + Copyright 2009 Daniel Mack + based on module-zeroconf-publish.c + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include stdio.h +#include stdlib.h +#include string.h +#include unistd.h +#include dns_sd.h + +#include CoreFoundation/CoreFoundation.h + +#include pulse/xmalloc.h +#include pulse/util.h + +#include pulsecore/parseaddr.h +#include pulsecore/sink.h +#include pulsecore/source.h +#include pulsecore/native-common.h +#include pulsecore/core-util.h +#include pulsecore/log.h +#include pulsecore/core-subscribe.h +#include pulsecore/dynarray.h +#include pulsecore/modargs.h +#include pulsecore/avahi-wrap.h +#include pulsecore/endianmacros.h +#include pulsecore/protocol-native.h + +#include module-bonjour-publish-symdef.h + +PA_MODULE_AUTHOR(Daniel Mack); +PA_MODULE_DESCRIPTION(Mac OS X Bonjour Service Publisher); +PA_MODULE_VERSION(PACKAGE_VERSION); +PA_MODULE_LOAD_ONCE(TRUE); + +#define SERVICE_TYPE_SINK _pulse-sink._tcp +#define SERVICE_TYPE_SOURCE _pulse-source._tcp +#define SERVICE_TYPE_SERVER _pulse-server._tcp + +static const char* const valid_modargs[] = { +NULL +}; + +enum service_subtype { +SUBTYPE_HARDWARE, +SUBTYPE_VIRTUAL, +SUBTYPE_MONITOR +}; + +struct service { +struct userdata *userdata; +DNSServiceRef service; +DNSRecordRef rec, rec2; +char *service_name
[pulseaudio-discuss] [PATCH] fix a number of warnings
most of them were due to missing #ifdefs or wrong printf format type for [s]size_t. --- src/daemon/daemon-conf.c |4 src/pulsecore/core-util.c |4 ++-- src/pulsecore/envelope.c |8 +++- src/pulsecore/sink-input.c | 12 +++- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index bfd5c11..79dd49a 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -466,6 +466,7 @@ static int parse_rtprio(const char *filename, unsigned line, const char *section return 0; } +#ifdef HAVE_DBUS static int parse_server_type(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; @@ -481,6 +482,7 @@ static int parse_server_type(const char *filename, unsigned line, const char *se return 0; } +#endif int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { int r = -1; @@ -666,12 +668,14 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) { [PA_LOG_ERROR] = error }; +#ifdef HAVE_DBUS static const char* const server_type_to_string[] = { [PA_SERVER_TYPE_UNSET] = !!UNSET!!, [PA_SERVER_TYPE_USER] = user, [PA_SERVER_TYPE_SYSTEM] = system, [PA_SERVER_TYPE_NONE] = none }; +#endif pa_strbuf *s; char cm[PA_CHANNEL_MAP_SNPRINT_MAX]; diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index d596c48..b64c51e 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -580,8 +580,8 @@ char *pa_strlcpy(char *b, const char *s, size_t l) { static int set_scheduler(int rtprio) { struct sched_param sp; -int r; #ifdef HAVE_DBUS +int r; DBusError error; DBusConnection *bus; @@ -628,7 +628,7 @@ static int set_scheduler(int rtprio) { errno = -r; #else -errno = r; +errno = 0; #endif return -1; diff --git a/src/pulsecore/envelope.c b/src/pulsecore/envelope.c index 0eca811..75e189c 100644 --- a/src/pulsecore/envelope.c +++ b/src/pulsecore/envelope.c @@ -597,7 +597,7 @@ void pa_envelope_apply(pa_envelope *e, pa_memchunk *chunk) { fs = pa_frame_size(e-sample_spec); n = chunk-length; -pa_log_debug(Envelop position %d applying factor %d=%f, sample spec is %d, chunk's length is %d, fs is %d\n, e-x, linear_get_int(e, v), ((float) linear_get_int(e,v))/0x1, e-sample_spec.format, n, fs); +pa_log_debug(Envelop position %zu applying factor %d=%f, sample spec is %d, chunk's length is %zu, fs is %zu\n, e-x, linear_get_int(e, v), ((float) linear_get_int(e,v))/0x1, e-sample_spec.format, n, fs); switch (e-sample_spec.format) { @@ -965,11 +965,10 @@ void pa_envelope_restart(pa_envelope* e) { } pa_bool_t pa_envelope_is_finished(pa_envelope* e) { -pa_assert(e); - int v; pa_bool_t finished; +pa_assert(e); envelope_begin_read(e, v); finished = (e-x = e-points[v].x[e-points[v].n_points-1]); envelope_commit_read(e, v); @@ -978,11 +977,10 @@ pa_bool_t pa_envelope_is_finished(pa_envelope* e) { } int32_t pa_envelope_length(pa_envelope *e) { -pa_assert(e); - int v; size_t size; +pa_assert(e); envelope_begin_read(e, v); size = e-points[v].x[e-points[v].n_points-1] - e-points[v].x[0]; envelope_commit_read(e, v); diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 35e3d4a..9b4edeb 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -779,11 +779,11 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink frames */, p if (!i-thread_info.ramp_info.envelope_dead) { i-thread_info.ramp_info.envelope_dying += chunk-length; -pa_log_debug(Envelope dying is %d, chunk length is %d, dead thresholder is %d\n, i-thread_info.ramp_info.envelope_dying, +pa_log_debug(Envelope dying is %d, chunk length is %zu, dead thresholder is %lu\n, i-thread_info.ramp_info.envelope_dying, chunk-length, i-sink-thread_info.max_rewind + pa_envelope_length(i-thread_info.ramp_info.envelope)); -if (i-thread_info.ramp_info.envelope_dying = (i-sink-thread_info.max_rewind + pa_envelope_length(i-thread_info.ramp_info.envelope))) { +if (i-thread_info.ramp_info.envelope_dying = (int32_t) (i-sink-thread_info.max_rewind + pa_envelope_length(i-thread_info.ramp_info.envelope))) { pa_log_debug(RELEASE Envelop); i-thread_info.ramp_info.envelope_dead = TRUE; sink_input_release_envelope(i); @@ -1767,12 +1767,14 @@ static void sink_input_rewind_ramp_info(pa_sink_input *i, size_t nbytes) { pa_assert(i); if (!i-thread_info.ramp_info.envelope_dead) { -pa_assert(i-thread_info.ramp_info.envelope); +int32_t envelope_length; -int32_t envelope_length =
Re: [pulseaudio-discuss] State of OS X port
On Tue, Dec 08, 2009 at 09:10:53AM +, Colin Guthrie wrote: 'Twas brillig, and João Paulo Rechi Vita at 08/12/09 02:01 did gyre and gimble: All Enlightenment is written in pure C (GNU 99). So if the consensus is C, is there really much point in wrapping up the libpulse c library with another c library? Would it really add that much shared code? Don't know how much of the Code needed in the GUIs is actually implemented in libpulse. I didn't have any close look yet at all. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] State of OS X port
On Wed, Dec 09, 2009 at 10:12:32AM +1100, Christopher James Halse Rogers wrote: As someone who has been (slowly) writing a C# wrapper for libpulse with the initial purpose of providing a volume-control... I don't think there's much extra code that could be usefully added to libpulse for writing GUIs. It's currently pretty simple to do all the pulse interaction required. Ah, can you share code? Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 1/7] configure.ac: add DARWIN_OS variable
From: Kim Lester k...@dfusion.com.au Signed-off-by: Kim Lester k...@dfusion.com.au Signed-off-by: Daniel Mack dan...@caiaq.de --- configure.ac | 22 ++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index af60fff..11af89b 100644 --- a/configure.ac +++ b/configure.ac @@ -172,6 +172,10 @@ case $host in AC_MSG_RESULT([linux]) pulse_target_os=linux ;; +*-*-darwin*) +AC_MSG_RESULT([darwin]) +pulse_target_os=darwin +;; *) AC_MSG_RESULT([unknown]) pulse_target_os=unknown @@ -291,15 +295,21 @@ AC_SUBST([LIBLTDL]) Determine build environment os_is_win32=0 +os_is_darwin=0 case $host_os in mingw*) AC_DEFINE([OS_IS_WIN32], 1, [Build target is Windows.]) os_is_win32=1 ;; +darwin*) +AC_DEFINE([OS_IS_DARWIN], 1, [Build target is Darwin.]) +os_is_darwin=1 +;; esac AM_CONDITIONAL(OS_IS_WIN32, test x$os_is_win32 = x1) +AM_CONDITIONAL(OS_IS_DARWIN, test x$os_is_darwin = x1) ### # Basic environment checks # @@ -403,6 +413,18 @@ AC_SEARCH_LIBS([backtrace], [execinfo]) # build, disabling its ability to make dlls. AC_CHECK_FUNCS([getopt_long], [], [AC_CHECK_LIB([iberty], [getopt_long])]) +# Darwin/OS X +if test x$os_is_darwin = x1 ; then +AC_MSG_CHECKING([looking for Apple CoreService Framework]) +# How do I check a framework library - AC_CHECK_LIB prob. won't work??, just assign LIBS hope +AC_CHECK_HEADER([/Developer/Headers/FlatCarbon/CoreServices.h], +[LIBS=$LIBS -framework CoreServices], +[AC_MSG_ERROR([CoreServices.h header file not found]) ]) + +AC_MSG_RESULT([ok]) +AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Using clock_gettime() replacement]) +fi + Check for functions # ISO -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] (no subject)
Here's a series of 7 patches that add support for the PA daemon to run under OS X. Two real OS X bugs are worked around. One is that poll() does not work, so we have to enable the select() workaround. The other is that we can't detect hung up descriptors with recv() and MSG_PEEK, as it will eat up data from the descriptor. Use an ioctl for this. There are two new modules, one for CoreAudio device management and hotplug detection, and one for the audio stream implementation. There is currently no support for sources (inbound audio data) and hardware volume controls, but at least it works, so it's good enough for a first release. These patches are also available at git://github.com/zonque/pulseaudio.git topic/osx Expect that branch to be rebased, so don't track it. I would appreciate if someone could give that sources a try and see whether it also works on other machines. Thanks, Daniel [PATCH 1/7] configure.ac: add DARWIN_OS variable [PATCH 2/7] core-rtclock.c: tweak OS_IS_DARWIN constraints [PATCH 3/7] src/Makefile.am: add specific OS_IS_DARWIN files [PATCH 4/7] poll() is totally broken on Mac OS X [PATCH 5/7] hack around another OS X bug: recv() with MSG_PEEK does not work [PATCH 6/7] CoreAudio: add device detection module [PATCH 7/7] CoreAudio: add audio device module ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 2/7] core-rtclock.c: tweak OS_IS_DARWIN constraints
Move the code for OS_IS_DARWIN to the top as on Darwin, HAVE_CLOCK_GETTIME is also defined. --- src/pulsecore/core-rtclock.c | 69 +- 1 files changed, 28 insertions(+), 41 deletions(-) diff --git a/src/pulsecore/core-rtclock.c b/src/pulsecore/core-rtclock.c index 4fe0a47..110158b 100644 --- a/src/pulsecore/core-rtclock.c +++ b/src/pulsecore/core-rtclock.c @@ -37,6 +37,7 @@ #include CoreServices/CoreServices.h #include mach/mach.h #include mach/mach_time.h +#include unistd.h #endif #include pulse/timeval.h @@ -54,7 +55,19 @@ pa_usec_t pa_rtclock_age(const struct timeval *tv) { struct timeval *pa_rtclock_get(struct timeval *tv) { -#if defined(HAVE_CLOCK_GETTIME) +#if defined(OS_IS_DARWIN) +uint64_t val, abs_time = mach_absolute_time(); +Nanoseconds nanos; + +nanos = AbsoluteToNanoseconds(*(AbsoluteTime *) abs_time); +val = *(uint64_t *) nanos; + +tv-tv_sec = val / PA_NSEC_PER_SEC; +tv-tv_usec = (val % PA_NSEC_PER_SEC) / PA_NSEC_PER_USEC; + +return tv; + +#elif defined(HAVE_CLOCK_GETTIME) struct timespec ts; #ifdef CLOCK_MONOTONIC @@ -75,65 +88,39 @@ struct timeval *pa_rtclock_get(struct timeval *tv) { tv-tv_usec = ts.tv_nsec / PA_NSEC_PER_USEC; return tv; - -#elif defined(OS_IS_DARWIN) -static mach_timebase_info_data_t tbi; -uint64_t nticks; -uint64_t time_nsec; - -/* Refer Apple ADC QA1398 - Also: http://devworld.apple.com/documentation/Darwin/Conceptual/KernelProgramming/services/services.html - - Note: argument is timespec NOT timeval (timespec uses nsec, timeval uses usec) -*/ - -/* try and be a mite efficient - maybe I should keep the N/D as a float !? */ -if (tbi.denom == 0) -mach_timebase_info(tbi); - -nticks = mach_absolute_time(); -time_nsec = nticks * tbi.numer / tbi.denom; // see above - -tv-tv_sec = time_nsec / PA_NSEC_PER_SEC; -tv-tv_usec = time_nsec / PA_NSEC_PER_USEC; - -return tv; - -#else /* OS_IS_DARWIN */ +#endif /* HAVE_CLOCK_GETTIME */ return pa_gettimeofday(tv); - -#endif } pa_bool_t pa_rtclock_hrtimer(void) { -#if defined(HAVE_CLOCK_GETTIME) +#if defined (OS_IS_DARWIN) +mach_timebase_info_data_t tbi; +uint64_t time_nsec; + +mach_timebase_info(tbi); + +/* nsec = nticks * (N/D) - we want 1 tick == resolution !? */ +time_nsec = tbi.numer / tbi.denom; +return time_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); + +#elif defined(HAVE_CLOCK_GETTIME) struct timespec ts; #ifdef CLOCK_MONOTONIC if (clock_getres(CLOCK_MONOTONIC, ts) = 0) return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); + #endif /* CLOCK_MONOTONIC */ pa_assert_se(clock_getres(CLOCK_REALTIME, ts) == 0); return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); -#elif defined (OS_IS_DARWIN) -mach_timebase_info_data_t tbi; -uint64_t time_nsec; - -mach_timebase_info(tbi); +#endif /* HAVE_CLOCK_GETTIME */ -/* nsec = nticks * (N/D) - we want 1 tick == resolution !? */ -time_nsec = tbi.numer / tbi.denom; -return time_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); - -#else /* OS_IS_DARWIN */ return FALSE; - -#endif } #define TIMER_SLACK_NS (int) ((500 * PA_NSEC_PER_USEC)) -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 3/7] src/Makefile.am: add specific OS_IS_DARWIN files
From: Kim Lester k...@dfusion.com.au Signed-off-by: Kim Lester k...@dfusion.com.au Signed-off-by: Daniel Mack dan...@caiaq.de --- src/Makefile.am | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 11826a4..90160d1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -640,12 +640,21 @@ libpulsecomm...@pa_majorminormicro@_la_SOURCES += \ pulsecore/mutex-win32.c pulsecore/mutex.h \ pulsecore/thread-win32.c pulsecore/thread.h \ pulsecore/semaphore-win32.c pulsecore/semaphore.h -else +else !OS_IS_WIN32 +if OS_IS_DARWIN +libpulsecomm...@pa_majorminormicro@_la_SOURCES += \ + pulsecore/mutex-posix.c pulsecore/mutex.h \ + pulsecore/thread-posix.c pulsecore/thread.h \ + pulsecore/semaphore-osx.c pulsecore/semaphore.h +libpulsecomm...@pa_majorminormicro@_la_CFLAGS += -I/Developer/Headers/FlatCarbon/ +#libpulsecomm...@pa_majorminormicro@_la_LDFLAGS += -framework CoreServices +else !OS_IS_DARWIN libpulsecomm...@pa_majorminormicro@_la_SOURCES += \ pulsecore/mutex-posix.c pulsecore/mutex.h \ pulsecore/thread-posix.c pulsecore/thread.h \ pulsecore/semaphore-posix.c pulsecore/semaphore.h -endif +endif !OS_IS_DARWIN +endif !OS_IS_WIN32 if HAVE_X11 libpulsecomm...@pa_majorminormicro@_la_SOURCES += pulsecore/x11prop.c pulsecore/x11prop.h -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 5/7] hack around another OS X bug: recv() with MSG_PEEK does not work
At least for pipes, recv() with MSG_PEEK does actually eat up data from file descriptors. Hence, this can't be used for PULLHUP emulation. Use another ioctl hack for that. --- src/pulsecore/poll.c | 22 ++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/src/pulsecore/poll.c b/src/pulsecore/poll.c index 27f04aa..cd9aaca 100644 --- a/src/pulsecore/poll.c +++ b/src/pulsecore/poll.c @@ -35,6 +35,10 @@ #include config.h #endif +#ifdef HAVE_SYS_IOCTL_H +#include sys/ioctl.h +#endif + #include errno.h #ifdef HAVE_SYS_SELECT_H @@ -66,7 +70,9 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { struct pollfd *f; int ready; int maxfd = 0; +#ifdef OS_IS_WIN32 char data[64]; +#endif FD_ZERO (rset); FD_ZERO (wset); @@ -109,6 +115,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { ready = select ((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 rset, SELECT_TYPE_ARG234 wset, SELECT_TYPE_ARG234 xset, SELECT_TYPE_ARG5 (timeout == -1 ? NULL : tv)); + if ((ready == -1) (errno == EBADF)) { ready = 0; @@ -171,6 +178,8 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { #endif if (ready 0) { +int r; + ready = 0; for (f = fds; f fds[nfds]; ++f) { f-revents = 0; @@ -178,6 +187,18 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { if (FD_ISSET (f-fd, rset)) { /* support for POLLHUP. An hung up descriptor does not increase the return value! */ +#ifdef OS_IS_DARWIN +/* There is a bug in Mac OS X that causes it to ignore MSG_PEEK + * for some kinds of descriptors. Detect if this descriptor is a + * connected socket, a server socket, or something else using a + * 0-byte recv, and use ioctl(2) to detect POLLHUP. */ +r = recv(f-fd, NULL, 0, MSG_PEEK); + if (r == 0 || (r 0 errno == ENOTSOCK)) + ioctl(f-fd, FIONREAD, r); + + if (r == 0) + f-revents |= POLLHUP; +#else /* !OS_IS_DARWIN */ if (recv (f-fd, data, 64, MSG_PEEK) == -1) { if (errno == ESHUTDOWN || errno == ECONNRESET || errno == ECONNABORTED || errno == ENETRESET) { @@ -185,6 +206,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { f-revents |= POLLHUP; } } +#endif if (f-revents == 0) f-revents |= POLLIN; -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 6/7] CoreAudio: add device detection module
This adds a new module for CoreAudio device detection. It registers a callback to detect hotplugged devices and creates/destroys modules named 'module-coreaudio-device'. Devices are identified via a system-wide unique AudioDeviceID. --- src/Makefile.am | 14 ++ src/modules/coreaudio/module-coreaudio-detect.c | 229 +++ 2 files changed, 243 insertions(+), 0 deletions(-) create mode 100644 src/modules/coreaudio/module-coreaudio-detect.c diff --git a/src/Makefile.am b/src/Makefile.am index 90160d1..70ab5b0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1066,6 +1066,11 @@ modlibexec_LTLIBRARIES += \ module-oss.la endif +if HAVE_COREAUDIO +modlibexec_LTLIBRARIES += \ + module-coreaudio-detect.la +endif + pulselibexec_PROGRAMS = if HAVE_ALSA @@ -1238,6 +1243,7 @@ SYMDEF_FILES = \ modules/alsa/module-alsa-sink-symdef.h \ modules/alsa/module-alsa-source-symdef.h \ modules/alsa/module-alsa-card-symdef.h \ + modules/coreaudio/module-coreaudio-detect-symdef.h \ modules/module-solaris-symdef.h \ modules/module-waveout-symdef.h \ modules/module-detect-symdef.h \ @@ -1469,6 +1475,14 @@ module_oss_la_SOURCES = modules/oss/module-oss.c module_oss_la_LDFLAGS = $(MODULE_LDFLAGS) module_oss_la_LIBADD = $(AM_LIBADD) liboss-util.la libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la +# COREAUDIO + +module_coreaudio_detect_la_SOURCES = modules/coreaudio/module-coreaudio-detect.c +module_coreaudio_detect_la_LDFLAGS = $(MODULE_LDFLAGS) \ + -Wl,-framework -Wl,Cocoa -framework CoreAudio \ + -Wl,-framework -Wl,AudioUnit -framework AudioUnit +module_coreaudio_detect_la_LIBADD = $(AM_LIBADD) libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la + # ALSA libalsa_util_la_SOURCES = modules/alsa/alsa-util.c modules/alsa/alsa-util.h modules/alsa/alsa-mixer.c modules/alsa/alsa-mixer.h modules/alsa/alsa-sink.c modules/alsa/alsa-sink.h modules/alsa/alsa-source.c modules/alsa/alsa-source.h modules/reserve-wrap.c modules/reserve-wrap.h diff --git a/src/modules/coreaudio/module-coreaudio-detect.c b/src/modules/coreaudio/module-coreaudio-detect.c new file mode 100644 index 000..3e04136 --- /dev/null +++ b/src/modules/coreaudio/module-coreaudio-detect.c @@ -0,0 +1,229 @@ +/*** + This file is part of PulseAudio. + + Copyright 2009 Daniel Mack dan...@caiaq.de + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, + or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include pulse/xmalloc.h + +#include pulsecore/module.h +#include pulsecore/core-util.h +#include pulsecore/modargs.h +#include pulsecore/log.h +#include pulsecore/llist.h + +#include CoreAudio/CoreAudio.h + +#include module-coreaudio-detect-symdef.h + +#define DEVICE_MODULE_NAME module-coreaudio-device + +PA_MODULE_AUTHOR(Daniel Mack); +PA_MODULE_DESCRIPTION(CoreAudio device detection); +PA_MODULE_VERSION(PACKAGE_VERSION); +PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_USAGE(); + +typedef struct ca_device ca_device; + +struct ca_device { +AudioDeviceID id; +unsigned int module_index; +PA_LLIST_FIELDS(ca_device); +}; + +struct userdata { +int detect_fds[2]; +pa_io_event *detect_io; + +PA_LLIST_HEAD(ca_device, devices); +}; + +static int ca_device_added(struct pa_module *m, AudioDeviceID id) { +pa_module *mod; +struct userdata *u = m-userdata; +struct ca_device *dev; +char *args; + +pa_assert(u); + +args = pa_sprintf_malloc(device_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); + +if (!mod) { +pa_log_info(Failed to load module %s with arguments '%s', DEVICE_MODULE_NAME, args); +return -1; +} + +dev = pa_xnew0(ca_device, 1); +dev-module_index = mod-index; +dev-id = id; + +PA_LLIST_INIT(ca_device, dev); +PA_LLIST_PREPEND(ca_device, u-devices, dev); + +return 0; +} + +static int ca_update_device_list(struct pa_module *m) { +OSStatus err; +UInt32 i, size
[pulseaudio-discuss] [PATCH 4/7] poll() is totally broken on Mac OS X
Even on 10.5.8, poll() does not do the right thing. Haven't checked on newer versions. Hence, wrap all occurences of poll() to pa_poll and emulate that call with select() on OSX. This is totally embarassing. --- src/modules/module-sine-source.c|2 +- src/modules/raop/module-raop-sink.c |2 +- src/modules/raop/raop_client.c |5 - src/modules/rtp/rtsp_client.c |5 - src/pulse/mainloop.c|9 ++--- src/pulsecore/lock-autospawn.c |3 ++- src/pulsecore/poll.c| 17 ++--- src/pulsecore/poll.h|9 +++-- src/pulsecore/rtpoll.c |9 ++--- src/tests/lock-autospawn-test.c |4 ++-- src/tests/rtpoll-test.c |2 +- src/utils/pacmd.c |4 ++-- 12 files changed, 34 insertions(+), 37 deletions(-) diff --git a/src/modules/module-sine-source.c b/src/modules/module-sine-source.c index 9826e5f..53f5335 100644 --- a/src/modules/module-sine-source.c +++ b/src/modules/module-sine-source.c @@ -32,7 +32,6 @@ #include unistd.h #include limits.h #include sys/ioctl.h -#include sys/poll.h #include pulse/rtclock.h #include pulse/timeval.h @@ -48,6 +47,7 @@ #include pulsecore/thread.h #include pulsecore/thread-mq.h #include pulsecore/rtpoll.h +#include pulsecore/poll.h #include module-sine-source-symdef.h diff --git a/src/modules/raop/module-raop-sink.c b/src/modules/raop/module-raop-sink.c index ac48ab1..ce534ce 100644 --- a/src/modules/raop/module-raop-sink.c +++ b/src/modules/raop/module-raop-sink.c @@ -32,7 +32,6 @@ #include fcntl.h #include unistd.h #include limits.h -#include poll.h #include sys/socket.h #include netinet/in.h #include netinet/tcp.h @@ -60,6 +59,7 @@ #include pulsecore/thread.h #include pulsecore/time-smoother.h #include pulsecore/socket-util.h +#include pulsecore/poll.h #include module-raop-sink-symdef.h #include rtp.h diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c index c4b0237..e3152dd 100644 --- a/src/modules/raop/raop_client.c +++ b/src/modules/raop/raop_client.c @@ -51,12 +51,7 @@ #include pulsecore/macro.h #include pulsecore/strbuf.h #include pulsecore/random.h - -#ifdef HAVE_POLL_H -#include poll.h -#else #include pulsecore/poll.h -#endif #include raop_client.h #include rtsp_client.h diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c index 5961806..6094eb8 100644 --- a/src/modules/rtp/rtsp_client.c +++ b/src/modules/rtp/rtsp_client.c @@ -45,12 +45,7 @@ #include pulsecore/macro.h #include pulsecore/strbuf.h #include pulsecore/ioline.h - -#ifdef HAVE_POLL_H -#include poll.h -#else #include pulsecore/poll.h -#endif #include rtsp_client.h diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c index 6cd089e..8f743ec 100644 --- a/src/pulse/mainloop.c +++ b/src/pulse/mainloop.c @@ -32,12 +32,6 @@ #include fcntl.h #include errno.h -#ifdef HAVE_POLL_H -#include poll.h -#else -#include pulsecore/poll.h -#endif - #ifndef HAVE_PIPE #include pulsecore/pipe.h #endif @@ -47,6 +41,7 @@ #include pulse/timeval.h #include pulse/xmalloc.h +#include pulsecore/poll.h #include pulsecore/core-rtclock.h #include pulsecore/core-util.h #include pulsecore/llist.h @@ -887,7 +882,7 @@ int pa_mainloop_poll(pa_mainloop *m) { m-prepared_timeout == PA_USEC_INVALID ? NULL : pa_timespec_store(ts, m-prepared_timeout), NULL); #else -m-poll_func_ret = poll( +m-poll_func_ret = pa_poll( m-pollfds, m-n_pollfds, usec_to_timeout(m-prepared_timeout)); #endif diff --git a/src/pulsecore/lock-autospawn.c b/src/pulsecore/lock-autospawn.c index 65e3563..95ca04a 100644 --- a/src/pulsecore/lock-autospawn.c +++ b/src/pulsecore/lock-autospawn.c @@ -33,6 +33,7 @@ #include pulse/i18n.h #include pulse/xmalloc.h +#include pulsecore/poll.h #include pulsecore/mutex.h #include pulsecore/thread.h #include pulsecore/core-util.h @@ -182,7 +183,7 @@ static void wait_for_ping(void) { pfd.fd = pipe_fd[0]; pfd.events = POLLIN; -if ((k = poll(pfd, 1, -1)) != 1) { +if ((k = pa_poll(pfd, 1, -1)) != 1) { pa_assert(k 0); pa_assert(errno == EINTR); } else if ((s = read(pipe_fd[0], x, 1)) != 1) { diff --git a/src/pulsecore/poll.c b/src/pulsecore/poll.c index 46a69c5..27f04aa 100644 --- a/src/pulsecore/poll.c +++ b/src/pulsecore/poll.c @@ -43,13 +43,24 @@ #include winsock.h -#ifndef HAVE_POLL_H - #include pulsecore/core-util.h +#include pulse/util.h #include poll.h -int poll (struct pollfd *fds, unsigned long int nfds, int timeout) { +/* Mac OSX fails to implement poll() in a working way since 10.4. IOW, for + * several years. We need to enable a dirty workaround and emulate that call + * with select(), just like for Windows. sic! */ + +#if defined(HAVE_POLL_H) !defined(OS_IS_DARWIN) + +int pa_poll (struct pollfd
[pulseaudio-discuss] [PATCH 7/7] CoreAudio: add audio device module
This patch adds support for CoreAudio driven devices under Mac OS X. It is typically instanciated by the CoreAudio device detection module and handles all available streams on a specific device. Sinks are created according to the reported stream configuration. Float32 is used as default audio sample format at it is the only format CoreAudio speaks natively. Sources are not implemented yet. Neither is hardware volume control. --- src/Makefile.am |9 +- src/modules/coreaudio/module-coreaudio-device.c | 609 +++ 2 files changed, 617 insertions(+), 1 deletions(-) create mode 100644 src/modules/coreaudio/module-coreaudio-device.c diff --git a/src/Makefile.am b/src/Makefile.am index 70ab5b0..fa5d170 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1068,7 +1068,8 @@ endif if HAVE_COREAUDIO modlibexec_LTLIBRARIES += \ - module-coreaudio-detect.la + module-coreaudio-detect.la \ + module-coreaudio-device.la endif pulselibexec_PROGRAMS = @@ -1244,6 +1245,7 @@ SYMDEF_FILES = \ modules/alsa/module-alsa-source-symdef.h \ modules/alsa/module-alsa-card-symdef.h \ modules/coreaudio/module-coreaudio-detect-symdef.h \ + modules/coreaudio/module-coreaudio-device-symdef.h \ modules/module-solaris-symdef.h \ modules/module-waveout-symdef.h \ modules/module-detect-symdef.h \ @@ -1483,6 +1485,11 @@ module_coreaudio_detect_la_LDFLAGS = $(MODULE_LDFLAGS) \ -Wl,-framework -Wl,AudioUnit -framework AudioUnit module_coreaudio_detect_la_LIBADD = $(AM_LIBADD) libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la +module_coreaudio_device_la_SOURCES = modules/coreaudio/module-coreaudio-device.c +module_coreaudio_device_la_LDFLAGS = $(MODULE_LDFLAGS) \ + -Wl,-framework -Wl,Cocoa -framework CoreAudio \ + -Wl,-framework -Wl,AudioUnit -framework AudioUnit +module_coreaudio_device_la_LIBADD = $(AM_LIBADD) libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la # ALSA libalsa_util_la_SOURCES = modules/alsa/alsa-util.c modules/alsa/alsa-util.h modules/alsa/alsa-mixer.c modules/alsa/alsa-mixer.h modules/alsa/alsa-sink.c modules/alsa/alsa-sink.h modules/alsa/alsa-source.c modules/alsa/alsa-source.h modules/reserve-wrap.c modules/reserve-wrap.h diff --git a/src/modules/coreaudio/module-coreaudio-device.c b/src/modules/coreaudio/module-coreaudio-device.c new file mode 100644 index 000..fdd429a --- /dev/null +++ b/src/modules/coreaudio/module-coreaudio-device.c @@ -0,0 +1,609 @@ +/*** + This file is part of PulseAudio. + + Copyright 2009 Daniel Mack dan...@caiaq.de + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, + or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +/* TODO: +- implement sources (inbound data) +- implement hardware volume controls +- handle audio device stream format changes (will require changes to the core) +*/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include pulse/xmalloc.h +#include pulse/util.h + +#include pulsecore/core-error.h +#include pulsecore/sink.h +#include pulsecore/source.h +#include pulsecore/module.h +#include pulsecore/sample-util.h +#include pulsecore/core-util.h +#include pulsecore/modargs.h +#include pulsecore/log.h +#include pulsecore/macro.h +#include pulsecore/llist.h +#include pulsecore/card.h +#include pulsecore/strbuf.h +#include pulsecore/thread.h +#include pulsecore/thread-mq.h + +#include CoreAudio/CoreAudio.h +#include CoreAudio/CoreAudioTypes.h +#include CoreAudio/AudioHardware.h + +#include module-coreaudio-device-symdef.h + +PA_MODULE_AUTHOR(Daniel Mack); +PA_MODULE_DESCRIPTION(CoreAudio device); +PA_MODULE_VERSION(PACKAGE_VERSION); +PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_USAGE( +device_id=the CoreAudio device id +sample_frames=frames +); + +enum { +SINK_MESSAGE_RENDER = PA_SINK_MESSAGE_MAX, +}; + +typedef struct coreaudio_sink coreaudio_sink; + +struct userdata { +AudioDeviceID device_id; +AudioDeviceIOProcID proc_id; + +pa_thread_mq thread_mq; +pa_asyncmsgq *async_msgq; + +pa_rtpoll *rtpoll; +pa_thread *thread; + +pa_module *module
[pulseaudio-discuss] State of OS X port (was: Re: pa_fdsem racy?)
On Mon, Dec 07, 2009 at 01:10:29AM +, Colin Guthrie wrote: It sounds like you are making good progress Daniel. Have you got a rough idea of what is done and what still needs to be done to make PA useful on OSX? Well actually I'm making quite slow progress on all this, which is because I only find few hours per week to work on that. I do, however, have a more or less complete outline of where I want to get with all the PA stuff on OS X. There are rougly 4 major things to work on: 1. Make the PA daemon run smoothly This has been done now, finally, and the reason for all the trouble were Darwin kernel and/or libc incompatiblities. poll() not paying attention to the timeout value, recv() failing with MSG_PEEK for pipe fds, unimplemented unnamed semaphores, to just name a few. 2. Provide modules for CoreAudio A module for hotplug detection of new audio devices is done and works well. It instanciates one module per found audio device which is still under construction. IOW, it doesn't render any audio yet. I had a small hack session with Lennart the other day and what I cooked together doesn't look totally wrong, at least. 3. Hack a virtual audio device for CoreAudio This will allow us to route arbitrary sound sources and sinks from and to all applications that are able to deal with audio. For example, you can capture your DVD player, reroute it to PA and then stream it out on an AirportExpress. One weird idea is to implement the driver in a way that it can stream out different client audio streams as different PA inputs. With that, we could have per-client audio mixing, but I'm not sure yet whether that will be possible. There's a rough skeleton for that, but not more. 4. Cocoa based mixer/control applications In order to control all the PA daemon's features, GUI tools like PreferencePanes and mixer applications will be needed. This is also almost entirely unimplemented. However, it would make things a lot easier if code neeeded by the GUI tools would be factored out to a library, so I wouldn't need to copy'n paste major part of the GTK+ based things that exist already. Lennart wanted to think about whether this is possible. I'll continue on all these things gradually, but I fear I won't be able to dramatically speed up things in near future. Stay tuned :) Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] pa_fdsem racy?
On Tue, Dec 01, 2009 at 01:34:11PM +0100, Daniel Mack wrote: while debugging more details about the Mac OS X port of pulseaudio, I constently stumble over more and more things that demand attention. Oh well, forget about that. This turned out to be yet another Mac OS X breakage. For pipe descriptors, recv() with a MSG_PEEK flags will actually eat up data, which is exactly what it must _not_ do. WTF. Ridiculous, really. I added more hacks to catch that and queued them up. The PA daemon will now reliably startup as expected. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] pa_fdsem racy?
Can anyone help resolve this? On Tue, Dec 01, 2009 at 01:34:11PM +0100, Daniel Mack wrote: while debugging more details about the Mac OS X port of pulseaudio, I constently stumble over more and more things that demand attention. One thing is that poll() is entirely broken on Mac OS X and causes the CPU to suck 100% load because the timeout parameter is ignored. I fixed that already by enabling the legacy 'poll via select' workaround that has been in the PA tree for a long time (and originally for Windows). Will post patches soon. But even with that workaround enabled, the PA daemon often fails to start with a command line as simple as $ ./pulseaudio -vvn -L module-null-sink -C The above should bring me to an interactive prompt, but it doesn't, at least not always. When debugging that, I always find a thread hung in read(), caused by the pa_fdsem code. This execution path waits for some user of a pa_fdsem to call pa_fdsem_post(). I suspect this implementation to be racy, but I might have not understood the sematic of this data type. Is a pa_fdsem supposed to be accessed by more than one reader/writer? I wrote a little test which shows that the latter does not work reliably: https://gist.github.com/1e8ba0dc00c94a05c090 I would expect thread #0 to eat one of the two references it posted, so there is one free for thread #1. However, this test only ever succeeds if thread #1's wait() happens to be called right between the two posts in thread #0. IOW, it mostly fails and hangs. Can anyone explain whether this is a bug or if I'm digging at the wrong place? While the plain logic behind all this is fairly simple, I'm just not aware of how things are supposed to work in PA. Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] pa_fdsem racy?
Gentlemen, while debugging more details about the Mac OS X port of pulseaudio, I constently stumble over more and more things that demand attention. One thing is that poll() is entirely broken on Mac OS X and causes the CPU to suck 100% load because the timeout parameter is ignored. I fixed that already by enabling the legacy 'poll via select' workaround that has been in the PA tree for a long time (and originally for Windows). Will post patches soon. But even with that workaround enabled, the PA daemon often fails to start with a command line as simple as $ ./pulseaudio -vvn -L module-null-sink -C The above should bring me to an interactive prompt, but it doesn't, at least not always. When debugging that, I always find a thread hung in read(), caused by the pa_fdsem code. This execution path waits for some user of a pa_fdsem to call pa_fdsem_post(). I suspect this implementation to be racy, but I might have not understood the sematic of this data type. Is a pa_fdsem supposed to be accessed by more than one reader/writer? I wrote a little test which shows that the latter does not work reliably: https://gist.github.com/1e8ba0dc00c94a05c090 I would expect thread #0 to eat one of the two references it posted, so there is one free for thread #1. However, this test only ever succeeds if thread #1's wait() happens to be called right between the two posts in thread #0. IOW, it mostly fails and hangs. Can anyone explain whether this is a bug or if I'm digging at the wrong place? While the plain logic behind all this is fairly simple, I'm just not aware of how things are supposed to work in PA. Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] pa_fdsem racy?
On Tue, Dec 01, 2009 at 01:34:11PM +0100, Daniel Mack wrote: I suspect this implementation to be racy, but I might have not understood the sematic of this data type. Is a pa_fdsem supposed to be accessed by more than one reader/writer? I wrote a little test which shows that the latter does not work reliably: One more thing that caught my eye and which doesn't seem to make terribly much sense to me is code in flush() and pa_fdsem_wait() from pulsecore/fdsem.c. There are snipplets that read as follows for !HAVE_SYS_EVENTFD_H: do { char x[10]; // HAVE_SYS_EVENTFD_H code omitted if ((r = read(f-fds[0], x, sizeof(x))) = 0) { pa_assert(r 0 errno == EINTR); continue; } } while (pa_atomic_sub(f-data-in_pipe, (int) r) (int) r); A read() of 10 bytes from a pipe will _block_ until at least 10 bytes have been written to the counterpart fd. Why is that 10, where does the magic come from? How is that supposed to work for occasions of writes that are not muliples of 10 bytes? I'm confused. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] semaphores macosx, comments please
On Thu, Nov 12, 2009 at 07:37:26PM +0100, Claesson Mattias wrote: This is what I did for src/pulsecore/semaphore-osx.c @@ -21,11 +21,11 @@ #ifdef HAVE_CONFIG_H #include config.h #endif -#include Multiprocessing.h +#include CoreServices/CoreServices.h #include pulse/xmalloc.h #include pulsecore/macro.h #include semaphore.h POSIX unnamed semaphores are not supported under macos x. Other free software use named semaphores (that is supposed to work) to implement also unnamed semaphores. sem_open(clever random name) + sem_unlink() instead of sem_init() + sem_close(). Tried a quick test and it should be possible to get this to work, it all depends on the random name used. Hmm - what exactly is the problem you're seeing? What is the reason for changing that? Doesn't the current code compile for you? Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] semaphores macosx, comments please
On Thu, Nov 12, 2009 at 10:50:11PM +0100, Claesson Mattias wrote: For some reason I don't have the Multiprocessing.h include, maybe I am on a newer version. XCode Version 3.2.1 (1613) on macos 10.6. Here is a reference to the same issue as I found. http://forum.soft32.com/mac/Multiprocessing-issue-ftopict43400.html Strange, it works here for 10.5.8. Probably Apple deprecated another interface, well done I'll update to SnowLeopard these days and retry. The code does compile, but it compiles the semaphore-posix.c file, there is just no way that the osx version gets compiled in my source tree. If I force semaphore-osx.c to be compiled instead of semaphore-posix.c, it is not linking either without adding a library too. That is because autoconf fails to see Multiprocessing.h, and it is right about that. Hey, maybe I did something wrong when retreiving the code? I use: git fetch git://0pointer.de/pulseaudio.git A fetch is indeed not enought. What you normally do is an initial clone and then just call 'git pull'. 'git fetch' will get new objects from the repository, but it will not update your working tree. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] broken detection of vm
On Mon, Nov 09, 2009 at 03:42:15PM -0600, pl bossart wrote: Here's the error I get with git master when compiling on an older Thinkpad X41: pulsecore/core-util.c: In function ‘pa_running_in_vm’: pulsecore/core-util.c:3087: error: can't find a register in class ‘BREG’ while reloading ‘asm’ pulsecore/core-util.c:3087: error: ‘asm’ operand has impossible constraints Is this code supposed to work across all x86 versions? Does compiling with -O1 or without -fpic solve the problem? I got similar problems on Mac OS X. But not with the same source file. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [RFC][PATCH] CoreAudio: add device detection module
On Tue, Nov 03, 2009 at 11:02:58PM +0100, Lennart Poettering wrote: On Tue, 03.11.09 14:40, Daniel Mack (dan...@caiaq.de) wrote: This is for RFC. Don't know if it makes sense to commit it already as the module it instantiates is not yet finished. Anyway, let me know what you think. A few comments: Comments addresses, except for the locking issues which we can add as fixup later. See the patch below. Thanks for the input, Daniel From 74df9a25ed7aba16989f9a04edeed20a1e2b33a9 Mon Sep 17 00:00:00 2001 From: Daniel Mack dan...@caiaq.de Date: Tue, 22 Sep 2009 11:10:26 +0800 Subject: [PATCH] CoreAudio: add device detection module This adds a new module for CoreAudio device detection. It registers a callback to detect hotplugged devices and creates/destroys modules named 'module-coreaudio-device'. Devices are identified via a system-wide unique AudioDeviceID. --- src/Makefile.am | 14 ++ src/modules/coreaudio/module-coreaudio-detect.c | 205 +++ 2 files changed, 219 insertions(+), 0 deletions(-) create mode 100644 src/modules/coreaudio/module-coreaudio-detect.c diff --git a/src/Makefile.am b/src/Makefile.am index e228800..2084b38 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1088,6 +1088,11 @@ modlibexec_LTLIBRARIES += \ module-oss.la endif +if HAVE_COREAUDIO +modlibexec_LTLIBRARIES += \ + module-coreaudio-detect.la +endif + pulselibexec_PROGRAMS = if HAVE_ALSA @@ -1257,6 +1262,7 @@ SYMDEF_FILES = \ modules/alsa/module-alsa-sink-symdef.h \ modules/alsa/module-alsa-source-symdef.h \ modules/alsa/module-alsa-card-symdef.h \ + modules/coreaudio/module-coreaudio-detect-symdef.h \ modules/module-solaris-symdef.h \ modules/module-waveout-symdef.h \ modules/module-detect-symdef.h \ @@ -1488,6 +1494,14 @@ module_oss_la_SOURCES = modules/oss/module-oss.c module_oss_la_LDFLAGS = $(MODULE_LDFLAGS) module_oss_la_LIBADD = $(AM_LIBADD) liboss-util.la libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la +# COREAUDIO + +module_coreaudio_detect_la_SOURCES = modules/coreaudio/module-coreaudio-detect.c +module_coreaudio_detect_la_LDFLAGS = $(MODULE_LDFLAGS) \ + -Wl,-framework -Wl,Cocoa -framework CoreAudio \ + -Wl,-framework -Wl,AudioUnit -framework AudioUnit +module_coreaudio_detect_la_LIBADD = $(AM_LIBADD) libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la + # ALSA libalsa_util_la_SOURCES = modules/alsa/alsa-util.c modules/alsa/alsa-util.h modules/alsa/alsa-mixer.c modules/alsa/alsa-mixer.h modules/alsa/alsa-sink.c modules/alsa/alsa-sink.h modules/alsa/alsa-source.c modules/alsa/alsa-source.h modules/reserve-wrap.c modules/reserve-wrap.h diff --git a/src/modules/coreaudio/module-coreaudio-detect.c b/src/modules/coreaudio/module-coreaudio-detect.c new file mode 100644 index 000..bd8672c --- /dev/null +++ b/src/modules/coreaudio/module-coreaudio-detect.c @@ -0,0 +1,205 @@ +/*** + This file is part of PulseAudio. + + Copyright 2009 Daniel Mack dan...@caiaq.de + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, + or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include pulse/xmalloc.h + +#include pulsecore/module.h +#include pulsecore/core-util.h +#include pulsecore/modargs.h +#include pulsecore/log.h +#include pulsecore/llist.h + +#include CoreAudio/CoreAudio.h + +#include module-coreaudio-detect-symdef.h + +#define DEVICE_MODULE_NAME module-coreaudio-device + +PA_MODULE_AUTHOR(Daniel Mack); +PA_MODULE_DESCRIPTION(CoreAudio device detection); +PA_MODULE_VERSION(PACKAGE_VERSION); +PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_USAGE(); + +typedef struct ca_device ca_device; + +struct ca_device { +AudioDeviceID id; +unsigned int module_index; +PA_LLIST_FIELDS(ca_device); +}; + +struct userdata { +PA_LLIST_HEAD(ca_device, devices); +}; + +static int ca_device_added(struct pa_module *m, AudioDeviceID id) { +pa_module *mod; +struct userdata *u = m-userdata; +struct ca_device *dev; +char *args; + +pa_assert(u); + +args = pa_sprintf_malloc(device_id=%d, (int) id
Re: [pulseaudio-discuss] sink/source implementation for pull-io audio processing
On Wed, Nov 04, 2009 at 12:02:27AM +0100, Lennart Poettering wrote: On Tue, 03.11.09 10:54, Daniel Mack (dan...@caiaq.de) wrote: CoreAudio is implemented in a asynchronous pull-io fashion, which means that the user registers a callback (IOProc) to be called for the device whenever there is a specified amount of data available and/or wanted, respectively. That's all fairly straight forward. As the PA sinks/sources are set up to match the sample format used by CoreAudio's IOProc, there is actually nothing more left to do inside this callback than copying the buffers from one end to the other when I'm called and then inform PA about new data arrival. Which API would cause as less overhead as possible? I didn't fully understand the magic behind the PA RT threads yet, and I doubt I need that at all as CoreAudio's IOProc is already called from a _very_ highly priorized thread. This is actually similar to the JACK situation. On JACK too, the API allocates the thread and we need to make the best of it. In the Jack case we work around that by playing ping-pong between two RT threads: the one that is created by libjack and the one that is created by PA. This is actually really bad, since this means one additional context switch, and we really would prefer to do without it. That's what I thought, too. The PA core actually does not require that it runs an RT thread that was created by itself, we are actually very flexible on this and could run fine with a foreign thread. However, what is important is that there is a way so that the PA core can wake up the RT thread at any time and cause it to execute code then. Unfortunately JACK currently does not allow that, the RT thread can only be woken up by the JACK server, not by our PA core. Now the question is: how much control does CoreAudio actually give you for that high prio thread? Is there any chance you can trigger from the PA main thread that some code is run inside the RT thread CoreAudio maintains? That means to things: firstly, there needs to be a way to wake up the RT thread from another thread, and secondly that some arbitrary code can be executed in the RT thread then. Executing arbitrary code from that thread wouldn't be a problem, as I'm just dumped to a callback function to do my audio processing in there. It's up to the user whether to memcpy() a chunk of data or to do realtime audio rendering in this callback. However, the thread can not be woken up by the userspace AFAIK. It is purely driven by the audio callback of the corresponding hardware and will even stop occuring at all in case the hardware stops clocking for whatever reason. So it's not more than the userspace part of the audio device driver. The question I have about this is: why does PA necessarily need to process events within that very thread? Wouldn't it be possible to let the CoreAudio RT thread do all the audio stuff and create a PA RT thread to handle everything else? That way, we wouldn't have a context switch for all the audio material. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 4/4] Wrap clock_gettime and friends
On Wed, Nov 04, 2009 at 02:09:21PM +0100, Claesson Mattias wrote: Have build working now using last nights repository on my Snow Leopard mac. Had to do quite some hands-on in the build system to make it compile. Using these changes make pulseaudio start and then exist because of no loaded modules. Ah, good. More people testing this stuff :) Which version did you compile? You should use git to check out the latest sources for that. Some changes mandatory for Mac OS X builds came in after the last release. Things I needed to adapt was: 1. semaphore-osx.c #include Multiprocessing.h #include CoreServices/CoreServices.h (old include was renamed in newer macos headers, according to google) 2. These was no way for the osx version to be compiled in the build so I just changed the src/Makefile.am pulsecore/semaphore-posix.c pulsecore/semaphore.h pulsecore/semaphore-osx.c pulsecore/semaphore.h 3. Dynamic linkage error because symbolic link missing for the MPCreateSemaphore API call. Added the library to Makefile.am. libpulsecomm...@pa_majorminormicro@_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version libpulsecomm...@pa_majorminormicro@_la_LDFLAGS = -framework Carbon $(AM_LDFLAGS) -avoid-version If you made these changes to the git version, the outout of 'git diff' would be appreciated. (A real patch would be even better if you know how to do this, but a simple diff would suffice in the first place). Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] sink/source implementation for pull-io audio processing
Hey, I'm currently hacking on modules for CoreAudio sink/sources and wonder which way to go for the actual audio buffer transfer. CoreAudio is implemented in a asynchronous pull-io fashion, which means that the user registers a callback (IOProc) to be called for the device whenever there is a specified amount of data available and/or wanted, respectively. That's all fairly straight forward. As the PA sinks/sources are set up to match the sample format used by CoreAudio's IOProc, there is actually nothing more left to do inside this callback than copying the buffers from one end to the other when I'm called and then inform PA about new data arrival. Which API would cause as less overhead as possible? I didn't fully understand the magic behind the PA RT threads yet, and I doubt I need that at all as CoreAudio's IOProc is already called from a _very_ highly priorized thread. Any pointers appreciated. Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [RFC][PATCH] CoreAudio: add device detection module
This is for RFC. Don't know if it makes sense to commit it already as the module it instantiates is not yet finished. Anyway, let me know what you think. Daniel From a7a3f3a64859833cfcfc7877aba354d7d298f8e9 Mon Sep 17 00:00:00 2001 From: Daniel Mack dan...@caiaq.de Subject: [PATCH] CoreAudio: add device detection module This adds a new module for CoreAudio device detection. It registers a callback to detect hotplugged devices and creates/destroys modules named 'module-coreaudio-device'. Devices are identified via a system-wide unique AudioDeviceID. --- src/Makefile.am | 19 ++ src/modules/coreaudio/module-coreaudio-detect.c | 208 +++ 2 files changed, 227 insertions(+), 0 deletions(-) create mode 100644 src/modules/coreaudio/module-coreaudio-detect.c diff --git a/src/Makefile.am b/src/Makefile.am index e228800..eafc4ca 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1088,6 +1088,12 @@ modlibexec_LTLIBRARIES += \ module-oss.la endif +if HAVE_COREAUDIO +modlibexec_LTLIBRARIES += \ + libcoreaudio-util.la \ + module-coreaudio-detect.la +endif + pulselibexec_PROGRAMS = if HAVE_ALSA @@ -1257,6 +1263,7 @@ SYMDEF_FILES = \ modules/alsa/module-alsa-sink-symdef.h \ modules/alsa/module-alsa-source-symdef.h \ modules/alsa/module-alsa-card-symdef.h \ + modules/coreaudio/module-coreaudio-detect-symdef.h \ modules/module-solaris-symdef.h \ modules/module-waveout-symdef.h \ modules/module-detect-symdef.h \ @@ -1488,6 +1495,18 @@ module_oss_la_SOURCES = modules/oss/module-oss.c module_oss_la_LDFLAGS = $(MODULE_LDFLAGS) module_oss_la_LIBADD = $(AM_LIBADD) liboss-util.la libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la +# COREAUDIO + +libcoreaudio_util_la_SOURCES = modules/coreaudio/coreaudio-util.c modules/coreaudio/coreaudio-util.h +libcoreaudio_util_la_LDFLAGS = -avoid-version +libcoreaudio_util_la_LIBADD = libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la + +module_coreaudio_detect_la_SOURCES = modules/coreaudio/module-coreaudio-detect.c +module_coreaudio_detect_la_LDFLAGS = $(MODULE_LDFLAGS) \ + -Wl,-framework -Wl,Cocoa -framework CoreAudio \ + -Wl,-framework -Wl,AudioUnit -framework AudioUnit +module_coreaudio_detect_la_LIBADD = $(AM_LIBADD) libcoreaudio-util.la libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la + # ALSA libalsa_util_la_SOURCES = modules/alsa/alsa-util.c modules/alsa/alsa-util.h modules/alsa/alsa-mixer.c modules/alsa/alsa-mixer.h modules/alsa/alsa-sink.c modules/alsa/alsa-sink.h modules/alsa/alsa-source.c modules/alsa/alsa-source.h modules/reserve-wrap.c modules/reserve-wrap.h diff --git a/src/modules/coreaudio/module-coreaudio-detect.c b/src/modules/coreaudio/module-coreaudio-detect.c new file mode 100644 index 000..34d00fa --- /dev/null +++ b/src/modules/coreaudio/module-coreaudio-detect.c @@ -0,0 +1,208 @@ +/*** + This file is part of PulseAudio. + + Copyright 2009 Daniel Mack dan...@caiaq.de + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, + or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include pulse/xmalloc.h + +#include pulsecore/module.h +#include pulsecore/core-util.h +#include pulsecore/modargs.h +#include pulsecore/log.h +#include pulsecore/llist.h + +#include CoreAudio/CoreAudio.h + +#include module-coreaudio-detect-symdef.h + +#define DEVICE_MODULE_NAME module-coreaudio-device + +PA_MODULE_AUTHOR(Daniel Mack); +PA_MODULE_DESCRIPTION(CoreAudio device detection); +PA_MODULE_VERSION(PACKAGE_VERSION); +PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_USAGE(); + +typedef struct ca_device ca_device; + +struct ca_device { +AudioDeviceID id; +unsigned int module_index; +PA_LLIST_FIELDS(ca_device); +}; + +struct userdata { +PA_LLIST_HEAD(ca_device, devices); +}; + +static int ca_device_added(struct pa_module *m, AudioDeviceID id) { +char args[32]; +pa_module *mod; +struct userdata *u = m-userdata; +struct ca_device *dev; + +pa_assert(u); + +pa_snprintf(args, sizeof(args), device_id=%d, id
Re: [pulseaudio-discuss] [RFC][PATCH] CoreAudio: add device detection module
On Tue, Nov 03, 2009 at 01:57:08PM +, Colin Guthrie wrote: 'Twas brillig, and Daniel Mack at 03/11/09 13:40 did gyre and gimble: This is for RFC. Don't know if it makes sense to commit it already as the module it instantiates is not yet finished. Anyway, let me know what you think. Unless I've missed this in an earlier patch, these files are missing from the patch (probably just a missing git add before generating the patch). modules/coreaudio/coreaudio-util.c modules/coreaudio/coreaudio-util.h Erm, sorry. their empty anyway. I dropped them. Daniel From 21b3e4baeb23f4a637d3284a70d9a67c5aaf5282 Mon Sep 17 00:00:00 2001 From: Daniel Mack dan...@caiaq.de Date: Tue, 22 Sep 2009 11:10:26 +0800 Subject: [PATCH] CoreAudio: add device detection module This adds a new module for CoreAudio device detection. It registers a callback to detect hotplugged devices and creates/destroys modules named 'module-coreaudio-device'. Devices are identified via a system-wide unique AudioDeviceID. --- src/Makefile.am | 14 ++ src/modules/coreaudio/module-coreaudio-detect.c | 208 +++ 2 files changed, 222 insertions(+), 0 deletions(-) create mode 100644 src/modules/coreaudio/module-coreaudio-detect.c diff --git a/src/Makefile.am b/src/Makefile.am index e228800..2084b38 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1088,6 +1088,11 @@ modlibexec_LTLIBRARIES += \ module-oss.la endif +if HAVE_COREAUDIO +modlibexec_LTLIBRARIES += \ + module-coreaudio-detect.la +endif + pulselibexec_PROGRAMS = if HAVE_ALSA @@ -1257,6 +1262,7 @@ SYMDEF_FILES = \ modules/alsa/module-alsa-sink-symdef.h \ modules/alsa/module-alsa-source-symdef.h \ modules/alsa/module-alsa-card-symdef.h \ + modules/coreaudio/module-coreaudio-detect-symdef.h \ modules/module-solaris-symdef.h \ modules/module-waveout-symdef.h \ modules/module-detect-symdef.h \ @@ -1488,6 +1494,14 @@ module_oss_la_SOURCES = modules/oss/module-oss.c module_oss_la_LDFLAGS = $(MODULE_LDFLAGS) module_oss_la_LIBADD = $(AM_LIBADD) liboss-util.la libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la +# COREAUDIO + +module_coreaudio_detect_la_SOURCES = modules/coreaudio/module-coreaudio-detect.c +module_coreaudio_detect_la_LDFLAGS = $(MODULE_LDFLAGS) \ + -Wl,-framework -Wl,Cocoa -framework CoreAudio \ + -Wl,-framework -Wl,AudioUnit -framework AudioUnit +module_coreaudio_detect_la_LIBADD = $(AM_LIBADD) libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la + # ALSA libalsa_util_la_SOURCES = modules/alsa/alsa-util.c modules/alsa/alsa-util.h modules/alsa/alsa-mixer.c modules/alsa/alsa-mixer.h modules/alsa/alsa-sink.c modules/alsa/alsa-sink.h modules/alsa/alsa-source.c modules/alsa/alsa-source.h modules/reserve-wrap.c modules/reserve-wrap.h diff --git a/src/modules/coreaudio/module-coreaudio-detect.c b/src/modules/coreaudio/module-coreaudio-detect.c new file mode 100644 index 000..34d00fa --- /dev/null +++ b/src/modules/coreaudio/module-coreaudio-detect.c @@ -0,0 +1,208 @@ +/*** + This file is part of PulseAudio. + + Copyright 2009 Daniel Mack dan...@caiaq.de + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, + or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include pulse/xmalloc.h + +#include pulsecore/module.h +#include pulsecore/core-util.h +#include pulsecore/modargs.h +#include pulsecore/log.h +#include pulsecore/llist.h + +#include CoreAudio/CoreAudio.h + +#include module-coreaudio-detect-symdef.h + +#define DEVICE_MODULE_NAME module-coreaudio-device + +PA_MODULE_AUTHOR(Daniel Mack); +PA_MODULE_DESCRIPTION(CoreAudio device detection); +PA_MODULE_VERSION(PACKAGE_VERSION); +PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_USAGE(); + +typedef struct ca_device ca_device; + +struct ca_device { +AudioDeviceID id; +unsigned int module_index; +PA_LLIST_FIELDS(ca_device); +}; + +struct userdata { +PA_LLIST_HEAD(ca_device, devices); +}; + +static int ca_device_added(struct pa_module *m, AudioDeviceID id) { +char args[32]; +pa_module *mod; +struct userdata *u
Re: [pulseaudio-discuss] [RFC][PATCH] CoreAudio: add device detection module
On Tue, Nov 03, 2009 at 11:02:58PM +0100, Lennart Poettering wrote: On Tue, 03.11.09 14:40, Daniel Mack (dan...@caiaq.de) wrote: +typedef struct ca_device ca_device; + +struct ca_device { +AudioDeviceID id; +unsigned int module_index; +PA_LLIST_FIELDS(ca_device); +}; In PA we generally don't prefix static variables or file-local structs, since they are unlikely to cause namespace collisions and this is a nice way to determine easily if something is exported or not exported API. But that's just nitpicking. Which prefix do you mean? I just didn't want to call it 'device', and 'ca_device' was short enough for me to be 'local' :) +struct userdata { +PA_LLIST_HEAD(ca_device, devices); +}; + +static int ca_device_added(struct pa_module *m, AudioDeviceID id) { +char args[32]; +pa_module *mod; +struct userdata *u = m-userdata; +struct ca_device *dev; + +pa_assert(u); + +pa_snprintf(args, sizeof(args), device_id=%d, id); Using pa_malloc_sprintf() is recommended. I am actually trying to get rid of the use of pa_snprintf() in PA entirely and am replacing it with the malloc version wherever I encounter it and it makes sense (i.e. outside of RT threads). Ok, will fix. +if (!mod) { +pa_log_info(Failed to load module %s with arguments '%s', DEVICE_MODULE_NAME, args); +return -1; +} + +dev = pa_xnew0(ca_device, 1); +pa_assert(dev); No need for this assert. The x in pa_xnew0 should make clear that this is an aborting allocation anyway. Ok. +if (AudioHardwareAddPropertyListener(kAudioHardwarePropertyDevices, property_listener_proc, m)) { +pa_log(AudioHardwareAddPropertyListener() failed.); +goto fail; +} Hmm, how are these event callbacks called? From a background thread? Or is this hooked up to the event loop in some way? Or is this only one-time during initialization? They're called from a background thread, indeed. CoreAudio has no clue about PA's mainloop implementation, so it can't hook up in there. So yes, we might need some locking here. I just wasn't sure how PA likes that (iow, which resources I need to lock and how), so I ignored it for now. Any hint? Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 4/4] Wrap clock_gettime and friends
On Tue, Nov 03, 2009 at 11:33:37PM +0100, Lennart Poettering wrote: On Sun, 01.11.09 20:16, Daniel Mack (dan...@caiaq.de) wrote: My build bails due to an undefined 'CLOCK_REALTIME', and this is because HAVE_CLOCK_GETTIME is also defined on Darwin. Uh? If HAVE_CLOCK_GETTIME is set, than this means that clock_gettime() is available, too. So why are we emulating it then? Because CLOCK_REALTIME is undefined. I think the true reason is that HAVE_CLOCK_GETTIME is bogus in this case. It is reported to be supported but in fact it isn't. Maybe the real fix would be to check why. But that involves dealing with autofoo and their braindead m4 macro voodoo which always ruins my day ;) Volounteers? Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 4/4] Wrap clock_gettime and friends
On Sat, Oct 31, 2009 at 01:41:19AM +0100, Lennart Poettering wrote: On Mon, 19.10.09 12:45, Daniel Mack (dan...@caiaq.de) wrote: And clock_gettime we don't really need either. We need some kind of accurate system timers (preferably monotonic), and on Linux we use clock_gettime() for that. But we already have a fallback there for gettimeofday(). Or in other words, the current APIs pa_rtclock_get(), pa_rtclock_hrtimer() is supposed to be the abstract API that has different backends on different systems. I'd very much prefer if any MacOS specific code would simply be plugged in there instead of creating various new abstraction interfaces! Ok - what about the version below? I don't particularily like the #ifdeffery jungle, but it is a lot less code now. Thanks. Looks much better. I reordered things a little now and merged this. Please verify that I didn't break the MacOS code while I did that! My build bails due to an undefined 'CLOCK_REALTIME', and this is because HAVE_CLOCK_GETTIME is also defined on Darwin. Below is a patch to fix it. Thanks, Daniel From bc9d25667bf983a0c278a0b151b511de1ea2a246 Mon Sep 17 00:00:00 2001 From: Daniel Mack dan...@caiaq.de Date: Sun, 1 Nov 2009 20:06:08 +0100 Subject: [PATCH] core-rtclock.c: tweak OS_IS_DARWIN contraints Move the code for OS_IS_DARWIN to the top as on Darwin, HAVE_CLOCK_GETTIME is also defined. --- src/pulsecore/core-rtclock.c | 75 -- 1 files changed, 36 insertions(+), 39 deletions(-) diff --git a/src/pulsecore/core-rtclock.c b/src/pulsecore/core-rtclock.c index 4fe0a47..d75674c 100644 --- a/src/pulsecore/core-rtclock.c +++ b/src/pulsecore/core-rtclock.c @@ -54,29 +54,7 @@ pa_usec_t pa_rtclock_age(const struct timeval *tv) { struct timeval *pa_rtclock_get(struct timeval *tv) { -#if defined(HAVE_CLOCK_GETTIME) -struct timespec ts; - -#ifdef CLOCK_MONOTONIC -/* No locking or atomic ops for no_monotonic here */ -static pa_bool_t no_monotonic = FALSE; - -if (!no_monotonic) -if (clock_gettime(CLOCK_MONOTONIC, ts) 0) -no_monotonic = TRUE; - -if (no_monotonic) -#endif /* CLOCK_MONOTONIC */ -pa_assert_se(clock_gettime(CLOCK_REALTIME, ts) == 0); - -pa_assert(tv); - -tv-tv_sec = ts.tv_sec; -tv-tv_usec = ts.tv_nsec / PA_NSEC_PER_USEC; - -return tv; - -#elif defined(OS_IS_DARWIN) +#if defined(OS_IS_DARWIN) static mach_timebase_info_data_t tbi; uint64_t nticks; uint64_t time_nsec; @@ -99,41 +77,60 @@ struct timeval *pa_rtclock_get(struct timeval *tv) { return tv; -#else /* OS_IS_DARWIN */ +#elif defined(HAVE_CLOCK_GETTIME) +struct timespec ts; -return pa_gettimeofday(tv); +#ifdef CLOCK_MONOTONIC +/* No locking or atomic ops for no_monotonic here */ +static pa_bool_t no_monotonic = FALSE; -#endif +if (!no_monotonic) +if (clock_gettime(CLOCK_MONOTONIC, ts) 0) +no_monotonic = TRUE; + +if (no_monotonic) +#endif /* CLOCK_MONOTONIC */ +pa_assert_se(clock_gettime(CLOCK_REALTIME, ts) == 0); + +pa_assert(tv); + +tv-tv_sec = ts.tv_sec; +tv-tv_usec = ts.tv_nsec / PA_NSEC_PER_USEC; + +return tv; +#endif /* HAVE_CLOCK_GETTIME */ + +return pa_gettimeofday(tv); } pa_bool_t pa_rtclock_hrtimer(void) { -#if defined(HAVE_CLOCK_GETTIME) +#if defined (OS_IS_DARWIN) +mach_timebase_info_data_t tbi; +uint64_t time_nsec; + +mach_timebase_info(tbi); + +/* nsec = nticks * (N/D) - we want 1 tick == resolution !? */ +time_nsec = tbi.numer / tbi.denom; +return time_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); + +#elif defined(HAVE_CLOCK_GETTIME) struct timespec ts; #ifdef CLOCK_MONOTONIC if (clock_getres(CLOCK_MONOTONIC, ts) = 0) return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); + #endif /* CLOCK_MONOTONIC */ pa_assert_se(clock_getres(CLOCK_REALTIME, ts) == 0); return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); -#elif defined (OS_IS_DARWIN) -mach_timebase_info_data_t tbi; -uint64_t time_nsec; +#else /* HAVE_CLOCK_GETTIME */ -mach_timebase_info(tbi); - -/* nsec = nticks * (N/D) - we want 1 tick == resolution !? */ -time_nsec = tbi.numer / tbi.denom; -return time_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); - -#else /* OS_IS_DARWIN */ return FALSE; - -#endif } #define TIMER_SLACK_NS (int) ((500 * PA_NSEC_PER_USEC)) -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 1/4] configure.ac: add DARWIN_OS variable
Hi Lennart, This one is still missing upstream. Care to pick it? Thanks, Daniel On Wed, Sep 16, 2009 at 03:15:20PM +0800, Daniel Mack wrote: Signed-off-by: Kim Lester k...@dfusion.com.au Signed-off-by: Daniel Mack dan...@caiaq.de --- configure.ac | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index adf5d90..27b2e46 100644 --- a/configure.ac +++ b/configure.ac @@ -186,6 +186,10 @@ case $host in AC_MSG_RESULT([netbsd]) pulse_target_os=netbsd ;; +*-*-darwin*) +AC_MSG_RESULT([darwin]) +pulse_target_os=darwin +;; *) AC_MSG_RESULT([unknown]) pulse_target_os=unknown @@ -303,15 +307,21 @@ AC_SUBST([LIBLTDL]) Determine build environment os_is_win32=0 +os_is_darwin=0 case $host_os in mingw*) AC_DEFINE([OS_IS_WIN32], 1, [Build target is Windows.]) os_is_win32=1 ;; +darwin*) +AC_DEFINE([OS_IS_DARWIN], 1, [Build target is Darwin.]) +os_is_darwin=1 +;; esac AM_CONDITIONAL(OS_IS_WIN32, test x$os_is_win32 = x1) +AM_CONDITIONAL(OS_IS_DARWIN, test x$os_is_darwin = x1) ### # Basic environment checks # @@ -415,6 +425,19 @@ AC_SEARCH_LIBS([backtrace], [execinfo]) # build, disabling its ability to make dlls. AC_CHECK_FUNCS([getopt_long], [], [AC_CHECK_LIB([iberty], [getopt_long])]) +# Darwin/OS X +if test x$os_is_darwin = x1 ; then +AC_MSG_CHECKING([looking for Apple CoreService Framework]) +# How do I check a framework library - AC_CHECK_LIB prob. won't work??, just assign LIBS hope +# AC_CHECK_HEADER([Multiprocessing.h], +AC_CHECK_HEADER([/Developer/Headers/FlatCarbon/Multiprocessing.h], +[LIBS=$LIBS -framework CoreServices], +[AC_MSG_ERROR([Multiprocessing.h header file not found]) ]) + +AC_MSG_RESULT([ok]) +AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Using clock_gettime() replacement]) +fi + Check for functions # ISO -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 3/4] src/Makefile.am: add specific OS_IS_DARWIN files
This one also didn't make it yet :) Daniel On Wed, Sep 16, 2009 at 03:15:22PM +0800, Daniel Mack wrote: Signed-off-by: Kim Lester k...@dfusion.com.au Signed-off-by: Daniel Mack dan...@caiaq.de --- src/Makefile.am | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 6544e2a..b12ed8f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -649,12 +649,21 @@ libpulsecomm...@pa_majorminormicro@_la_SOURCES += \ pulsecore/mutex-win32.c pulsecore/mutex.h \ pulsecore/thread-win32.c pulsecore/thread.h \ pulsecore/semaphore-win32.c pulsecore/semaphore.h -else +else !OS_IS_WIN32 +if OS_IS_DARWIN +libpulsecomm...@pa_majorminormicro@_la_SOURCES += \ + pulsecore/mutex-posix.c pulsecore/mutex.h \ + pulsecore/thread-posix.c pulsecore/thread.h \ + pulsecore/semaphore-osx.c pulsecore/semaphore.h +libpulsecomm...@pa_majorminormicro@_la_CFLAGS += -I/Developer/Headers/FlatCarbon/ +#libpulsecomm...@pa_majorminormicro@_la_LDFLAGS += -framework CoreServices +else !OS_IS_DARWIN libpulsecomm...@pa_majorminormicro@_la_SOURCES += \ pulsecore/mutex-posix.c pulsecore/mutex.h \ pulsecore/thread-posix.c pulsecore/thread.h \ pulsecore/semaphore-posix.c pulsecore/semaphore.h -endif +endif !OS_IS_DARWIN +endif !OS_IS_WIN32 if HAVE_X11 libpulsecomm...@pa_majorminormicro@_la_SOURCES += pulsecore/x11prop.c pulsecore/x11prop.h -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 4/4] Wrap clock_gettime and friends
On Sun, Nov 01, 2009 at 08:16:10PM +0100, Daniel Mack wrote: On Sat, Oct 31, 2009 at 01:41:19AM +0100, Lennart Poettering wrote: On Mon, 19.10.09 12:45, Daniel Mack (dan...@caiaq.de) wrote: And clock_gettime we don't really need either. We need some kind of accurate system timers (preferably monotonic), and on Linux we use clock_gettime() for that. But we already have a fallback there for gettimeofday(). Or in other words, the current APIs pa_rtclock_get(), pa_rtclock_hrtimer() is supposed to be the abstract API that has different backends on different systems. I'd very much prefer if any MacOS specific code would simply be plugged in there instead of creating various new abstraction interfaces! Ok - what about the version below? I don't particularily like the #ifdeffery jungle, but it is a lot less code now. Thanks. Looks much better. I reordered things a little now and merged this. Please verify that I didn't break the MacOS code while I did that! My build bails due to an undefined 'CLOCK_REALTIME', and this is because HAVE_CLOCK_GETTIME is also defined on Darwin. Below is a patch to fix it. Damn, that one was broken. New version below. Daniel From d36d53f6123a358cd69988f98180977e706c27e4 Mon Sep 17 00:00:00 2001 From: Daniel Mack dan...@caiaq.de Date: Sun, 1 Nov 2009 20:06:08 +0100 Subject: [PATCH] core-rtclock.c: tweak OS_IS_DARWIN constraints Move the code for OS_IS_DARWIN to the top as on Darwin, HAVE_CLOCK_GETTIME is also defined. --- src/pulsecore/core-rtclock.c | 75 -- 1 files changed, 36 insertions(+), 39 deletions(-) diff --git a/src/pulsecore/core-rtclock.c b/src/pulsecore/core-rtclock.c index 4fe0a47..5916d96 100644 --- a/src/pulsecore/core-rtclock.c +++ b/src/pulsecore/core-rtclock.c @@ -54,29 +54,7 @@ pa_usec_t pa_rtclock_age(const struct timeval *tv) { struct timeval *pa_rtclock_get(struct timeval *tv) { -#if defined(HAVE_CLOCK_GETTIME) -struct timespec ts; - -#ifdef CLOCK_MONOTONIC -/* No locking or atomic ops for no_monotonic here */ -static pa_bool_t no_monotonic = FALSE; - -if (!no_monotonic) -if (clock_gettime(CLOCK_MONOTONIC, ts) 0) -no_monotonic = TRUE; - -if (no_monotonic) -#endif /* CLOCK_MONOTONIC */ -pa_assert_se(clock_gettime(CLOCK_REALTIME, ts) == 0); - -pa_assert(tv); - -tv-tv_sec = ts.tv_sec; -tv-tv_usec = ts.tv_nsec / PA_NSEC_PER_USEC; - -return tv; - -#elif defined(OS_IS_DARWIN) +#if defined(OS_IS_DARWIN) static mach_timebase_info_data_t tbi; uint64_t nticks; uint64_t time_nsec; @@ -99,41 +77,60 @@ struct timeval *pa_rtclock_get(struct timeval *tv) { return tv; -#else /* OS_IS_DARWIN */ +#elif defined(HAVE_CLOCK_GETTIME) +struct timespec ts; -return pa_gettimeofday(tv); +#ifdef CLOCK_MONOTONIC +/* No locking or atomic ops for no_monotonic here */ +static pa_bool_t no_monotonic = FALSE; -#endif +if (!no_monotonic) +if (clock_gettime(CLOCK_MONOTONIC, ts) 0) +no_monotonic = TRUE; + +if (no_monotonic) +#endif /* CLOCK_MONOTONIC */ +pa_assert_se(clock_gettime(CLOCK_REALTIME, ts) == 0); + +pa_assert(tv); + +tv-tv_sec = ts.tv_sec; +tv-tv_usec = ts.tv_nsec / PA_NSEC_PER_USEC; + +return tv; +#endif /* HAVE_CLOCK_GETTIME */ + +return pa_gettimeofday(tv); } pa_bool_t pa_rtclock_hrtimer(void) { -#if defined(HAVE_CLOCK_GETTIME) +#if defined (OS_IS_DARWIN) +mach_timebase_info_data_t tbi; +uint64_t time_nsec; + +mach_timebase_info(tbi); + +/* nsec = nticks * (N/D) - we want 1 tick == resolution !? */ +time_nsec = tbi.numer / tbi.denom; +return time_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); + +#elif defined(HAVE_CLOCK_GETTIME) struct timespec ts; #ifdef CLOCK_MONOTONIC if (clock_getres(CLOCK_MONOTONIC, ts) = 0) return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); + #endif /* CLOCK_MONOTONIC */ pa_assert_se(clock_getres(CLOCK_REALTIME, ts) == 0); return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); -#elif defined (OS_IS_DARWIN) -mach_timebase_info_data_t tbi; -uint64_t time_nsec; +#endif /* HAVE_CLOCK_GETTIME */ -mach_timebase_info(tbi); - -/* nsec = nticks * (N/D) - we want 1 tick == resolution !? */ -time_nsec = tbi.numer / tbi.denom; -return time_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); - -#else /* OS_IS_DARWIN */ return FALSE; - -#endif } #define TIMER_SLACK_NS (int) ((500 * PA_NSEC_PER_USEC)) -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] cli: handle platforms with O_CLOEXIT undefined
O_CLOEXIT is undefined on Mac OS X, #define it to 0 there. --- src/modules/module-cli.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/modules/module-cli.c b/src/modules/module-cli.c index 6bd0f4f..bfd58b3 100644 --- a/src/modules/module-cli.c +++ b/src/modules/module-cli.c @@ -40,6 +40,11 @@ #include module-cli-symdef.h +/* Mac OS X does not define O_CLOEXEC */ +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif + PA_MODULE_AUTHOR(Lennart Poettering); PA_MODULE_DESCRIPTION(Command line interface); PA_MODULE_VERSION(PACKAGE_VERSION); -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] configure.ac: enable check for CoreAudio
diff --git a/configure.ac b/configure.ac index ca6eaca..83983c3 100644 --- a/configure.ac +++ b/configure.ac @@ -765,6 +765,28 @@ AC_SUBST(HAVE_OSS) AM_CONDITIONAL([HAVE_OSS_OUTPUT], [test x$HAVE_OSS = x1 test x${oss_output} != xno]) AM_CONDITIONAL([HAVE_OSS_WRAPPER], [test x$HAVE_OSS = x1 test x${oss_wrapper} != xno]) + CoreAudio support (optional) + +AC_ARG_ENABLE([coreaudio-output], +AS_HELP_STRING([--disable-coreaudio-output],[Disable optional CoreAudio output support]), +[ +case ${enableval} in +yes) coreaudio_enabled=yes ;; +no) coreaudio_enabled=no ;; +*) AC_MSG_ERROR(bad value ${enableval} for --disable-coreaudio-output) ;; +esac +], +[coreaudio_enabled=auto]) + +if test x${coreaudio_enabled} != xno ; then +AC_CHECK_HEADERS([CoreAudio/CoreAudio.h], HAVE_COREAUDIO=1) +else +HAVE_COREAUDIO=0 +fi + +AC_SUBST(HAVE_COREAUDIO) +AM_CONDITIONAL([HAVE_COREAUDIO], [test x$HAVE_COREAUDIO = x1 test x${coreaudio_enabled} != xno]) + ALSA support (optional) AC_ARG_ENABLE([alsa], @@ -1446,6 +1468,11 @@ if test x$HAVE_OSS = x1 ; then fi fi +ENABLE_COREAUDIO=no +if test x$HAVE_COREAUDIO = x1 ; then + ENABLE_COREAUDIO=yes +fi + ENABLE_ALSA=no if test x$HAVE_ALSA = x1 ; then ENABLE_ALSA=yes @@ -1571,6 +1598,7 @@ echo Have X11: ${ENABLE_X11} Enable OSS Output: ${ENABLE_OSS_OUTPUT} Enable OSS Wrapper:${ENABLE_OSS_WRAPPER} +Enable CoreAudio: ${ENABLE_COREAUDIO} Enable Alsa: ${ENABLE_ALSA} Enable Solaris:${ENABLE_SOLARIS} Enable GLib 2.0: ${ENABLE_GLIB20} -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] cli: handle platforms with O_CLOEXIT undefined
On Sat, Oct 31, 2009 at 01:59:33AM +0100, Lennart Poettering wrote: On Sat, 31.10.09 01:54, Daniel Mack (dan...@caiaq.de) wrote: O_CLOEXIT is undefined on Mac OS X, #define it to 0 there. --- src/modules/module-cli.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) I figure you mean O_CLOEXEC, right? Erm, of course. Coincidentally I have applied a number of patches yesterday that get rid of O_CLOEXEC entirely, and replaced it with a central function pa_open_cloexec() that portably uses it if it is available and otherwise falls back to fcntl(). If you update your tree from current git this problem should be fixed for you... Ok, great. Will do. Thanks, Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 4/4] Wrap clock_gettime and friends
ping? On Mon, Oct 19, 2009 at 12:45:30PM +0200, Daniel Mack wrote: On Wed, Sep 16, 2009 at 11:48:58PM +0200, Lennart Poettering wrote: On Wed, 16.09.09 15:15, Daniel Mack (dan...@caiaq.de) wrote: From: Kim Lester k...@dfusion.com.au OS X does not define clockid_t or clock_gettime() and friends. Add a wrapper to fix this. Hmpf. I am not particularly happy with this. This adds a lot of unnecessary compat code. We don't actually need implementations of clock_getres(). All we need is some kind of check whether system timers are accurate or whether they are rounded up to scheduling slices. On Linux we do that check with clock_getres(), but all the information it returns is actually not intertesting at all. We just check if this is below some trheshold, that's all. clock_settime() we don't use at all! We shouldn't carry compat code for that. And clock_gettime we don't really need either. We need some kind of accurate system timers (preferably monotonic), and on Linux we use clock_gettime() for that. But we already have a fallback there for gettimeofday(). Or in other words, the current APIs pa_rtclock_get(), pa_rtclock_hrtimer() is supposed to be the abstract API that has different backends on different systems. I'd very much prefer if any MacOS specific code would simply be plugged in there instead of creating various new abstraction interfaces! Ok - what about the version below? I don't particularily like the #ifdeffery jungle, but it is a lot less code now. Daniel From 9f0a051953ec354ccdb8aa44a9845c408b26ae0b Mon Sep 17 00:00:00 2001 From: Kim Lester k...@dfusion.com.au Date: Wed, 16 Sep 2009 14:40:01 +0800 Subject: [PATCH] Implement pa_rtclock_get() and pa_rtclock_hrtimer() for Darwin OS X does not define clockid_t or clock_gettime() and friends. Add wrappers to fix this. Based on a patch from Kim Lester k...@dfusion.com.au. Signed-off-by: Daniel Mack dan...@caiaq.de --- src/pulsecore/core-rtclock.c | 53 ++--- 1 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/pulsecore/core-rtclock.c b/src/pulsecore/core-rtclock.c index 1420470..15b4f16 100644 --- a/src/pulsecore/core-rtclock.c +++ b/src/pulsecore/core-rtclock.c @@ -33,6 +33,12 @@ #include sys/prctl.h #endif +#ifdef OS_IS_DARWIN +#include CoreServices/CoreServices.h +#include mach/mach.h +#include mach/mach_time.h +#endif + #include pulse/timeval.h #include pulsecore/macro.h #include pulsecore/core-error.h @@ -47,6 +53,7 @@ pa_usec_t pa_rtclock_age(const struct timeval *tv) { } struct timeval *pa_rtclock_get(struct timeval *tv) { +#ifndef OS_IS_DARWIN #ifdef HAVE_CLOCK_GETTIME struct timespec ts; @@ -59,7 +66,7 @@ struct timeval *pa_rtclock_get(struct timeval *tv) { no_monotonic = TRUE; if (no_monotonic) -#endif +#endif /* CLOCK_MONOTONIC */ pa_assert_se(clock_gettime(CLOCK_REALTIME, ts) == 0); pa_assert(tv); @@ -73,21 +80,59 @@ struct timeval *pa_rtclock_get(struct timeval *tv) { return pa_gettimeofday(tv); -#endif +#endif /* HAVE_CLOCK_GETTIME */ + +#else /* OS_IS_DARWIN */ +static mach_timebase_info_data_t tbi; +uint64_t nticks; +uint64_t time_nsec; + +/* Refer Apple ADC QA1398 + Also: http://devworld.apple.com/documentation/Darwin/Conceptual/KernelProgramming/services/services.html + + Note: argument is timespec NOT timeval (timespec uses nsec, timeval uses usec) +*/ + +/* try and be a mite efficient - maybe I should keep the N/D as a float !? */ +if (tbi.denom == 0) +mach_timebase_info(tbi); + +nticks = mach_absolute_time(); +time_nsec = nticks * tbi.numer / tbi.denom; // see above + +tv-tv_sec = time_nsec / PA_NSEC_PER_SEC; +tv-tv_usec = time_nsec / PA_NSEC_PER_USEC; + +return tv; + +#endif /* OS_IS_DARWIN */ } pa_bool_t pa_rtclock_hrtimer(void) { #ifdef HAVE_CLOCK_GETTIME -struct timespec ts; #ifdef CLOCK_MONOTONIC +struct timespec ts; + if (clock_getres(CLOCK_MONOTONIC, ts) = 0) return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); -#endif +#elif defined (OS_IS_DARWIN) +mach_timebase_info_data_t tbi; +uint64_t time_nsec; + +mach_timebase_info(tbi); + +/* nsec = nticks * (N/D) - we want 1 tick == resolution !? */ +time_nsec = tbi.numer / tbi.denom; +return time_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); +#else +struct timespec ts; pa_assert_se(clock_getres(CLOCK_REALTIME, ts) == 0); return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); +#endif /* OS_IS_DARWIN */ + #else /* HAVE_CLOCK_GETTIME */ return FALSE; -- 1.6.3.3 ___ pulseaudio-discuss mailing
Re: [pulseaudio-discuss] [PATCH 4/4] Wrap clock_gettime and friends
On Wed, Sep 16, 2009 at 11:48:58PM +0200, Lennart Poettering wrote: On Wed, 16.09.09 15:15, Daniel Mack (dan...@caiaq.de) wrote: From: Kim Lester k...@dfusion.com.au OS X does not define clockid_t or clock_gettime() and friends. Add a wrapper to fix this. Hmpf. I am not particularly happy with this. This adds a lot of unnecessary compat code. We don't actually need implementations of clock_getres(). All we need is some kind of check whether system timers are accurate or whether they are rounded up to scheduling slices. On Linux we do that check with clock_getres(), but all the information it returns is actually not intertesting at all. We just check if this is below some trheshold, that's all. clock_settime() we don't use at all! We shouldn't carry compat code for that. And clock_gettime we don't really need either. We need some kind of accurate system timers (preferably monotonic), and on Linux we use clock_gettime() for that. But we already have a fallback there for gettimeofday(). Or in other words, the current APIs pa_rtclock_get(), pa_rtclock_hrtimer() is supposed to be the abstract API that has different backends on different systems. I'd very much prefer if any MacOS specific code would simply be plugged in there instead of creating various new abstraction interfaces! Ok - what about the version below? I don't particularily like the #ifdeffery jungle, but it is a lot less code now. Daniel From 9f0a051953ec354ccdb8aa44a9845c408b26ae0b Mon Sep 17 00:00:00 2001 From: Kim Lester k...@dfusion.com.au Date: Wed, 16 Sep 2009 14:40:01 +0800 Subject: [PATCH] Implement pa_rtclock_get() and pa_rtclock_hrtimer() for Darwin OS X does not define clockid_t or clock_gettime() and friends. Add wrappers to fix this. Based on a patch from Kim Lester k...@dfusion.com.au. Signed-off-by: Daniel Mack dan...@caiaq.de --- src/pulsecore/core-rtclock.c | 53 ++--- 1 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/pulsecore/core-rtclock.c b/src/pulsecore/core-rtclock.c index 1420470..15b4f16 100644 --- a/src/pulsecore/core-rtclock.c +++ b/src/pulsecore/core-rtclock.c @@ -33,6 +33,12 @@ #include sys/prctl.h #endif +#ifdef OS_IS_DARWIN +#include CoreServices/CoreServices.h +#include mach/mach.h +#include mach/mach_time.h +#endif + #include pulse/timeval.h #include pulsecore/macro.h #include pulsecore/core-error.h @@ -47,6 +53,7 @@ pa_usec_t pa_rtclock_age(const struct timeval *tv) { } struct timeval *pa_rtclock_get(struct timeval *tv) { +#ifndef OS_IS_DARWIN #ifdef HAVE_CLOCK_GETTIME struct timespec ts; @@ -59,7 +66,7 @@ struct timeval *pa_rtclock_get(struct timeval *tv) { no_monotonic = TRUE; if (no_monotonic) -#endif +#endif /* CLOCK_MONOTONIC */ pa_assert_se(clock_gettime(CLOCK_REALTIME, ts) == 0); pa_assert(tv); @@ -73,21 +80,59 @@ struct timeval *pa_rtclock_get(struct timeval *tv) { return pa_gettimeofday(tv); -#endif +#endif /* HAVE_CLOCK_GETTIME */ + +#else /* OS_IS_DARWIN */ +static mach_timebase_info_data_t tbi; +uint64_t nticks; +uint64_t time_nsec; + +/* Refer Apple ADC QA1398 + Also: http://devworld.apple.com/documentation/Darwin/Conceptual/KernelProgramming/services/services.html + + Note: argument is timespec NOT timeval (timespec uses nsec, timeval uses usec) +*/ + +/* try and be a mite efficient - maybe I should keep the N/D as a float !? */ +if (tbi.denom == 0) +mach_timebase_info(tbi); + +nticks = mach_absolute_time(); +time_nsec = nticks * tbi.numer / tbi.denom; // see above + +tv-tv_sec = time_nsec / PA_NSEC_PER_SEC; +tv-tv_usec = time_nsec / PA_NSEC_PER_USEC; + +return tv; + +#endif /* OS_IS_DARWIN */ } pa_bool_t pa_rtclock_hrtimer(void) { #ifdef HAVE_CLOCK_GETTIME -struct timespec ts; #ifdef CLOCK_MONOTONIC +struct timespec ts; + if (clock_getres(CLOCK_MONOTONIC, ts) = 0) return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); -#endif +#elif defined (OS_IS_DARWIN) +mach_timebase_info_data_t tbi; +uint64_t time_nsec; + +mach_timebase_info(tbi); + +/* nsec = nticks * (N/D) - we want 1 tick == resolution !? */ +time_nsec = tbi.numer / tbi.denom; +return time_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); +#else +struct timespec ts; pa_assert_se(clock_getres(CLOCK_REALTIME, ts) == 0); return ts.tv_sec == 0 ts.tv_nsec = (long) (PA_HRTIMER_THRESHOLD_USEC*PA_NSEC_PER_USEC); +#endif /* OS_IS_DARWIN */ + #else /* HAVE_CLOCK_GETTIME */ return FALSE; -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 2/4] Mac OS X: add semaphore implementation
On Wed, Sep 16, 2009 at 11:57:04PM +0200, Lennart Poettering wrote: On Wed, 16.09.09 15:15, Daniel Mack (dan...@caiaq.de) wrote: +s = pa_xnew(pa_semaphore, 1); +MPCreateSemaphore(UINT_MAX, value, (s-sema)); +pa_assert(s-sema != 0); Hmm, I'd prefer if the ret val of MPCreateSemaphore() would be checked here. Also I find it a bit weird checking for s-sema, though not initializing it to 0 in the beginning. If the call actually failed, then the assert will check uninitialized memory. Also, comparing pointers with 0 sucks. That should be NULL. Given that this can not realisitically fail, only in OOM or OOM-like situations in which case we abort anyway it mght be enough just writing: pa_assert_se(MPCreateSemaphore(UINT_MAX, value, s-sema) == 0); (Assuming that success is signalled by retval == 0 on MacOSX) +void pa_semaphore_free(pa_semaphore *s) { +pa_assert(s); +MPDeleteSemaphore(s-sema); Same here. +pa_xfree(s); +} + +void pa_semaphore_post(pa_semaphore *s) { +pa_assert(s); +MPSignalSemaphore(s-sema); And here. +} + +void pa_semaphore_wait(pa_semaphore *s) { +pa_assert(s); +/* should probably check return value (-ve is error), noErr is ok. */ +MPWaitOnSemaphore(s-sema, kDurationForever); And here. Ok, done. See the patch below. Daniel From 26df2fbae6d9215a3ae084876fb5f79e4d9cf4f0 Mon Sep 17 00:00:00 2001 From: Kim Lester k...@dfusion.com.au Date: Wed, 16 Sep 2009 09:23:39 +0800 Subject: [PATCH] Mac OS X: add semaphore implementation Signed-off-by: Kim Lester k...@dfusion.com.au Signed-off-by: Daniel Mack dan...@caiaq.de --- src/pulsecore/semaphore-osx.c | 63 + 1 files changed, 63 insertions(+), 0 deletions(-) create mode 100644 src/pulsecore/semaphore-osx.c diff --git a/src/pulsecore/semaphore-osx.c b/src/pulsecore/semaphore-osx.c new file mode 100644 index 000..73f4355 --- /dev/null +++ b/src/pulsecore/semaphore-osx.c @@ -0,0 +1,63 @@ +/*** + This file is part of PulseAudio. + + Copyright 2009 Kim Lester k...@dfusion.com.au + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, + or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include Multiprocessing.h + +#include pulse/xmalloc.h +#include pulsecore/macro.h + +#include semaphore.h + +struct pa_semaphore +{ +MPSemaphoreID sema; +}; + +pa_semaphore* pa_semaphore_new(unsigned int value) { +/* NOTE: Can't assume boolean - ie value = 0,1, so use UINT_MAX (boolean more efficient ?) */ +pa_semaphore *s; + +s = pa_xnew(pa_semaphore, 1); +pa_assert_se(MPCreateSemaphore(UINT_MAX, value, s-sema) == 0); + +return s; +} + +void pa_semaphore_free(pa_semaphore *s) { +pa_assert(s); +pa_assert_se(MPDeleteSemaphore(s-sema) == 0); +pa_xfree(s); +} + +void pa_semaphore_post(pa_semaphore *s) { +pa_assert(s); +pa_assert_se(MPSignalSemaphore(s-sema) == 0); +} + +void pa_semaphore_wait(pa_semaphore *s) { +pa_assert(s); +/* should probably check return value (-ve is error), noErr is ok. */ +pa_assert_se(MPWaitOnSemaphore(s-sema, kDurationForever) == 0); +} -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] Build w/o DBus
The current git head does not build without DBus libraries installed. Does the patch below look suitable? Thanks, Daniel From f69145fc603c56cef02134ceeba10e1727fa217e Mon Sep 17 00:00:00 2001 From: Daniel Mack dan...@caiaq.de Date: Thu, 8 Oct 2009 14:41:21 +0800 Subject: [PATCH] Makefile.am: fix builds without DBus Signed-off-by: Daniel Mack dan...@caiaq.de --- src/Makefile.am | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 74ad659..87be0c0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -180,14 +180,19 @@ pulseaudio_SOURCES = \ daemon/daemon-conf.c daemon/daemon-conf.h \ daemon/dumpmodules.c daemon/dumpmodules.h \ daemon/ltdl-bind-now.c daemon/ltdl-bind-now.h \ - daemon/main.c \ - daemon/server-lookup.c daemon/server-lookup.h + daemon/main.c -pulseaudio_CFLAGS = $(AM_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(LIBSNDFILE_CFLAGS) $(CAP_CFLAGS) $(DBUS_CFLAGS) -pulseaudio_LDADD = $(AM_LDADD) libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSPEEX_LIBS) $(LIBSNDFILE_LIBS) $(CAP_LIBS) $(DBUS_LIBS) +pulseaudio_CFLAGS = $(AM_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(LIBSNDFILE_CFLAGS) $(CAP_CFLAGS) +pulseaudio_LDADD = $(AM_LDADD) libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSPEEX_LIBS) $(LIBSNDFILE_LIBS) $(CAP_LIBS) # This is needed because automake doesn't properly expand the foreach below pulseaudio_DEPENDENCIES = libpulseco...@pa_majorminormicro@.la libpulsecomm...@pa_majorminormicro@.la libpulse.la $(PREOPEN_LIBS) +if HAVE_DBUS +pulseaudio_CFLAGS += $(DBUS_CFLAGS) +pulseaudio_SOURCES += daemon/server-lookup.c daemon/server-lookup.h +pulseaudio_LDADD += $(DBUS_LIBS) +endif + if PREOPEN_MODS PREOPEN_LIBS = $(PREOPEN_MODS) else -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Mac OS X: dyld: Symbol not found: _g_get_application_name
On Fri, Sep 18, 2009 at 01:36:13AM +1000, Kim Lester wrote: That's fine by me :-) Sorry I haven't been around lately to split up my patches etc - work :-) Trying to keep an eye on PA though. Hmm. I'd appreciate if you could pick up the thread again and follow Lennart's suggestions to clean up the code. Is that possible? It might take awhile until I find time to do it, but I will eventually if nobody else cares. Daniel On 16/09/2009, at 4:53 PM, Daniel Mack wrote: On Tue, Sep 15, 2009 at 02:48:00PM +0200, Lennart Poettering wrote: On Tue, 15.09.09 05:51, Daniel Mack (dan...@caiaq.de) wrote: I do get another error now, which I will try to sort out later today. But maybe anyone has an idea, so I still let you know: $ ./pulseaudio E: semaphore-posix.c: Assertion 'sem_init(s-sem, 0, value) == 0' failed at pulsecore/semaphore-posix.c:43, function pa_semaphore_new(). Aborting. Abort trap I think this makes an interesting read: https://tango.0pointer.de/pipermail/pulseaudio-discuss/2008-November/002590.html Kim Lester already fixed that in his patch. I split it up now to four smaller pieces and will send them to list to comment on. I left all the comments in and cleaned up the coding style as far as I could. And as all the code is from Kim, I used his Signed-off-by line on all the patches. Hope that's ok. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Mac OS X: dyld: Symbol not found: _g_get_application_name
On Tue, Sep 15, 2009 at 02:48:00PM +0200, Lennart Poettering wrote: On Tue, 15.09.09 05:51, Daniel Mack (dan...@caiaq.de) wrote: I do get another error now, which I will try to sort out later today. But maybe anyone has an idea, so I still let you know: $ ./pulseaudio E: semaphore-posix.c: Assertion 'sem_init(s-sem, 0, value) == 0' failed at pulsecore/semaphore-posix.c:43, function pa_semaphore_new(). Aborting. Abort trap I think this makes an interesting read: https://tango.0pointer.de/pipermail/pulseaudio-discuss/2008-November/002590.html Kim Lester already fixed that in his patch. I split it up now to four smaller pieces and will send them to list to comment on. I left all the comments in and cleaned up the coding style as far as I could. And as all the code is from Kim, I used his Signed-off-by line on all the patches. Hope that's ok. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 2/4] Mac OS X: add semaphore implementation
From: Kim Lester k...@dfusion.com.au Signed-off-by: Kim Lester k...@dfusion.com.au Signed-off-by: Daniel Mack dan...@caiaq.de --- src/pulsecore/semaphore-osx.c | 64 + 1 files changed, 64 insertions(+), 0 deletions(-) create mode 100644 src/pulsecore/semaphore-osx.c diff --git a/src/pulsecore/semaphore-osx.c b/src/pulsecore/semaphore-osx.c new file mode 100644 index 000..0fb3d5c --- /dev/null +++ b/src/pulsecore/semaphore-osx.c @@ -0,0 +1,64 @@ +/*** + This file is part of PulseAudio. + + Copyright 2009 Kim Lester k...@dfusion.com.au + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, + or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include Multiprocessing.h + +#include pulse/xmalloc.h +#include pulsecore/macro.h + +#include semaphore.h + +struct pa_semaphore +{ +MPSemaphoreID sema; +}; + +pa_semaphore* pa_semaphore_new(unsigned int value) { +/* NOTE: Can't assume boolean - ie value = 0,1, so use UINT_MAX (boolean more efficient ?) */ +pa_semaphore *s; + +s = pa_xnew(pa_semaphore, 1); +MPCreateSemaphore(UINT_MAX, value, (s-sema)); +pa_assert(s-sema != 0); + +return s; +} + +void pa_semaphore_free(pa_semaphore *s) { +pa_assert(s); +MPDeleteSemaphore(s-sema); +pa_xfree(s); +} + +void pa_semaphore_post(pa_semaphore *s) { +pa_assert(s); +MPSignalSemaphore(s-sema); +} + +void pa_semaphore_wait(pa_semaphore *s) { +pa_assert(s); +/* should probably check return value (-ve is error), noErr is ok. */ +MPWaitOnSemaphore(s-sema, kDurationForever); +} -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 3/4] src/Makefile.am: add specific OS_IS_DARWIN files
From: Kim Lester k...@dfusion.com.au Signed-off-by: Kim Lester k...@dfusion.com.au Signed-off-by: Daniel Mack dan...@caiaq.de --- src/Makefile.am | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 6544e2a..b12ed8f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -649,12 +649,21 @@ libpulsecomm...@pa_majorminormicro@_la_SOURCES += \ pulsecore/mutex-win32.c pulsecore/mutex.h \ pulsecore/thread-win32.c pulsecore/thread.h \ pulsecore/semaphore-win32.c pulsecore/semaphore.h -else +else !OS_IS_WIN32 +if OS_IS_DARWIN +libpulsecomm...@pa_majorminormicro@_la_SOURCES += \ + pulsecore/mutex-posix.c pulsecore/mutex.h \ + pulsecore/thread-posix.c pulsecore/thread.h \ + pulsecore/semaphore-osx.c pulsecore/semaphore.h +libpulsecomm...@pa_majorminormicro@_la_CFLAGS += -I/Developer/Headers/FlatCarbon/ +#libpulsecomm...@pa_majorminormicro@_la_LDFLAGS += -framework CoreServices +else !OS_IS_DARWIN libpulsecomm...@pa_majorminormicro@_la_SOURCES += \ pulsecore/mutex-posix.c pulsecore/mutex.h \ pulsecore/thread-posix.c pulsecore/thread.h \ pulsecore/semaphore-posix.c pulsecore/semaphore.h -endif +endif !OS_IS_DARWIN +endif !OS_IS_WIN32 if HAVE_X11 libpulsecomm...@pa_majorminormicro@_la_SOURCES += pulsecore/x11prop.c pulsecore/x11prop.h -- 1.6.3.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 4/4] Wrap clock_gettime and friends
From: Kim Lester k...@dfusion.com.au OS X does not define clockid_t or clock_gettime() and friends. Add a wrapper to fix this. Signed-off-by: Kim Lester k...@dfusion.com.au Signed-off-by: Daniel Mack dan...@caiaq.de --- src/Makefile.am |1 + src/pulsecore/core-clock.c | 176 ++ src/pulsecore/core-clock.h | 75 ++ src/pulsecore/core-rtclock.c | 13 ++-- src/tests/rtstutter.c|9 +- 5 files changed, 264 insertions(+), 10 deletions(-) create mode 100644 src/pulsecore/core-clock.c create mode 100644 src/pulsecore/core-clock.h diff --git a/src/Makefile.am b/src/Makefile.am index b12ed8f..f73772e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -580,6 +580,7 @@ libpulsecomm...@pa_majorminormicro@_la_SOURCES = \ pulsecore/conf-parser.c pulsecore/conf-parser.h \ pulsecore/core-error.c pulsecore/core-error.h \ pulsecore/core-rtclock.c pulsecore/core-rtclock.h \ + pulsecore/core-clock.c pulsecore/core-clock.h \ pulsecore/core-util.c pulsecore/core-util.h \ pulsecore/creds.h \ pulsecore/dynarray.c pulsecore/dynarray.h \ diff --git a/src/pulsecore/core-clock.c b/src/pulsecore/core-clock.c new file mode 100644 index 000..d4a47ce --- /dev/null +++ b/src/pulsecore/core-clock.c @@ -0,0 +1,176 @@ +/*** + This file is part of PulseAudio. + + Copyright 2009 Kim Lester, Datafusion Systems P/L + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#ifdef OS_IS_DARWIN +#include CoreServices/CoreServices.h +#include mach/mach.h +#include mach/mach_time.h +#endif + +#include time.h +#include errno.h + +#include core-clock.h + + +int pa_clock_getres(clockid_t clk_id, struct timespec *res) { +#ifndef OS_IS_DARWIN +/* #ifdef HAVE_CLOCK_GETRES - use this eventually !? */ + +return clock_getres(clk_id, res); + +#elif defined(OS_IS_DARWIN) + +mach_timebase_info_data_t tbi; +uint64_t time_nsec; + +if (!res) { +/* KRL: can one always set errno - cross platform ? */ +errno = EFAULT; +return -1; +} + +switch (clk_id) { +case PA_CLOCK_REALTIME: + /* System-wide realtime clock (may be changed). */ +case PA_CLOCK_MONOTONIC: + /* Clock that cannot be set and represents + monotonic time since some unspecified starting point. */ +case PA_CLOCK_MONOTONIC_RAW: + /* What's the difference? */ +break; + +#if 0 +case PA_CLOCK_PROCESS_CPUTIME_ID: + /* High-resolution per-process timer from the CPU. */ +case PA_CLOCK_THREAD_CPUTIME_ID: + /* Thread-specific CPU-time clock. */ +#endif + +default: +/* KRL: can one always set errno - cross platform ? */ +errno = EINVAL; +return -1; +} + +mach_timebase_info(tbi); + +/* nsec = nticks * (N/D) - we want 1 tick == resolution !? */ +time_nsec = tbi.numer / tbi.denom; + +/* I presume this is expected to be set !? */ +res-tv_sec = time_nsec / 1E9; +res-tv_nsec = time_nsec; + +return 0; +#endif +} + + +int pa_clock_gettime(clockid_t clk_id, struct timespec *tp) { +/* can't use HAVE_CLOCK_GETTIME as we override this to be true for Darwin */ +#ifndef OS_IS_DARWIN + +return clock_gettime(clk_id, tp); + +#elif defined(OS_IS_DARWIN) + +static mach_timebase_info_data_t tbi; +uint64_t nticks; +uint64_t time_nsec; + +/* Refer Apple ADC QA1398 + Also: http://devworld.apple.com/documentation/Darwin/Conceptual/KernelProgramming/services/services.html + + Note: argument is timespec NOT timeval (timespec uses nsec, timeval uses usec) +*/ + +if (!tp) { +/* KRL: can one always set errno - cross platform ? */ +errno = EFAULT; +return -1; // an error occurred +} + +switch (clk_id) { +case PA_CLOCK_REALTIME: + /* System-wide realtime clock (may be changed). */ +case PA_CLOCK_MONOTONIC: + /* Clock that cannot be set and represents + monotonic time since some unspecified starting point
[pulseaudio-discuss] Error compiling sconv_sse.c on Mac OS X
Hi, I'm trying to build the current PA git and get the following error message. Any ideas? Daniel CC libpulsecore_0.9.17_la-sconv_sse.lo pulsecore/sconv_sse.c: In function 'pa_sconv_s16le_from_f32ne_sse': pulsecore/sconv_sse.c:47: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm' pulsecore/sconv_sse.c:47: error: 'asm' operand has impossible constraints make[3]: *** [libpulsecore_0.9.17_la-sconv_sse.lo] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Error compiling sconv_sse.c on Mac OS X
On Mon, Sep 14, 2009 at 10:59:31AM +0100, Colin Guthrie wrote: 'Twas brillig, and Daniel Mack at 14/09/09 09:39 did gyre and gimble: I'm trying to build the current PA git and get the following error message. Any ideas? It should be safe to disable all the MMX/SSE stuff on OSX as a quick fix... How would you do that? I don't see any configure options at a glance? as for the actual error, I don't personally know... wtay? Googling brought up some links that say it is a problem with -fPIC and -O2. I can just say that this error wasn't there some weeks before. Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Error compiling sconv_sse.c on Mac OS X
On Mon, Sep 14, 2009 at 03:55:11PM +0200, Lennart Poettering wrote: On Mon, 14.09.09 10:39, Daniel Mack (dan...@caiaq.de) wrote: Hi, I'm trying to build the current PA git and get the following error message. Any ideas? Daniel CC libpulsecore_0.9.17_la-sconv_sse.lo pulsecore/sconv_sse.c: In function 'pa_sconv_s16le_from_f32ne_sse': pulsecore/sconv_sse.c:47: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm' pulsecore/sconv_sse.c:47: error: 'asm' operand has impossible constraints make[3]: *** [libpulsecore_0.9.17_la-sconv_sse.lo] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Hmm, I think this means that the asm code uses more registers than gcc can offer it. Apparently the ABI on MacOS has fewer registers available for various purposes then the one on Linux? The asm code currently asks for 8 registers. It might be possible to get rid of one of them. A temporary fix could be changing this: #if defined (__i386__) || defined (__amd64__) to this: #if !defined(__APPLE__) (defined (__i386__) || defined (__amd64__)) twice in that file. I'll try that later. However, compiling this single file with -O1 also fixes it. Hmm!? Daniel ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss