X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/e7eb3a2744aa45179daea235800753d3d1955338..06f35ddcffa7e9d5a6c6b53cbb07ef11fab49f95:/server/disorder-server.h
diff --git a/server/disorder-server.h b/server/disorder-server.h
index c3a0e69..e8f4dab 100644
--- a/server/disorder-server.h
+++ b/server/disorder-server.h
@@ -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
@@ -15,6 +15,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
+/** @file server/disorder-server.h
+ * @brief Definitions for server and allied utilities
+ */
#ifndef DISORDER_SERVER_H
#define DISORDER_SERVER_H
@@ -39,6 +42,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -63,7 +67,6 @@
#include "logfd.h"
#include "mem.h"
#include "mime.h"
-#include "mixer.h"
#include "printf.h"
#include "queue.h"
#include "random.h"
@@ -77,12 +80,15 @@
#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"
@@ -93,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
@@ -118,10 +134,13 @@ void recent_write(void);
/* write the recently played list out. Calls @fatal@ on error. */
struct queue_entry *queue_add(const char *track, const char *submitter,
- int where);
+ int where, const char *target,
+ enum track_origin origin);
#define WHERE_START 0 /* Add to head of queue */
#define WHERE_END 1 /* Add to end of queue */
#define WHERE_BEFORE_RANDOM 2 /* End, or before random track */
+#define WHERE_AFTER 3 /* After the target */
+#define WHERE_NOWHERE 4 /* Don't add to queue at all */
/* add an entry to the queue. Return a pointer to the new entry. */
void queue_remove(struct queue_entry *q, const char *who);
@@ -318,6 +337,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 */
/*