1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00
Commit Graph

127 Commits

Author SHA1 Message Date
moritz
9a5b5ed973 Forgot one PATH_SEPARATOR instance ...
git-svn-id: https://svn.xiph.org/trunk/ezstream@12617 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-03 17:50:02 +00:00
moritz
6187391e2c Use size_t in strrcmp().
git-svn-id: https://svn.xiph.org/trunk/ezstream@12616 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-03 17:48:11 +00:00
moritz
c205414d70 Iterate back towards working Windows support.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12615 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-03 16:13:08 +00:00
moritz
1be748b206 STDERR_FILENO -> fileno(stderr), and fix a brain'o: Systems with limited or
no signals support obviously don't have SIG_HUP/SIG_USR1 defined.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12614 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-03 12:42:50 +00:00
moritz
539bb39322 Improve string to integer conversion stuff, and have another stab at the config
file parsing. Ezstream now prints each error it can find and then bails out,
instead of bailing out on the first error. Tweak URL parsing as well, and do
some cosmetic changes to the error messages.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12603 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-02 12:52:10 +00:00
moritz
956f674a44 Allow users to restrict the number of reconnection attempts. This also changes
how reconnections are handled in general: A recovered connection always skips
to the next tune as well, as it seems that at least for Ogg Vorbis, libshout
wants to see an Ogg header after a shout_open(). The new code makes this
behavior consistent among all formats.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12599 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-02 00:57:11 +00:00
moritz
2a511a64fc Enable more warnings on gcc, and do some miscellaneous cleanups.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12597 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-01 14:50:14 +00:00
moritz
ca6161358d Redirect only de-/encoder screen output to /dev/null with -q, and restore
standard error outside that popen() call.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12596 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-01 01:22:06 +00:00
moritz
6cdaac888d Tweak XXX comment.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12595 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-01 00:34:57 +00:00
moritz
9e0c427433 Make the example configuration files directory configurable.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12594 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-03-01 00:10:12 +00:00
moritz
ad46ff44c6 Add new <stream_once> configuration option for disabling continuous streaming.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12592 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-28 21:48:01 +00:00
moritz
7d51c20fb8 Add new playlist scripting feature (works similar to Ices 2.x.)
git-svn-id: https://svn.xiph.org/trunk/ezstream@12591 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-28 21:26:16 +00:00
moritz
1712f4f88f Replace geteuid() check with stat(), and make it an error if the configuration
file is group or world writeable. This is actually what the warning about root
was all about.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12590 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-28 15:35:07 +00:00
moritz
159ebfdd91 Back out hardly used ezsignals.h.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12589 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-28 13:53:58 +00:00
moritz
8e56ed5c07 Remove redundant paragraph.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12588 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-28 12:47:26 +00:00
moritz
18f395b6ff Make a more standard distribution: Rename CHANGELOG to NEWS, bring back the
complete ChangeLog and add mkcl.sh that contains the options to generate
ChangeLog.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12587 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-28 12:44:56 +00:00
moritz
631c6aa5fe Switch from a generated ChangeLog to a manually maintained and more compact
CHANGELOG.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12586 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-28 11:06:46 +00:00
moritz
52f1750a70 Sync usageHelp() with new reality.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12585 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-28 11:03:06 +00:00
moritz
6b01b59811 Let MIPS[pro] C be chatty with warnings and check for basename() in libgen.
Ezstream now builds on IRIX.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12576 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-27 14:44:46 +00:00
moritz
382c811b97 getopt() returns int, not char.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12575 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-27 14:42:14 +00:00
moritz
3418a75a66 Use backticks to execute xml2-config/xslt-config, which is more portable.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12574 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-27 14:41:51 +00:00
moritz
43d8282bb3 Document a caveat when building ezstream on Solaris with a different compiler
than the one used to build libshout.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12573 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-27 12:46:56 +00:00
moritz
5cd0b1aba9 Make this work on static archs, and get one step closer to SunCC support on
Solaris. Also, don't complain if libshout isn't thread-safe, as Ezstream isn't
multithreaded.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12572 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-26 20:29:48 +00:00
moritz
fddb4090c7 Add m4/ to the distribution tarball.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12571 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-26 19:59:19 +00:00
moritz
678e161e54 Unbreak "make distcheck": $prefix is not a good default, use /usr/local instead.
This makes it more likely that installed libogg and libvorbis are found, when
the user (or autoconf) specifies a different --prefix. Users who installed
their libraries in their homedir now have to set $OGG_PREFIX and $VORBIS_PREFIX,
or set their respective --with arguments.
Let the snapshot target use distcheck now that it works.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12570 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-26 15:28:50 +00:00
moritz
e05ccb9f05 Remove unused .m4 files and sync the used ones with Icecast.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12565 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-26 02:56:12 +00:00
moritz
270c56c8bf Make Ezstream work properly and do the right thing, even when bombarded with
a flurry of simultaneous SIGHUP and SIGUSR1 signals. From what I can tell,
signal handling is now quite solid now. Achieve this by moving most of
streamFile() into a new sendStream() function, which is called within a new
do-while loop inside streamFile(). There, proper behavior is ensured and
a race condition resolved in favor of SIGHUP.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12564 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-25 18:28:05 +00:00
moritz
ea8d29f742 Switch from using signal() to sigaction() and friends, so that SA_RESTART can
be used. This is required for Solaris and possibly others, where signal handlers
have to be reinstalled after having caught one signal via signal(). Also prevent
Ezstream from being killed by a handled signal in streamFile(), where they
can interrupt fread()'s system calls. This improves matters, but isn't perfect,
yet. A SIGHUP signal can still cause skipping to the next track, which should
be triggered only by SIGUSR1.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12563 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-25 16:00:41 +00:00
moritz
733c989d1b 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 14:00:15 +00:00
moritz
04e087fc11 Merge changes to the remaining two functions, openResource() and streamFile(),
after which the merge is complete. Changes in openResource():
 * Let the caller know whether we're streaming from standard input, and give
   it a copy of the metadata information.
 * Make filename extension matching case insensitive. Ezstream can now stream
   foo.Ogg out of playlist.tXt. (On that note, another item from the
   parseConfig() commit log message was missing: <format/> and <match/> are
   also case insensitive now.)
Changes in streamFile():
 * New feature: Skip currently playing track when receiving SIGUSR1.
 * New feature: When using both the new -q and -v command line parameters,
   Ezstream now displays some "real-time" information: playlist position,
   elapsed time streaming the current track, and approximate bitrate in kbps.
 * Fix the fread() loop by moving the "if read bytes > 0" condition into the
   while statement, and check with ferror() afterwards whether an error occured.
 * Remove redundant shout_delay() call. Ezstream puts itself to sleep with
   shout_sync().
 * Return a value that makes sense in main()'s do-while loop, instead of
   whatever shout_send() returned last.
 * Remove or prettify a few messages.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12557 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-25 03:49:30 +00:00
moritz
31b8880bd4 Merge processMetadata() changes:
* Fix how the metadata string is generated. Don't include the " - " in the
   output if either artist or title are missing from ID3v1/Vorbis tags.
 * Print the correct error message when ov_open() fails.
 * Improve filename-based generation of metadata. Use a copy of fileName for
   basename(), which may modify its argument in some places where the old, weird
   POSIX implementation is used. Also, basename() is not infallible, but when
   it fails, it is annoying for us. Assert that it cannot fail since we feed
   it with path names < PATH_MAX (handled in playlist.c and configfile.c.) In
   short, make processMetadata() always return something more or less useful
   as long as the file in question can be opened.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12554 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-25 03:10:13 +00:00
moritz
d657af0b8a Merge changes to replaceString() and buildCommandString(), and do the formatting
nitpickery to setMetadata(). Changes in replaceString():
 * Fix a heap overflow. replaceString() would happily replace multiple '@T@'
   and '@M@' placeholders and write into *dest until things blow up. Fix this
   by using safe string functions. Then completely prevent it by ensuring that
   it replaces only one placeholder per call (adjusting buildCommandString()
   accordingly) and already complaining to the user in parseConfig() about
   illegal, multiple placeholders in their command lines. (That parseConfig()
   change was missing from the commit log earlier.)
In buildCommandString():
 * Use xcalloc() instead of malloc() and get rid of the now redundant memset()
   calls.
 * Allow decoder command lines to contain the '@M@' metadata placeholder.
   Useful for combined de-/encoders like ffmpeg2theora.
 * Tweak message about "unsupported" format, which used to be false in the case
   of Ogg Theora streams.
 * Plug several memory leaks.
 * Don't print the "Executing command 'foo'" message in this function.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12553 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-25 02:36:40 +00:00
moritz
710570627d 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-25 01:14:36 +00:00
moritz
b59da7de0c Add check for geteuid(), which is better than checking for WIN32.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12551 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-25 00:35:48 +00:00
moritz
5a233a4e03 Begin merging ezstream.c changes. This first batch includes:
* License reference and various #include cleanups and additions that are
   required later.
 * Add new usage() and usageHelp() functions (which already contain what's
   to come.) Move them close to main() where getopt() is called.
 * New signal handler, which now no longer uses printf(). printf() is not safe
   to use in signal handlers. Use volatile sig_atomic_t types instead of ints
   as flags to set in the handler.
 * Formatting and const'ifying of WIN32-basename() and strrcmp(). Rearrange
   them so that the actual "worker functions" are grouped together.
 * Add function prototypes for those that are already up-to-date.
 * Rename ReplaceString() to replaceString() for consistency with other
   function names in Ezstream.
 * Prepare for portable *__progname usage.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12550 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-25 00:25:07 +00:00
moritz
52e249f73f Merge new parseConfig() function. There were many changes, but those are too
cumbersome to merge separately. They are:
 * The usual formatting nitpickings.
 * Don't leak memory in case of duplicate entries. Instead make it an error
   and print a helpful error message, with config file line number, to the
   user.
 * Replace the manual cast to (const xmlChar *) with libxml2's BAD_CAST.
   There probably won't be any UTF8 support in Ezstream any time soon ...
 * Remove redundant strlen() check - xmlNodeListGetString() never returns
   an empty string if (cur->xmlChildrenNode != NULL).
 * Use xstrdup() instead of malloc() + memset() + strcpy().
 * Ensure that boolean configration options are always either 1 or 0.
 * Ensure that path names given via <filename /> do not exceed PATH_MAX.
 * Add <shuffle /> configuration option for playlist shuffling.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12549 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 23:26:16 +00:00
moritz
99e0d7b8bf Add function to free a configuration in case of an error.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12548 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 23:05:51 +00:00
moritz
2874fca043 Fix typo in comment.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12547 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 23:03:51 +00:00
moritz
9d2434c46c Replace three if-conditionals with one, both in getFormatEncoder() and
getFormatDecoder(), with prettier formatting.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12546 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 22:56:18 +00:00
moritz
94ed7d1672 Const'ify configfile functions.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12545 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 22:50:14 +00:00
moritz
d912dfe302 Add license reference to configfile.c, sync #includes with what will be required
later, getEZConfig() formatting and remove unused printConfig() function.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12544 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 22:25:28 +00:00
moritz
4cd0959aa8 Begin merging configfile.* changes by cleaning up the .h file: Add license
reference, remove prototype of nonexistent getMetadataGrabber() function, and
do some formatting.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12543 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 22:16:39 +00:00
moritz
68acca112f Clean core and backup files in this directory as well. Only ~2500 lines of
diffs left to merge.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12542 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 22:03:36 +00:00
moritz
5d3fc1ddda Commit header with three macros that help with signal handling. Will be actually
used later. Now, all new files are in.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12541 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 22:01:35 +00:00
moritz
1fca228230 Let the configure script set a (hard-coded, for now) examples installation
directory. This will be made configurable later.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12540 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 21:59:07 +00:00
moritz
e74272332e Add several checks that we need now, i.e. very soon.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12539 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 21:50:54 +00:00
moritz
e811f2578b AM_CONFIG_HEADER -> AC_CONFIG_HEADERS, and move config.h into src/.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12538 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 21:46:05 +00:00
moritz
d196074741 Autoconf 2.61 has a nice macro AC_USE_SYSTEM_EXTENSIONS. Use it, depend on
autoconf-2.61 for it and remove the annoying _GNU_SOURCE and _XOPEN_SOURCE ...
dung. Autoconf takes care of this, and even checks for more useful stuff for
us.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12537 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 21:44:35 +00:00
moritz
aab6c56ae2 Generate a Makefile in doc/, and switch to AC_CONFIG_FILES.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12536 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 21:37:06 +00:00
moritz
c7a3eda868 Ezstream does not need libtool, so remove it. Remove other redundant configure
checks as well: AC_PROG_CC and AC_HEADER_STDC are automatically checked in
packages written in C, no need to do it twice. This shaves a lot off configure
runtime.


git-svn-id: https://svn.xiph.org/trunk/ezstream@12535 0101bb08-14d6-0310-b084-bc0e0c8e3800
2007-02-24 21:34:05 +00:00