2007-02-24 19:25:07 -05:00
|
|
|
/*
|
|
|
|
* ezstream - source client for Icecast with external en-/decoder support
|
|
|
|
* Copyright (C) 2003, 2004, 2005, 2006 Ed Zaleski <oddsock@oddsock.org>
|
|
|
|
* Copyright (C) 2007 Moritz Grimm <gtgbr@gmx.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-03-04 10:16:36 -05:00
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
2007-02-24 19:25:07 -05:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2004-01-30 12:19:45 -05:00
|
|
|
|
2007-02-24 19:25:07 -05:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
2007-02-28 10:35:07 -05:00
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
# include <sys/stat.h>
|
|
|
|
#endif
|
2007-02-24 19:25:07 -05:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
# include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
2007-03-08 09:39:00 -05:00
|
|
|
#ifdef HAVE_LIBGEN_H
|
|
|
|
# include <libgen.h>
|
|
|
|
#endif
|
|
|
|
#include <limits.h>
|
2007-02-24 19:25:07 -05:00
|
|
|
#ifdef HAVE_PATHS_H
|
|
|
|
# include <paths.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SIGNAL_H
|
|
|
|
# include <signal.h>
|
|
|
|
#endif
|
2004-01-30 12:19:45 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2004-02-01 23:37:42 -05:00
|
|
|
#ifdef WIN32
|
2007-02-24 19:25:07 -05:00
|
|
|
# include <io.h>
|
|
|
|
# include <windows.h>
|
|
|
|
#endif /* WIN32 */
|
2007-03-08 09:39:00 -05:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2004-01-30 12:19:45 -05:00
|
|
|
#include <shout/shout.h>
|
2007-02-24 19:25:07 -05:00
|
|
|
|
2007-03-03 11:13:08 -05:00
|
|
|
#include "compat.h"
|
|
|
|
#include "configfile.h"
|
2007-02-24 19:25:07 -05:00
|
|
|
#ifndef HAVE_GETOPT
|
|
|
|
# include "getopt.h"
|
|
|
|
#endif
|
2007-03-08 09:39:00 -05:00
|
|
|
#include "metadata.h"
|
2007-02-24 19:25:07 -05:00
|
|
|
#include "playlist.h"
|
2007-03-02 07:52:10 -05:00
|
|
|
#include "strfctns.h"
|
2007-02-24 19:25:07 -05:00
|
|
|
#include "util.h"
|
|
|
|
|
2007-03-01 19:57:11 -05:00
|
|
|
#define STREAM_DONE 0
|
|
|
|
#define STREAM_CONT 1
|
|
|
|
#define STREAM_SKIP 2
|
|
|
|
#define STREAM_SERVERR 3
|
2007-03-08 21:30:29 -05:00
|
|
|
#define STREAM_UPDMDATA 4
|
2007-03-01 19:57:11 -05:00
|
|
|
|
2007-02-24 19:25:07 -05:00
|
|
|
#ifdef HAVE___PROGNAME
|
2007-02-25 11:00:41 -05:00
|
|
|
extern char *__progname;
|
2007-02-24 19:25:07 -05:00
|
|
|
#else
|
2007-02-25 11:00:41 -05:00
|
|
|
char *__progname;
|
2007-02-24 19:25:07 -05:00
|
|
|
#endif /* HAVE___PROGNAME */
|
|
|
|
|
2007-02-25 11:00:41 -05:00
|
|
|
int qFlag;
|
|
|
|
int vFlag;
|
2007-03-08 21:30:29 -05:00
|
|
|
int metadataFromProgram;
|
2004-01-30 12:19:45 -05:00
|
|
|
|
Various cleanups and auto-fu tweaks.
* Make Makefile.am files look alike as much as possible.
* Remove debug: target and don't mess with the users DEBUG environment
variable: Autoconf checks for -g and automatically adds it to CFLAGS, which
is overridden by the user's $DEBUG. If the user didn't specify one, "make
install" will strip the resulting binaries and leave the debugging symbols
intact otherwise.
* Remove profile: target, as it is quite pointless in Ezstream. Also, the user
can add profiling flags via the $DEBUG variable as well.
* Remove -ffast-math and -fsigned-char from gcc, and enable two additional
warnings instead.
* Unconfuse Solaris compiler flags (unfortunately, the configure script still
fails in the libshout check with some obscure linker error): Do not force
-x04 and -fast optimizations, let the user decide (it doesn't matter for
Ezstream anyways.) Remove -xgc92, which is deprecated and actually makes
the resulting binary run slower on SPARC. Also remove -fsimple, which does
not help and has the potential of causing trouble, and don't enable verbose
warnings just to disable them afterwards with -w. Leave only -v for verbose
warnings.
* Const'ify getFormat*() functions and blankString, and squelch a few const-
related warnings.
* Squelch a signedness warning and fix two ;; syntax errors.
* Add a snapshot target to Makefile.am that creates a tarball of the form
ezstream-snapshot-YYYYMMDD.tar.gz.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12562 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-25 09:00:15 -05:00
|
|
|
EZCONFIG *pezConfig = NULL;
|
|
|
|
static const char *blankString = "";
|
|
|
|
playlist_t *playlist = NULL;
|
|
|
|
int playlistMode = 0;
|
2004-04-21 09:48:22 -04:00
|
|
|
|
2007-02-24 19:25:07 -05:00
|
|
|
#ifdef HAVE_SIGNALS
|
2007-03-08 21:30:29 -05:00
|
|
|
const int ezstream_signals[] = { SIGHUP, SIGUSR1, SIGUSR2 };
|
2007-02-25 11:00:41 -05:00
|
|
|
|
|
|
|
volatile sig_atomic_t rereadPlaylist = 0;
|
|
|
|
volatile sig_atomic_t rereadPlaylist_notify = 0;
|
|
|
|
volatile sig_atomic_t skipTrack = 0;
|
2007-03-09 08:43:26 -05:00
|
|
|
volatile sig_atomic_t queryMetadata = 0;
|
2004-07-18 23:12:31 -04:00
|
|
|
#else
|
2007-02-25 11:00:41 -05:00
|
|
|
int rereadPlaylist = 0;
|
|
|
|
int rereadPlaylist_notify = 0;
|
|
|
|
int skipTrack = 0;
|
2007-03-08 21:30:29 -05:00
|
|
|
int queryMetadata = 0;
|
2007-02-24 19:25:07 -05:00
|
|
|
#endif /* HAVE_SIGNALS */
|
2004-01-30 12:19:45 -05:00
|
|
|
|
|
|
|
typedef struct tag_ID3Tag {
|
|
|
|
char tag[3];
|
|
|
|
char trackName[30];
|
|
|
|
char artistName[30];
|
|
|
|
char albumName[30];
|
|
|
|
char year[3];
|
|
|
|
char comment[30];
|
|
|
|
char genre;
|
|
|
|
} ID3Tag;
|
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
int urlParse(const char *, char **, int *, char **);
|
2007-02-24 21:36:40 -05:00
|
|
|
void replaceString(const char *, char *, size_t, const char *, const char *);
|
|
|
|
char * buildCommandString(const char *, const char *, const char *);
|
2007-03-08 09:39:00 -05:00
|
|
|
char * processMetadata(shout_t *, const char *);
|
2007-02-24 22:49:30 -05:00
|
|
|
FILE * openResource(shout_t *, const char *, int *, char **, int *);
|
2007-03-01 19:57:11 -05:00
|
|
|
int reconnectServer(shout_t *, int);
|
2007-02-25 13:28:05 -05:00
|
|
|
int sendStream(shout_t *, FILE *, const char *, int, void *);
|
2007-02-24 22:49:30 -05:00
|
|
|
int streamFile(shout_t *, const char *);
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
int streamPlaylist(shout_t *, const char *);
|
2007-02-24 19:25:07 -05:00
|
|
|
char * getProgname(const char *);
|
|
|
|
void usage(void);
|
|
|
|
void usageHelp(void);
|
2004-01-30 12:19:45 -05:00
|
|
|
|
2007-03-03 07:42:50 -05:00
|
|
|
#ifdef HAVE_SIGNALS
|
|
|
|
void sig_handler(int);
|
|
|
|
|
2007-03-01 09:50:14 -05:00
|
|
|
void
|
|
|
|
sig_handler(int sig)
|
|
|
|
{
|
|
|
|
switch (sig) {
|
|
|
|
case SIGHUP:
|
|
|
|
rereadPlaylist = 1;
|
|
|
|
rereadPlaylist_notify = 1;
|
|
|
|
break;
|
|
|
|
case SIGUSR1:
|
|
|
|
skipTrack = 1;
|
|
|
|
break;
|
2007-03-08 21:30:29 -05:00
|
|
|
case SIGUSR2:
|
|
|
|
queryMetadata = 1;
|
|
|
|
break;
|
2007-03-01 09:50:14 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-03-03 07:42:50 -05:00
|
|
|
#endif /* HAVE_SIGNALS */
|
2007-03-01 09:50:14 -05:00
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
int
|
|
|
|
urlParse(const char *url, char **hostname, int *port, char **mountname)
|
2004-01-30 12:19:45 -05:00
|
|
|
{
|
2007-03-02 07:52:10 -05:00
|
|
|
char *p1, *p2, *p3;
|
|
|
|
char tmpPort[6] = "";
|
|
|
|
size_t hostsiz, mountsiz;
|
|
|
|
const char *errstr;
|
2004-01-30 12:19:45 -05:00
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
if (hostname == NULL || port == NULL || mountname == NULL) {
|
|
|
|
printf("%s: urlParse(): Internal error: Bad arguments\n",
|
|
|
|
__progname);
|
|
|
|
exit(1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
|
2007-03-02 07:52:10 -05:00
|
|
|
if (strncmp(url, "http://", strlen("http://")) != 0) {
|
|
|
|
printf("%s: Error: Invalid <url>: Not an HTTP address\n",
|
|
|
|
__progname);
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
return (0);
|
2007-03-02 07:52:10 -05:00
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
|
|
|
|
p1 = (char *)(url) + strlen("http://");
|
2004-01-30 12:19:45 -05:00
|
|
|
p2 = strchr(p1, ':');
|
2007-03-02 07:52:10 -05:00
|
|
|
if (p2 == NULL) {
|
|
|
|
printf("%s: Error: Invalid <url>: Missing port\n",
|
|
|
|
__progname);
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
return (0);
|
2007-03-02 07:52:10 -05:00
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
hostsiz = (p2 - p1) + 1;
|
|
|
|
*hostname = xmalloc(hostsiz);
|
|
|
|
strlcpy(*hostname, p1, hostsiz);
|
|
|
|
|
2004-01-30 12:19:45 -05:00
|
|
|
p2++;
|
|
|
|
p3 = strchr(p2, '/');
|
2007-03-02 07:52:10 -05:00
|
|
|
if (p3 == NULL || p3 - p2 >= (int)sizeof(tmpPort)) {
|
|
|
|
printf("%s: Error: Invalid <url>: Missing mountpoint or too long port number\n",
|
|
|
|
__progname);
|
|
|
|
xfree(*hostname);
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
return (0);
|
2007-03-02 07:52:10 -05:00
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
|
|
|
|
strlcpy(tmpPort, p2, (p3 - p2) + 1);
|
2007-03-03 15:17:33 -05:00
|
|
|
*port = (int)strtonum(tmpPort, 1, 65535, &errstr);
|
2007-03-02 07:52:10 -05:00
|
|
|
if (errstr) {
|
|
|
|
printf("%s: Error: Invalid <url>: Port '%s' is %s\n",
|
|
|
|
__progname, tmpPort, errstr);
|
|
|
|
xfree(*hostname);
|
|
|
|
return (0);
|
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
|
|
|
|
mountsiz = strlen(p3) + 1;
|
|
|
|
*mountname = xmalloc(mountsiz);
|
|
|
|
strlcpy(*mountname, p3, mountsiz);
|
|
|
|
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
|
2007-02-24 21:36:40 -05:00
|
|
|
void
|
|
|
|
replaceString(const char *source, char *dest, size_t size,
|
|
|
|
const char *from, const char *to)
|
2004-07-18 23:12:31 -04:00
|
|
|
{
|
2007-02-24 21:36:40 -05:00
|
|
|
char *p1 = (char *)source;
|
|
|
|
char *p2;
|
|
|
|
|
|
|
|
p2 = strstr(p1, from);
|
|
|
|
if (p2 != NULL) {
|
2007-03-01 09:50:14 -05:00
|
|
|
if ((unsigned int)(p2 - p1) >= size) {
|
2007-02-24 21:36:40 -05:00
|
|
|
printf("%s: replaceString(): Internal error: p2 - p1 >= size\n",
|
|
|
|
__progname);
|
|
|
|
abort();
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
2007-02-24 21:36:40 -05:00
|
|
|
strncat(dest, p1, p2 - p1);
|
|
|
|
strlcat(dest, to, size);
|
|
|
|
p1 = p2 + strlen(from);
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
2007-02-24 21:36:40 -05:00
|
|
|
strlcat(dest, p1, size);
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
|
|
|
|
2007-03-08 09:39:00 -05:00
|
|
|
char *
|
2007-02-24 21:36:40 -05:00
|
|
|
buildCommandString(const char *extension, const char *fileName,
|
|
|
|
const char *metadata)
|
2004-07-18 23:12:31 -04:00
|
|
|
{
|
|
|
|
char *commandString = NULL;
|
2007-02-24 21:36:40 -05:00
|
|
|
size_t commandStringLen = 0;
|
|
|
|
char *encoder = NULL;
|
|
|
|
char *decoder = NULL;
|
|
|
|
char *newDecoder = NULL;
|
|
|
|
size_t newDecoderLen = 0;
|
|
|
|
char *newEncoder = NULL;
|
|
|
|
size_t newEncoderLen = 0;
|
|
|
|
|
|
|
|
decoder = xstrdup(getFormatDecoder(extension));
|
2004-07-18 23:12:31 -04:00
|
|
|
if (strlen(decoder) == 0) {
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("%s: Unknown extension '%s', cannot decode '%s'\n",
|
2007-02-24 21:36:40 -05:00
|
|
|
__progname, extension, fileName);
|
|
|
|
xfree(decoder);
|
|
|
|
return (NULL);
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
|
|
|
newDecoderLen = strlen(decoder) + strlen(fileName) + 1;
|
2007-02-24 21:36:40 -05:00
|
|
|
newDecoder = xcalloc(1, newDecoderLen);
|
|
|
|
replaceString(decoder, newDecoder, newDecoderLen, TRACK_PLACEHOLDER,
|
|
|
|
fileName);
|
|
|
|
if (strstr(decoder, METADATA_PLACEHOLDER) != NULL) {
|
|
|
|
size_t tmpLen = strlen(newDecoder) + strlen(metadata) + 1;
|
|
|
|
char *tmpStr = xcalloc(1, tmpLen);
|
|
|
|
replaceString(newDecoder, tmpStr, tmpLen, METADATA_PLACEHOLDER,
|
|
|
|
metadata);
|
|
|
|
xfree(newDecoder);
|
|
|
|
newDecoder = tmpStr;
|
|
|
|
}
|
2004-07-18 23:12:31 -04:00
|
|
|
|
2007-02-24 21:36:40 -05:00
|
|
|
encoder = xstrdup(getFormatEncoder(pezConfig->format));
|
2004-12-21 20:49:56 -05:00
|
|
|
if (strlen(encoder) == 0) {
|
2007-02-24 21:36:40 -05:00
|
|
|
if (vFlag)
|
|
|
|
printf("%s: Passing through%s%s data from the decoder\n",
|
|
|
|
__progname,
|
|
|
|
(strcmp(pezConfig->format, THEORA_FORMAT) != 0) ? " (unsupported) " : " ",
|
|
|
|
pezConfig->format);
|
2004-12-21 20:49:56 -05:00
|
|
|
commandStringLen = strlen(newDecoder) + 1;
|
2007-02-24 21:36:40 -05:00
|
|
|
commandString = xcalloc(1, commandStringLen);
|
|
|
|
strlcpy(commandString, newDecoder, commandStringLen);
|
|
|
|
xfree(decoder);
|
|
|
|
xfree(encoder);
|
|
|
|
xfree(newDecoder);
|
|
|
|
return (commandString);
|
2004-12-21 20:49:56 -05:00
|
|
|
}
|
|
|
|
|
2007-02-24 21:36:40 -05:00
|
|
|
newEncoderLen = strlen(encoder) + strlen(metadata) + 1;
|
|
|
|
newEncoder = xcalloc(1, newEncoderLen);
|
|
|
|
replaceString(encoder, newEncoder, newEncoderLen, METADATA_PLACEHOLDER,
|
|
|
|
metadata);
|
2004-07-18 23:12:31 -04:00
|
|
|
|
2007-02-24 21:36:40 -05:00
|
|
|
commandStringLen = strlen(newDecoder) + strlen(" | ") +
|
|
|
|
strlen(newEncoder) + 1;
|
|
|
|
commandString = xcalloc(1, commandStringLen);
|
|
|
|
snprintf(commandString, commandStringLen, "%s | %s", newDecoder,
|
|
|
|
newEncoder);
|
|
|
|
|
|
|
|
xfree(decoder);
|
|
|
|
xfree(encoder);
|
|
|
|
xfree(newDecoder);
|
|
|
|
xfree(newEncoder);
|
|
|
|
|
|
|
|
return (commandString);
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
2005-12-14 16:13:25 -05:00
|
|
|
|
2007-02-24 22:10:13 -05:00
|
|
|
char *
|
2007-03-08 09:39:00 -05:00
|
|
|
processMetadata(shout_t *shout, const char *fileName)
|
2007-02-24 22:10:13 -05:00
|
|
|
{
|
|
|
|
char *songInfo = NULL;
|
2007-03-08 09:39:00 -05:00
|
|
|
shout_metadata_t *shout_mdata = NULL;
|
|
|
|
metadata_t *mdata = NULL;
|
2004-07-18 23:12:31 -04:00
|
|
|
|
2007-03-08 21:30:29 -05:00
|
|
|
if (metadataFromProgram) {
|
|
|
|
if ((mdata = metadata_program(fileName)) == NULL)
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
if (!metadata_program_update(mdata, METADATA_STRING)) {
|
|
|
|
metadata_free(&mdata);
|
|
|
|
songInfo = xstrdup(blankString);
|
|
|
|
return (songInfo);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((mdata = metadata_file(fileName)) == NULL)
|
|
|
|
return (NULL);
|
2007-02-24 22:10:13 -05:00
|
|
|
|
2007-03-08 21:30:29 -05:00
|
|
|
if (!metadata_file_update(mdata)) {
|
|
|
|
metadata_free(&mdata);
|
|
|
|
songInfo = xstrdup(blankString);
|
|
|
|
return (songInfo);
|
|
|
|
}
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
2007-03-08 21:30:29 -05:00
|
|
|
|
2007-03-08 09:39:00 -05:00
|
|
|
songInfo = xstrdup(metadata_get_string(mdata));
|
2007-03-08 10:25:33 -05:00
|
|
|
metadata_free(&mdata);
|
2004-07-18 23:12:31 -04:00
|
|
|
|
2007-03-08 09:39:00 -05:00
|
|
|
if ((shout_mdata = shout_metadata_new()) == NULL) {
|
2007-02-24 22:10:13 -05:00
|
|
|
printf("%s: shout_metadata_new(): %s\n", __progname,
|
|
|
|
strerror(ENOMEM));
|
|
|
|
exit(1);
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
2007-03-08 09:39:00 -05:00
|
|
|
shout_metadata_add(shout_mdata, "song", songInfo);
|
|
|
|
shout_set_metadata(shout, shout_mdata);
|
|
|
|
shout_metadata_free(shout_mdata);
|
2007-02-24 22:10:13 -05:00
|
|
|
|
|
|
|
return (songInfo);
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
|
|
|
|
2007-02-24 22:49:30 -05:00
|
|
|
FILE *
|
|
|
|
openResource(shout_t *shout, const char *fileName, int *popenFlag,
|
|
|
|
char **metaCopy, int *isStdin)
|
2004-07-18 23:12:31 -04:00
|
|
|
{
|
|
|
|
FILE *filep = NULL;
|
2007-02-24 22:49:30 -05:00
|
|
|
char extension[25];
|
2007-03-08 09:39:00 -05:00
|
|
|
char *p = NULL;
|
2007-02-24 22:49:30 -05:00
|
|
|
char *pMetadata = NULL;
|
|
|
|
char *pCommandString = NULL;
|
2005-12-14 16:13:25 -05:00
|
|
|
|
2007-02-24 22:49:30 -05:00
|
|
|
if (strcmp(fileName, "stdin") == 0) {
|
2007-03-08 21:30:29 -05:00
|
|
|
if (metadataFromProgram &&
|
|
|
|
processMetadata(shout, pezConfig->metadataProgram) == NULL)
|
|
|
|
return (filep);
|
|
|
|
|
2007-02-24 22:49:30 -05:00
|
|
|
if (vFlag)
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("%s: Reading from standard input\n",
|
2007-02-24 22:49:30 -05:00
|
|
|
__progname);
|
|
|
|
if (isStdin != NULL)
|
|
|
|
*isStdin = 1;
|
2004-02-01 23:37:42 -05:00
|
|
|
#ifdef WIN32
|
|
|
|
_setmode(_fileno(stdin), _O_BINARY);
|
|
|
|
#endif
|
2004-07-18 23:12:31 -04:00
|
|
|
filep = stdin;
|
2007-02-24 22:49:30 -05:00
|
|
|
return (filep);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
2007-02-24 22:49:30 -05:00
|
|
|
if (isStdin != NULL)
|
|
|
|
*isStdin = 0;
|
|
|
|
|
|
|
|
extension[0] = '\0';
|
2007-03-08 09:39:00 -05:00
|
|
|
p = strrchr(fileName, '.');
|
|
|
|
if (p != NULL)
|
|
|
|
strlcpy(extension, p, sizeof(extension));
|
|
|
|
for (p = extension; *p != '\0'; p++)
|
|
|
|
*p = tolower((int)*p);
|
|
|
|
|
|
|
|
if (strlen(extension) == 0) {
|
|
|
|
printf("%s: Error: Cannot determine file type of '%s'\n",
|
|
|
|
__progname, fileName);
|
|
|
|
return (filep);
|
|
|
|
}
|
|
|
|
|
2007-03-08 21:30:29 -05:00
|
|
|
if (metadataFromProgram)
|
|
|
|
pMetadata = processMetadata(shout, pezConfig->metadataProgram);
|
|
|
|
else
|
|
|
|
pMetadata = processMetadata(shout, fileName);
|
|
|
|
if (pMetadata == NULL)
|
|
|
|
return (filep);
|
2007-02-24 22:49:30 -05:00
|
|
|
if (metaCopy != NULL)
|
|
|
|
*metaCopy = xstrdup(pMetadata);
|
|
|
|
|
|
|
|
*popenFlag = 0;
|
|
|
|
if (pezConfig->reencode) {
|
2007-03-08 09:39:00 -05:00
|
|
|
int stderr_fd = dup(fileno(stderr));
|
|
|
|
|
|
|
|
pCommandString = buildCommandString(extension, fileName, pMetadata);
|
|
|
|
if (vFlag > 1)
|
|
|
|
printf("%s: Running command `%s`\n", __progname,
|
|
|
|
pCommandString);
|
|
|
|
|
|
|
|
if (qFlag) {
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1) {
|
|
|
|
printf("%s: Cannot open %s for redirecting STDERR output: %s\n",
|
|
|
|
__progname, _PATH_DEVNULL, strerror(errno));
|
|
|
|
exit(1);
|
2007-02-28 20:22:06 -05:00
|
|
|
}
|
|
|
|
|
2007-03-08 09:39:00 -05:00
|
|
|
dup2(fd, fileno(stderr));
|
|
|
|
if (fd > 2)
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
fflush(NULL);
|
|
|
|
errno = 0;
|
|
|
|
if ((filep = popen(pCommandString, "r")) == NULL) {
|
|
|
|
printf("%s: popen(): Error while executing '%s'",
|
|
|
|
__progname, pCommandString);
|
|
|
|
/* popen() does not set errno reliably ... */
|
|
|
|
if (errno)
|
|
|
|
printf(": %s\n", strerror(errno));
|
|
|
|
else
|
|
|
|
printf("\n");
|
|
|
|
} else {
|
|
|
|
*popenFlag = 1;
|
2005-12-14 16:13:25 -05:00
|
|
|
#ifdef WIN32
|
2007-03-08 09:39:00 -05:00
|
|
|
_setmode(_fileno(filep), _O_BINARY );
|
2005-12-14 16:13:25 -05:00
|
|
|
#endif
|
2007-03-08 09:39:00 -05:00
|
|
|
}
|
|
|
|
xfree(pCommandString);
|
2007-02-28 20:22:06 -05:00
|
|
|
|
2007-03-08 09:39:00 -05:00
|
|
|
if (qFlag)
|
|
|
|
dup2(stderr_fd, fileno(stderr));
|
2004-07-18 23:12:31 -04:00
|
|
|
|
2007-02-24 22:49:30 -05:00
|
|
|
xfree(pMetadata);
|
|
|
|
return (filep);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
2007-02-24 22:49:30 -05:00
|
|
|
|
|
|
|
xfree(pMetadata);
|
|
|
|
|
|
|
|
if ((filep = fopen(fileName, "rb")) == NULL)
|
|
|
|
printf("%s: %s: %s\n", __progname, fileName,
|
|
|
|
strerror(errno));
|
|
|
|
|
|
|
|
return (filep);
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
|
|
|
|
2007-03-01 19:57:11 -05:00
|
|
|
int
|
|
|
|
reconnectServer(shout_t *shout, int closeConn)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
int close_conn = closeConn;
|
|
|
|
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("%s: Connection to %s lost\n", __progname, pezConfig->URL);
|
2007-03-01 19:57:11 -05:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (++i) {
|
|
|
|
printf("%s: Attempting reconnection #", __progname);
|
|
|
|
if (pezConfig->reconnectAttempts > 0)
|
|
|
|
printf("%u/%u: ", i,
|
|
|
|
pezConfig->reconnectAttempts);
|
|
|
|
else
|
|
|
|
printf("%u: ", i);
|
|
|
|
|
|
|
|
if (close_conn == 0)
|
|
|
|
close_conn = 1;
|
|
|
|
else
|
|
|
|
shout_close(shout);
|
|
|
|
if (shout_open(shout) == SHOUTERR_SUCCESS) {
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("OK\n%s: Reconnect to %s successful\n",
|
2007-03-01 19:57:11 -05:00
|
|
|
__progname, pezConfig->URL);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("FAILED: %s\n", shout_get_error(shout));
|
|
|
|
|
|
|
|
if (pezConfig->reconnectAttempts > 0 &&
|
|
|
|
i >= pezConfig->reconnectAttempts)
|
|
|
|
break;
|
|
|
|
|
|
|
|
printf("%s: Waiting 5s for %s to come back ...\n",
|
|
|
|
__progname, pezConfig->URL);
|
|
|
|
sleep(5);
|
|
|
|
};
|
|
|
|
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("%s: Giving up\n", __progname);
|
2007-03-01 19:57:11 -05:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2007-02-24 22:49:30 -05:00
|
|
|
int
|
2007-02-25 13:28:05 -05:00
|
|
|
sendStream(shout_t *shout, FILE *filepstream, const char *fileName,
|
|
|
|
int isStdin, void *tv)
|
2007-02-24 22:49:30 -05:00
|
|
|
{
|
|
|
|
unsigned char buff[4096];
|
|
|
|
size_t read, total, oldTotal;
|
2007-03-01 19:57:11 -05:00
|
|
|
int ret;
|
2007-02-24 22:49:30 -05:00
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
|
|
|
double kbps = -1.0;
|
2007-02-25 13:28:05 -05:00
|
|
|
struct timeval timeStamp, *startTime = (struct timeval *)tv;
|
2007-02-24 22:49:30 -05:00
|
|
|
|
2007-02-25 13:28:05 -05:00
|
|
|
if (startTime == NULL) {
|
|
|
|
printf("%s: sendStream(): Internal error: startTime is NULL\n",
|
|
|
|
__progname);
|
|
|
|
abort();
|
2007-02-24 22:49:30 -05:00
|
|
|
}
|
|
|
|
|
2007-02-25 13:28:05 -05:00
|
|
|
timeStamp.tv_sec = startTime->tv_sec;
|
|
|
|
timeStamp.tv_usec = startTime->tv_usec;
|
|
|
|
#endif /* HAVE_GETTIMEOFDAY */
|
2007-02-24 22:49:30 -05:00
|
|
|
|
|
|
|
total = oldTotal = 0;
|
2007-03-01 19:57:11 -05:00
|
|
|
ret = STREAM_DONE;
|
2007-02-24 22:49:30 -05:00
|
|
|
while ((read = fread(buff, 1, sizeof(buff), filepstream)) > 0) {
|
2007-03-01 19:57:11 -05:00
|
|
|
if (shout_get_connected(shout) != SHOUTERR_CONNECTED &&
|
|
|
|
reconnectServer(shout, 0) == 0) {
|
|
|
|
ret = STREAM_SERVERR;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-03-08 21:30:29 -05:00
|
|
|
shout_sync(shout);
|
|
|
|
|
|
|
|
if (shout_send(shout, buff, read) != SHOUTERR_SUCCESS) {
|
|
|
|
printf("%s: shout_send(): %s\n", __progname,
|
|
|
|
shout_get_error(shout));
|
|
|
|
if (reconnectServer(shout, 1))
|
|
|
|
break;
|
|
|
|
else {
|
|
|
|
ret = STREAM_SERVERR;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-25 13:28:05 -05:00
|
|
|
if (rereadPlaylist_notify) {
|
|
|
|
rereadPlaylist_notify = 0;
|
2007-02-28 16:26:16 -05:00
|
|
|
if (!pezConfig->fileNameIsProgram)
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("%s: SIGHUP signal received, will reread playlist after this file\n",
|
2007-02-28 16:26:16 -05:00
|
|
|
__progname);
|
2007-02-25 13:28:05 -05:00
|
|
|
}
|
|
|
|
if (skipTrack) {
|
|
|
|
skipTrack = 0;
|
2007-03-01 19:57:11 -05:00
|
|
|
ret = STREAM_SKIP;
|
2007-02-25 13:28:05 -05:00
|
|
|
break;
|
|
|
|
}
|
2007-03-08 21:30:29 -05:00
|
|
|
if (queryMetadata) {
|
|
|
|
queryMetadata = 0;
|
|
|
|
if (metadataFromProgram) {
|
|
|
|
ret = STREAM_UPDMDATA;
|
2007-03-01 19:57:11 -05:00
|
|
|
break;
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
2007-02-24 22:49:30 -05:00
|
|
|
}
|
|
|
|
|
2007-02-25 13:28:05 -05:00
|
|
|
total += read;
|
2007-02-24 22:49:30 -05:00
|
|
|
if (qFlag && vFlag) {
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
|
|
|
struct timeval tv;
|
|
|
|
double oldTime, newTime;
|
|
|
|
unsigned int hrs, mins, secs;
|
|
|
|
#endif /* HAVE_GETTIMEOFDAY */
|
|
|
|
|
2007-02-28 16:26:16 -05:00
|
|
|
if (!isStdin && playlistMode) {
|
|
|
|
if (pezConfig->fileNameIsProgram) {
|
|
|
|
char *tmp = xstrdup(pezConfig->fileName);
|
|
|
|
printf(" [%s]",
|
|
|
|
basename(tmp));
|
|
|
|
xfree(tmp);
|
|
|
|
} else
|
|
|
|
printf(" [%4lu/%-4lu]",
|
|
|
|
playlist_get_position(playlist),
|
|
|
|
playlist_get_num_items(playlist));
|
|
|
|
}
|
2007-02-24 22:49:30 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
|
|
|
oldTime = (double)timeStamp.tv_sec
|
|
|
|
+ (double)timeStamp.tv_usec / 1000000.0;
|
|
|
|
gettimeofday(&tv, NULL);
|
|
|
|
newTime = (double)tv.tv_sec
|
|
|
|
+ (double)tv.tv_usec / 1000000.0;
|
2007-02-25 13:28:05 -05:00
|
|
|
secs = tv.tv_sec - startTime->tv_sec;
|
2007-02-24 22:49:30 -05:00
|
|
|
hrs = secs / 3600;
|
|
|
|
secs %= 3600;
|
|
|
|
mins = secs / 60;
|
|
|
|
secs %= 60;
|
|
|
|
if (newTime - oldTime >= 1.0) {
|
|
|
|
kbps = (((double)(total - oldTotal) / (newTime - oldTime)) * 8.0) / 1000.0;
|
|
|
|
timeStamp.tv_sec = tv.tv_sec;
|
|
|
|
timeStamp.tv_usec = tv.tv_usec;
|
|
|
|
oldTotal = total;
|
|
|
|
}
|
|
|
|
printf(" [ %uh%02um%02us]", hrs, mins, secs);
|
|
|
|
if (kbps < 0)
|
|
|
|
printf(" ");
|
|
|
|
else
|
|
|
|
printf(" [%8.2f kbps]", kbps);
|
|
|
|
#endif /* HAVE_GETTIMEOFDAY */
|
|
|
|
|
|
|
|
printf(" \r");
|
|
|
|
fflush(stdout);
|
|
|
|
}
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
2007-02-25 11:00:41 -05:00
|
|
|
if (ferror(filepstream)) {
|
|
|
|
if (errno == EINTR) {
|
|
|
|
clearerr(filepstream);
|
2007-03-01 19:57:11 -05:00
|
|
|
ret = STREAM_CONT;
|
2007-02-25 11:00:41 -05:00
|
|
|
} else
|
|
|
|
printf("%s: streamFile(): Error while reading '%s': %s\n",
|
|
|
|
__progname, fileName, strerror(errno));
|
2007-02-25 13:28:05 -05:00
|
|
|
}
|
|
|
|
|
2007-02-28 16:26:16 -05:00
|
|
|
return (ret);
|
2007-02-25 13:28:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
streamFile(shout_t *shout, const char *fileName)
|
|
|
|
{
|
|
|
|
FILE *filepstream = NULL;
|
|
|
|
int popenFlag = 0;
|
|
|
|
char *metaData = NULL;
|
|
|
|
int isStdin = 0;
|
|
|
|
int ret, retval = 0;
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
|
|
|
struct timeval startTime;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ((filepstream = openResource(shout, fileName, &popenFlag,
|
|
|
|
&metaData, &isStdin))
|
|
|
|
== NULL) {
|
|
|
|
return (retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (metaData != NULL) {
|
|
|
|
printf("%s: Streaming ``%s''", __progname, metaData);
|
|
|
|
if (vFlag)
|
|
|
|
printf(" (file: %s)\n", fileName);
|
|
|
|
else
|
|
|
|
printf("\n");
|
|
|
|
xfree(metaData);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
|
|
|
gettimeofday(&startTime, NULL);
|
|
|
|
do {
|
|
|
|
ret = sendStream(shout, filepstream, fileName, isStdin,
|
|
|
|
(void *)&startTime);
|
|
|
|
#else
|
|
|
|
do {
|
|
|
|
ret = sendStream(shout, filepstream, fileName, isStdin, NULL);
|
|
|
|
#endif
|
2007-03-01 19:57:11 -05:00
|
|
|
if (ret != STREAM_DONE) {
|
2007-03-08 21:30:29 -05:00
|
|
|
if ((skipTrack && rereadPlaylist) ||
|
|
|
|
(skipTrack && queryMetadata)) {
|
2007-02-25 13:28:05 -05:00
|
|
|
skipTrack = 0;
|
2007-03-08 21:30:29 -05:00
|
|
|
ret = STREAM_CONT;
|
|
|
|
}
|
|
|
|
if (queryMetadata && rereadPlaylist) {
|
|
|
|
queryMetadata = 0;
|
|
|
|
ret = STREAM_CONT;
|
2007-02-25 13:28:05 -05:00
|
|
|
}
|
2007-03-01 19:57:11 -05:00
|
|
|
if (ret == STREAM_SKIP || skipTrack) {
|
2007-02-25 13:28:05 -05:00
|
|
|
skipTrack = 0;
|
|
|
|
if (!isStdin && vFlag)
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("%s: SIGUSR1 signal received, skipping current track\n",
|
2007-02-25 13:28:05 -05:00
|
|
|
__progname);
|
|
|
|
retval = 1;
|
2007-03-01 19:57:11 -05:00
|
|
|
ret = STREAM_DONE;
|
|
|
|
}
|
2007-03-08 21:30:29 -05:00
|
|
|
if (ret == STREAM_UPDMDATA || queryMetadata) {
|
|
|
|
queryMetadata = 0;
|
|
|
|
if (metadataFromProgram) {
|
|
|
|
char *mdataStr;
|
|
|
|
|
|
|
|
if (vFlag > 1)
|
|
|
|
printf("%s: Querying '%s' for fresh metadata\n",
|
|
|
|
__progname, pezConfig->metadataProgram);
|
|
|
|
if ((mdataStr = processMetadata(shout, pezConfig->metadataProgram)) == NULL) {
|
|
|
|
retval = 0;
|
|
|
|
ret = STREAM_DONE;
|
|
|
|
}
|
|
|
|
printf("%s: New metadata: ``%s''\n",
|
|
|
|
__progname, mdataStr);
|
|
|
|
xfree(mdataStr);
|
|
|
|
}
|
|
|
|
}
|
2007-03-01 19:57:11 -05:00
|
|
|
if (ret == STREAM_SERVERR) {
|
|
|
|
retval = 0;
|
|
|
|
ret = STREAM_DONE;
|
2007-02-25 13:28:05 -05:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
retval = 1;
|
2007-03-08 21:30:29 -05:00
|
|
|
} while (ret != STREAM_DONE);
|
2007-02-24 22:49:30 -05:00
|
|
|
|
|
|
|
if (popenFlag)
|
2005-12-14 16:13:25 -05:00
|
|
|
pclose(filepstream);
|
2007-02-24 22:49:30 -05:00
|
|
|
else
|
2005-12-14 16:13:25 -05:00
|
|
|
fclose(filepstream);
|
2007-02-24 22:49:30 -05:00
|
|
|
|
|
|
|
return (retval);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
2007-02-24 19:25:07 -05:00
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
int
|
|
|
|
streamPlaylist(shout_t *shout, const char *fileName)
|
|
|
|
{
|
|
|
|
const char *song;
|
2007-03-08 16:38:12 -05:00
|
|
|
char lastSong[PATH_MAX];
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
|
|
|
|
if (playlist == NULL) {
|
2007-02-28 16:26:16 -05:00
|
|
|
if (pezConfig->fileNameIsProgram) {
|
|
|
|
if ((playlist = playlist_program(fileName)) == NULL)
|
|
|
|
return (0);
|
|
|
|
} else {
|
|
|
|
if ((playlist = playlist_read(fileName)) == NULL)
|
|
|
|
return (0);
|
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
} else
|
2007-02-28 16:26:16 -05:00
|
|
|
/*
|
|
|
|
* XXX: This preserves traditional behavior, however,
|
|
|
|
* rereading the playlist after each walkthrough seems a
|
|
|
|
* bit more logical.
|
|
|
|
*/
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
playlist_rewind(playlist);
|
|
|
|
|
2007-02-28 16:26:16 -05:00
|
|
|
if (!pezConfig->fileNameIsProgram && pezConfig->shuffle)
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
playlist_shuffle(playlist);
|
|
|
|
|
|
|
|
while ((song = playlist_get_next(playlist)) != NULL) {
|
|
|
|
strlcpy(lastSong, song, sizeof(lastSong));
|
|
|
|
if (!streamFile(shout, song))
|
|
|
|
return (0);
|
|
|
|
if (rereadPlaylist) {
|
|
|
|
rereadPlaylist = rereadPlaylist_notify = 0;
|
2007-02-28 16:26:16 -05:00
|
|
|
if (pezConfig->fileNameIsProgram)
|
|
|
|
continue;
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: Rereading playlist\n", __progname);
|
|
|
|
if (!playlist_reread(&playlist))
|
|
|
|
return (0);
|
|
|
|
if (pezConfig->shuffle)
|
|
|
|
playlist_shuffle(playlist);
|
|
|
|
else {
|
|
|
|
playlist_goto_entry(playlist, lastSong);
|
|
|
|
playlist_skip_next(playlist);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
continue;
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
|
2007-03-08 21:30:29 -05:00
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
|
2007-02-24 19:25:07 -05:00
|
|
|
/* Borrowed from OpenNTPd-portable's compat-openbsd/bsd-misc.c */
|
|
|
|
char *
|
|
|
|
getProgname(const char *argv0)
|
|
|
|
{
|
|
|
|
#ifdef HAVE___PROGNAME
|
|
|
|
return (xstrdup(__progname));
|
|
|
|
#else
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if (argv0 == NULL)
|
|
|
|
return ((char *)"ezstream");
|
2007-03-03 11:13:08 -05:00
|
|
|
p = strrchr(argv0, PATH_SEPARATOR);
|
2007-02-24 19:25:07 -05:00
|
|
|
if (p == NULL)
|
Various cleanups and auto-fu tweaks.
* Make Makefile.am files look alike as much as possible.
* Remove debug: target and don't mess with the users DEBUG environment
variable: Autoconf checks for -g and automatically adds it to CFLAGS, which
is overridden by the user's $DEBUG. If the user didn't specify one, "make
install" will strip the resulting binaries and leave the debugging symbols
intact otherwise.
* Remove profile: target, as it is quite pointless in Ezstream. Also, the user
can add profiling flags via the $DEBUG variable as well.
* Remove -ffast-math and -fsigned-char from gcc, and enable two additional
warnings instead.
* Unconfuse Solaris compiler flags (unfortunately, the configure script still
fails in the libshout check with some obscure linker error): Do not force
-x04 and -fast optimizations, let the user decide (it doesn't matter for
Ezstream anyways.) Remove -xgc92, which is deprecated and actually makes
the resulting binary run slower on SPARC. Also remove -fsimple, which does
not help and has the potential of causing trouble, and don't enable verbose
warnings just to disable them afterwards with -w. Leave only -v for verbose
warnings.
* Const'ify getFormat*() functions and blankString, and squelch a few const-
related warnings.
* Squelch a signedness warning and fix two ;; syntax errors.
* Add a snapshot target to Makefile.am that creates a tarball of the form
ezstream-snapshot-YYYYMMDD.tar.gz.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12562 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-25 09:00:15 -05:00
|
|
|
p = (char *)argv0;
|
2007-02-24 19:25:07 -05:00
|
|
|
else
|
|
|
|
p++;
|
|
|
|
|
|
|
|
return (xstrdup(p));
|
|
|
|
#endif /* HAVE___PROGNAME */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
usage(void)
|
|
|
|
{
|
2007-03-04 09:27:37 -05:00
|
|
|
printf("usage: %s [-hqVv] [-c configfile]\n", __progname);
|
2007-02-24 19:25:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
usageHelp(void)
|
|
|
|
{
|
|
|
|
printf("\n");
|
|
|
|
printf(" -c configfile use XML configuration in configfile\n");
|
|
|
|
printf(" -h display this additional help and exit\n");
|
|
|
|
printf(" -q suppress STDERR output from external en-/decoders\n");
|
2007-03-04 09:27:37 -05:00
|
|
|
printf(" -V print the version number and exit\n");
|
2007-02-28 06:03:06 -05:00
|
|
|
printf(" -v verbose output (use twice for more effect)\n");
|
2007-02-24 19:25:07 -05:00
|
|
|
printf("\n");
|
|
|
|
printf("See the ezstream(1) manual for detailed information.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
main(int argc, char *argv[])
|
2004-01-30 12:19:45 -05:00
|
|
|
{
|
2007-02-27 09:42:14 -05:00
|
|
|
int c;
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
char *configFile = NULL;
|
|
|
|
char *host = NULL;
|
|
|
|
int port = 0;
|
|
|
|
char *mount = NULL;
|
|
|
|
shout_t *shout;
|
|
|
|
extern char *optarg;
|
|
|
|
extern int optind;
|
2007-02-25 11:00:41 -05:00
|
|
|
#ifdef HAVE_SIGNALS
|
|
|
|
struct sigaction act;
|
2007-02-28 08:53:58 -05:00
|
|
|
unsigned int i;
|
2007-02-25 11:00:41 -05:00
|
|
|
#endif
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
|
|
|
|
__progname = getProgname(argv[0]);
|
|
|
|
pezConfig = getEZConfig();
|
2004-01-30 12:19:45 -05:00
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
qFlag = 0;
|
|
|
|
vFlag = 0;
|
2004-01-30 12:19:45 -05:00
|
|
|
|
2007-03-04 09:27:37 -05:00
|
|
|
while ((c = getopt(argc, argv, "c:hqVv")) != -1) {
|
2004-01-30 12:19:45 -05:00
|
|
|
switch (c) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
case 'c':
|
|
|
|
if (configFile != NULL) {
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("Error: multiple -c arguments given\n");
|
2004-01-30 12:19:45 -05:00
|
|
|
usage();
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
return (2);
|
|
|
|
}
|
|
|
|
configFile = xstrdup(optarg);
|
|
|
|
break;
|
|
|
|
case 'h':
|
|
|
|
usage();
|
|
|
|
usageHelp();
|
|
|
|
return (0);
|
|
|
|
case 'q':
|
|
|
|
qFlag = 1;
|
|
|
|
break;
|
2007-03-04 09:27:37 -05:00
|
|
|
case 'V':
|
|
|
|
printf("%s\n", PACKAGE_STRING);
|
|
|
|
return (0);
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
case 'v':
|
|
|
|
vFlag++;
|
|
|
|
break;
|
|
|
|
case '?':
|
|
|
|
usage();
|
|
|
|
return (2);
|
|
|
|
default:
|
|
|
|
break;
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
argc -= optind;
|
|
|
|
argv += optind;
|
2004-01-30 12:19:45 -05:00
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
if (configFile == NULL) {
|
|
|
|
printf("You must supply a config file with the -c argument.\n");
|
2004-01-30 12:19:45 -05:00
|
|
|
usage();
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
return (2);
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Attempt to open configFile here for a more meaningful error
|
2007-02-28 10:35:07 -05:00
|
|
|
* message. Where possible, do it with stat() and check for
|
|
|
|
* safe config file permissions.
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
*/
|
2007-02-28 10:35:07 -05:00
|
|
|
#ifdef HAVE_STAT
|
|
|
|
struct stat st;
|
|
|
|
|
|
|
|
if (stat(configFile, &st) == -1) {
|
|
|
|
printf("%s: %s\n", configFile, strerror(errno));
|
|
|
|
usage();
|
|
|
|
return (2);
|
|
|
|
}
|
|
|
|
if (vFlag && (st.st_mode & (S_IRGRP | S_IROTH)))
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("%s: Warning: %s is group and/or world readable\n",
|
2007-02-28 10:35:07 -05:00
|
|
|
__progname, configFile);
|
|
|
|
if (st.st_mode & (S_IWGRP | S_IWOTH)) {
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("%s: Error: %s is group and/or world writeable\n",
|
2007-02-28 10:35:07 -05:00
|
|
|
__progname, configFile);
|
|
|
|
return (2);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
FILE *tmp;
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
|
|
|
|
if ((tmp = fopen(configFile, "r")) == NULL) {
|
|
|
|
printf("%s: %s\n", configFile, strerror(errno));
|
|
|
|
usage();
|
|
|
|
return (2);
|
2007-02-28 10:35:07 -05:00
|
|
|
}
|
|
|
|
fclose(tmp);
|
|
|
|
#endif /* HAVE_STAT */
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
2004-07-18 23:12:31 -04:00
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
if (!parseConfig(configFile))
|
|
|
|
return (2);
|
|
|
|
|
|
|
|
shout_init();
|
|
|
|
playlist_init();
|
|
|
|
|
|
|
|
if (pezConfig->URL == NULL) {
|
|
|
|
printf("%s: Error: Missing <url>\n", configFile);
|
|
|
|
return (2);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
if (!urlParse(pezConfig->URL, &host, &port, &mount)) {
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("Must be of the form ``http://server:port/mountpoint''\n");
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
return (2);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
2007-03-02 07:52:10 -05:00
|
|
|
if (strlen(host) == 0) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: Error: Invalid <url>: Missing server:\n", configFile);
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("Must be of the form ``http://server:port/mountpoint''\n");
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
return (2);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
2007-03-02 07:52:10 -05:00
|
|
|
if (strlen(mount) == 0) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: Error: Invalid <url>: Missing mountpoint:\n", configFile);
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("Must be of the form ``http://server:port/mountpoint''\n");
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
return (2);
|
|
|
|
}
|
2007-03-02 07:52:10 -05:00
|
|
|
if (pezConfig->password == NULL) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: Error: Missing <sourcepassword>\n", configFile);
|
|
|
|
return (2);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
2007-03-02 07:52:10 -05:00
|
|
|
if (pezConfig->fileName == NULL) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: Error: Missing <filename>\n", configFile);
|
|
|
|
return (2);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
if (pezConfig->format == NULL) {
|
|
|
|
printf("%s: Warning: Missing <format>:\n", configFile);
|
2007-03-02 07:52:10 -05:00
|
|
|
printf("Specify a stream format of either MP3, VORBIS or THEORA\n");
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
|
|
|
|
xfree(configFile);
|
|
|
|
|
|
|
|
if ((shout = shout_new()) == NULL) {
|
|
|
|
printf("%s: shout_new(): %s", __progname, strerror(ENOMEM));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (shout_set_host(shout, host) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_host(): %s\n", __progname,
|
|
|
|
shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
if (shout_set_protocol(shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_protocol(): %s\n", __progname,
|
|
|
|
shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
if (shout_set_port(shout, port) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_port: %s\n", __progname,
|
|
|
|
shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
if (shout_set_password(shout, pezConfig->password) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_password(): %s\n", __progname,
|
|
|
|
shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
if (shout_set_mount(shout, mount) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_mount(): %s\n", __progname,
|
|
|
|
shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
if (shout_set_user(shout, "source") != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_user(): %s\n", __progname,
|
|
|
|
shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
|
2004-07-18 23:12:31 -04:00
|
|
|
if (!strcmp(pezConfig->format, MP3_FORMAT)) {
|
2004-01-30 12:19:45 -05:00
|
|
|
if (shout_set_format(shout, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_format(MP3): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-07-18 23:12:31 -04:00
|
|
|
}
|
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
if (!strcmp(pezConfig->format, VORBIS_FORMAT) ||
|
|
|
|
!strcmp(pezConfig->format, THEORA_FORMAT)) {
|
2004-07-12 15:13:14 -04:00
|
|
|
if (shout_set_format(shout, SHOUT_FORMAT_OGG) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_format(OGG): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pezConfig->serverName) {
|
|
|
|
if (shout_set_name(shout, pezConfig->serverName) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_name(): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pezConfig->serverURL) {
|
|
|
|
if (shout_set_url(shout, pezConfig->serverURL) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_url(): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pezConfig->serverGenre) {
|
|
|
|
if (shout_set_genre(shout, pezConfig->serverGenre) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_genre(): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pezConfig->serverDescription) {
|
|
|
|
if (shout_set_description(shout, pezConfig->serverDescription) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_description(): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pezConfig->serverBitrate) {
|
|
|
|
if (shout_set_audio_info(shout, SHOUT_AI_BITRATE, pezConfig->serverBitrate) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_audio_info(AI_BITRATE): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pezConfig->serverChannels) {
|
|
|
|
if (shout_set_audio_info(shout, SHOUT_AI_CHANNELS, pezConfig->serverChannels) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_audio_info(AI_CHANNELS): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pezConfig->serverSamplerate) {
|
|
|
|
if (shout_set_audio_info(shout, SHOUT_AI_SAMPLERATE, pezConfig->serverSamplerate) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_audio_info(AI_SAMPLERATE): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pezConfig->serverQuality) {
|
|
|
|
if (shout_set_audio_info(shout, SHOUT_AI_QUALITY, pezConfig->serverQuality) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_audio_info(AI_QUALITY): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (shout_set_public(shout, pezConfig->serverPublic) != SHOUTERR_SUCCESS) {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
printf("%s: shout_set_public(): %s\n",
|
|
|
|
__progname, shout_get_error(shout));
|
|
|
|
return (1);
|
2004-01-30 12:19:45 -05:00
|
|
|
}
|
|
|
|
|
2007-03-08 21:30:29 -05:00
|
|
|
if (pezConfig->metadataProgram != NULL)
|
|
|
|
metadataFromProgram = 1;
|
|
|
|
else
|
|
|
|
metadataFromProgram = 0;
|
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
#ifdef HAVE_SIGNALS
|
2007-02-25 11:00:41 -05:00
|
|
|
memset(&act, 0, sizeof(act));
|
|
|
|
act.sa_handler = sig_handler;
|
|
|
|
# ifdef SA_RESTART
|
|
|
|
act.sa_flags = SA_RESTART;
|
|
|
|
# endif
|
2007-02-28 08:53:58 -05:00
|
|
|
for (i = 0; i < sizeof(ezstream_signals) / sizeof(int); i++) {
|
|
|
|
if (sigaction(ezstream_signals[i], &act, NULL) == -1) {
|
|
|
|
printf("%s: sigaction(): %s\n",
|
|
|
|
__progname, strerror(errno));
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
#endif /* HAVE_SIGNALS */
|
|
|
|
|
|
|
|
if (shout_open(shout) == SHOUTERR_SUCCESS) {
|
|
|
|
int ret;
|
|
|
|
char *tmpFileName, *p;
|
|
|
|
|
|
|
|
printf("%s: Connected to http://%s:%d%s\n", __progname,
|
|
|
|
host, port, mount);
|
|
|
|
|
|
|
|
tmpFileName = xstrdup(pezConfig->fileName);
|
|
|
|
for (p = tmpFileName; *p != '\0'; p++)
|
|
|
|
*p = tolower((int)*p);
|
2007-02-28 16:26:16 -05:00
|
|
|
if (pezConfig->fileNameIsProgram ||
|
|
|
|
strrcmp(tmpFileName, ".m3u") == 0 ||
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
strrcmp(tmpFileName, ".txt") == 0)
|
|
|
|
playlistMode = 1;
|
|
|
|
else
|
|
|
|
playlistMode = 0;
|
|
|
|
xfree(tmpFileName);
|
|
|
|
|
2007-02-28 16:26:16 -05:00
|
|
|
if (vFlag && pezConfig->fileNameIsProgram)
|
|
|
|
printf("%s: Using program '%s' to get filenames for streaming\n",
|
|
|
|
__progname, pezConfig->fileName);
|
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
ret = 1;
|
|
|
|
do {
|
|
|
|
if (playlistMode)
|
|
|
|
ret = streamPlaylist(shout,
|
|
|
|
pezConfig->fileName);
|
2007-02-28 16:48:01 -05:00
|
|
|
else {
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
ret = streamFile(shout, pezConfig->fileName);
|
2007-02-28 16:48:01 -05:00
|
|
|
if (pezConfig->streamOnce)
|
|
|
|
break;
|
|
|
|
}
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
} while (ret);
|
|
|
|
} else
|
|
|
|
printf("%s: Connection to http://%s:%d%s failed: %s\n", __progname,
|
|
|
|
host, port, mount, shout_get_error(shout));
|
|
|
|
|
2007-02-28 16:26:16 -05:00
|
|
|
if (vFlag)
|
|
|
|
printf("%s: Exiting ...\n", __progname);
|
|
|
|
|
2004-01-30 12:19:45 -05:00
|
|
|
shout_close(shout);
|
|
|
|
|
2007-03-08 15:59:29 -05:00
|
|
|
playlist_free(&playlist);
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
playlist_shutdown();
|
|
|
|
|
2004-01-30 12:19:45 -05:00
|
|
|
shout_shutdown();
|
|
|
|
|
Merge changes to main(), urlParse() and streamPlaylist(). In main():
* Install the signal handler as late as possible.
* Add new command line options: -v (verbose, use twice for even more verbose
output) and -q (quiet, redirect standard error output from external de-/
encoders to /dev/null.)
* It is now an error to supply more than one -c parameter. This prevents
unexpected results.
* Add a stern warning when ezstream is running as root. Just Don't Do It.
Leaving the configfile writeable to others by accident could mean instant
root compromise.
* Before handing the config file over to libxml, try to open it ourselves
first. The error message from strerror() is a lot more helpful than the
cryption I/O error printed by libxml.
* Don't preallocate memory for urlParse().
* Fix command line error messages, they seem to be for a different program
than Ezstream.
* More terse libshout error messages, just print which function failed.
I consider these errors of questionable value for an end user, but at least
a knowledgeable one will know instantly what went wrong.
* Case insensitive matching of playlist file extensions.
* Print the address, port and mountpoint that Ezstream is actually trying to
connect to, instead of what the user supplied. That should make it easier
to spot reasons for connect failures (e.g. typos.)
Changes in urlParse():
* Let urlParse() allocate memory for hostname and mountpoint, as it knows
how much memory is actually required.
* Fix a buffer overflow of the tmpPort buffer by adding checks and using safe
string functions.
* Let the caller print an error message, instead of having the same printf()
twice in urlParse().
The streamPlaylist() function has been rewritten to use the new playlist_*()
routines. Apart from the added playlist shuffle feature no functional change.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12552 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 20:14:36 -05:00
|
|
|
xfree(host);
|
|
|
|
xfree(mount);
|
2004-01-30 12:19:45 -05:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|