mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2024-11-03 04:17:18 -05:00
Add new <stream_once> configuration option for disabling continuous streaming.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12592 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
parent
7d51c20fb8
commit
ad46ff44c6
2
NEWS
2
NEWS
@ -9,6 +9,8 @@ Changes in 0.3.0, (SVN trunk):
|
||||
- Playlist scripting support: Indicate that the executable in <filename>
|
||||
should be run each time to get a new media filename to stream, by setting
|
||||
the new <playlist_program> configuration option to 1.
|
||||
- New <stream_once> configuration option, which makes ezstream play a media
|
||||
file or playlist once and then exit.
|
||||
- Add feature to skip the currently streaming track, done by sending the
|
||||
SIGUSR1 signal to the ezstream process.
|
||||
- New command line option `-q': Suppress standard error output from external
|
||||
|
@ -11,7 +11,9 @@
|
||||
<sourcepassword>hackme</sourcepassword>
|
||||
<format>MP3</format>
|
||||
<filename>playlist.m3u</filename>
|
||||
<!--
|
||||
<!-- Once done streaming playlist.m3u, exit: -->
|
||||
<stream_once>1</stream_once>
|
||||
<!--
|
||||
The following settings are used to describe your stream to the server.
|
||||
It's up to you to make sure that the bitrate/samplerate/channels
|
||||
information matches up with your input stream files. Note that
|
||||
|
@ -11,7 +11,9 @@
|
||||
<sourcepassword>hackme</sourcepassword>
|
||||
<format>VORBIS</format>
|
||||
<filename>playlist.m3u</filename>
|
||||
<!--
|
||||
<!-- For demonstrational purposes, explicitly set continuous streaming: -->
|
||||
<stream_once>0</stream_once>
|
||||
<!--
|
||||
The following settings are used to describe your stream to the server.
|
||||
It's up to you to make sure that the bitrate/quality/samplerate/channels
|
||||
information matches up with your input stream files.
|
||||
|
@ -160,11 +160,23 @@ Comments in playlists are introduced by a
|
||||
sign at the beginning of a line and ignored by
|
||||
.Nm .
|
||||
.It Sy \&<playlist_program\ /\&>
|
||||
Indicates that the file in \&<filename/\&> is actually an executable program
|
||||
.Pq Optional.
|
||||
Set to
|
||||
.Sy 1
|
||||
.Pq one
|
||||
to indicate that the file in \&<filename/\&> is actually an executable program
|
||||
or script.
|
||||
This program is supposed to print
|
||||
.Pq to standard output
|
||||
one line with the name of a file that should be streamed next and then exit.
|
||||
.Pp
|
||||
If set to
|
||||
.Sy 0
|
||||
.Pq zero ,
|
||||
\&<filename/\&> content is assumed to be a media file, playlist file or the
|
||||
keyword
|
||||
.Pa stdin
|
||||
.Pq the default .
|
||||
.It Sy \&<shuffle\ /\&>
|
||||
.Pq Optional.
|
||||
Set to
|
||||
@ -177,6 +189,15 @@ Files are played sequentially if set to
|
||||
or when the \&<shuffle/\&> element is absent.
|
||||
This option will be ignored if \&<playlist_program/\&> is set to 1
|
||||
.Pq one.
|
||||
.It Sy \&<stream_once\ /\&>
|
||||
Set to
|
||||
.Sy 1
|
||||
.Pq one
|
||||
to stream \&<filename/\&> content only once, and to
|
||||
.Sy 0
|
||||
.Pq zero
|
||||
for continuous streaming
|
||||
.Pq the default .
|
||||
.It Sy \&<svrinfoname\ /\&>
|
||||
.Pq Optional.
|
||||
Set the name of the broadcast.
|
||||
|
@ -140,7 +140,8 @@ parseConfig(const char *fileName)
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr cur;
|
||||
char *ls_xmlContentPtr;
|
||||
int shuffle_set, svrinfopublic_set, program_set;
|
||||
int program_set, shuffle_set, streamOnce_set,
|
||||
svrinfopublic_set;
|
||||
|
||||
xmlLineNumbersDefault(1);
|
||||
if ((doc = xmlParseFile(fileName)) == NULL) {
|
||||
@ -158,9 +159,10 @@ parseConfig(const char *fileName)
|
||||
|
||||
memset(&ezConfig, '\000', sizeof(ezConfig));
|
||||
|
||||
shuffle_set = 0;
|
||||
svrinfopublic_set = 0;
|
||||
program_set = 0;
|
||||
shuffle_set = 0;
|
||||
streamOnce_set = 0;
|
||||
svrinfopublic_set = 0;
|
||||
cur = cur->xmlChildrenNode;
|
||||
while (cur != NULL) {
|
||||
if (!xmlStrcmp(cur->name, BAD_CAST "url")) {
|
||||
@ -252,6 +254,22 @@ parseConfig(const char *fileName)
|
||||
shuffle_set = 1;
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, BAD_CAST "stream_once")) {
|
||||
if (streamOnce_set) {
|
||||
printf("%s[%ld]: Error: Cannot have multiple <stream_once> elements.\n",
|
||||
fileName, xmlGetLineNo(cur));
|
||||
goto config_error;
|
||||
}
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
int tmp;
|
||||
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
tmp = atoi(ls_xmlContentPtr);
|
||||
ezConfig.streamOnce = (tmp == 0) ? 0 : 1;
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
streamOnce_set = 1;
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, BAD_CAST "svrinfoname")) {
|
||||
if (ezConfig.serverName != NULL) {
|
||||
printf("%s[%ld]: Error: Cannot have multiple <svrinfoname> elements.\n",
|
||||
|
@ -58,6 +58,7 @@ typedef struct tag_EZCONFIG {
|
||||
int numEncoderDecoders;
|
||||
int shuffle;
|
||||
int fileNameIsProgram;
|
||||
int streamOnce;
|
||||
} EZCONFIG;
|
||||
|
||||
EZCONFIG * getEZConfig(void);
|
||||
|
@ -775,7 +775,10 @@ streamPlaylist(shout_t *shout, const char *fileName)
|
||||
}
|
||||
}
|
||||
|
||||
return (1);
|
||||
if (pezConfig->streamOnce)
|
||||
return (0);
|
||||
else
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Borrowed from OpenNTPd-portable's compat-openbsd/bsd-misc.c */
|
||||
@ -1123,8 +1126,11 @@ main(int argc, char *argv[])
|
||||
if (playlistMode)
|
||||
ret = streamPlaylist(shout,
|
||||
pezConfig->fileName);
|
||||
else
|
||||
else {
|
||||
ret = streamFile(shout, pezConfig->fileName);
|
||||
if (pezConfig->streamOnce)
|
||||
break;
|
||||
}
|
||||
} while (ret);
|
||||
} else
|
||||
printf("%s: Connection to http://%s:%d%s failed: %s\n", __progname,
|
||||
|
Loading…
Reference in New Issue
Block a user