chiark / gitweb /
Do a test decode of a FLAC file.
[disorder] / server / disorder-server.h
index 1a52e25172bf1be83d6afacdc2de47fa160c2057..60e97dfc343ddde47d8216d9b2a92ba3985c4b4c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder
- * Copyright (C) 2008 Richard Kettlewell
+ * Copyright (C) 2008, 2009 Richard Kettlewell
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -42,6 +42,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/un.h>
+#include <sys/resource.h>
 #include <syslog.h>
 #include <time.h>
 #include <unistd.h>
@@ -66,7 +67,6 @@
 #include "logfd.h"
 #include "mem.h"
 #include "mime.h"
-#include "mixer.h"
 #include "printf.h"
 #include "queue.h"
 #include "random.h"
 #include "trackdb-int.h"
 #include "trackdb.h"
 #include "trackname.h"
+#include "uaudio.h"
 #include "unicode.h"
 #include "user.h"
 #include "vector.h"
 #include "version.h"
 #include "wstat.h"
 
+extern const struct uaudio *api;
+
 void daemonize(const char *tag, int fac, const char *pidfile);
 /* Go into background.  Send stdout/stderr to syslog.
  * If @pri@ is non-null, it should be "facility.level"
@@ -96,8 +99,18 @@ void daemonize(const char *tag, int fac, const char *pidfile);
 void quit(ev_source *ev) attribute((noreturn));
 /* terminate the daemon */
 
-int reconfigure(ev_source *ev, int reload);
-/* reconfigure.  If @reload@ is nonzero, update the configuration. */
+int reconfigure(ev_source *ev, unsigned flags);
+/* reconfigure */
+
+void reset_sockets(ev_source *ev);
+
+/** @brief Set when starting server */
+#define RECONFIGURE_FIRST 0x0001
+
+/** @brief Set when reloading after SIGHUP etc */
+#define RECONFIGURE_RELOADING 0x0002
+
+void dbparams_check(void);
 
 extern struct queue_entry qhead;
 /* queue of things yet to be played.  the head will be played
@@ -321,6 +334,41 @@ int play_pause(const struct plugin *pl, long *playedp, void *data);
 void play_resume(const struct plugin *pl, void *data);
 /* Resume track. */
 
+/* background process support *************************************************/
+
+/** @brief Child process parameters */
+struct pbgc_params {
+  /** @brief Length of player command */
+  int argc;
+  /** @brief Player command */
+  const char **argv;
+  /** @brief Device to wait for or NULL */
+  const char *waitdevice;
+  /** @brief Raw track name */
+  const char *rawpath;
+};
+
+/** @brief Callback to play or prepare a track
+ * @param q Track to play or decode
+ * @param bgdata User data pointer
+ * @return Exit code
+ */
+typedef int play_background_child_fn(struct queue_entry *q,
+                                     const struct pbgc_params *params,
+                                     void *bgdata);
+
+int play_background(ev_source *ev,
+                    const struct stringlist *player,
+                    struct queue_entry *q,
+                    play_background_child_fn *child,
+                    void *bgdata);
+
+/* Return values from start(),  prepare() and play_background() */
+
+#define START_OK 0        /**< @brief Succeeded. */
+#define START_HARDFAIL 1   /**< @brief Track is broken. */
+#define START_SOFTFAIL 2   /**< @brief Track OK, system (temporarily?) broken */
+
 #endif /* DISORDER_SERVER_H */
 
 /*