[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-95-g37c3620
Lennart Poettering
gitmailer-noreply at 0pointer.de
Mon May 11 11:00:55 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 35faedb6e836a4dbc32403dc9688c3bbbd377cb3 (commit)
- Log -----------------------------------------------------------------
37c3620 upnp: rework property handling
35b7ce5 upnp: use new rygel @HOSTNAME@ wildcard for server name
dc5dce5 upnp: properly issue method not found exception when we don't now it
98a6454 upnp: update to newest spec, generate 'Updated' signal
6c4c61d upnp: fix URL of MediaServer spec
eb20564 mime: drop additional whitespace from mime types
-----------------------------------------------------------------------
Summary of changes:
src/modules/module-rygel-media-server.c | 230 +++++++++++++++++++++---------
src/pulsecore/mime-type.c | 5 +-
2 files changed, 165 insertions(+), 70 deletions(-)
-----------------------------------------------------------------------
commit eb205646aeffd60cecf3e35b0bd99a98a4e11dc5
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon May 11 19:56:13 2009 +0200
mime: drop additional whitespace from mime types
diff --git a/src/pulsecore/mime-type.c b/src/pulsecore/mime-type.c
index 55b8ffd..b9fe944 100644
--- a/src/pulsecore/mime-type.c
+++ b/src/pulsecore/mime-type.c
@@ -154,7 +154,10 @@ char *pa_sample_spec_to_mime_type(const pa_sample_spec *ss, const pa_channel_map
case PA_SAMPLE_S16BE:
case PA_SAMPLE_S24BE:
case PA_SAMPLE_U8:
- return pa_sprintf_malloc("audio/%s; rate=%u; channels=%u",
+ /* Stupid UPnP implementations (PS3...) choke on spaces in
+ * the mime type, that's why we write only ';' here,
+ * instead of '; '. */
+ return pa_sprintf_malloc("audio/%s;rate=%u;channels=%u",
ss->format == PA_SAMPLE_S16BE ? "L16" :
(ss->format == PA_SAMPLE_S24BE ? "L24" : "L8"),
ss->rate, ss->channels);
commit 6c4c61de2c84223fc2c13e11135caa388235221f
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon May 11 19:57:00 2009 +0200
upnp: fix URL of MediaServer spec
diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c
index 8ea134b..cde411f 100644
--- a/src/modules/module-rygel-media-server.c
+++ b/src/modules/module-rygel-media-server.c
@@ -59,7 +59,7 @@ PA_MODULE_LOAD_ONCE(TRUE);
PA_MODULE_USAGE(
"display_name=<UPnP Media Server name>");
-/* This implements http://live.gnome.org/action/edit/Rygel/MediaProviderSpec */
+/* This implements http://live.gnome.org/action/edit/Rygel/MediaServerSpec */
#define SERVICE_NAME "org.Rygel.MediaServer1.PulseAudio"
@@ -71,7 +71,7 @@ PA_MODULE_USAGE(
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
"<node>" \
" <!-- If you are looking for documentation make sure to check out" \
- " http://live.gnome.org/Rygel/MediaProviderSpec -->" \
+ " http://live.gnome.org/Rygel/MediaServerSpec -->" \
" <interface name=\"org.Rygel.MediaContainer1\">" \
" <method name=\"GetContainers\">" \
" <arg name=\"children\" type=\"ao\" direction=\"out\"/>" \
commit 98a645416695a2f235b5ed92f0f9085e01cdaf60
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon May 11 19:59:14 2009 +0200
upnp: update to newest spec, generate 'Updated' signal
diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c
index cde411f..1565a2e 100644
--- a/src/modules/module-rygel-media-server.c
+++ b/src/modules/module-rygel-media-server.c
@@ -79,16 +79,7 @@ PA_MODULE_USAGE(
" <method name=\"GetItems\">" \
" <arg name=\"children\" type=\"ao\" direction=\"out\"/>" \
" </method>" \
- " <signal name=\"ItemAdded\">" \
- " <arg name=\"path\" type=\"o\"/>" \
- " </signal>" \
- " <signal name=\"ItemRemoved\">" \
- " <arg name=\"path\" type=\"o\"/>" \
- " </signal>" \
- " <signal name=\"ContainerAdded\">" \
- " <arg name=\"path\" type=\"o\"/>" \
- " </signal>" \
- " <signal name=\"ContainerRemoved\">" \
+ " <signal name=\"Updated\">" \
" <arg name=\"path\" type=\"o\"/>" \
" </signal>" \
" </interface>" \
@@ -164,9 +155,8 @@ struct userdata {
pa_http_protocol *http;
};
-static void send_signal(struct userdata *u, pa_source *s, const char *name) {
+static void send_signal(struct userdata *u, pa_source *s) {
DBusMessage *m;
- char *child;
const char *parent;
pa_assert(u);
@@ -175,28 +165,22 @@ static void send_signal(struct userdata *u, pa_source *s, const char *name) {
if (u->core->state == PA_CORE_SHUTDOWN)
return;
- if (s->monitor_of) {
+ if (s->monitor_of)
parent = OBJECT_SINKS;
- child = pa_sprintf_malloc(OBJECT_SINKS "/%s", s->monitor_of->name);
- } else {
+ else
parent = OBJECT_SOURCES;
- child = pa_sprintf_malloc(OBJECT_SOURCES "/%s", s->name);
- }
- pa_assert_se(m = dbus_message_new_signal(parent, "org.Rygel.MediaContainer1", name));
- pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_OBJECT_PATH, &child, DBUS_TYPE_INVALID));
+ pa_assert_se(m = dbus_message_new_signal(parent, "org.Rygel.MediaContainer1", "Updated"));
pa_assert_se(dbus_connection_send(pa_dbus_connection_get(u->bus), m, NULL));
- pa_xfree(child);
-
dbus_message_unref(m);
}
-static pa_hook_result_t source_new_cb(pa_core *c, pa_source *s, struct userdata *u) {
+static pa_hook_result_t source_new_or_unlink_cb(pa_core *c, pa_source *s, struct userdata *u) {
pa_assert(c);
pa_source_assert_ref(s);
- send_signal(u, s, "ItemAdded");
+ send_signal(u, s);
return PA_HOOK_OK;
}
@@ -539,8 +523,8 @@ int pa__init(pa_module *m) {
pa_xfree(h);
}
- u->source_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_PUT], PA_HOOK_LATE, (pa_hook_cb_t) source_new_cb, u);
- u->source_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) source_unlink_cb, u);
+ u->source_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_PUT], PA_HOOK_LATE, (pa_hook_cb_t) source_new_or_unlink_cb, u);
+ u->source_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) source_new_or_unlink_cb, u);
if (!(u->bus = pa_dbus_bus_get(m->core, DBUS_BUS_SESSION, &error))) {
pa_log("Failed to get session bus connection: %s", error.message);
commit dc5dce50ea9290817d5c74ba6f0a4ec8d985fa31
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon May 11 20:00:02 2009 +0200
upnp: properly issue method not found exception when we don't now it
diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c
index 1565a2e..63ac8bd 100644
--- a/src/modules/module-rygel-media-server.c
+++ b/src/modules/module-rygel-media-server.c
@@ -415,7 +415,8 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
DBUS_TYPE_INVALID));
pa_xfree(xml);
- }
+ } else
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else {
pa_sink *sink = NULL;
commit 35b7ce56edcc0a0a0c228959c490d4654fab213e
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon May 11 20:00:43 2009 +0200
upnp: use new rygel @HOSTNAME@ wildcard for server name
diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c
index 63ac8bd..b0c06ed 100644
--- a/src/modules/module-rygel-media-server.c
+++ b/src/modules/module-rygel-media-server.c
@@ -516,13 +516,8 @@ int pa__init(pa_module *m) {
if ((t = pa_modargs_get_value(ma, "display_name", NULL)))
u->display_name = pa_utf8_filter(t);
- else {
- char *h;
-
- h = pa_get_host_name_malloc();
- u->display_name = pa_sprintf_malloc(_("Audio on %s"), h);
- pa_xfree(h);
- }
+ else
+ u->display_name = pa_xstrdup(_("Audio on @HOSTNAME@"));
u->source_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_PUT], PA_HOOK_LATE, (pa_hook_cb_t) source_new_or_unlink_cb, u);
u->source_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) source_new_or_unlink_cb, u);
commit 37c36202c6f98faabe5fdbc3efe3174997b2466e
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon May 11 20:01:05 2009 +0200
upnp: rework property handling
diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c
index b0c06ed..f004f46 100644
--- a/src/modules/module-rygel-media-server.c
+++ b/src/modules/module-rygel-media-server.c
@@ -84,6 +84,7 @@ PA_MODULE_USAGE(
" </signal>" \
" </interface>" \
" <interface name=\"org.Rygel.MediaObject1\">" \
+ " <property name=\"icon-name\" type=\"s\" access=\"read\"/>" \
" <property name=\"display-name\" type=\"s\" access=\"read\"/>" \
" </interface>" \
" <interface name=\"org.freedesktop.DBus.Properties\">" \
@@ -92,6 +93,10 @@ PA_MODULE_USAGE(
" <arg name=\"property\" direction=\"in\" type=\"s\"/>" \
" <arg name=\"value\" direction=\"out\" type=\"v\"/>" \
" </method>" \
+ " <method name=\"GetAll\">" \
+ " <arg name=\"interface\" direction=\"in\" type=\"s\"/>" \
+ " <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>" \
+ " </method>" \
" </interface>" \
" <interface name=\"org.freedesktop.DBus.Introspectable\">" \
" <method name=\"Introspect\">" \
@@ -127,6 +132,10 @@ PA_MODULE_USAGE(
" <arg name=\"property\" direction=\"in\" type=\"s\"/>" \
" <arg name=\"value\" direction=\"out\" type=\"v\"/>" \
" </method>" \
+ " <method name=\"GetAll\">" \
+ " <arg name=\"interface\" direction=\"in\" type=\"s\"/>" \
+ " <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>" \
+ " </method>" \
" </interface>" \
" <interface name=\"org.freedesktop.DBus.Introspectable\">" \
" <method name=\"Introspect\">" \
@@ -185,45 +194,69 @@ static pa_hook_result_t source_new_or_unlink_cb(pa_core *c, pa_source *s, struct
return PA_HOOK_OK;
}
+static pa_bool_t message_is_property_get(DBusMessage *m, const char *interface, const char *property) {
+ const char *i, *p;
+ DBusError error;
-static pa_hook_result_t source_unlink_cb(pa_core *c, pa_source *s, struct userdata *u) {
- pa_assert(c);
- pa_source_assert_ref(s);
+ dbus_error_init(&error);
- send_signal(u, s, "ItemRemoved");
+ pa_assert(m);
- return PA_HOOK_OK;
+ if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get"))
+ return FALSE;
+
+ if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_STRING, &p, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
+ dbus_error_free(&error);
+ return FALSE;
+ }
+
+ return pa_streq(i, interface) && pa_streq(p, property);
}
-static pa_bool_t message_is_property_get(DBusMessage *m, const char *interface, const char *property) {
- char *i, *p;
+static pa_bool_t message_is_property_get_all(DBusMessage *m, const char *interface) {
+ const char *i;
DBusError error;
dbus_error_init(&error);
pa_assert(m);
- if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get"))
+ if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "GetAll"))
return FALSE;
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_STRING, &p, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
+ if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
dbus_error_free(&error);
return FALSE;
}
- return pa_streq(i, interface) && pa_streq(p, property);
+ return pa_streq(i, interface);
}
-static void append_variant_string(DBusMessage *m, const char *s) {
- DBusMessageIter iter, sub;
+static void append_variant_string(DBusMessage *m, DBusMessageIter *iter, const char *s) {
+ DBusMessageIter _iter, sub;
pa_assert(m);
pa_assert(s);
- dbus_message_iter_init_append(m, &iter);
- pa_assert_se(dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, "s", &sub));
+ if (!iter) {
+ dbus_message_iter_init_append(m, &_iter);
+ iter = &_iter;
+ }
+
+ pa_assert_se(dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, "s", &sub));
pa_assert_se(dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &s));
- pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
+ pa_assert_se(dbus_message_iter_close_container(iter, &sub));
+}
+
+static void append_property_dict_entry(DBusMessage *m, DBusMessageIter *iter, const char *name, const char *value) {
+ DBusMessageIter sub;
+
+ pa_assert(iter);
+
+ pa_assert_se(dbus_message_iter_open_container(iter, DBUS_TYPE_DICT_ENTRY, NULL, &sub));
+ pa_assert_se(dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &name));
+ append_variant_string(m, &sub, value);
+ pa_assert_se(dbus_message_iter_close_container(iter, &sub));
}
static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *userdata) {
@@ -254,7 +287,23 @@ static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *u
} else if (message_is_property_get(m, "org.Rygel.MediaObject1", "display-name")) {
pa_assert_se(r = dbus_message_new_method_return(m));
- append_variant_string(r, u->display_name);
+ append_variant_string(r, NULL, u->display_name);
+
+ } else if (message_is_property_get(m, "org.Rygel.MediaObject1", "icon-name")) {
+ pa_assert_se(r = dbus_message_new_method_return(m));
+ append_variant_string(r, NULL, "audio-card");
+
+ } else if (message_is_property_get_all(m, "org.Rygel.MediaObject1")) {
+ DBusMessageIter iter, sub;
+
+ pa_assert_se(r = dbus_message_new_method_return(m));
+ dbus_message_iter_init_append(r, &iter);
+
+ pa_assert_se(dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &sub));
+ append_property_dict_entry(r, &sub, "display-name", u->display_name);
+ append_property_dict_entry(r, &sub, "icon-name", "audio-card");
+ pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
+
} else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
const char *xml = ROOT_INTROSPECT_XML;
@@ -376,13 +425,27 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
} else if (message_is_property_get(m, "org.Rygel.MediaObject1", "display-name")) {
- if (pa_streq(path, OBJECT_SINKS)) {
- pa_assert_se(r = dbus_message_new_method_return(m));
- append_variant_string(r, _("Output Devices"));
- } else {
- pa_assert_se(r = dbus_message_new_method_return(m));
- append_variant_string(r, _("Input Devices"));
- }
+ pa_assert_se(r = dbus_message_new_method_return(m));
+
+ append_variant_string(r,
+ NULL,
+ pa_streq(path, OBJECT_SINKS) ?
+ _("Output Devices") :
+ _("Input Devices"));
+
+ } else if (message_is_property_get_all(m, "org.Rygel.MediaObject1")) {
+ DBusMessageIter iter, sub;
+
+ pa_assert_se(r = dbus_message_new_method_return(m));
+
+ dbus_message_iter_init_append(r, &iter);
+
+ pa_assert_se(dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &sub));
+ append_property_dict_entry(m, &sub, "display-name",
+ pa_streq(path, OBJECT_SINKS) ?
+ _("Output Devices") :
+ _("Input Devices"));
+ pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
} else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
pa_strbuf *sb;
@@ -434,11 +497,11 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
if (message_is_property_get(m, "org.Rygel.MediaObject1", "display-name")) {
pa_assert_se(r = dbus_message_new_method_return(m));
- append_variant_string(r, pa_strna(pa_proplist_gets(sink ? sink->proplist : source->proplist, PA_PROP_DEVICE_DESCRIPTION)));
+ append_variant_string(r, NULL, pa_strna(pa_proplist_gets(sink ? sink->proplist : source->proplist, PA_PROP_DEVICE_DESCRIPTION)));
} else if (message_is_property_get(m, "org.Rygel.MediaItem1", "type")) {
pa_assert_se(r = dbus_message_new_method_return(m));
- append_variant_string(r, "audio");
+ append_variant_string(r, NULL, "audio");
} else if (message_is_property_get(m, "org.Rygel.MediaItem1", "mime-type")) {
char *t;
@@ -449,22 +512,71 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
t = pa_sample_spec_to_mime_type_mimefy(&source->sample_spec, &source->channel_map);
pa_assert_se(r = dbus_message_new_method_return(m));
- append_variant_string(r, t);
+ append_variant_string(r, NULL, t);
+ pa_xfree(t);
} else if (message_is_property_get(m, "org.Rygel.MediaItem1", "urls")) {
- char * array[1];
- char ** parray = array;
+ DBusMessageIter iter, sub, array;
+ char *url;
pa_assert_se(r = dbus_message_new_method_return(m));
- array[0] = compute_url(u, sink ? sink->monitor_source->name : source->name);
+ dbus_message_iter_init_append(r, &iter);
- pa_assert_se(dbus_message_append_args(
- r,
- DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &parray, 1,
- DBUS_TYPE_INVALID));
+ url = compute_url(u, sink ? sink->monitor_source->name : source->name);
+
+ pa_assert_se(dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, "as", &sub));
+ pa_assert_se(dbus_message_iter_open_container(&sub, DBUS_TYPE_ARRAY, "s", &array));
+ pa_assert_se(dbus_message_iter_append_basic(&array, DBUS_TYPE_STRING, &url));
+ pa_assert_se(dbus_message_iter_close_container(&sub, &array));
+ pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
+
+ pa_xfree(url);
+
+ } else if (message_is_property_get_all(m, "org.Rygel.MediaObject1")) {
+ DBusMessageIter iter, sub;
+
+ pa_assert_se(r = dbus_message_new_method_return(m));
+ dbus_message_iter_init_append(r, &iter);
+
+ pa_assert_se(dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &sub));
+ append_property_dict_entry(r, &sub, "display-name", pa_strna(pa_proplist_gets(sink ? sink->proplist : source->proplist, PA_PROP_DEVICE_DESCRIPTION)));
+ pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
+
+ } else if (message_is_property_get_all(m, "org.Rygel.MediaItem1")) {
+ DBusMessageIter iter, sub, dict, variant, array;
+ char *url, *t;
+ const char *un = "urls";
+
+ pa_assert_se(r = dbus_message_new_method_return(m));
+ dbus_message_iter_init_append(r, &iter);
+
+ pa_assert_se(dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &sub));
+ append_property_dict_entry(r, &sub, "type", "audio");
+
+ if (sink)
+ t = pa_sample_spec_to_mime_type_mimefy(&sink->sample_spec, &sink->channel_map);
+ else
+ t = pa_sample_spec_to_mime_type_mimefy(&source->sample_spec, &source->channel_map);
+
+ append_property_dict_entry(r, &sub, "mime-type", t);
+ pa_xfree(t);
+
+ pa_assert_se(dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY, NULL, &dict));
+ pa_assert_se(dbus_message_iter_append_basic(&dict, DBUS_TYPE_STRING, &un));
+
+ url = compute_url(u, sink ? sink->monitor_source->name : source->name);
+
+ pa_assert_se(dbus_message_iter_open_container(&dict, DBUS_TYPE_VARIANT, "as", &variant));
+ pa_assert_se(dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY, "s", &array));
+ pa_assert_se(dbus_message_iter_append_basic(&array, DBUS_TYPE_STRING, &url));
+ pa_assert_se(dbus_message_iter_close_container(&variant, &array));
+ pa_assert_se(dbus_message_iter_close_container(&dict, &variant));
+ pa_assert_se(dbus_message_iter_close_container(&sub, &dict));
+
+ pa_xfree(url);
- pa_xfree(array[0]);
+ pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
} else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
const char *xml =
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list