[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-test2-31-g6db3073

Lennart Poettering gitmailer-noreply at 0pointer.de
Wed Feb 18 13:12:47 PST 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  a571565f86a34d4ce4f16669c021be92494e132d (commit)

- Log -----------------------------------------------------------------
6db3073... export card information for sinks/sources and number of sinks/sources a profile would create to clients
7b8bed3... introduce pa_realpath()
d85ef71... export pa_match()
be81a68... if we fail to import a memblock fill in silence to guarantee stability of timing
1737a19... allow importing of more memory blocks than exporting
07333f8... refer folks to the ALSA devs, not us
dc1ad08... minor optimizations
ff58fa8... simplify pa_alsa_init_proplist_pcm() a bit and include resolution bits in alsa device props
c9c63c2... allow pa to be run in a chroot() environment tht lacks /proc
c1892f2... bump required alsa version
-----------------------------------------------------------------------

Summary of changes:
 configure.ac                    |    4 +-
 src/daemon/main.c               |    7 ++++-
 src/modules/alsa/alsa-sink.c    |   10 +-------
 src/modules/alsa/alsa-source.c  |   10 +-------
 src/modules/alsa/alsa-util.c    |   48 ++++++++++++++++++++++++++++++--------
 src/modules/alsa/alsa-util.h    |    3 +-
 src/pulse/context.c             |   13 +++++-----
 src/pulse/introspect.c          |   12 +++++++--
 src/pulse/introspect.h          |    4 +++
 src/pulsecore/core-util.c       |   31 ++++++++++++++++++++++--
 src/pulsecore/core-util.h       |    4 +++
 src/pulsecore/memblock.c        |    2 +-
 src/pulsecore/protocol-native.c |   32 +++++++++++++++++--------
 src/pulsecore/pstream.c         |    9 ++++---
 14 files changed, 128 insertions(+), 61 deletions(-)

-----------------------------------------------------------------------

commit c1892f29de7962a95806f78719d0ff9af87b49a3
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 21:44:30 2009 +0100

    bump required alsa version

diff --git a/configure.ac b/configure.ac
index c28a72c..ddf7a1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -638,7 +638,7 @@ AC_ARG_ENABLE([alsa],
         [alsa=auto])
 
 if test "x${alsa}" != xno ; then
-    PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.17 ],
+    PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.19 ],
         [
             HAVE_ALSA=1
             AC_DEFINE([HAVE_ALSA], 1, [Have ALSA?])
@@ -646,7 +646,7 @@ if test "x${alsa}" != xno ; then
         [
             HAVE_ALSA=0
             if test "x$alsa" = xyes ; then
-                AC_MSG_ERROR([*** Needed alsa >= 1.0.17 support not found])
+                AC_MSG_ERROR([*** Needed alsa >= 1.0.19 support not found])
             fi
         ])
 else

commit c9c63c295f8f7bfa825a095d6e09b199c9eab859
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 21:45:06 2009 +0100

    allow pa to be run in a chroot() environment tht lacks /proc

diff --git a/src/daemon/main.c b/src/daemon/main.c
index 936c214..d3e02fa 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -369,8 +369,11 @@ int main(int argc, char *argv[]) {
          * value of $LD_BIND_NOW on initialization. */
 
         pa_set_env("LD_BIND_NOW", "1");
-        pa_assert_se(rp = pa_readlink("/proc/self/exe"));
-        pa_assert_se(execv(rp, argv) == 0);
+
+        if ((rp = pa_readlink("/proc/self/exe")))
+            pa_assert_se(execv(rp, argv) == 0);
+        else
+            pa_log_warn("Couldn't read /proc/self/exe, cannot self execute. Running in a chroot()?");
     }
 #endif
 

commit ff58fa8870a62c88dba0fb26a77331e1f27c73a8
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 21:49:31 2009 +0100

    simplify pa_alsa_init_proplist_pcm() a bit and include resolution bits in alsa device props

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 1474cfe..5fc3468 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1236,14 +1236,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
     snd_pcm_uframes_t period_frames, tsched_frames;
     size_t frame_size;
-    snd_pcm_info_t *pcm_info = NULL;
     int err;
     pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE;
     pa_usec_t usec;
     pa_sink_new_data data;
 
-    snd_pcm_info_alloca(&pcm_info);
-
     pa_assert(m);
     pa_assert(ma);
 
@@ -1378,11 +1375,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     if (u->use_tsched)
         pa_log_info("Successfully enabled timer-based scheduling mode.");
 
-    if ((err = snd_pcm_info(u->pcm_handle, pcm_info)) < 0) {
-        pa_log("Error fetching PCM info: %s", snd_strerror(err));
-        goto fail;
-    }
-
     /* ALSA might tweak the sample spec, so recalculate the frame size */
     frame_size = pa_frame_size(&ss);
 
@@ -1396,7 +1388,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     pa_sink_new_data_set_sample_spec(&data, &ss);
     pa_sink_new_data_set_channel_map(&data, &map);
 
-    pa_alsa_init_proplist_pcm(m->core, data.proplist, pcm_info);
+    pa_alsa_init_proplist_pcm(m->core, data.proplist, u->pcm_handle);
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device_name);
     pa_proplist_setf(data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) (period_frames * frame_size * nfrags));
     pa_proplist_setf(data.proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%lu", (unsigned long) (period_frames * frame_size));
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 192645d..1909cae 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1071,13 +1071,10 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
     snd_pcm_uframes_t period_frames, tsched_frames;
     size_t frame_size;
-    snd_pcm_info_t *pcm_info = NULL;
     int err;
     pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE;
     pa_source_new_data data;
 
-    snd_pcm_info_alloca(&pcm_info);
-
     pa_assert(m);
 
     ss = m->core->default_sample_spec;
@@ -1203,11 +1200,6 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     if (u->use_tsched)
         pa_log_info("Successfully enabled timer-based scheduling mode.");
 
-    if ((err = snd_pcm_info(u->pcm_handle, pcm_info)) < 0) {
-        pa_log("Error fetching PCM info: %s", snd_strerror(err));
-        goto fail;
-    }
-
     /* ALSA might tweak the sample spec, so recalculate the frame size */
     frame_size = pa_frame_size(&ss);
 
@@ -1221,7 +1213,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     pa_source_new_data_set_sample_spec(&data, &ss);
     pa_source_new_data_set_channel_map(&data, &map);
 
-    pa_alsa_init_proplist_pcm(m->core, data.proplist, pcm_info);
+    pa_alsa_init_proplist_pcm(m->core, data.proplist, u->pcm_handle);
     pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device_name);
     pa_proplist_setf(data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) (period_frames * frame_size * nfrags));
     pa_proplist_setf(data.proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%lu", (unsigned long) (period_frames * frame_size));
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index d7caa0f..7cecfd1 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -37,6 +37,7 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/atomic.h>
+#include <pulsecore/core-error.h>
 
 #include "alsa-util.h"
 
@@ -1361,7 +1362,7 @@ void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) {
 #endif
 }
 
-void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_info) {
+void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_info) {
 
     static const char * const alsa_class_table[SND_PCM_CLASS_LAST+1] = {
         [SND_PCM_CLASS_GENERIC] = "generic",
@@ -1427,6 +1428,28 @@ void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_i
         pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, n);
 }
 
+void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm) {
+    snd_pcm_hw_params_t *hwparams;
+    snd_pcm_info_t *info;
+    int bits, err;
+
+    snd_pcm_hw_params_alloca(&hwparams);
+    snd_pcm_info_alloca(&info);
+
+    if ((err = snd_pcm_hw_params_current(pcm, hwparams)) < 0)
+        pa_log_warn("Error fetching hardware parameter info: %s", snd_strerror(err));
+    else {
+
+        if ((bits = snd_pcm_hw_params_get_sbits(hwparams)) >= 0)
+            pa_proplist_setf(p, "alsa.resolution_bits", "%i", bits);
+    }
+
+    if ((err = snd_pcm_info(pcm, info)) < 0)
+        pa_log_warn("Error fetching PCM info: %s", snd_strerror(err));
+    else
+        pa_alsa_init_proplist_pcm_info(c, p, info);
+}
+
 int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents) {
     snd_pcm_state_t state;
     int err;
diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
index 8b08339..9eab644 100644
--- a/src/modules/alsa/alsa-util.h
+++ b/src/modules/alsa/alsa-util.h
@@ -120,8 +120,9 @@ void pa_alsa_dump_status(snd_pcm_t *pcm);
 void pa_alsa_redirect_errors_inc(void);
 void pa_alsa_redirect_errors_dec(void);
 
-void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_info);
+void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_info);
 void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card);
+void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm);
 
 int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents);
 

commit dc1ad08a65302c537d607f29be51a0c64cddec7c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 21:50:09 2009 +0100

    minor optimizations

diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 7cecfd1..50ba35a 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -343,7 +343,8 @@ int pa_alsa_set_hw_params(
         goto finish;
 
     if (_use_mmap) {
-        if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_MMAP_INTERLEAVED)) < 0) {
+
+        if (snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) {
 
             /* mmap() didn't work, fall back to interleaved */
 
@@ -806,8 +807,7 @@ snd_pcm_t *pa_alsa_open_by_device_string(
                                 SND_PCM_NO_AUTO_CHANNELS|
                                 (reformat ? 0 : SND_PCM_NO_AUTO_FORMAT))) < 0) {
             pa_log_info("Error opening PCM device %s: %s", d, snd_strerror(err));
-            pa_xfree(d);
-            return NULL;
+            goto fail;
         }
 
         if ((err = pa_alsa_set_hw_params(pcm_handle, ss, nfrags, period_size, tsched_size, use_mmap, use_tsched, require_exact_channel_number)) < 0) {
@@ -835,9 +835,9 @@ snd_pcm_t *pa_alsa_open_by_device_string(
             }
 
             pa_log_info("Failed to set hardware parameters on %s: %s", d, snd_strerror(err));
-            pa_xfree(d);
             snd_pcm_close(pcm_handle);
-            return NULL;
+
+            goto fail;
         }
 
         if (dev)
@@ -850,6 +850,11 @@ snd_pcm_t *pa_alsa_open_by_device_string(
 
         return pcm_handle;
     }
+
+fail:
+    pa_xfree(d);
+
+    return NULL;
 }
 
 int pa_alsa_probe_profiles(

commit 07333f8cae480a25af02ad32286ab38d4272698e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 21:50:27 2009 +0100

    refer folks to the ALSA devs, not us

diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 50ba35a..1bb7ddf 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -1553,8 +1553,8 @@ snd_pcm_sframes_t pa_alsa_safe_avail_update(snd_pcm_t *pcm, size_t hwbuf_size, c
 
     if (k >= hwbuf_size * 3 ||
         k >= pa_bytes_per_second(ss)*10)
-        pa_log("snd_pcm_avail_update() returned a value that is exceptionally large: %lu bytes (%lu ms) "
-               "Most likely this is an ALSA driver bug. Please report this issue to the PulseAudio developers.",
+        pa_log("snd_pcm_avail_update() returned a value that is exceptionally large: %lu bytes (%lu ms). "
+               "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers.",
                (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
 
     return n;
@@ -1585,8 +1585,8 @@ int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas
         k >= hwbuf_size * 3 ||
         k >= pa_bytes_per_second(ss)*10)
 
-        pa_log("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu bytes (%lu ms) "
-               "Most likely this is an ALSA driver bug. Please report this issue to the PulseAudio developers.",
+        pa_log("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu bytes (%lu ms). "
+               "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers.",
                (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
 
     return r;

commit 1737a19c86d34d1a3721d019f649beaa9aea02b3
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 21:52:21 2009 +0100

    allow importing of more memory blocks than exporting

diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index 1d7f455..fbf0a47 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -57,7 +57,7 @@
 
 #define PA_MEMEXPORT_SLOTS_MAX 128
 
-#define PA_MEMIMPORT_SLOTS_MAX 128
+#define PA_MEMIMPORT_SLOTS_MAX 160
 #define PA_MEMIMPORT_SEGMENTS_MAX 16
 
 struct pa_memblock {

commit be81a681ac84ac56208c3bb315e04d04c2e53606
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 21:55:55 2009 +0100

    if we fail to import a memblock fill in silence to guarantee stability of timing

diff --git a/src/pulse/context.c b/src/pulse/context.c
index 8686e0d..d8d0a51 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -335,8 +335,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
 
     pa_assert(p);
     pa_assert(chunk);
-    pa_assert(chunk->memblock);
-    pa_assert(chunk->length);
+    pa_assert(chunk->length > 0);
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
 
@@ -344,11 +343,11 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
 
     if ((s = pa_dynarray_get(c->record_streams, channel))) {
 
-        pa_assert(seek == PA_SEEK_RELATIVE);
-        pa_assert(offset == 0);
-
-        pa_memblockq_seek(s->record_memblockq, offset, seek);
-        pa_memblockq_push_align(s->record_memblockq, chunk);
+        if (chunk->memblock) {
+            pa_memblockq_seek(s->record_memblockq, offset, seek);
+            pa_memblockq_push_align(s->record_memblockq, chunk);
+        } else
+            pa_memblockq_seek(s->record_memblockq, offset+chunk->length, seek);
 
         if (s->read_callback) {
             size_t l;
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index c303261..fd7d936 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -4144,17 +4144,20 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
     if (playback_stream_isinstance(stream)) {
         playback_stream *ps = PLAYBACK_STREAM(stream);
 
-        if (seek != PA_SEEK_RELATIVE || offset != 0)
-            pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_SEEK, PA_UINT_TO_PTR(seek), offset, NULL, NULL);
+        if (chunk->memblock) {
+            if (seek != PA_SEEK_RELATIVE || offset != 0)
+                pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_SEEK, PA_UINT_TO_PTR(seek), offset, NULL, NULL);
 
-        pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
+            pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
+        } else
+            pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_SEEK, PA_UINT_TO_PTR(seek), offset+chunk->length, NULL, NULL);
 
     } else {
         upload_stream *u = UPLOAD_STREAM(stream);
         size_t l;
 
         if (!u->memchunk.memblock) {
-            if (u->length == chunk->length) {
+            if (u->length == chunk->length && chunk->memblock) {
                 u->memchunk = *chunk;
                 pa_memblock_ref(u->memchunk.memblock);
                 u->length = 0;
@@ -4170,17 +4173,22 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
         if (l > chunk->length)
             l = chunk->length;
 
-
         if (l > 0) {
-            void *src, *dst;
+            void *dst;
             dst = pa_memblock_acquire(u->memchunk.memblock);
-            src = pa_memblock_acquire(chunk->memblock);
 
-            memcpy((uint8_t*) dst + u->memchunk.index + u->memchunk.length,
-                   (uint8_t*) src+chunk->index, l);
+            if (chunk->memblock) {
+                void *src;
+                src = pa_memblock_acquire(chunk->memblock);
+
+                memcpy((uint8_t*) dst + u->memchunk.index + u->memchunk.length,
+                       (uint8_t*) src + chunk->index, l);
+
+                pa_memblock_release(chunk->memblock);
+            } else
+                pa_silence_memory((uint8_t*) dst + u->memchunk.index + u->memchunk.length, l, &u->sample_spec);
 
             pa_memblock_release(u->memchunk.memblock);
-            pa_memblock_release(chunk->memblock);
 
             u->memchunk.length += l;
             u->length -= l;
diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 7ff8edc..ef1105b 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -832,8 +832,8 @@ static int do_read(pa_pstream *p) {
                                           ntohl(p->read.shm_info[PA_PSTREAM_SHM_INDEX]),
                                           ntohl(p->read.shm_info[PA_PSTREAM_SHM_LENGTH])))) {
 
-                    pa_log_warn("Failed to import memory block.");
-                    return -1;
+                    if (pa_log_ratelimit())
+                        pa_log_debug("Failed to import memory block.");
                 }
 
                 if (p->recieve_memblock_callback) {
@@ -842,7 +842,7 @@ static int do_read(pa_pstream *p) {
 
                     chunk.memblock = b;
                     chunk.index = 0;
-                    chunk.length = pa_memblock_get_length(b);
+                    chunk.length = b ? pa_memblock_get_length(b) : ntohl(p->read.shm_info[PA_PSTREAM_SHM_LENGTH]);
 
                     offset = (int64_t) (
                             (((uint64_t) ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI])) << 32) |
@@ -857,7 +857,8 @@ static int do_read(pa_pstream *p) {
                             p->recieve_memblock_callback_userdata);
                 }
 
-                pa_memblock_unref(b);
+                if (b)
+                    pa_memblock_unref(b);
             }
 
             goto frame_done;

commit d85ef716757f8c91ec1c97f87daf75e48bbe2de1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 21:57:16 2009 +0100

    export pa_match()

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index ad6c6ca..d0ff751 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -704,7 +704,7 @@ void pa_reset_priority(void) {
 #endif
 }
 
-static int match(const char *expr, const char *v) {
+int pa_match(const char *expr, const char *v) {
     int k;
     regex_t re;
     int r;
@@ -744,12 +744,12 @@ int pa_parse_boolean(const char *v) {
     /* And then we check language dependant */
     if ((expr = nl_langinfo(YESEXPR)))
         if (expr[0])
-            if ((r = match(expr, v)) > 0)
+            if ((r = pa_match(expr, v)) > 0)
                 return 1;
 
     if ((expr = nl_langinfo(NOEXPR)))
         if (expr[0])
-            if ((r = match(expr, v)) > 0)
+            if ((r = pa_match(expr, v)) > 0)
                 return 0;
 
     errno = EINVAL;
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index 442815f..8fd521b 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -141,6 +141,8 @@ size_t pa_vsnprintf(char *str, size_t size, const char *format, va_list ap);
 
 char *pa_truncate_utf8(char *c, size_t l);
 
+int pa_match(const char *expr, const char *v);
+
 char *pa_getcwd(void);
 char *pa_make_path_absolute(const char *p);
 pa_bool_t pa_is_path_absolute(const char *p);

commit 7b8bed3e285f31537aa39f88600e59b749ac6508
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 21:57:57 2009 +0100

    introduce pa_realpath()

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index d0ff751..61f9a65 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2604,3 +2604,28 @@ char *pa_unescape(char *p) {
 
     return p;
 }
+
+char *pa_realpath(const char *path) {
+    char *r, *t;
+    pa_assert(path);
+
+    /* We want only abolsute paths */
+    if (path[0] != '/') {
+        errno = EINVAL;
+        return NULL;
+    }
+
+#ifndef __GLIBC__
+#error "It's not clear whether this system supports realpath(..., NULL) like GNU libc does. If it doesn't we need a private version of realpath() here."
+#endif
+
+    if (!(r = realpath(path, NULL)))
+        return NULL;
+
+    /* We copy this here in case our pa_xmalloc() is not implemented
+     * on top of libc malloc() */
+    t = pa_xstrdup(r);
+    pa_xfree(r);
+
+    return t;
+}
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index 8fd521b..0ba33f3 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -221,4 +221,6 @@ char *pa_replace(const char*s, const char*a, const char *b);
 
 char *pa_unescape(char *p);
 
+char *pa_realpath(const char *path);
+
 #endif

commit 6db307360b7ef95211aff13548206464e8909882
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 18 22:11:50 2009 +0100

    export card information for sinks/sources and number of sinks/sources a profile would create to clients

diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 1d50939..04bcd4f 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -162,6 +162,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
             i.n_volume_steps = PA_VOLUME_NORM+1;
             mute = FALSE;
             state = PA_SINK_INVALID_STATE;
+            i.card = PA_INVALID_INDEX;
 
             if (pa_tagstruct_getu32(t, &i.index) < 0 ||
                 pa_tagstruct_gets(t, &i.name) < 0 ||
@@ -182,7 +183,8 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
                 (o->context->version >= 15 &&
                  (pa_tagstruct_get_volume(t, &i.base_volume) < 0 ||
                   pa_tagstruct_getu32(t, &state) < 0 ||
-                  pa_tagstruct_getu32(t, &i.n_volume_steps) < 0))) {
+                  pa_tagstruct_getu32(t, &i.n_volume_steps) < 0 ||
+                  pa_tagstruct_getu32(t, &i.card) < 0))) {
 
                 pa_context_fail(o->context, PA_ERR_PROTOCOL);
                 pa_proplist_free(i.proplist);
@@ -293,6 +295,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
             i.n_volume_steps = PA_VOLUME_NORM+1;
             mute = FALSE;
             state = PA_SOURCE_INVALID_STATE;
+            i.card = PA_INVALID_INDEX;
 
             if (pa_tagstruct_getu32(t, &i.index) < 0 ||
                 pa_tagstruct_gets(t, &i.name) < 0 ||
@@ -313,7 +316,8 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
                 (o->context->version >= 15 &&
                  (pa_tagstruct_get_volume(t, &i.base_volume) < 0 ||
                   pa_tagstruct_getu32(t, &state) < 0 ||
-                  pa_tagstruct_getu32(t, &i.n_volume_steps) < 0))) {
+                  pa_tagstruct_getu32(t, &i.n_volume_steps) < 0 ||
+                  pa_tagstruct_getu32(t, &i.card) < 0))) {
 
                 pa_context_fail(o->context, PA_ERR_PROTOCOL);
                 pa_proplist_free(i.proplist);
@@ -517,7 +521,9 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u
                 for (j = 0; j < i.n_profiles; j++) {
 
                     if (pa_tagstruct_gets(t, &i.profiles[j].name) < 0 ||
-                        pa_tagstruct_gets(t, &i.profiles[j].description) < 0) {
+                        pa_tagstruct_gets(t, &i.profiles[j].description) < 0 ||
+                        pa_tagstruct_getu32(t, &i.profiles[j].n_sinks) < 0 ||
+                        pa_tagstruct_getu32(t, &i.profiles[j].n_sources)< 0) {
 
                         pa_context_fail(o->context, PA_ERR_PROTOCOL);
                         pa_xfree(i.profiles);
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index badc787..b873a84 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -215,6 +215,7 @@ typedef struct pa_sink_info {
     pa_volume_t base_volume;           /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the output device. \since 0.9.15 */
     pa_sink_state_t state;             /**< State \since 0.9.15 */
     uint32_t n_volume_steps;           /**< Number of volume steps for sinks which do not support arbitrary volumes. \since 0.9.15 */
+    uint32_t card;                     /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
 } pa_sink_info;
 
 /** Callback prototype for pa_context_get_sink_info_by_name() and friends */
@@ -273,6 +274,7 @@ typedef struct pa_source_info {
     pa_volume_t base_volume;            /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the input device. \since 0.9.15 */
     pa_source_state_t state;            /**< State \since 0.9.15 */
     uint32_t n_volume_steps;            /**< Number of volume steps for sources which do not support arbitrary volumes. \since 0.9.15 */
+    uint32_t card;                      /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
 } pa_source_info;
 
 /** Callback prototype for pa_context_get_source_info_by_name() and friends */
@@ -396,6 +398,8 @@ pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_suc
 typedef struct pa_card_profile_info {
     const char *name;                   /**< Name of this profile */
     const char *description;            /**< Description of this profile */
+    uint32_t n_sinks;                   /**< Number of sinks this profile would create */
+    uint32_t n_sources;                 /**< Number of sources this profile would create */
 } pa_card_profile_info;
 
 /** Stores information about cards. Please note that this structure
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index fd7d936..79b9b06 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -2749,6 +2749,7 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin
             pa_log_error("Internal sink state is invalid.");
         pa_tagstruct_putu32(t, pa_sink_get_state(sink));
         pa_tagstruct_putu32(t, sink->n_volume_steps);
+        pa_tagstruct_putu32(t, sink->card ? sink->card->index : PA_INVALID_INDEX);
     }
 }
 
@@ -2788,6 +2789,7 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s
             pa_log_error("Internal source state is invalid.");
         pa_tagstruct_putu32(t, pa_source_get_state(source));
         pa_tagstruct_putu32(t, source->n_volume_steps);
+        pa_tagstruct_putu32(t, source->card ? source->card->index : PA_INVALID_INDEX);
     }
 }
 
@@ -2822,6 +2824,8 @@ static void card_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_car
         while ((p = pa_hashmap_iterate(card->profiles, &state, NULL))) {
             pa_tagstruct_puts(t, p->name);
             pa_tagstruct_puts(t, p->description);
+            pa_tagstruct_putu32(t, p->n_sinks);
+            pa_tagstruct_putu32(t, p->n_sources);
         }
     }
 

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list