chiark / gitweb /
Merge volume and build fixes
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 8 Mar 2009 14:02:07 +0000 (14:02 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 8 Mar 2009 14:02:07 +0000 (14:02 +0000)
1  2 
lib/uaudio-rtp.c
server/speaker.c

diff --combined lib/uaudio-rtp.c
index b800b8b612661175b28e5e078854f6f6a6a91476,4189cb38a51968653a14bef62f72043402e48ad6..702747a119d0aa852f5ad0d2c5e454b6d45d4ad4
@@@ -23,6 -23,8 +23,8 @@@
  #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>
@@@ -36,7 -38,6 +38,7 @@@
  #include "addr.h"
  #include "ifreq.h"
  #include "timeval.h"
 +#include "configuration.h"
  
  /** @brief Bytes to send per network packet
   *
@@@ -297,33 -298,13 +299,33 @@@ static void rtp_deactivate(void) 
    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,
  };
  
  /*
diff --combined server/speaker.c
index 9b16cc8e2410eed1a2c74230d270b01cc7477edd,cc1764ed464f11fc1ba526f1abb5a81ac7173686..9cef6a43d370df40c146ac854382ecffd8fa818b
@@@ -79,6 -79,8 +79,8 @@@
  #include <sys/un.h>
  #include <sys/stat.h>
  #include <pthread.h>
+ #include <sys/resource.h>
+ #include <gcrypt.h>
  
  #include "configuration.h"
  #include "syscalls.h"
@@@ -651,6 -653,11 +653,11 @@@ int main(int argc, char **argv) 
      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);