summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/alsa/alsa-sink.c2
-rw-r--r--src/modules/alsa/alsa-source.c2
-rw-r--r--src/modules/module-raop-discover.c27
-rw-r--r--src/modules/module-raop-sink.c9
-rw-r--r--src/modules/raop/raop_client.c4
-rw-r--r--src/modules/rtp/rtsp_client.c56
6 files changed, 62 insertions, 38 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 7768b38e..d4325881 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -148,7 +148,7 @@ static void reserve_update(struct userdata *u) {
const char *description;
pa_assert(u);
- if (!u->sink)
+ if (!u->sink || !u->reserve)
return;
if ((description = pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)))
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index def638ec..7a1b0f8d 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -146,7 +146,7 @@ static void reserve_update(struct userdata *u) {
const char *description;
pa_assert(u);
- if (!u->source)
+ if (!u->source || !u->reserve)
return;
if ((description = pa_proplist_gets(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION)))
diff --git a/src/modules/module-raop-discover.c b/src/modules/module-raop-discover.c
index df393151..7df549ea 100644
--- a/src/modules/module-raop-discover.c
+++ b/src/modules/module-raop-discover.c
@@ -152,11 +152,18 @@ static void resolver_cb(
if (event != AVAHI_RESOLVER_FOUND)
pa_log("Resolving of '%s' failed: %s", name, avahi_strerror(avahi_client_errno(u->client)));
else {
- char *device = NULL, *dname, *vname, *args;
+ char *device = NULL, *nicename, *dname, *vname, *args;
char at[AVAHI_ADDRESS_STR_MAX];
AvahiStringList *l;
pa_module *m;
+ if ((nicename = strstr(name, "@"))) {
+ ++nicename;
+ if (strlen(nicename) > 0) {
+ pa_log_debug("Found RAOP: %s", nicename);
+ }
+ }
+
for (l = txt; l; l = l->next) {
char *key, *value;
pa_assert_se(avahi_string_list_get_pair(l, &key, &value, NULL) == 0);
@@ -190,10 +197,20 @@ static void resolver_cb(
"sink_name=%s",
avahi_address_snprint(at, sizeof(at), a), port,
vname);*/
- args = pa_sprintf_malloc("server=%s "
- "sink_name=%s",
- avahi_address_snprint(at, sizeof(at), a),
- vname);
+ if (nicename) {
+ args = pa_sprintf_malloc("server=%s "
+ "sink_name=%s "
+ "description=\"%s\"",
+ avahi_address_snprint(at, sizeof(at), a),
+ vname,
+ nicename);
+
+ } else {
+ args = pa_sprintf_malloc("server=%s "
+ "sink_name=%s",
+ avahi_address_snprint(at, sizeof(at), a),
+ vname);
+ }
pa_log_debug("Loading module-raop-sink with arguments '%s'", args);
diff --git a/src/modules/module-raop-sink.c b/src/modules/module-raop-sink.c
index da338f5d..88fc6f1e 100644
--- a/src/modules/module-raop-sink.c
+++ b/src/modules/module-raop-sink.c
@@ -72,6 +72,7 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE(
"sink_name=<name for the sink> "
+ "description=<description for the sink> "
"server=<address> "
"format=<sample format> "
"channels=<number of channels> "
@@ -122,6 +123,7 @@ static const char* const valid_modargs[] = {
"format",
"channels",
"sink_name",
+ "description",
NULL
};
@@ -502,7 +504,7 @@ int pa__init(pa_module*m) {
struct userdata *u = NULL;
pa_sample_spec ss;
pa_modargs *ma = NULL;
- const char *server;
+ const char *server, *desc;
pa_sink_new_data data;
pa_assert(m);
@@ -564,7 +566,10 @@ int pa__init(pa_module*m) {
pa_sink_new_data_set_name(&data, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME));
pa_sink_new_data_set_sample_spec(&data, &ss);
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, server);
- pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "RAOP sink '%s'", server);
+ if ((desc = pa_modargs_get_value(ma, "description", NULL)))
+ pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, desc);
+ else
+ pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "RAOP sink '%s'", server);
u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY|PA_SINK_NETWORK);
pa_sink_new_data_done(&data);
diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c
index 4627545e..0cc67aeb 100644
--- a/src/modules/raop/raop_client.c
+++ b/src/modules/raop/raop_client.c
@@ -339,9 +339,13 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
break;
case STATE_TEARDOWN:
+ pa_log_debug("RAOP: TEARDOWN");
+ break;
+
case STATE_SET_PARAMETER:
pa_log_debug("RAOP: SET_PARAMETER");
break;
+
case STATE_DISCONNECTED:
pa_assert(c->closed_callback);
pa_assert(c->rtsp);
diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index 9eb3d964..3b077bec 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -101,26 +101,27 @@ pa_rtsp_client* pa_rtsp_client_new(pa_mainloop_api *mainloop, const char* hostna
void pa_rtsp_client_free(pa_rtsp_client* c) {
- if (c) {
- if (c->sc)
- pa_socket_client_unref(c->sc);
- if (c->ioline)
- pa_ioline_close(c->ioline);
- else if (c->io)
- pa_iochannel_free(c->io);
-
- pa_xfree(c->hostname);
- pa_xfree(c->url);
- pa_xfree(c->localip);
- pa_xfree(c->session);
- pa_xfree(c->transport);
- pa_xfree(c->last_header);
- if (c->header_buffer)
- pa_strbuf_free(c->header_buffer);
- if (c->response_headers)
- pa_headerlist_free(c->response_headers);
- pa_headerlist_free(c->headers);
- }
+ pa_assert(c);
+
+ if (c->sc)
+ pa_socket_client_unref(c->sc);
+ if (c->ioline)
+ pa_ioline_close(c->ioline);
+ else if (c->io)
+ pa_iochannel_free(c->io);
+
+ pa_xfree(c->hostname);
+ pa_xfree(c->url);
+ pa_xfree(c->localip);
+ pa_xfree(c->session);
+ pa_xfree(c->transport);
+ pa_xfree(c->last_header);
+ if (c->header_buffer)
+ pa_strbuf_free(c->header_buffer);
+ if (c->response_headers)
+ pa_headerlist_free(c->response_headers);
+ pa_headerlist_free(c->headers);
+
pa_xfree(c);
}
@@ -141,8 +142,6 @@ static void headers_read(pa_rtsp_client *c) {
c->transport = pa_xstrdup(pa_headerlist_gets(c->response_headers, "Transport"));
if (!c->session || !c->transport) {
- pa_headerlist_free(c->response_headers);
- c->response_headers = NULL;
pa_log("Invalid SETUP response.");
return;
}
@@ -160,8 +159,6 @@ static void headers_read(pa_rtsp_client *c) {
}
if (0 == c->rtp_port) {
/* Error no server_port in response */
- pa_headerlist_free(c->response_headers);
- c->response_headers = NULL;
pa_log("Invalid SETUP response (no port number).");
return;
}
@@ -169,9 +166,6 @@ static void headers_read(pa_rtsp_client *c) {
/* Call our callback */
c->callback(c, c->state, c->response_headers, c->userdata);
-
- pa_headerlist_free(c->response_headers);
- c->response_headers = NULL;
}
@@ -201,7 +195,8 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
}
if (c->waiting && 0 == strcmp("RTSP/1.0 200 OK", s2)) {
c->waiting = 0;
- pa_assert(!c->response_headers);
+ if (c->response_headers)
+ pa_headerlist_free(c->response_headers);
c->response_headers = pa_headerlist_new();
goto exit;
}
@@ -353,9 +348,12 @@ void pa_rtsp_set_callback(pa_rtsp_client *c, pa_rtsp_cb_t callback, void *userda
void pa_rtsp_disconnect(pa_rtsp_client *c) {
pa_assert(c);
- if (c->io)
+ if (c->ioline)
+ pa_ioline_close(c->ioline);
+ else if (c->io)
pa_iochannel_free(c->io);
c->io = NULL;
+ c->ioline = NULL;
}