X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/05b75f8d50b83e943af3be4071449304d82dbdcd..37f29ce96baac1d999dab119d671bb7dff6793e8:/server/disorder-server.h diff --git a/server/disorder-server.h b/server/disorder-server.h index 361bd4f..60e97df 100644 --- a/server/disorder-server.h +++ b/server/disorder-server.h @@ -1,21 +1,22 @@ /* * 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 + * 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 - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA + * along with this program. If not, see . + */ +/** @file server/disorder-server.h + * @brief Definitions for server and allied utilities */ #ifndef DISORDER_SERVER_H @@ -41,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -65,7 +67,6 @@ #include "logfd.h" #include "mem.h" #include "mime.h" -#include "mixer.h" #include "printf.h" #include "queue.h" #include "random.h" @@ -79,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" @@ -95,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 @@ -120,7 +134,7 @@ 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, 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 */ @@ -320,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 */ /*