#include <sys/socket.h>
#include <ifaddrs.h>
#include <net/if.h>
+ #include <arpa/inet.h>
+ #include <netinet/in.h>
#include <gcrypt.h>
#include <unistd.h>
#include <time.h>
#include "addr.h"
#include "ifreq.h"
#include "timeval.h"
+#include "configuration.h"
/** @brief Bytes to send per network packet
*
uaudio_thread_deactivate();
}
+static void rtp_configure(void) {
+ char buffer[64];
+
+ uaudio_set("rtp-destination", config->broadcast.s[0]);
+ uaudio_set("rtp-destination-port", config->broadcast.s[1]);
+ if(config->broadcast_from.n) {
+ uaudio_set("rtp-source", config->broadcast_from.s[0]);
+ uaudio_set("rtp-source-port", config->broadcast_from.s[0]);
+ } else {
+ uaudio_set("rtp-source", NULL);
+ uaudio_set("rtp-source-port", NULL);
+ }
+ snprintf(buffer, sizeof buffer, "%ld", config->multicast_ttl);
+ uaudio_set("multicast-ttl", buffer);
+ uaudio_set("multicast-loop", config->multicast_loop ? "yes" : "no");
+ snprintf(buffer, sizeof buffer, "%ld", config->rtp_delay_threshold);
+ uaudio_set("delay-threshold", buffer);
+}
+
const struct uaudio uaudio_rtp = {
.name = "rtp",
.options = rtp_options,
.start = rtp_start,
.stop = rtp_stop,
.activate = rtp_activate,
- .deactivate = rtp_deactivate
+ .deactivate = rtp_deactivate,
+ .configure = rtp_configure,
};
/*
#include <sys/un.h>
#include <sys/stat.h>
#include <pthread.h>
+ #include <sys/resource.h>
+ #include <gcrypt.h>
#include "configuration.h"
#include "syscalls.h"
info("set RLIM_NOFILE to %lu", (unsigned long)rl->rlim_cur);
} else
info("RLIM_NOFILE is %lu", (unsigned long)rl->rlim_cur);
+ /* gcrypt initialization */
+ if(!gcry_check_version(NULL))
+ disorder_fatal(0, "gcry_check_version failed");
+ gcry_control(GCRYCTL_INIT_SECMEM, 0);
+ gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
/* create a pipe between the backend callback and the poll() loop */
xpipe(sigpipe);
nonblock(sigpipe[0]);
/* TODO other parameters! */
backend = uaudio_find(config->api);
/* backend-specific initialization */
+ if(backend->configure)
+ backend->configure();
backend->start(speaker_callback, NULL);
/* create the socket directory */
byte_xasprintf(&dir, "%s/speaker", config->home);