chiark
/
gitweb
/
~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clients/playrtp.c: Make the `getaddrinfo' hints structure writable.
[disorder]
/
clients
/
playrtp.c
diff --git
a/clients/playrtp.c
b/clients/playrtp.c
index d28369fb5b5293195c0e9bab73d81476957b6b10..eda7ce9d27d5c7fa7b60504218e96b303f76f10e 100644
(file)
--- a/
clients/playrtp.c
+++ b/
clients/playrtp.c
@@
-704,7
+704,7
@@
int main(int argc, char **argv) {
int monitor = 0;
static const int one = 1;
int monitor = 0;
static const int one = 1;
- st
atic const st
ruct addrinfo prefs = {
+ struct addrinfo prefs = {
.ai_flags = AI_PASSIVE,
.ai_family = PF_INET,
.ai_socktype = SOCK_DGRAM,
.ai_flags = AI_PASSIVE,
.ai_family = PF_INET,
.ai_socktype = SOCK_DGRAM,
@@
-754,6
+754,7
@@
int main(int argc, char **argv) {
}
}
if(config_read(0, NULL)) disorder_fatal(0, "cannot read configuration");
}
}
if(config_read(0, NULL)) disorder_fatal(0, "cannot read configuration");
+ /* Choose a sensible default audio backend */
if(!backend) {
backend = uaudio_default(uaudio_apis, UAUDIO_API_CLIENT);
if(!backend)
if(!backend) {
backend = uaudio_default(uaudio_apis, UAUDIO_API_CLIENT);
if(!backend)
@@
-795,6
+796,12
@@
int main(int argc, char **argv) {
struct sockaddr *addr;
socklen_t addr_len;
if(!strcmp(sl.s[0], "-")) {
struct sockaddr *addr;
socklen_t addr_len;
if(!strcmp(sl.s[0], "-")) {
+ /* We'll need a connection to request the incoming stream, so open one if
+ * we don't have one already */
+ if(!c) {
+ if(!(c = disorder_new(1))) exit(EXIT_FAILURE);
+ if(disorder_connect(c)) exit(EXIT_FAILURE);
+ }
/* Pick address family to match known-working connectivity to the server */
int family = disorder_client_af(c);
/* Get a list of interfaces */
/* Pick address family to match known-working connectivity to the server */
int family = disorder_client_af(c);
/* Get a list of interfaces */
@@
-803,6
+810,7
@@
int main(int argc, char **argv) {
disorder_fatal(errno, "error calling getifaddrs");
/* Try to pick a good one */
for(; ifa; ifa = ifa->ifa_next) {
disorder_fatal(errno, "error calling getifaddrs");
/* Try to pick a good one */
for(; ifa; ifa = ifa->ifa_next) {
+ if(!ifa->ifa_addr) continue;
if(bestifa == NULL
|| compare_interfaces(ifa, bestifa, family) > 0)
bestifa = ifa;
if(bestifa == NULL
|| compare_interfaces(ifa, bestifa, family) > 0)
bestifa = ifa;