mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2025-02-02 15:07:45 -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>
|
- Playlist scripting support: Indicate that the executable in <filename>
|
||||||
should be run each time to get a new media filename to stream, by setting
|
should be run each time to get a new media filename to stream, by setting
|
||||||
the new <playlist_program> configuration option to 1.
|
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
|
- Add feature to skip the currently streaming track, done by sending the
|
||||||
SIGUSR1 signal to the ezstream process.
|
SIGUSR1 signal to the ezstream process.
|
||||||
- New command line option `-q': Suppress standard error output from external
|
- New command line option `-q': Suppress standard error output from external
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
<sourcepassword>hackme</sourcepassword>
|
<sourcepassword>hackme</sourcepassword>
|
||||||
<format>MP3</format>
|
<format>MP3</format>
|
||||||
<filename>playlist.m3u</filename>
|
<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.
|
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
|
It's up to you to make sure that the bitrate/samplerate/channels
|
||||||
information matches up with your input stream files. Note that
|
information matches up with your input stream files. Note that
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
<sourcepassword>hackme</sourcepassword>
|
<sourcepassword>hackme</sourcepassword>
|
||||||
<format>VORBIS</format>
|
<format>VORBIS</format>
|
||||||
<filename>playlist.m3u</filename>
|
<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.
|
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
|
It's up to you to make sure that the bitrate/quality/samplerate/channels
|
||||||
information matches up with your input stream files.
|
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
|
sign at the beginning of a line and ignored by
|
||||||
.Nm .
|
.Nm .
|
||||||
.It Sy \&<playlist_program\ /\&>
|
.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.
|
or script.
|
||||||
This program is supposed to print
|
This program is supposed to print
|
||||||
.Pq to standard output
|
.Pq to standard output
|
||||||
one line with the name of a file that should be streamed next and then exit.
|
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\ /\&>
|
.It Sy \&<shuffle\ /\&>
|
||||||
.Pq Optional.
|
.Pq Optional.
|
||||||
Set to
|
Set to
|
||||||
@ -177,6 +189,15 @@ Files are played sequentially if set to
|
|||||||
or when the \&<shuffle/\&> element is absent.
|
or when the \&<shuffle/\&> element is absent.
|
||||||
This option will be ignored if \&<playlist_program/\&> is set to 1
|
This option will be ignored if \&<playlist_program/\&> is set to 1
|
||||||
.Pq one.
|
.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\ /\&>
|
.It Sy \&<svrinfoname\ /\&>
|
||||||
.Pq Optional.
|
.Pq Optional.
|
||||||
Set the name of the broadcast.
|
Set the name of the broadcast.
|
||||||
|
@ -140,7 +140,8 @@ parseConfig(const char *fileName)
|
|||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
char *ls_xmlContentPtr;
|
char *ls_xmlContentPtr;
|
||||||
int shuffle_set, svrinfopublic_set, program_set;
|
int program_set, shuffle_set, streamOnce_set,
|
||||||
|
svrinfopublic_set;
|
||||||
|
|
||||||
xmlLineNumbersDefault(1);
|
xmlLineNumbersDefault(1);
|
||||||
if ((doc = xmlParseFile(fileName)) == NULL) {
|
if ((doc = xmlParseFile(fileName)) == NULL) {
|
||||||
@ -158,9 +159,10 @@ parseConfig(const char *fileName)
|
|||||||
|
|
||||||
memset(&ezConfig, '\000', sizeof(ezConfig));
|
memset(&ezConfig, '\000', sizeof(ezConfig));
|
||||||
|
|
||||||
shuffle_set = 0;
|
|
||||||
svrinfopublic_set = 0;
|
|
||||||
program_set = 0;
|
program_set = 0;
|
||||||
|
shuffle_set = 0;
|
||||||
|
streamOnce_set = 0;
|
||||||
|
svrinfopublic_set = 0;
|
||||||
cur = cur->xmlChildrenNode;
|
cur = cur->xmlChildrenNode;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if (!xmlStrcmp(cur->name, BAD_CAST "url")) {
|
if (!xmlStrcmp(cur->name, BAD_CAST "url")) {
|
||||||
@ -252,6 +254,22 @@ parseConfig(const char *fileName)
|
|||||||
shuffle_set = 1;
|
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 (!xmlStrcmp(cur->name, BAD_CAST "svrinfoname")) {
|
||||||
if (ezConfig.serverName != NULL) {
|
if (ezConfig.serverName != NULL) {
|
||||||
printf("%s[%ld]: Error: Cannot have multiple <svrinfoname> elements.\n",
|
printf("%s[%ld]: Error: Cannot have multiple <svrinfoname> elements.\n",
|
||||||
|
@ -58,6 +58,7 @@ typedef struct tag_EZCONFIG {
|
|||||||
int numEncoderDecoders;
|
int numEncoderDecoders;
|
||||||
int shuffle;
|
int shuffle;
|
||||||
int fileNameIsProgram;
|
int fileNameIsProgram;
|
||||||
|
int streamOnce;
|
||||||
} EZCONFIG;
|
} EZCONFIG;
|
||||||
|
|
||||||
EZCONFIG * getEZConfig(void);
|
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 */
|
/* Borrowed from OpenNTPd-portable's compat-openbsd/bsd-misc.c */
|
||||||
@ -1123,8 +1126,11 @@ main(int argc, char *argv[])
|
|||||||
if (playlistMode)
|
if (playlistMode)
|
||||||
ret = streamPlaylist(shout,
|
ret = streamPlaylist(shout,
|
||||||
pezConfig->fileName);
|
pezConfig->fileName);
|
||||||
else
|
else {
|
||||||
ret = streamFile(shout, pezConfig->fileName);
|
ret = streamFile(shout, pezConfig->fileName);
|
||||||
|
if (pezConfig->streamOnce)
|
||||||
|
break;
|
||||||
|
}
|
||||||
} while (ret);
|
} while (ret);
|
||||||
} else
|
} else
|
||||||
printf("%s: Connection to http://%s:%d%s failed: %s\n", __progname,
|
printf("%s: Connection to http://%s:%d%s failed: %s\n", __progname,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user