mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
Merge commit 'coling/master'
This commit is contained in:
commit
77514c1c4c
6 changed files with 61 additions and 37 deletions
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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_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->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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue