mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
raop: Add IPv6 support
This commit is contained in:
parent
3e53f47c8d
commit
3de65e61e4
2 changed files with 17 additions and 8 deletions
|
|
@ -752,6 +752,7 @@ static int open_bind_udp_socket(pa_raop_client *c, uint16_t *actual_port) {
|
|||
if (inet_pton(AF_INET, pa_rtsp_localip(c->rtsp), &sa4.sin_addr) > 0) {
|
||||
sa4.sin_family = af = AF_INET;
|
||||
sa4.sin_port = htons(port);
|
||||
sa4.sin_addr.s_addr = INADDR_ANY;
|
||||
sa = (struct sockaddr *) &sa4;
|
||||
salen = sizeof(sa4);
|
||||
sa_port = &sa4.sin_port;
|
||||
|
|
@ -759,6 +760,7 @@ static int open_bind_udp_socket(pa_raop_client *c, uint16_t *actual_port) {
|
|||
} else if (inet_pton(AF_INET6, pa_rtsp_localip(c->rtsp), &sa6.sin6_addr) > 0) {
|
||||
sa6.sin6_family = af = AF_INET6;
|
||||
sa6.sin6_port = htons(port);
|
||||
sa6.sin6_addr = in6addr_any;
|
||||
sa = (struct sockaddr *) &sa6;
|
||||
salen = sizeof(sa6);
|
||||
sa_port = &sa6.sin6_port;
|
||||
|
|
@ -849,11 +851,18 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_
|
|||
int frames = 0;
|
||||
const char *ip;
|
||||
char *url;
|
||||
int ipv;
|
||||
|
||||
pa_log_debug("RAOP: CONNECTED");
|
||||
|
||||
ip = pa_rtsp_localip(c->rtsp);
|
||||
url = pa_sprintf_malloc("rtsp://%s/%s", ip, c->sid);
|
||||
if (pa_is_ip6_address(ip)) {
|
||||
ipv = 6;
|
||||
url = pa_sprintf_malloc("rtsp://[%s]/%s", ip, c->sid);
|
||||
} else {
|
||||
ipv = 4;
|
||||
url = pa_sprintf_malloc("rtsp://%s/%s", ip, c->sid);
|
||||
}
|
||||
pa_rtsp_set_url(c->rtsp, url);
|
||||
|
||||
if (c->protocol == PA_RAOP_PROTOCOL_TCP)
|
||||
|
|
@ -865,14 +874,14 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_
|
|||
case PA_RAOP_ENCRYPTION_NONE: {
|
||||
sdp = pa_sprintf_malloc(
|
||||
"v=0\r\n"
|
||||
"o=iTunes %s 0 IN IP4 %s\r\n"
|
||||
"o=iTunes %s 0 IN IP%d %s\r\n"
|
||||
"s=iTunes\r\n"
|
||||
"c=IN IP4 %s\r\n"
|
||||
"c=IN IP%d %s\r\n"
|
||||
"t=0 0\r\n"
|
||||
"m=audio 0 RTP/AVP 96\r\n"
|
||||
"a=rtpmap:96 AppleLossless\r\n"
|
||||
"a=fmtp:96 %d 0 16 40 10 14 2 255 0 0 44100\r\n",
|
||||
c->sid, ip, c->host, frames);
|
||||
c->sid, ipv, ip, ipv, c->host, frames);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -886,16 +895,16 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_
|
|||
|
||||
sdp = pa_sprintf_malloc(
|
||||
"v=0\r\n"
|
||||
"o=iTunes %s 0 IN IP4 %s\r\n"
|
||||
"o=iTunes %s 0 IN IP%d %s\r\n"
|
||||
"s=iTunes\r\n"
|
||||
"c=IN IP4 %s\r\n"
|
||||
"c=IN IP%d %s\r\n"
|
||||
"t=0 0\r\n"
|
||||
"m=audio 0 RTP/AVP 96\r\n"
|
||||
"a=rtpmap:96 AppleLossless\r\n"
|
||||
"a=fmtp:96 %d 0 16 40 10 14 2 255 0 0 44100\r\n"
|
||||
"a=rsaaeskey:%s\r\n"
|
||||
"a=aesiv:%s\r\n",
|
||||
c->sid, ip, c->host, frames, key, iv);
|
||||
c->sid, ipv, ip, ipv, c->host, frames, key, iv);
|
||||
|
||||
pa_xfree(key);
|
||||
pa_xfree(iv);
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
|
|||
}
|
||||
} else if (AF_INET6 == sa.sa.sa_family) {
|
||||
if ((res = inet_ntop(AF_INET6, &sa.in6.sin6_addr, buf, sizeof(buf)))) {
|
||||
c->localip = pa_sprintf_malloc("[%s]", res);
|
||||
c->localip = pa_xstrdup(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue