1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-12-04 14:46:31 -05:00

added ability to send a signal (SIGHUP) which will re-read the current playlist (m3u) that is being processed. When this happens, ezstream will pick up from the last track that was played.

git-svn-id: https://svn.xiph.org/trunk/ezstream@6563 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
oddsock 2004-04-21 13:48:22 +00:00
parent 214c97a30b
commit b85a6a2ca3
4 changed files with 50 additions and 292 deletions

View File

@ -1,4 +1,4 @@
AC_INIT([ezstream], [0.1.1], [icecast@xiph.org]) AC_INIT([ezstream], [0.1.2], [icecast@xiph.org])
AC_PREREQ(2.54) AC_PREREQ(2.54)
AC_CONFIG_SRCDIR(src/ezstream.c) AC_CONFIG_SRCDIR(src/ezstream.c)

View File

@ -1,143 +0,0 @@
configfile.o: configfile.c /usr/include/string.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h \
/usr/include/bits/string.h /usr/include/bits/string2.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/bits/types.h /usr/include/bits/wordsize.h \
/usr/include/bits/typesizes.h /usr/include/stdlib.h configfile.h \
/usr/include/libxml2/libxml/parser.h \
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h \
/usr/include/libxml2/libxml/xmlversion.h \
/usr/include/libxml2/libxml/xmlexports.h \
/usr/include/libxml2/libxml/tree.h /usr/include/stdio.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/include/bits/wchar.h /usr/include/gconv.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdio.h /usr/include/libxml2/libxml/xmlregexp.h \
/usr/include/libxml2/libxml/dict.h /usr/include/libxml2/libxml/hash.h \
/usr/include/libxml2/libxml/valid.h \
/usr/include/libxml2/libxml/xmlerror.h \
/usr/include/libxml2/libxml/list.h \
/usr/include/libxml2/libxml/xmlautomata.h \
/usr/include/libxml2/libxml/entities.h \
/usr/include/libxml2/libxml/encoding.h /usr/include/iconv.h \
/usr/include/libxml2/libxml/xmlIO.h \
/usr/include/libxml2/libxml/globals.h /usr/include/libxml2/libxml/SAX.h \
/usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
/usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
/usr/include/alloca.h /usr/include/libxml2/libxml/xlink.h \
/usr/include/libxml2/libxml/SAX2.h \
/usr/include/libxml2/libxml/xmlmemory.h \
/usr/include/libxml2/libxml/threads.h
/usr/include/string.h:
/usr/include/features.h:
/usr/include/sys/cdefs.h:
/usr/include/gnu/stubs.h:
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h:
/usr/include/bits/string.h:
/usr/include/bits/string2.h:
/usr/include/endian.h:
/usr/include/bits/endian.h:
/usr/include/bits/types.h:
/usr/include/bits/wordsize.h:
/usr/include/bits/typesizes.h:
/usr/include/stdlib.h:
configfile.h:
/usr/include/libxml2/libxml/parser.h:
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h:
/usr/include/libxml2/libxml/xmlversion.h:
/usr/include/libxml2/libxml/xmlexports.h:
/usr/include/libxml2/libxml/tree.h:
/usr/include/stdio.h:
/usr/include/libio.h:
/usr/include/_G_config.h:
/usr/include/wchar.h:
/usr/include/bits/wchar.h:
/usr/include/gconv.h:
/usr/include/bits/stdio_lim.h:
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/libxml2/libxml/xmlregexp.h:
/usr/include/libxml2/libxml/dict.h:
/usr/include/libxml2/libxml/hash.h:
/usr/include/libxml2/libxml/valid.h:
/usr/include/libxml2/libxml/xmlerror.h:
/usr/include/libxml2/libxml/list.h:
/usr/include/libxml2/libxml/xmlautomata.h:
/usr/include/libxml2/libxml/entities.h:
/usr/include/libxml2/libxml/encoding.h:
/usr/include/iconv.h:
/usr/include/libxml2/libxml/xmlIO.h:
/usr/include/libxml2/libxml/globals.h:
/usr/include/libxml2/libxml/SAX.h:
/usr/include/sys/types.h:
/usr/include/time.h:
/usr/include/sys/select.h:
/usr/include/bits/select.h:
/usr/include/bits/sigset.h:
/usr/include/bits/time.h:
/usr/include/sys/sysmacros.h:
/usr/include/bits/pthreadtypes.h:
/usr/include/bits/sched.h:
/usr/include/alloca.h:
/usr/include/libxml2/libxml/xlink.h:
/usr/include/libxml2/libxml/SAX2.h:
/usr/include/libxml2/libxml/xmlmemory.h:
/usr/include/libxml2/libxml/threads.h:

View File

@ -1,148 +0,0 @@
ezstream.o: ezstream.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h \
/usr/include/bits/types.h /usr/include/bits/wordsize.h \
/usr/include/bits/typesizes.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
/usr/include/gconv.h \
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdio.h /usr/include/stdlib.h \
/usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
/usr/include/bits/endian.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
/usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
/usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
/usr/include/bits/string2.h /usr/local/include/shout/shout.h getopt.h \
configfile.h /usr/include/libxml2/libxml/parser.h \
/usr/include/libxml2/libxml/xmlversion.h \
/usr/include/libxml2/libxml/xmlexports.h \
/usr/include/libxml2/libxml/tree.h \
/usr/include/libxml2/libxml/xmlregexp.h \
/usr/include/libxml2/libxml/dict.h /usr/include/libxml2/libxml/hash.h \
/usr/include/libxml2/libxml/valid.h \
/usr/include/libxml2/libxml/xmlerror.h \
/usr/include/libxml2/libxml/list.h \
/usr/include/libxml2/libxml/xmlautomata.h \
/usr/include/libxml2/libxml/entities.h \
/usr/include/libxml2/libxml/encoding.h /usr/include/iconv.h \
/usr/include/libxml2/libxml/xmlIO.h \
/usr/include/libxml2/libxml/globals.h /usr/include/libxml2/libxml/SAX.h \
/usr/include/libxml2/libxml/xlink.h /usr/include/libxml2/libxml/SAX2.h \
/usr/include/libxml2/libxml/xmlmemory.h \
/usr/include/libxml2/libxml/threads.h
/usr/include/stdio.h:
/usr/include/features.h:
/usr/include/sys/cdefs.h:
/usr/include/gnu/stubs.h:
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h:
/usr/include/bits/types.h:
/usr/include/bits/wordsize.h:
/usr/include/bits/typesizes.h:
/usr/include/libio.h:
/usr/include/_G_config.h:
/usr/include/wchar.h:
/usr/include/bits/wchar.h:
/usr/include/gconv.h:
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h:
/usr/include/bits/stdio_lim.h:
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/stdlib.h:
/usr/include/sys/types.h:
/usr/include/time.h:
/usr/include/endian.h:
/usr/include/bits/endian.h:
/usr/include/sys/select.h:
/usr/include/bits/select.h:
/usr/include/bits/sigset.h:
/usr/include/bits/time.h:
/usr/include/sys/sysmacros.h:
/usr/include/bits/pthreadtypes.h:
/usr/include/bits/sched.h:
/usr/include/alloca.h:
/usr/include/string.h:
/usr/include/bits/string.h:
/usr/include/bits/string2.h:
/usr/local/include/shout/shout.h:
getopt.h:
configfile.h:
/usr/include/libxml2/libxml/parser.h:
/usr/include/libxml2/libxml/xmlversion.h:
/usr/include/libxml2/libxml/xmlexports.h:
/usr/include/libxml2/libxml/tree.h:
/usr/include/libxml2/libxml/xmlregexp.h:
/usr/include/libxml2/libxml/dict.h:
/usr/include/libxml2/libxml/hash.h:
/usr/include/libxml2/libxml/valid.h:
/usr/include/libxml2/libxml/xmlerror.h:
/usr/include/libxml2/libxml/list.h:
/usr/include/libxml2/libxml/xmlautomata.h:
/usr/include/libxml2/libxml/entities.h:
/usr/include/libxml2/libxml/encoding.h:
/usr/include/iconv.h:
/usr/include/libxml2/libxml/xmlIO.h:
/usr/include/libxml2/libxml/globals.h:
/usr/include/libxml2/libxml/SAX.h:
/usr/include/libxml2/libxml/xlink.h:
/usr/include/libxml2/libxml/SAX2.h:
/usr/include/libxml2/libxml/xmlmemory.h:
/usr/include/libxml2/libxml/threads.h:

View File

@ -12,6 +12,17 @@
#include "configfile.h" #include "configfile.h"
EZCONFIG *pezConfig = NULL; EZCONFIG *pezConfig = NULL;
int rereadPlaylist = 0;
#ifndef WIN32
#include <signal.h>
void hup_handler(int sig)
{
rereadPlaylist = 1;
printf("Will reread the playlist on next song\n");
}
#endif
typedef struct tag_ID3Tag { typedef struct tag_ID3Tag {
char tag[3]; char tag[3];
@ -139,6 +150,7 @@ int streamFile(shout_t *shout, char *fileName) {
int streamPlaylist(shout_t *shout, char *fileName) { int streamPlaylist(shout_t *shout, char *fileName) {
FILE *filep = NULL; FILE *filep = NULL;
char streamFileName[8096] = ""; char streamFileName[8096] = "";
char lastStreamFileName[8096] = "";
int loop = 1; int loop = 1;
filep = fopen(fileName, "r"); filep = fopen(fileName, "r");
@ -152,11 +164,45 @@ int streamPlaylist(shout_t *shout, char *fileName) {
fgets(streamFileName, sizeof(streamFileName), filep); fgets(streamFileName, sizeof(streamFileName), filep);
streamFileName[strlen(streamFileName)-1] = '\000'; streamFileName[strlen(streamFileName)-1] = '\000';
if (strlen(streamFileName) > 0) { if (strlen(streamFileName) > 0) {
memset(lastStreamFileName, '\000', sizeof(lastStreamFileName));
strcpy(lastStreamFileName, streamFileName);
/* Skip entries that begin with a # */ /* Skip entries that begin with a # */
if (strncmp(streamFileName, "#", 1)) { if (strncmp(streamFileName, "#", 1)) {
streamFile(shout, streamFileName); streamFile(shout, streamFileName);
} }
} }
if (rereadPlaylist) {
rereadPlaylist = 0;
fclose(filep);
printf("Reopening playlist\n");
filep = fopen(fileName, "r");
if (filep == 0) {
printf("Cannot open %s\n", fileName);
return(0);
}
else {
int loop2 = 1;
printf("Repositioning to (%s)\n", lastStreamFileName);
while (loop2) {
/* If we reach the end before finding
our last spot, we will start over at the
beginning */
if (feof(filep)) {
loop2 = 0;
}
else {
memset(streamFileName, '\000', sizeof(streamFileName));
fgets(streamFileName, sizeof(streamFileName), filep);
streamFileName[strlen(streamFileName)-1] = '\000';
if (!strcmp(streamFileName, lastStreamFileName)) {
/* If we found our last position, then bump out of the loop */
loop2 = 0;
}
}
}
}
}
} }
rewind(filep); rewind(filep);
} }
@ -174,6 +220,9 @@ int main(int argc, char **argv)
pezConfig = getEZConfig(); pezConfig = getEZConfig();
#ifndef WIN32
signal(SIGHUP, hup_handler);
#endif
shout_init(); shout_init();