[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-216-g75256fb

Lennart Poettering gitmailer-noreply at 0pointer.de
Wed Jun 17 14:40:29 PDT 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  6b2ca094ae18110271ef6facd963e5cf11ff1715 (commit)

- Log -----------------------------------------------------------------
75256fb pactl: show list of supported ports
46b8ca2 native-protocol: allow enumerating ports
c65ebee raop: move all raop files to subdir
-----------------------------------------------------------------------

Summary of changes:
 src/Makefile.am                               |    8 +-
 src/modules/{ => raop}/module-raop-discover.c |    0
 src/modules/{ => raop}/module-raop-sink.c     |    0
 src/pulse/introspect.c                        |  110 ++++++++++++++++++++++---
 src/pulse/introspect.h                        |   24 ++++++
 src/pulsecore/protocol-native.c               |   35 ++++++++
 src/utils/pactl.c                             |   24 ++++++
 7 files changed, 184 insertions(+), 17 deletions(-)
 rename src/modules/{ => raop}/module-raop-discover.c (100%)
 rename src/modules/{ => raop}/module-raop-sink.c (100%)

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

commit c65ebeec1e3eafef453ff9d936af4d314034c5c3
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jun 17 15:09:28 2009 +0200

    raop: move all raop files to subdir

diff --git a/src/Makefile.am b/src/Makefile.am
index 5d8487a..40b5675 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1205,8 +1205,8 @@ SYMDEF_FILES = \
 		modules/bluetooth/module-bluetooth-proximity-symdef.h \
 		modules/bluetooth/module-bluetooth-discover-symdef.h \
 		modules/bluetooth/module-bluetooth-device-symdef.h \
-		modules/module-raop-sink-symdef.h \
-		modules/module-raop-discover-symdef.h \
+		modules/raop/module-raop-sink-symdef.h \
+		modules/raop/module-raop-discover-symdef.h \
 		modules/gconf/module-gconf-symdef.h \
 		modules/module-position-event-sounds-symdef.h \
 		modules/module-augment-properties-symdef.h \
@@ -1626,11 +1626,11 @@ module_bluetooth_device_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulsecore- at PA_M
 module_bluetooth_device_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
 
 # Apple Airtunes/RAOP
-module_raop_sink_la_SOURCES = modules/module-raop-sink.c
+module_raop_sink_la_SOURCES = modules/raop/module-raop-sink.c
 module_raop_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_raop_sink_la_LIBADD = $(AM_LIBADD) libpulsecore- at PA_MAJORMINORMICRO@.la librtp.la libraop.la libpulsecommon- at PA_MAJORMINORMICRO@.la libpulse.la
 
-module_raop_discover_la_SOURCES = modules/module-raop-discover.c
+module_raop_discover_la_SOURCES = modules/raop/module-raop-discover.c
 module_raop_discover_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_raop_discover_la_LIBADD = $(AM_LIBADD) $(AVAHI_LIBS) libavahi-wrap.la libpulsecore- at PA_MAJORMINORMICRO@.la libpulsecommon- at PA_MAJORMINORMICRO@.la libpulse.la
 module_raop_discover_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)
diff --git a/src/modules/module-raop-discover.c b/src/modules/raop/module-raop-discover.c
similarity index 100%
rename from src/modules/module-raop-discover.c
rename to src/modules/raop/module-raop-discover.c
diff --git a/src/modules/module-raop-sink.c b/src/modules/raop/module-raop-sink.c
similarity index 100%
rename from src/modules/module-raop-sink.c
rename to src/modules/raop/module-raop-sink.c

commit 46b8ca21d1ef56df298cfa9412e73fdf17cbea49
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jun 17 23:17:37 2009 +0200

    native-protocol: allow enumerating ports

diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 0c45f99..ab67f59 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -49,7 +49,7 @@ static void context_stat_callback(pa_pdispatch *pd, uint32_t command, uint32_t t
     pa_assert(o);
     pa_assert(PA_REFCNT_VALUE(o) >= 1);
 
-    memset(&i, 0, sizeof(i));
+    pa_zero(i);
 
     if (!o->context)
         goto finish;
@@ -93,7 +93,7 @@ static void context_get_server_info_callback(pa_pdispatch *pd, uint32_t command,
     pa_assert(o);
     pa_assert(PA_REFCNT_VALUE(o) >= 1);
 
-    memset(&i, 0, sizeof(i));
+    pa_zero(i);
 
     if (!o->context)
         goto finish;
@@ -161,8 +161,10 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
             pa_bool_t mute;
             uint32_t flags;
             uint32_t state;
+            uint32_t j;
+            const char *ap = NULL;
 
-            memset(&i, 0, sizeof(i));
+            pa_zero(i);
             i.proplist = pa_proplist_new();
             i.base_volume = PA_VOLUME_NORM;
             i.n_volume_steps = PA_VOLUME_NORM+1;
@@ -190,13 +192,53 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
                  (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.card) < 0))) {
+                  pa_tagstruct_getu32(t, &i.card) < 0)) ||
+                (o->context->version >= 16 &&
+                 (pa_tagstruct_getu32(t, &i.n_ports)))) {
 
                 pa_context_fail(o->context, PA_ERR_PROTOCOL);
                 pa_proplist_free(i.proplist);
                 goto finish;
             }
 
+            if (i.n_ports > 0) {
+                i.ports = pa_xnew(pa_sink_port_info*, i.n_ports+1);
+                i.ports[0] = pa_xnew(pa_sink_port_info, i.n_ports);
+
+                for (j = 0; j < i.n_ports; j++) {
+                    if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
+                        pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
+                        pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
+
+                        pa_context_fail(o->context, PA_ERR_PROTOCOL);
+                        pa_xfree(i.ports);
+                        pa_xfree(i.ports[0]);
+                        pa_proplist_free(i.proplist);
+                        goto finish;
+                    }
+
+                    i.ports[j] = &i.ports[0][j];
+                }
+
+                i.ports[j] = NULL;
+            }
+
+            if (pa_tagstruct_gets(t, &ap) < 0) {
+                pa_context_fail(o->context, PA_ERR_PROTOCOL);
+                pa_xfree(i.ports[0]);
+                pa_xfree(i.ports);
+                pa_proplist_free(i.proplist);
+                goto finish;
+            }
+
+            if (ap) {
+                for (j = 0; j < i.n_ports; j++)
+                    if (pa_streq(i.ports[j]->name, ap)) {
+                        i.active_port = i.ports[j];
+                        break;
+                    }
+            }
+
             i.mute = (int) mute;
             i.flags = (pa_sink_flags_t) flags;
             i.state = (pa_sink_state_t) state;
@@ -346,8 +388,10 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
             pa_bool_t mute;
             uint32_t flags;
             uint32_t state;
+            unsigned j;
+            const char *ap;
 
-            memset(&i, 0, sizeof(i));
+            pa_zero(i);
             i.proplist = pa_proplist_new();
             i.base_volume = PA_VOLUME_NORM;
             i.n_volume_steps = PA_VOLUME_NORM+1;
@@ -375,13 +419,53 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
                  (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.card) < 0))) {
+                  pa_tagstruct_getu32(t, &i.card) < 0)) ||
+                (o->context->version >= 16 &&
+                 (pa_tagstruct_getu32(t, &i.n_ports)))) {
 
                 pa_context_fail(o->context, PA_ERR_PROTOCOL);
                 pa_proplist_free(i.proplist);
                 goto finish;
             }
 
+            if (i.n_ports > 0) {
+                i.ports = pa_xnew(pa_source_port_info*, i.n_ports+1);
+                i.ports[0] = pa_xnew(pa_source_port_info, i.n_ports);
+
+                for (j = 0; j < i.n_ports; j++) {
+                    if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
+                        pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
+                        pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
+
+                        pa_context_fail(o->context, PA_ERR_PROTOCOL);
+                        pa_xfree(i.ports[0]);
+                        pa_xfree(i.ports);
+                        pa_proplist_free(i.proplist);
+                        goto finish;
+                    }
+
+                    i.ports[j] = &i.ports[0][j];
+                }
+
+                i.ports[j] = NULL;
+            }
+
+            if (pa_tagstruct_gets(t, &ap) < 0) {
+                pa_context_fail(o->context, PA_ERR_PROTOCOL);
+                pa_xfree(i.ports[0]);
+                pa_xfree(i.ports);
+                pa_proplist_free(i.proplist);
+                goto finish;
+            }
+
+            if (ap) {
+                for (j = 0; j < i.n_ports; j++)
+                    if (pa_streq(i.ports[j]->name, ap)) {
+                        i.active_port = i.ports[j];
+                        break;
+                    }
+            }
+
             i.mute = (int) mute;
             i.flags = (pa_source_flags_t) flags;
             i.state = (pa_source_state_t) state;
@@ -529,7 +613,7 @@ static void context_get_client_info_callback(pa_pdispatch *pd, uint32_t command,
         while (!pa_tagstruct_eof(t)) {
             pa_client_info i;
 
-            memset(&i, 0, sizeof(i));
+            pa_zero(i);
             i.proplist = pa_proplist_new();
 
             if (pa_tagstruct_getu32(t, &i.index) < 0 ||
@@ -614,7 +698,7 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u
             uint32_t j;
             const char*ap;
 
-            memset(&i, 0, sizeof(i));
+            pa_zero(i);
 
             if (pa_tagstruct_getu32(t, &i.index) < 0 ||
                 pa_tagstruct_gets(t, &i.name) < 0 ||
@@ -627,7 +711,7 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u
             }
 
             if (i.n_profiles > 0) {
-                i.profiles = pa_xnew(pa_card_profile_info, i.n_profiles+1);
+                i.profiles = pa_xnew0(pa_card_profile_info, i.n_profiles+1);
 
                 for (j = 0; j < i.n_profiles; j++) {
 
@@ -815,7 +899,7 @@ static void context_get_module_info_callback(pa_pdispatch *pd, uint32_t command,
             pa_module_info i;
             pa_bool_t auto_unload = FALSE;
 
-            memset(&i, 0, sizeof(i));
+            pa_zero(i);
             i.proplist = pa_proplist_new();
 
             if (pa_tagstruct_getu32(t, &i.index) < 0 ||
@@ -900,7 +984,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
             pa_sink_input_info i;
             pa_bool_t mute = FALSE;
 
-            memset(&i, 0, sizeof(i));
+            pa_zero(i);
             i.proplist = pa_proplist_new();
 
             if (pa_tagstruct_getu32(t, &i.index) < 0 ||
@@ -994,7 +1078,7 @@ static void context_get_source_output_info_callback(pa_pdispatch *pd, uint32_t c
         while (!pa_tagstruct_eof(t)) {
             pa_source_output_info i;
 
-            memset(&i, 0, sizeof(i));
+            pa_zero(i);
             i.proplist = pa_proplist_new();
 
             if (pa_tagstruct_getu32(t, &i.index) < 0 ||
@@ -1336,7 +1420,7 @@ static void context_get_sample_info_callback(pa_pdispatch *pd, uint32_t command,
             pa_sample_info i;
             pa_bool_t lazy = FALSE;
 
-            memset(&i, 0, sizeof(i));
+            pa_zero(i);
             i.proplist = pa_proplist_new();
 
             if (pa_tagstruct_getu32(t, &i.index) < 0 ||
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index 8782423..ee98210 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -193,6 +193,15 @@ PA_C_DECL_BEGIN
 
 /** @{ \name Sinks */
 
+/** Stores information about a specific port of a sink.  Please
+ * note that this structure can be extended as part of evolutionary
+ * API updates at any time in any new release. \since 0.9.16 */
+typedef struct pa_sink_port_info {
+    const char *name;                   /**< Name of this port */
+    const char *description;            /**< Description of this port */
+    uint32_t priority;                  /**< The higher this value is the more useful this port is as a default */
+} pa_sink_port_info;
+
 /** Stores information about sinks. Please note that this structure
  * can be extended as part of evolutionary API updates at any time in
  * any new release. */
@@ -216,6 +225,9 @@ typedef struct pa_sink_info {
     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 */
+    uint32_t n_ports;                  /**< Number of entries in port array \since 0.9.16 */
+    pa_sink_port_info** ports;         /**< Array of available ports, or NULL. Array is terminated by an entry set to NULL. The number of entries is stored in n_ports \since 0.9.16 */
+    pa_sink_port_info* active_port;    /**< Pointer to active port in the array, or NULL \since 0.9.16 */
 } pa_sink_info;
 
 /** Callback prototype for pa_context_get_sink_info_by_name() and friends */
@@ -258,6 +270,15 @@ pa_operation* pa_context_set_sink_port_by_name(pa_context *c, const char*name, c
 
 /** @{ \name Sources */
 
+/** Stores information about a specific port of a source.  Please
+ * note that this structure can be extended as part of evolutionary
+ * API updates at any time in any new release. \since 0.9.16 */
+typedef struct pa_source_port_info {
+    const char *name;                   /**< Name of this port */
+    const char *description;            /**< Description of this port */
+    uint32_t priority;                  /**< The higher this value is the more useful this port is as a default */
+} pa_source_port_info;
+
 /** Stores information about sources. Please note that this structure
  * can be extended as part of evolutionary API updates at any time in
  * any new release. */
@@ -281,6 +302,9 @@ typedef struct pa_source_info {
     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 */
+    uint32_t n_ports;                   /**< Number of entries in port array \since 0.9.16 */
+    pa_source_port_info** ports;        /**< Array of available ports, or NULL. Array is terminated by an entry set to NULL. The number of entries is stored in n_ports \since 0.9.16  */
+    pa_source_port_info* active_port;   /**< Pointer to active port in the array, or NULL \since 0.9.16  */
 } pa_source_info;
 
 /** Callback prototype for pa_context_get_source_info_by_name() and friends */
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 92efc9e..48f7b13 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -2845,6 +2845,23 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin
         pa_tagstruct_putu32(t, sink->n_volume_steps);
         pa_tagstruct_putu32(t, sink->card ? sink->card->index : PA_INVALID_INDEX);
     }
+
+    if (c->version >= 16) {
+        pa_tagstruct_putu32(t, sink->ports ? pa_hashmap_size(sink->ports) : 0);
+
+        if (sink->ports) {
+            void *state;
+            pa_device_port *p;
+
+            PA_HASHMAP_FOREACH(p, sink->ports, state) {
+                pa_tagstruct_puts(t, p->name);
+                pa_tagstruct_puts(t, p->description);
+                pa_tagstruct_putu32(t, p->priority);
+            }
+        }
+
+        pa_tagstruct_puts(t, sink->active_port ? sink->active_port->name : NULL);
+    }
 }
 
 static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_source *source) {
@@ -2885,6 +2902,24 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s
         pa_tagstruct_putu32(t, source->n_volume_steps);
         pa_tagstruct_putu32(t, source->card ? source->card->index : PA_INVALID_INDEX);
     }
+
+    if (c->version >= 16) {
+
+        pa_tagstruct_putu32(t, source->ports ? pa_hashmap_size(source->ports) : 0);
+
+        if (source->ports) {
+            void *state;
+            pa_device_port *p;
+
+            PA_HASHMAP_FOREACH(p, source->ports, state) {
+                pa_tagstruct_puts(t, p->name);
+                pa_tagstruct_puts(t, p->description);
+                pa_tagstruct_putu32(t, p->priority);
+            }
+        }
+
+        pa_tagstruct_puts(t, source->active_port ? source->active_port->name : NULL);
+    }
 }
 
 static void client_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_client *client) {

commit 75256fb671b6ae8d784e0d6415d292fdbc6482c2
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jun 17 23:40:46 2009 +0200

    pactl: show list of supported ports

diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 1ae15c7..c8c3a43 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -254,6 +254,18 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
            pl = pa_proplist_to_string_sep(i->proplist, "\n\t\t"));
 
     pa_xfree(pl);
+
+    if (i->ports) {
+        pa_sink_port_info **p;
+
+        printf(_("\tPorts:\n"));
+        for (p = i->ports; *p; p++)
+            printf("\t\t%s: %s (priority. %u)\n", (*p)->name, (*p)->description, (*p)->priority);
+    }
+
+    if (i->active_port)
+        printf(_("\tActive Port: %s\n"),
+               i->active_port->name);
 }
 
 static void get_source_info_callback(pa_context *c, const pa_source_info *i, int is_last, void *userdata) {
@@ -334,6 +346,18 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
            pl = pa_proplist_to_string_sep(i->proplist, "\n\t\t"));
 
     pa_xfree(pl);
+
+    if (i->ports) {
+        pa_source_port_info **p;
+
+        printf(_("\tPorts:\n"));
+        for (p = i->ports; *p; p++)
+            printf("\t\t%s: %s (priority. %u)\n", (*p)->name, (*p)->description, (*p)->priority);
+    }
+
+    if (i->active_port)
+        printf(_("\tActive Port: %s\n"),
+               i->active_port->name);
 }
 
 static void get_module_info_callback(pa_context *c, const pa_module_info *i, int is_last, void *userdata) {

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list