code. Luckily, I had the proper copyright statement in there already, so moving
it fixes things.
git-svn-id: https://svn.xiph.org/trunk/ezstream@15781 0101bb08-14d6-0310-b084-bc0e0c8e3800
whenever possible, and otherwise uses a stripped down, single options only,
BSD getopt() (which is smaller and doesn't come with ifdef-stuff-in-features.h.)
git-svn-id: https://svn.xiph.org/trunk/ezstream@15779 0101bb08-14d6-0310-b084-bc0e0c8e3800
way to prevent NULL dereferences after the recent character conversion changes
in other parts of ezstream.
git-svn-id: https://svn.xiph.org/trunk/ezstream@15778 0101bb08-14d6-0310-b084-bc0e0c8e3800
There are a few benefits to this, but the main reason is consistency and me
completely understanding what's going on. Regressions are not expected, but
wouldn't surprise either ... this needs lots of testing.
git-svn-id: https://svn.xiph.org/trunk/ezstream@15776 0101bb08-14d6-0310-b084-bc0e0c8e3800
of files with non-ASCII filenames, as well as some more cases related to
metadata.
From Roman Donchenko <DXDragon at yandex dot ru>, with some minor fixes by
myself.
git-svn-id: https://svn.xiph.org/trunk/ezstream@15770 0101bb08-14d6-0310-b084-bc0e0c8e3800
crash when streaming standard input without also using a metadata program
(d'oh.)
git-svn-id: https://svn.xiph.org/trunk/ezstream@13996 0101bb08-14d6-0310-b084-bc0e0c8e3800
* Add 'charset=UTF-8' to the metadata update query arguments. The current
release of Icecast will ignore it, and the next one will know how to handle
it (karl@ is still working on it at this point, but previous diffs worked
as advertised.)
* If no metadata format string is available and we have both an artist and
a title, use the artist/title way of updating instead of the generic "song"
interface.
git-svn-id: https://svn.xiph.org/trunk/ezstream@13658 0101bb08-14d6-0310-b084-bc0e0c8e3800
disagree with the new ISO-8859-1 assumption for non-Ogg streams, because
(for example) with ID3 tags, a codeset is simply not part of the specification
and a better assumption would be that they are in the user's locale.
Therefore, it would make more sense, IMO, to clearly specify that ANY metadata
sent to Icecast should be UTF-8 and let the source client figure out the rest.
This would also answer the question what codeset an /admin user should use if
the content type of a mountpoint isn't known (although that can be figured out
with an unclean read of the mountpoint's stats beforehand.)
git-svn-id: https://svn.xiph.org/trunk/ezstream@13622 0101bb08-14d6-0310-b084-bc0e0c8e3800
No new code is actually used, yet, as there's still more work to be done.
This adds the whole iconv-related build stuff and moves most auto* files
into build-aux/.
git-svn-id: https://svn.xiph.org/trunk/ezstream@13607 0101bb08-14d6-0310-b084-bc0e0c8e3800
out that there is still a problem with MP3 streams that are being reencoded.
This allows me to try out more solutions.
git-svn-id: https://svn.xiph.org/trunk/ezstream@13592 0101bb08-14d6-0310-b084-bc0e0c8e3800
for normalizing metadata strings, which -- I assume -- is due to strange
(MP3) encoders that do weird things. Well, why not. It's not too intrusive,
and disabled by default. Enable string normalization with the new -n command
line parameter.
git-svn-id: https://svn.xiph.org/trunk/ezstream@13544 0101bb08-14d6-0310-b084-bc0e0c8e3800
for streaming MP3 files without reencoding, which was lost during the many
changes in 0.3.0 and subsequently forgotten. Sorry for the inconvenience,
and thanks for the report.
git-svn-id: https://svn.xiph.org/trunk/ezstream@13542 0101bb08-14d6-0310-b084-bc0e0c8e3800
pointers to NULL if we lateron expect them to be NULL (no longer rely on
xalloc to do this for us.)
git-svn-id: https://svn.xiph.org/trunk/ezstream@13436 0101bb08-14d6-0310-b084-bc0e0c8e3800
took care of it partially. Diagnosed with the help from someone, who wishes
to stay anonymous. Thanks!
git-svn-id: https://svn.xiph.org/trunk/ezstream@13296 0101bb08-14d6-0310-b084-bc0e0c8e3800
found in the Icecast mailing list archive, in a mail by Geoff Shang, via
Google. Let's hope that the bug tracker prevents this kind of bug hunting
in the future ...
git-svn-id: https://svn.xiph.org/trunk/ezstream@13272 0101bb08-14d6-0310-b084-bc0e0c8e3800
has not been checked for changes to previous behavior and isn't complete, yet.
More to come.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12701 0101bb08-14d6-0310-b084-bc0e0c8e3800
program/script to get metadata from. Also include SIGUSR2 handling that triggers
metadata updates from the external program mid-stream.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12693 0101bb08-14d6-0310-b084-bc0e0c8e3800
was to set ptr to NULL, but the function only set the copy of ptr to NULL.
Spotted by Karl Heyes, thanks a lot!
git-svn-id: https://svn.xiph.org/trunk/ezstream@12677 0101bb08-14d6-0310-b084-bc0e0c8e3800
ezstream.c. Use a basename() function for Windows that behaves identical to
a modern Unix' basename().
git-svn-id: https://svn.xiph.org/trunk/ezstream@12673 0101bb08-14d6-0310-b084-bc0e0c8e3800
is different. The shifting severely screwed up its randomness. Just leave it
away and systems that only have a bad version of rand() will have to just deal
with it.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12629 0101bb08-14d6-0310-b084-bc0e0c8e3800
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
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
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
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
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
* 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
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
* 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
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
* 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
* 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
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
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
Makefile.am. Also let "make clean" clean up coredumps and editor backup files.
git-svn-id: https://svn.xiph.org/trunk/ezstream@12527 0101bb08-14d6-0310-b084-bc0e0c8e3800
fixed a buffer overflow on large id3tags
use pclose for popen'd file handles
git-svn-id: https://svn.xiph.org/trunk/ezstream@10589 0101bb08-14d6-0310-b084-bc0e0c8e3800