[xiph-commits] r8828 - in icecast/branches/ices0: . pipe pipe/conf pipe/doc pipe/src pipe/src/playlist

brendan at motherfish-iii.xiph.org brendan at motherfish-iii.xiph.org
Thu Feb 3 22:57:37 PST 2005


Author: brendan
Date: 2005-02-03 22:57:21 -0800 (Thu, 03 Feb 2005)
New Revision: 8828

Added:
   icecast/branches/ices0/pipe/
   icecast/branches/ices0/pipe/NEWS
   icecast/branches/ices0/pipe/README
   icecast/branches/ices0/pipe/README.playlist
   icecast/branches/ices0/pipe/conf/Makefile.am
   icecast/branches/ices0/pipe/conf/ices.conf.dist.in
   icecast/branches/ices0/pipe/conf/ices.sh.dist
   icecast/branches/ices0/pipe/configure.ac
   icecast/branches/ices0/pipe/doc/ices.1.in
   icecast/branches/ices0/pipe/doc/icesmanual.html
   icecast/branches/ices0/pipe/src/ices_config.c
   icecast/branches/ices0/pipe/src/icestypes.h
   icecast/branches/ices0/pipe/src/playlist/Makefile.am
   icecast/branches/ices0/pipe/src/playlist/playlist.c
   icecast/branches/ices0/pipe/src/playlist/playlist.h
   icecast/branches/ices0/pipe/src/playlist/pm_script.c
   icecast/branches/ices0/pipe/src/playlist/pm_script.h
   icecast/branches/ices0/pipe/src/setup.c
Removed:
   icecast/branches/ices0/pipe/NEWS
   icecast/branches/ices0/pipe/README
   icecast/branches/ices0/pipe/README.playlist
   icecast/branches/ices0/pipe/conf/Makefile.am
   icecast/branches/ices0/pipe/conf/ices.conf.dist.in
   icecast/branches/ices0/pipe/configure.ac
   icecast/branches/ices0/pipe/doc/ices.1.in
   icecast/branches/ices0/pipe/doc/icesmanual.html
   icecast/branches/ices0/pipe/src/ices_config.c
   icecast/branches/ices0/pipe/src/icestypes.h
   icecast/branches/ices0/pipe/src/playlist/Makefile.am
   icecast/branches/ices0/pipe/src/playlist/playlist.c
   icecast/branches/ices0/pipe/src/playlist/playlist.h
   icecast/branches/ices0/pipe/src/setup.c
Modified:
   icecast/branches/ices0/pipe/src/Makefile.am
   icecast/branches/ices0/pipe/src/definitions.h
   icecast/branches/ices0/pipe/src/stream.c
Log:
Branch while I convert the encoder and decoder from shared objects to pipes


Copied: icecast/branches/ices0/pipe (from rev 8703, icecast/trunk/ices0)

Deleted: icecast/branches/ices0/pipe/NEWS
===================================================================
--- icecast/trunk/ices0/NEWS	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/NEWS	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,94 +0,0 @@
-0.4     2004-08-28
-	* FLAC transcoding support.
-	* MP4 transcoding support added via libfaad.
-	* Crossfader added.
-	* Tested with LAME 3.96.1
-0.3     2003-07-13
-	* Updated to libshout2, which brings icecast2 compatibility.
-	* ices will now attempt to trim junk and short frames from MP3 files,
-	  which should help if you've been hearing chirps between songs.
-	* Reencoding is much more reliable - VBR, sampling rate changes, and
-	  a wide variety of bitrates have been tested.
-	* Stability stability stability.
-	* Ogg reencoding works on bigendian (eg PowerPC) systems now.
-	* Mono reencoding bug fixed.
-	* ID3v2 tag support.
-	* A blank line in a playlist will terminate ices.
-	* -i (icy_compat) has been removed in favor of -t 'protocol'
-0.2.3	2002-05-01
-	As always, the longer the time between releases, the less changed:
-	* ices no longer uses threads, making it much leaner and more portable.
-	* bundled with libshout 1.0.9, which makes it much less likely to
-	  segfault on normal MP3 files.
-	* Will now attempt to reload playlist modules when sighup'd. Make your
-	  scripting changes without interrupting your stream.
-	* Still includes a number of bugs (see BUGS)
-0.2.2	2001-08-01
-	* You can now specify the host and port for each mount point
-	  separately. In fact, you have to.
-	* MP3 encoding output buffer size increased, seems to handle VBRs
-	  better, don't know why this is necessary at the moment.
-	* Thread stack size increased again.
-	* Write to stdout directly for usage/-V info, so it doesn't get
-	  swallowed if ices is configured to run in the background.
-	* Include system configuration info in ices -V output.
-	* Use setsid() to detach from tty, not setpgid().
-	* Load perl module as a proper module. This means you'd better return
-	  1 at the end of your module.
-	* Set PYTHONPATH reliably (not using an automatic variable), and
-	  removed the arbitrary length limit.
-	* Log file no longer appends PID. In general I think this is a silly
-	  practice. I would have removed it from the cue file too, but a)
-	  I don't use the cue file, and b) it at least cleans up after itself
-	  on exit.
-	* Build dependency bugs fixed.
-0.2.1	2001-07-12
-	* Thread stack size increased, to prevent segfaults during metadata
-	  updates on Solaris, FreeBSD, OpenBSD, and probably anything that
-	  isn't Linux.
-	* Sleep code fixed to work better on other platforms. Solaris users
-	  should be happy.
-	* All playlist functions but ices_get_next made optional.
-	* Compatibility code uses old ices_(perl|python)_... function names
-	  if new, documented (man 1 ices) functions aren't found.
-0.2	2001-06-29
-	* This is a development release. It is not guaranteed to be as stable
-	  as 0.1.
-	* Multiple streams are supported. Add multiple stream sections to
-	  ices.conf or use multiple -m options on the command line. See the
-	  man page for details.
-	* Oh yeah, there's a man page.
-	* ices can decode ogg vorbis files and reencode them as MP3
-	* New ices_get_metadata function added for playlist scripts.
-	* Better recovery from transient network problems.
-	* SIGUSR1 causes ices to jump to the next track
-0.1.0	2001-06-15
-	* Reencoder updated to new LAME API of 3.88.
-	* new option --with-xmlconfig when building to locate xml libraries
-	* configure looks for python 2
-	* new commandline option -V for version/feature info
-	* cue file song length field now correct
-	* BaseDirectory configuration option works
-	* support for using an installed libshout
-	* fixes to metadata update (first song metadata now set)
-0.0.1b5	2000-08-29
-	* Perl module now supports dynamic loading of modules (e.g "use Socket")
-	* Ices now exits after 10 consecutive filename or other errors. (Removes spamming problems)
-0.0.1b4	2000-08-24
-	* New options to change sample rate and number of channels
-	  when reencoding.
-0.0.1b3	2000-08-08
-	* Reencoding fixes, commented config file and README.playlist
-	* Changed perl module to use user specified module
-	* ices.py and ices.pm now commented
-	* Configure.in now checks for gmake, and tells user to use this
-	  if found.
-	* ices.pm,ices.py and README.playlist included in dist.
-	* Moved README to README.old and lynx -dump -nolist on
-	  doc/icesmanual.html to the new README. (I don't want to
-	  maintain two sets of documentation)
-	* Started to work on the FAQ
-0.0.1b2	2000-08-02
-	* Code cleanup, lots of code comments added
-0.0.1b1	2000-07-19
-	* first release

Copied: icecast/branches/ices0/pipe/NEWS (from rev 8704, icecast/trunk/ices0/NEWS)

Deleted: icecast/branches/ices0/pipe/README
===================================================================
--- icecast/trunk/ices0/README	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/README	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,327 +0,0 @@
-
-                                  Ices Manual
-   __________
-   
-    A. Introduction
-    B. What's it for?
-    C. What can it do?
-         1. Cue file 
-         2. Signal Handling 
-         3. Playlist Handling 
-         4. Reencoding 
-	 5. Vorbis, FLAC and MP4 transcoding
-	 6. Crossfading
-    D. Configuring 
-         1. Command line options 
-         2. Configuration file (ices.conf) 
-    E. Licensing 
-    F. Developers resources 
-                                  _______
-   
-    A. Introduction
-       For a very long time, the only good streaming tool for command
-       line systems was shout. Shout had a lot of issues, it was a quick
-       and dirty hack, it was buggy, it was sending data too fast or too
-       slow, and it was just something no one wanted to fix. So we
-       rewrote it from scratch, and the next generation streamer, 'ices',
-       is here. 'ices' is short for 'icesource', a source for the icecast
-       server. 'ices' should be pronounced 'isis' like the egyptian
-       godess of fertility. For more information about icecast, I suggest
-       you check out the icecast webpage at http://www.icecast.org/.
-    B. What's it for?
-       ices, armed with a list of mp3 files, sends a continuous stream of
-       mp3 data to an icecast server. The server is then responsible for
-       accepting client connections and feeding the mp3 stream to them.
-       But the stream originates in the streamer, 'ices'. The terms
-       'encoder', 'streamer' and 'source' are used equivalently
-       throughout this document, and throughout all the documentation in
-       the streaming system.
-    C. What can it do?
-         1. Cue file
-            The cue file holds information on the file that ices is
-            currently feeding to the server. This is neat for you people
-            out there who like running scripts. I myself, use the cue
-            file in a tcl script, running from a eggdrop bot, on irc.
-            That way I can ask the bot what song is currently playing,
-            how long it is, how much of it has been played, and get
-            information about the next songs on the playlist.
-            The file currently has the following lines, (in this order).
-               o filename
-               o size (in bytes)
-               o bitrate (in kbits/s)
-               o minutes:seconds (total song length)
-               o percent played (i.e 25, no %-sign)
-               o playlist line index (i.e 3, if we're playing the 4:th
-                 line in the internal playlist. Logical, huh? ) Also, for
-                 you scripting people, when ices starts, it writes its
-                 process id to the file ices.pid.
-               o ID3 Artist
-               o ID3 Title
-         2. Signal handling
-               o Sending SIGINT to ices will make it exit.
-               o Sending SIGHUP to ices will make it close and reopen the
-                 logfile.
-         3. Reencoding
-            If compiled with support for reencoding using libmp3lame, and
-            you supply the -R command line option or set the
-            Execution/Reencode to 1 in the XML config file, then ices
-            will start reencoding your files on the fly to the bitrate
-            you specified with the -b option or the Stream/Bitrate tag.
-            The sample rate, number of channels, etc, will be chosen on
-            the fly by lame itself, unless you specify something using
-            the -H and -N options.
-            If you want to change it, I suggest you add support for this
-            to ices and mail me a patch.
-            I think you should be fine with whatever lame chooses though.
-            Also, please make sure that your files are ok before you
-            start reencoding them with ices. This is because the mpglib
-            part of lame (what does the decoding) is rather unstable and
-            will call exit(0) when errors are encountered.
-            This will make ices exit, which is kinda bad :)
-	    You'll need at least lame 3.88beta, and current CVS is a bit
-	    better.
-         4. Playlist handling
-            About 96% of all emails I got about shout was people asking
-            me to add small changes to shout playlist handling to suit
-            their specific needs. This is course is not how I want to
-            spend my life :) Shout had a feature to call an external
-            program with a system() call, before each song, and that
-            could possibly modify the playlist. This was rather ugly, but
-            did the trick. In ices, we take this a step further an
-            include scripting support inside the program. You can write
-            your own playlist handler in perl or python, whatever you
-            prefer. Your script module has to define 5 functions; test,
-            init, shutdown, get_next, and get_current_lineno. I suggest
-            you take a look in the distributed module files and just
-            expand on that.
-	 5. Vorbis, FLAC and MP4 transcoding
-            If compiled with the appropriate libraries, ices can transcode
-            Ogg Vorbis, FLAC and MP4 (AAC) audio files to MP3 on the fly. Keep
-	    your sources in whatever format you like best.
-	 6. Crossfading
-	    If compiled with reencoding support, ices can also crossfade
-            between tracks, giving you that pro radio station sound.
-    D. Configuring
-       ices can do everything shout could do, and more. It can be
-       configured through hard coded defaults, a configfile, and command
-       line options. The configfile is in XML, but don't get scared and
-       run off. Just edit the distributed configfile and change the
-       values you need. The command line options should be familiar to
-       old shout users, although some options have been renamed.
-         1. Command line options
-            Options:
-               o -B (Background (daemon mode))
-               o -b <stream bitrate>
-               o -C <crossfade seconds>
-               o -c <configfile>
-               o -D <base directory>
-               o -d <stream description>
-               o -f <dumpfile on server>
-               o -F <playlist>
-               o -g <stream genre>
-               o -h <host>
-               o -i (use icy headers)
-               o -M <interpreter module>
-               o -m <mountpoint>
-               o -n <stream name>
-               o -p <port>
-               o -P <password>
-               o -r (randomize playlist)
-               o -s (private stream)
-               o -S <perl|python|builtin>
-               o -u <stream url>
-               o -N <Reencoded number of channels>
-               o -H <Reencoded sample rate>
-         2. Configuration file (icec.conf)
-            Here's a sample configuration file. It's the same as the
-            ices.conf.dist that is included in the ices distribution.
-
-                        <?xml version="1.0"?>
-                        <ices:Configuration xmlns:ices="http://www.icecast.org/
-projects/ices">
-                        <Playlist>
-                                <File>apan.txt</File>
-                                <Randomize>1</Randomize>
-                                <Type>builtin</Type>
-                                <Module>ices</Module>
-				<Crossfade>0</Crossfade>
-                        </Playlist>
-                        <Server>
-                                <Hostname>localhost</Hostname>
-                                <Port>8000</Port>
-                                <Password>letmein</Password>
-                                <Protocol>http</Protocol>
-                        </Server>
-                        <Execution>
-                                <Background>0</Background>
-                                <Verbose>1</Verbose>
-                                <BaseDirectory>/tmp</BaseDirectory>
-                                <Reencode>0</Reencode>
-                                <Samplerate>-1</Samplerate>
-                                <Channels>-1</Channels>
-                        </Execution>
-                        <Stream>
-                                <Name>Cool ices default name from XML</ice
-s:Name>
-                                <Genre>Cool ices genre from XML</Genr
-e>
-                                <Description>Cool ices description from XM
-L</Description>
-                                <URL>Cool ices URL from XML</URL>
-                                <Bitrate>128</Bitrate>
-                                <Public>1</Public>
-                        </Stream>
-                        </ices:Configuration>
-                         3. Configurations options
-            This describes all the different options in ices.
-               o Server Hostname
-                 Command line option: -h <host>
-                 Config file tag: Server/Hostname
-                 This is the name, or ip, of the host ices should connect
-                 to. It has to run a streaming server, capable of the
-                 xaudiocast or icy protocol.
-                 This value defaults to localhost.
-               o Server Port
-                 Command line option: -p <port>
-                 Config file tag: Server/Port
-                 This is the port the server is listening on, by default
-                 8000.
-               o Server Password
-                 Command line option: -P <password>
-                 Config file tag: Server/Password
-                 The encoder password for the server. If this is not
-                 correct, then ices cannot log in on the server, and ices
-                 will exit.
-               o Server Protocol
-                 Command line option: -i for icy-headers
-                 Config file tag: Server/Protocol
-                 Either xaudiocast or icy. Use xaudiocast if you can, and
-                 icy if you must.
-               o Execution Background
-                 Command line option: -B
-                 Config file tag: Execution/Background
-                 This will launch ices in the background, as a daemon.
-               o Execution Verbose
-                 Command line option: -v
-                 Config file tag: Execution/Verbose
-                 Normally ices outputs what stream is playing and a small
-                 amount of extra information. With verbose turned on, you
-                 get a whole lot of debugging information and lots of
-                 track info.
-               o Execution Base Directory
-                 Command line option: -D <directory>
-                 Config file tag: Execution/BaseDirectory
-                 ices uses this directory for cue files, log files and
-                 temporary playlist files. You need write permissions in
-                 this directory. The default is /tmp
-               o Execution Reencode
-                 Command line option: -R (turns reencoding on)
-                 Config file tag: Execution/Reencode
-                 When you turn this option on, ices (if compiled with
-                 libmp3lame support) will reencode your mp3 files on the
-                 fly to whatever bitrate you specify with the Stream
-                 Bitrate option.
-                 PLEASE note that if your files are corrupt, this might
-                 crash ices because the library used to decode (mpglib)
-                 is not very stable. I suggest you check your files with
-                 mp3check or some other mp3 verification program before
-                 you add them to your playlist. Just popping them into
-                 your favourite player and checking the sound is
-                 definately not enough.
-                 For legal reasons, this option is not available on the
-                 binary distributions.
-               o Execution Samplerate
-                 Command line option: -H <samplerate>
-                 Config file tag: Execution/Samplerate
-                 Use this to force liblame reencoding to output mp3 data
-                 with this samplerate.
-               o Execution Channels
-                 Command line option: -N <number of channels>
-                 Config file tag: Execution/Channels
-                 Use this to force liblame reencoding to output mp3 data
-                 with this many channels.
-               o Stream Mountpoint
-                 Command line option: -m <mount point>
-		 Config file tag: Stream/Mountpoint
-                 This is the name of the mountpoint for this stream on the
-                 icecast server. Clients can access this stream at
-		 http://host:port/<mount point>.
-                 NOTE: This option does nothing if you are running in shoutcast
-                 compatibility mode.
-               o Stream Name
-                 Command line option: -n <stream name>
-                 Config file tag: Stream/Name
-                 This is the name of the stream, not to be confused with
-                 the name of the song playing.
-               o Stream Genre
-                 Command line option: -g <stream genre>
-                 Config file tag: Stream/Genre
-                 This is the genre of your stream, e.g Jazz or Static.
-               o Stream Description
-                 Command line option: -d <stream description>
-                 Config file tag: Stream/Description
-                 This option is a description of your stream.
-               o Stream URL
-                 Command line option: -u <URL>
-                 Config file tag: Stream/URL
-                 This should be a URL describing your stream.
-               o Stream Bitrate
-                 Command line option: -b <bitrate>
-                 Config file tag: Stream/Bitrate
-                 If you turn on reencoding then this will be the bitrate
-                 of the stream, otherwize the actual bitrate of the
-                 stream is the bitrate your files are encoded at, and
-                 this value is for displaying purposes only.
-                 Read the last 3 lines again, please.
-               o Stream Public
-                 Command line option: -s (makes stream private)
-                 Config file tag: Stream/Public
-                 This regulates whether the icecast server will display
-                 your stream on a directory server. Default is 1 (yes).
-               o Playlist File
-                 Command line option: -F <file>
-                 Config file tag: Playlist/File
-                 This is the file where ices originally looks for files
-                 to play.
-                 When using playlist modules in perl or python, this
-                 argument is passed to the playlist handler.
-               o Playlist Randomize
-                 Command line option: -r (randomizes file)
-                 Config file tag: Playlist/Randomize
-                 This option is passed to the playlist handler, and tells
-                 it to randomize the playlist.
-               o Playlist Type
-                 Command line option: -S <perl|python|builtin>
-                 Config file tag: Playlist/Type
-                 By default, ices using a builtin playlist handler. It
-                 handles randomization and not much more. Most people
-                 want sophisticated playlist handlers that interface
-                 databases and keeps track of god knows what. ices
-                 handles embedded python and embedded perl, so now you
-                 can write your own modules, without modifying ices, that
-                 does just about anything. Use this option to change the
-                 playlist handler type from builtin (default), to python
-                 or perl.
-               o Playlist Module
-                 Command line option: -M <module>
-                 Config file tag: Playlist/Module
-                 Use this option to execute a different python or perl
-                 module than the default.
-                 Default for python is ices.py and default for perl is
-                 ices.pm, although do NOT specify the file extension for
-                 the module. Use 'whatever' instead of 'whatever.pm' or
-                 'whatever.py'
-	       o Playlist Crossfade
-                 Command line option: -C <crossfade secs>
-                 Config file tag: Playlist/Crossfade
-                 If this is greater than zero, and you have reencoding support,
-                 ices will crossfade the specified number of seconds between tracks.
-    E. Licensing
-       ices is licensed under the Gnu General Public License, and for
-       more info about that I suggest you read the file named COPYING.
-    F. Developers resources
-       If you want to write your own streaming software, or perhaps a
-       nice streaming mp3 client, go to developer.icecast.org.
-                                  _______
-   
-    This document was originally written by Alexander Haväng [eel at icecast.org].

Copied: icecast/branches/ices0/pipe/README (from rev 8704, icecast/trunk/ices0/README)

Deleted: icecast/branches/ices0/pipe/README.playlist
===================================================================
--- icecast/trunk/ices0/README.playlist	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/README.playlist	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,45 +0,0 @@
-Ices Playlist Management
-------------------------
-
-Often the built-in playlist capabilities of ices are not enough. Luckily,
-ices can also be controlled by a perl or python script. Some ideas for
-scripts: to produce fancier metadata, call out to a database, insert
-station IDs every half an hour...
-
-The impatient should be able to figure out what they need to do by
-reading the ices.pm.dist or ices.py.dist (for perl or python,
-respectively) included in the ices distribution. Others should keep
-reading.
-
-The following methods may be defined:
-
-ices_get_next
--------------
-This method is the only required method. It is called by ices at
-startup or when it has finished playing the previous file. It should
-return the path to a track. Returning an empty string will signal
-ices to shut down.
-
-ices_init
----------
-If this method is defined, it will be called before any other
-method in your script. A return value other than 1 indicates
-that your script has failed to initialize and ices should
-terminate.
-
-ices_shutdown
--------------
-If this method is defined, it will be called before ices
-exits.
-
-ices_get_metadata
------------------
-If this method is defined, it will be called after ices_get_next
-and the result will be used as the current track title on
-the icecast server.
-
-ices_get_lineno
----------------
-If this method is defined, it will be called after ices_get_next
-and the result will be used for the line number field of the cue
-file. You probably won't be interested in this method.

Copied: icecast/branches/ices0/pipe/README.playlist (from rev 8704, icecast/trunk/ices0/README.playlist)

Deleted: icecast/branches/ices0/pipe/conf/Makefile.am
===================================================================
--- icecast/trunk/ices0/conf/Makefile.am	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/conf/Makefile.am	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,8 +0,0 @@
-## Process this with automake to create Makefile.in
-
-AUTOMAKE_OPTIONS = foreign
-
-sysconf_DATA = ices.conf.dist
-mod_DATA = ices.py.dist ices.pm.dist
-
-EXTRA_DIST = $(sysconf_DATA) $(mod_DATA)

Copied: icecast/branches/ices0/pipe/conf/Makefile.am (from rev 8704, icecast/trunk/ices0/conf/Makefile.am)

Deleted: icecast/branches/ices0/pipe/conf/ices.conf.dist.in
===================================================================
--- icecast/trunk/ices0/conf/ices.conf.dist.in	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/conf/ices.conf.dist.in	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,78 +0,0 @@
-<?xml version="1.0"?>
-<ices:Configuration xmlns:ices="http://www.icecast.org/projects/ices">
-  <Playlist>
-    <!-- This is the filename used as a playlist when using the builtin 
-	 playlist handler. -->
-    <File>playlist.txt</File>
-    <!-- Set this to 0 if you don't want to randomize your playlist, and to
-	 1 if you do. -->
-    <Randomize>1</Randomize>
-    <!-- One of builtin, perl, or python. -->
-    <Type>builtin</Type>
-    <!-- Module name to pass to the playlist handler if using  perl or python.
-	 If you use the builtin playlist handler then this is ignored -->
-    <Module>ices</Module>
-    <!-- Set this to the number of seconds to crossfade between tracks.
-         Leave out or set to zero to disable crossfading (the default).
-    <Crossfade>5</Crossfade>
-    -->
-  </Playlist>
-
-  <Execution>
-    <!-- Set this to 1 if you want ices to launch in the background as a
-         daemon -->
-    <Background>0</Background>
-    <!-- Set this to 1 if you want to see more verbose output from ices -->
-    <Verbose>0</Verbose>
-    <!-- This directory specifies where ices should put the logfile, cue file
-	 and pid file (if daemonizing). Don't use /tmp if you have l33t h4x0rz
-         on your server. -->
-    <BaseDirectory>/tmp</BaseDirectory>
-  </Execution>
-
-  <Stream>
-    <Server>
-      <!-- Hostname or ip of the icecast server you want to connect to -->
-      <Hostname>localhost</Hostname>
-      <!-- Port of the same -->
-      <Port>8000</Port>
-      <!-- Encoder password on the icecast server -->
-      <Password>letmein</Password>
-      <!-- Header protocol to use when communicating with the server.
-           Shoutcast servers need "icy", icecast 1.x needs "xaudiocast", and
-	   icecast 2.x needs "http". -->
-      <Protocol>http</Protocol>
-    </Server>
-
-    <!-- The name of the mountpoint on the icecast server -->
-    <Mountpoint>/ices</Mountpoint>
-    <!-- The name of the dumpfile on the server for your stream. DO NOT set
-	 this unless you know what you're doing.
-    <Dumpfile>ices.dump</Dumpfile>
-    -->
-    <!-- The name of you stream, not the name of the song! -->
-    <Name>Default stream</Name>
-    <!-- Genre of your stream, be it rock or pop or whatever -->
-    <Genre>Default genre</Genre>
-    <!-- Longer description of your stream -->
-    <Description>Default description</Description>
-    <!-- URL to a page describing your stream -->
-    <URL>http://localhost/</URL>
-    <!-- 0 if you don't want the icecast server to publish your stream on
-	 the yp server, 1 if you do -->
-    <Public>0</Public>
-
-    <!-- Stream bitrate, used to specify bitrate if reencoding, otherwise
-	 just used for display on YP and on the server. Try to keep it
-	 accurate -->
-    <Bitrate>128</Bitrate>
-    <!-- If this is set to 1, and ices is compiled with liblame support,
-	 ices will reencode the stream on the fly to the stream bitrate. -->
-    <Reencode>0</Reencode>
-    <!-- Number of channels to reencode to, 1 for mono or 2 for stereo -->
-    <!-- Sampe rate to reencode to in Hz. Leave out for LAME's best choice
-    <Samplerate>44100</Samplerate>
-    -->
-    <Channels>2</Channels>
-  </Stream>
-</ices:Configuration>

Copied: icecast/branches/ices0/pipe/conf/ices.conf.dist.in (from rev 8704, icecast/trunk/ices0/conf/ices.conf.dist.in)

Copied: icecast/branches/ices0/pipe/conf/ices.sh.dist (from rev 8704, icecast/trunk/ices0/conf/ices.sh.dist)

Deleted: icecast/branches/ices0/pipe/configure.ac
===================================================================
--- icecast/trunk/ices0/configure.ac	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/configure.ac	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,409 +0,0 @@
-# configure script for ices
-# $Id$
-
-m4_define(ICES_MAJOR, 0)
-m4_define(ICES_MINOR, 4)
-m4_define(ICES_MICRO, 0)
-m4_define(ICES_VERSION,
-  m4_if(ICES_MICRO, 0, ICES_MAJOR.ICES_MINOR, ICES_MAJOR.ICES_MINOR.ICES_MICRO))
-
-AC_INIT([ices], ICES_VERSION, [icecast at xiph.org])
-AC_PREREQ(2.52)
-AC_CONFIG_SRCDIR([src/ices.c])
-
-AC_CONFIG_FILES([Makefile src/Makefile src/playlist/Makefile conf/Makefile
- conf/ices.conf.dist doc/Makefile])
-
-VERSION=ICES_VERSION
-
-dnl -- Finally, actual autoconf stuff --
-
-AC_ARG_PROGRAM
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-
-if test "$GCC" = yes
-then
-  CFLAGS="$CFLAGS -Wall"
-fi
-
-dnl -- System check --
-
-AC_CANONICAL_HOST
-AC_AIX
-AC_ISC_POSIX
-AC_MINIX
-
-case $host in
-  *hpux*)
-    CFLAGS="$CFLAGS -D_HPUX_SOURCE -DHPUX"
-    if test "$CC" = cc
-    then
-      CFLAGS="$CFLAGS -Aa"
-    fi
-  ;;
-esac
-
-dnl -- Compiler feature check --
-
-AC_C_CONST
-AC_C_BIGENDIAN
-AC_C_INLINE
-
-dnl -- System header check --
-
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([errno.h fcntl.h signal.h sys/signal.h sys/socket.h \
-  sys/stat.h sys/time.h sys/types.h unistd.h])
-AC_HEADER_TIME
-
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_TYPE_SIGNAL
-
-dnl -- System function check --
-
-AC_FUNC_STRFTIME
-AC_CHECK_FUNCS([vsnprintf setsid setlinebuf])
-
-dnl -- Build system init --
-
-AM_INIT_AUTOMAKE([1.6 foreign])
-AM_MAINTAINER_MODE
-AM_CONFIG_HEADER(config.h)
-AC_PROG_LIBTOOL
-AC_SUBST(LIBTOOL_DEPS)
-
-AC_ARG_WITH(docdir,
-  [[  --with-docdir=DIR       put documentation in DIR [PREFIX/doc/ices]]],
-  [ices_cv_docdir="$with_docdir"],
-  [ices_cv_docdir='${prefix}/doc/ices'])
-
-docdir="$ices_cv_docdir"
-AC_SUBST(docdir)
-
-AC_ARG_WITH(moddir,
-  [[  --with-moddir=DIR       put playlist modules in DIR [SYSCONFDIR/modules]]],
-  [ices_cv_moddir="$with_moddir"],
-  [ices_cv_moddir='${sysconfdir}/modules'])
-
-moddir="$ices_cv_moddir"
-AC_SUBST(moddir)
-
-dnl -- Required extra libraries --
-
-XIPH_PATH_SHOUT(, [AC_MSG_ERROR([Could not find a usable libshout])])
-CFLAGS="$CFLAGS $SHOUT_CPPFLAGS $SHOUT_CFLAGS"
-LIBS="$LIBS $SHOUT_LIBS"
-
-dnl -- Optional features --
-AC_CACHE_SAVE
-
-AC_ARG_WITH(xml-config,
-  [  --with-xml-config=PATH  use xml-config in PATH to find libxml ])
-
-have_xml="no"
-if test "$with_xml_config" != "no"
-then
-  if test -n "$with_xml_config" -a "$with_xml_config" != "yes"
-  then
-    XMLCONFIG="$with_xml_config"
-    if ! test -x "$XMLCONFIG"
-    then
-      AC_MSG_ERROR([$with_xml_config cannot be run])
-    fi
-  else
-    AC_CHECK_PROGS(XMLCONFIG, [xml2-config xml-config])
-  fi
-
-  if test -n "$XMLCONFIG"
-  then
-    AC_DEFINE(HAVE_LIBXML, 1, [Define if you have the GNOME XML library])
-    LIBS="$LIBS `$XMLCONFIG --libs`"
-    CPPFLAGS="$CPPFLAGS `$XMLCONFIG --cflags`"
-    ICES_OBJECTS="$ICES_OBJECTS ices_config.o"
-    have_xml="yes"
-  else
-    AC_MSG_RESULT([Compiling without libxml support - no configfiles])
-  fi
-fi
-AM_CONDITIONAL(USE_XML, test "$have_xml" = "yes")
-
-AC_ARG_WITH([python],
-  [[  --with-python[=PATH]    include python scripting support]],
-  [enable_python="$with_python"],
-  [enable_python="yes"])
-
-have_python="no"
-if test "$enable_python" != "no"
-then
-  XIPH_PATH_PYTHON([$enable_python])
-  if test -n "$PYTHON_LIBS"
-  then
-    have_python="yes"
-    CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
-    LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
-    LIBS="$LIBS $PYTHON_LIBS"
-    PLAYLIST_OBJECTS="$PLAYLIST_OBJECTS pm_python.o"
-    AC_DEFINE(HAVE_LIBPYTHON, 1, [Define if you have the python library])
-  fi
-fi
-
-if test "$with_python" != "no" -a "$have_python" != "yes"
-then
-  if test -n "$with_python"
-  then
-    AC_MSG_ERROR([Could not link to python])
-  else
-    AC_MSG_RESULT([Could not link to python, python scripting disabled])
-  fi
-fi
-
-AC_ARG_WITH(perl,
-  [[  --with-perl[=PATH]      include perl scripting support]])
-
-have_perl="no"
-PERL=perl
-if test "$with_perl" != "no"
-then
-  if test -n "$with_perl" -a "$with_perl" != "yes"
-  then
-    PERL="$with_perl"
-    if ! test -x "$PERL"
-    then
-      AC_MSG_ERROR([Perl not found in the specified location])
-    fi
-  fi
-
-  PERLCFLAGS=`$PERL -MExtUtils::Embed -e ccopts`
-  PERLLIBS=`$PERL -MExtUtils::Embed -e ldopts`
-
-  saved_CPPFLAGS="$CPPFLAGS"
-  saved_LIBS="$LIBS"
-  CPPFLAGS="$CPPFLAGS $PERLCFLAGS"
-  LIBS="$LIBS $PERLLIBS"
-
-  AC_CHECK_FUNCS(perl_construct)
-  if test "$ac_cv_func_perl_construct" != "no"
-  then
-    have_perl="yes"
-    PLAYLIST_OBJECTS="$PLAYLIST_OBJECTS pm_perl.o"
-    AC_DEFINE(HAVE_LIBPERL, 1, [Define if you have perl libraries])
-  else
-    CPPFLAGS="$saved_CPPFLAGS"
-    LIBS="$saved_LIBS"
-  fi
-fi
-
-if test "$with_perl" != "no" -a "$have_perl" != "yes"
-then
-  if test -n "$with_perl"
-  then
-    AC_MSG_ERROR([Could not link to perl])
-  else
-    AC_MSG_RESULT([Could not link to perl, perl scripting disabled])
-  fi
-fi
-
-AC_ARG_WITH(lame,
-  [[  --with-lame[=DIR]       enable support for reencoding with lame [in DIR]]])
-
-have_LAME="no"
-if test "$with_lame" != "no"
-then
-  if test -n "$with_lame" -a "$with_lame" != "yes"
-  then
-    CPPFLAGS="$CPPFLAGS -I$with_lame/include"
-    LDFLAGS="$LDFLAGS -L$with_lame/lib"
-  fi
-
-  AC_CHECK_HEADER(lame/lame.h, [
-    have_LAME="maybe",
-    AC_DEFINE(HAVE_LAME_LAME_H, 1, [Use <lame/lame.h> instead of <lame.h>])
-    ], [
-    AC_CHECK_HEADER(lame.h, [
-    have_LAME="maybe"])])
-
-  if test "$have_LAME" != "no"
-  then
-    AC_CHECK_LIB(mp3lame, lame_encode_flush_nogap, [
-      have_LAME="yes"
-      LIBS="$LIBS -lmp3lame"
-      LIBM="-lm"
-      ICES_OBJECTS="$ICES_OBJECTS reencode.o"
-      AC_DEFINE(HAVE_LIBLAME, 1, [Define if you have the LAME MP3 library])
-      
-      AC_CHECK_FUNCS([lame_decode_exit])
-      ], [have_LAME="no"], -lm)
-  fi
-fi
-
-if test "$with_lame" != "no" -a "$have_LAME" != "yes"
-then
-  if test -n "$with_lame"
-  then
-    AC_MSG_ERROR([Could not find a valid LAME library installation])
-  else
-    AC_MSG_RESULT([Could not find a valid LAME library, reencoding disabled])
-  fi
-fi
-
-AC_ARG_WITH(vorbis,
-  [[  --with-vorbis[=DIR]     support for vorbis transcoding using libvorbisfile [in DIR]]])
-
-if test "$have_LAME" != "yes"
-then
-  if test -n "$with_vorbis" -a "$with_vorbis" != "no"
-  then
-    AC_MSG_ERROR([Vorbis cannot be enabled without LAME])
-  elif test "$with_vorbis" != "no"
-  then
-    AC_MSG_RESULT([Vorbis is disabled because LAME is not enabled])
-    with_vorbis="no"
-  fi
-fi
-
-have_vorbis="no"
-if test "$with_vorbis" != "no"
-then
-  if test -n "$with_vorbis" -a "$with_vorbis" != "yes"
-  then
-    CPPFLAGS="$CPPFLAGS -I$with_vorbis/include"
-    LDFLAGS="$LDFLAGS -L$with_vorbis/lib"
-  fi
-
-  AC_CHECK_HEADER(vorbis/vorbisfile.h, have_vorbis="maybe")
-  if test "$have_vorbis" != "no"
-  then
-    AC_CHECK_LIB(vorbisfile, ov_open, [
-      LIBS="$LIBS -lvorbisfile -lvorbis -logg"
-      AC_DEFINE(HAVE_LIBVORBISFILE, 1, [Define if you have libvorbisfile])
-      ICES_OBJECTS="$ICES_OBJECTS in_vorbis.o"
-      have_vorbis="yes"
-    ],[have_vorbis="no"],-lvorbis -logg)
-  fi
-fi
-
-if test "$with_vorbis" != "no" -a "$have_vorbis" != "yes"
-then
-  if test -n "$with_vorbis"
-  then
-    AC_MSG_ERROR([Could not find libvorbisfile])
-  else
-    AC_MSG_RESULT([Could not find libvorbisfile, vorbis support disabled])
-  fi
-fi
-
-AC_ARG_WITH(faad,
-  [[  --with-faad[=DIR]     support for MP4 (AAC) transcoding using libfaad [in DIR]]])
-
-if test "$have_LAME" != "yes"
-then
-  if test -n "$with_faad" -a "$with_faad" != "no"
-  then
-    AC_MSG_ERROR([MP4 transcoding cannot be enabled without LAME])
-  elif test "$with_faad" != "no"
-  then
-    AC_MSG_RESULT([MP4 transcoding is disabled because LAME is not enabled])
-    with_faad="no"
-  fi
-fi
-
-have_faad="no"
-if test "$with_faad" != "no"
-then
-  if test -n "$with_faad" -a "$with_faad" != "yes"
-  then
-    CPPFLAGS="$CPPFLAGS -I$with_faad/include"
-    LDFLAGS="$LDFLAGS -L$with_faad/lib"
-  fi
-
-  AC_CHECK_HEADER(faad.h, have_faad="maybe")
-  if test "$have_faad" != "no"
-  then
-    AC_CHECK_LIB(mp4v2, MP4Read, [
-      LIBS="$LIBS -lmp4v2 -lfaad"
-      AC_DEFINE(HAVE_LIBFAAD, 1, [Define if you have libfaad])
-      ICES_OBJECTS="$ICES_OBJECTS in_mp4.o"
-      have_faad="yes"
-    ],[have_faad="no"])
-  fi
-fi
-
-if test "$with_faad" != "no" -a "$have_faad" != "yes"
-then
-  if test -n "$with_faad"
-  then
-    AC_MSG_ERROR([Could not find libfaad])
-  else
-    AC_MSG_RESULT([Could not find libfaad, MP4 transcoding disabled])
-  fi
-fi
-
-AC_ARG_WITH(flac,
-  [[  --with-flac[=DIR]     support for FLAC transcoding using libFLAC [in DIR]]])
-
-if test "$have_LAME" != "yes"
-then
-  if test -n "$with_flac" -a "$with_flac" != "no"
-  then
-    AC_MSG_ERROR([FLAC transcoding cannot be enabled without LAME])
-  elif test "$with_flac" != "no"
-  then
-    AC_MSG_RESULT([FLAC transcoding is disabled because LAME is not enabled])
-    with_flac="no"
-  fi
-fi
-
-have_flac="no"
-if test "$with_flac" != "no"
-then
-  if test -n "$with_flac" -a "$with_flac" != "yes"
-  then
-    CPPFLAGS="$CPPFLAGS -I$with_flac/include"
-    LDFLAGS="$LDFLAGS -L$with_flac/lib"
-  fi
-
-  AC_CHECK_HEADER(faad.h, have_flac="maybe")
-  if test "$have_flac" != "no"
-  then
-    AC_CHECK_LIB(FLAC, FLAC__stream_decoder_new, [
-      LIBS="$LIBS -lFLAC"
-      AC_DEFINE(HAVE_LIBFLAC, 1, [Define if you have libFLAC])
-      ICES_OBJECTS="$ICES_OBJECTS in_flac.o"
-      have_flac="yes"
-    ],[have_flac="no"])
-  fi
-fi
-
-if test "$with_flac" != "no" -a "$have_flac" != "yes"
-then
-  if test -n "$with_flac"
-  then
-    AC_MSG_ERROR([Could not find libFLAC])
-  else
-    AC_MSG_RESULT([Could not find libFLAC, FLAC transcoding disabled])
-  fi
-fi
-
-dnl -- and finish up --
-
-LIBS="$LIBS $LIBM $LIBDL"
-AC_SUBST(ICES_OBJECTS)
-AC_SUBST(PLAYLIST_OBJECTS)
-
-AC_OUTPUT
-
-AC_MSG_RESULT([Compiling with: $CPPFLAGS $CFLAGS])
-AC_MSG_RESULT([Linking with: $LDFLAGS $LIBS])
-AC_MSG_RESULT([Features:])
-AC_MSG_RESULT([  XML     : $have_xml])
-AC_MSG_RESULT([  Python  : $have_python])
-AC_MSG_RESULT([  Perl    : $have_perl])
-AC_MSG_RESULT([  LAME    : $have_LAME])
-AC_MSG_RESULT([  Vorbis  : $have_vorbis])
-AC_MSG_RESULT([  MP4     : $have_faad])
-AC_MSG_RESULT([  FLAC    : $have_flac])

Copied: icecast/branches/ices0/pipe/configure.ac (from rev 8764, icecast/trunk/ices0/configure.ac)

Deleted: icecast/branches/ices0/pipe/doc/ices.1.in
===================================================================
--- icecast/trunk/ices0/doc/ices.1.in	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/doc/ices.1.in	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,302 +0,0 @@
-.TH "ices" "1" "July 2004" "ices @VERSION@" "Icecast media streaming system"
-.SH NAME
-ices \- stream MP3 audio to an icecast server
-
-.SH SYNOPSIS
-.B ices
-.RB [\| \-BVv \|]
-.\" Configuration path
-.RB [\| \-c
-.IR configfile \|]
-.\" Playlist options
-.RB [\| \-D
-.IR basedir \|]
-.RB [\| \-S\ builtin
-.RB [\| \-F
-.IR playlist \|]
-.RB [\| \-r \|]\|]\||[\| \-S
-.BR python \|| perl
-.RB [\| \-M
-.IR module \|]\|]
-.RB [\| \-C
-.IR crossfadesecs \|]
-.\" Server options
-.RB [\|[\| \-m
-.IR mount \|]
-.RB [\| \-h
-.IR host \|]
-.RB [\| \-p
-.IR port \|]
-.RB [\| \-P
-.IR password \|]
-.RB [\| \-t
-.IR protocol \|]
-.\" Stream options
-.RB [\| \-n
-.IR name \|]
-.RB [\| \-g
-.IR genre \|]
-.RB [\| \-d
-.IR description \|]
-.RB [\| \-u
-.IR url \|]
-.RB [\| -s \|]
-.RB [\| \-b
-.IR bitrate \|]
-.RB [\| \-f
-.IR dumpfile \|]
-.RB [\|[\| -R \|]
-.RB [\| \-H
-.IR samplerate \|]
-.RB [\| \-N
-.IR channels \|]\|]\|]\ .\|.\|.
-
-.nh
-.SH DESCRIPTION
-ices is a small but powerful and flexible encoder for icecast
-servers. Its features include:
-.IP \(bu
-A scripting interface to its playlist engine, using either python or
-perl as you prefer, in addition to a builtin static file server.
-Fetch your tracks from a database or update a webpage at each track
-change in a simple and robust way.
-.IP \(bu
-ices can read source audio from a FIFO. Between this and the script
-interface, it should be fairly easy to handle as complicated a
-media-delivery system as you can think up.
-.IP \(bu
-On-the-fly reencoding of your source audio to a different bitrate,
-number of channels and/or sample rate. ices can also decode Ogg Vorbis
-files and reencode them on the fly as MP3, for the benefit of older
-listening software. This just in: it can transcode FLAC and MP4 (AAC)
-files now too. Keep your sources in whatever format you prefer.
-.IP \(bu
-Crossfading between tracks. This is a new feature, and requires
-reencoding support.
-.IP \(bu
-Multiple streams from the same playlist. In conjunction with
-reencoding this gives you a very easy way to provide the same music
-for broadband and narrowband listeners at the same time.
-.IP \(bu
-A constantly-updated cue file containing up to the second information
-about which track is currently playing, how much has been played, and
-other details.
-
-.SH OPTIONS
-.SS "Execution options"
-.TP
-.B \-B
-Detach from the console and run in the background.
-.TP
-.BI \-c \ configfile
-Load configuration options from
-.IR configfile ,
-instead of the default. Command line options will override these.
-.TP
-.BI \-D \ basedir
-Write the log and cue file to
-.IR basedir .
-.TP
-.B \-V
-Show version information and compile-time options and exit.
-.TP
-.B \-v
-Run in verbose mode.
-
-.SS "Playlist options"
-.TP
-.BI \-S \ interpreter
-Chooses which playlist interpreter ices will use to find source audio
-files for streaming. May be one of
-.BR builtin , \ python ,\ or \ perl .
-The default is
-.BR builtin .
-.TP
-.BI \-F \ playlist
-If using the
-.B builtin
-playlist interpreter, this option specifies the location of the
-.I playlist
-file ices will read to find audio files. This file simply contains
-the paths to audio files, one per line.
-If not using the
-.B builtin
-interpreter, this options does nothing.
-.TP
-.B \-r
-Select songs from the playlist file in random order. If not using the
-.B builtin
-interpreter, this option does nothing.
-.TP
-.BI \-M \ module
-If using the
-.BR perl \ or \ python
-playlist modules, load the module named
-.I module
-instead of the default, 
-.BR ices .
-Otherwise this option does nothing.
-.TP
-.BI \-C \ crossfadesecs
-Crossfade between tracks. The length of the fade is
-.I crossfade
-seconds. This option requires reencoding support.
-
-.SS "Stream options"
-.TP
-.BI \-m \ mount
-Create a stream on the icecast server accessible at the mountpoint
-.IR mount .
-Clients may access your stream at
-.RI http:// host : port / mount .
-This option may be specified more than once to create multiple streams
-out of the same playlist. All stream options following each mount
-option apply to that mount only.
-
-If this option is not specified, an implicit mount named
-.B ices
-is implied.
-.TP
-.BI \-h \ host
-Connect to the icecast server on
-.IR host ,
-instead of the default,
-.BR localhost .
-.TP
-.BI \-p \ port
-Connect to the icecast server on
-.IR port ,
-instead of the default,
-.BR 8000 .
-.TP
-.BI \-P \ password
-Log into the icecast server using the password
-.IR password .
-.TP
-.BI \-t \ protocol
-Connect to the server using the streaming protocol
-.IR protocol .
-Protocol should be one of
-.BR http , \ xaudiocast ,\ or \ icy ,
-depending on whether your server is icecast 2, icecast 1,
-or shoutcast compatible, respectively. The default is
-.BR http .
-(Shoutcast would be most compatible but, unfortunately, that
-protocol does not support multiple mount points).
-.TP
-.BI \-n \ name
-Set the name of this stream to
-.IR name .
-.TP
-.BI \-g \ genre
-Set the genre of this stream to
-.IR genre .
-.TP
-.BI \-d \ description
-Set the description of this stream to
-.IR description .
-.TP
-.BI \-u \ url
-Set the URL of this stream to
-.IR url .
-.TP
-.B \-s
-Do not mark this stream as public. This instructs the icecast server
-not to update directory servers with information about this stream.
-.TP
-.BI \-b \ bitrate
-Set the bitrate of this stream to
-.IR bitrate .
-Unless reencoding is also enabled on this stream, this option is only
-informational.
-.TP
-.BI \-f \ dumpfile
-Write the contents of the stream to a file named
-.I dumpfile
-on the server. Use this option with care.
-.TP
-.B \-R
-Reencode this stream at the bitrate specified with the
-.B \-b
-option.
-.TP
-.BI \-H \ samplerate
-If reencoding, set the output sample rate to
-.IR samplerate .
-.TP
-.BI \-N \ channels
-If reencoding, set the number of output channels to
-.IR channels .
-May be
-.B 1
-for mono output or
-.B 2
-for stereo output. At low bitrates setting this to
-.B 1
-is a good way to improve sound quality.
-
-.SH "PLAYLIST SCRIPTING"
-In addition to its simple builtin playlist handler, ices can
-optionally call out to either a python or perl module for track
-information. Your module may define the following functions:
-
-.TP
-.B ices_init
-This function is called once when ices starts up, giving your module a
-chance to initialize itself (make database connections etc.). If this
-function returns a negative result, ices will terminate.
-.TP
-.B ices_shutdown
-This function is called before ices quits, to give your module a
-chance to free any resources it may have allocated.
-.TP
-.B ices_get_next
-This function is called at each track change. Your module should
-return a string containing the path to the next audio file to be
-played.
-.TP
-.B ices_get_metadata
-This function is called after
-.BR ices_get_next .
-If it returns a string, ices will use it as the title to be streamed
-instead of trying to build one from the ID3 or vorbis comment tags, or
-the filename if neither of those are available.
-.TP
-.B ices_get_lineno
-This function is also called after ices_get_next. Your module may
-return a number which will be inserted in the cue file as the current
-line number in the playlist. It serves no other purpose.
-
-Your module must at least define the 
-.B ices_get_next
-function. All others are optional.
-
-.SH "SIGNAL HANDLING"
-Ices handles the following signals specially:
-.TP
-.B SIGINT
-Causes ices to perform a clean shutdown.
-.TP
-.B SIGHUP
-Causes ices to close and reopen the log file and the playlist. It will also
-reload and restart the playlist script if you're using one.
-.TP
-.B SIGUSR1
-Causes ices to skip to the next track in the playlist immediately.
-
-.SH FILES
-.TP
-.I @sysconfdir@/ices.conf
-Default XML configuration file. May be overriden with
-.BR -c .
-.TP
-.I @moddir@/ices.py
-Default path to the python playlist module.
-.TP
-.I @moddir@/ices.pm
-Default path to the perl playlist module.
-
-.SH AUTHORS
-ices was originally written by Alexander Haväng <eel at icecast.org>.
-.P
-It is currently developed by Brendan Cully <brendan at icecast.org>.

Copied: icecast/branches/ices0/pipe/doc/ices.1.in (from rev 8704, icecast/trunk/ices0/doc/ices.1.in)

Deleted: icecast/branches/ices0/pipe/doc/icesmanual.html
===================================================================
--- icecast/trunk/ices0/doc/icesmanual.html	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/doc/icesmanual.html	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,473 +0,0 @@
-<html>
-<head><title>How to configure and run ices, the icecast streamer</title>
-</head>
-
-<body>
-
-<h1>Ices Manual</h1>
-<p align="left">
-
-<ol type=A>
-    <li> <a href="#section_introduction">Introduction</a></li>
-    <li> <a href="#section_purpose">What's it for?</a></li>
-    <li> <a href="#section_features">What can it do?</a>
-	 <ol type=1>
-		<li> <a href="#features_cue">Cue file </a></li>
-		<li> <a href="#features_signals">Signal Handling </a></li>
-		<li> <a	href="#features_reencoding">Reencoding</a></li>
-		<li> <a href="#features_crossfading">Crossfading</a></li>
-	        <li> <a href="#features_multistream">Multiple streams</a></li>
-		<li> <a href="#features_playlists">Playlist Handling </a></li>
-	</ol>
-    </li>	
-    <li> <a href="#section_configuring"> Configuring </a>
-         <ol type=1>
-             <li> <a href="#configure_commandlineoptions"> Command line options </a> </li>
-             <li> <a href="#configure_configurationfile"> Configuration file (ices.conf) </a> </li>
-         </ol>
-    </li>
-    <li> <a href="#section_licensing"> Licensing </a>
-    <li> <a href="#section_developer"> Developers resources </a></li>
-</ol>
-</p>
-
-<hr width="10%">
-
-<p>
-<ol type=A>
-	<li> <a name="section_introduction">Introduction</a>
-		<p>
-For a very long time, the only good streaming tool for command line systems
-was shout. Shout had a lot of issues, it was a quick and dirty hack, it
-was buggy, it was sending data too fast or too slow, and it was just something
-no one wanted to fix.
-
-So we rewrote it from scratch, and the next generation streamer, 'ices', is
-here. 'ices' is short for 'icesource', a source for the icecast server.
-'ices' should be pronounced 'isis' like the egyptian godess of fertility.
-
-For more information about icecast, I suggest you check out the icecast
-webpage at http://www.icecast.org/.
-		</p>
-	</li>
-
-	<li> <a name="section_purpose">What's it for?</a>
-		<p>
-ices, armed with a list of mp3 files, sends a continuous stream of mp3 data
-to an icecast server. The server is then responsible for accepting client
-connections and feeding the mp3 stream to them.
-But the stream originates in the streamer, 'ices'.
-The terms 'encoder', 'streamer' and 'source' are used equivalently throughout
-this document, and throughout all the documentation in the streaming system.
-		</p>
-
-	</li>
-
-	<li> <a name="section_features">What can it do?</a>
-	<ol type=1>
-	<li> <a name="features_cue">Cue file</a>
-	<p>
-The cue file holds information on the file that ices is currently feeding
-to the server. This is neat for you people out there who like running scripts.
-I myself, use the cue file in a tcl script, running from a eggdrop bot, on irc.
-That way I can ask the bot what song is currently playing, how long it is, how
-much of it has been played, and get information about the next songs on the
-playlist.<br>
-The file currently has the following lines, (in this order).<br>
-	<ul>
-		<li>filename</li>
-		<li>size (in bytes)</li>
-		<li>bitrate (in kbits/s)</li>
-		<li>minutes:seconds (total song length)</li>
-		<li>percent played (i.e 25, no %-sign)</li>
-		<li>playlist line index (i.e 3, if we're playing the 4:th line in the internal
-		    playlist. Logical, huh? ) Also, for you scripting people, when ices
-		    starts, it writes its process id to the file ices.pid.</li>
-	        <li>ID3 Artist</li>
-		<li>ID3 Title</li>
-	</ul>
-	</p>
-	</li>
-
-	<li> <a name="features_signals">Signal handling</a>
-	<p>
-	<ul>
-          <li>Sending SIGINT to ices will make it exit.</li>
-	  <li>Sending SIGHUP to ices will make it close and reopen the
-	      logfile and playlist, and reload and restart the playlist script if
-	      you are using one.</li>
-          <li>Sending SIGUSR1 to ices will make it skip to the next track.</li>
-	</ul>
-	</p>
-	</li>
-
-	<li> <a name="features_reencoding">Reencoding </a>
-	<p>
-If compiled with support for reencoding using liblame, and you supply
-the -R command line option or set the Stream/Reencode to 1 in the
-XML config file, then ices will start reencoding your files on the fly
-to the bitrate you specified with the -b option or the Stream/Bitrate
-tag.
-<br>
-If you are reencoding and ices was compiled with vorbis support, you
-may also reencode Ogg Vorbis files as MP3 on the fly. This gives you
-the opportunity to convert your source files to Ogg Vorbis at your
-convenience while still supporting as many listeners as possible.
-Likewise, ices can transcode FLAC and MP4 (AAC) files if you've
-compiled it with FLAC and FAAD libraries, respectively.
-<br>
-The sample rate, number of channels, etc, will be chosen on the fly by
-lame itself, unless you specify something using the -H and -N options.
-I think you should be fine with whatever lame chooses though.
-<br>
-Also, please make sure that your files are ok before you start
-reencoding them with ices. This is because the mpglib part of lame
-(what does the decoding) is rather unstable and will call exit(0) when
-errors are encountered.
-<br>
-This will make ices exit, which is kinda bad :)
-	</p>
-	</li>
-
-	<li> <a name="features_crossfading">Crossfading</a>
-	<p>
-If you've compiled with support for reencoding, you can
-crossfade between tracks (blend the end of one into the start
-of the next). This is controlled by the <tt>-C</tt> command line
-option or the <tt>Playlist/Crossfade</tt> parameter in the
-configuration file. Both of these take an integer argument,
-which is the number of seconds to crossfade.
-Songs less than twice the length of the crossfade requested will not
-be faded. This is handy for eg station IDs.
-        </p>
-	</li>
-
-	<li> <a name="features_multistream">Multiple streams</a>
-        <p>
-You can feed the same playlist simultaneously to different
-mountpoints, by specifying multiple <tt>Stream</tt> sections in the
-config file or passing multiple <tt>-m</tt>options on the command
-line. This is especially useful in conjunction with reencoding because
-you can stream the same music at a high bitrate for broadband
-listeners and simultaneously at a low bitrate for POTS listeners.
-	</p>
-
-	<li> <a name="features_playlists">Playlist handling</a>
-	<p>
-About 96% of all emails I got about shout was people asking me to add small
-changes to shout playlist handling to suit their specific needs.
-This is course is not how I want to spend my life :)
-Shout had a feature to call an external program with a system() call, before
-each song, and that could possibly modify the playlist.
-This was rather ugly, but did the trick.
-In ices, we take this a step further and include scripting support inside the
-program. You can write your own playlist handler in perl or python, whatever
-you prefer.
-<br>
-Your script module has to define at least a function named
-<tt>ices_get_next</tt>, which should return a path to a file or FIFO
-containing MP3 data.
-<br>
-In addition you may define the functions <tt>ices_init</tt> and 
-<tt>ices_shutdown</tt> which will be called by ices once before asking
-for the first song and before shutting down, respectively.
-<br>
-You may also define <tt>ices_get_lineno</tt>, which specifies the line
-number of the current track in the cue file. If you don't use the cue
-file it is safe to omit this function.
-<br>
-Finally you can define <tt>ices_get_metadata</tt> to return a string
-you want to use for title streaming. Ices will call this function once
-per track after calling <tt>ices_get_next</tt>. If this function is
-not defined or returns null, ices will use whatever it can get out of
-the file itself, either tags or the file name.
-<br>
-I suggest you take a look in the distributed module files and just expand on
-that.
-		</p>
-		
-	</li>
-
-	</ol>
-	</li>
-
-	<li> <a name="section_configuring">Configuring</a>
-	    <p>
-ices can do everything shout could do, and more.
-It can be configured through hard coded defaults, a configfile, and command
-line options.
-
-The configfile is in XML, but don't get scared and run off. Just edit the
-distributed configfile and change the values you need.
-
-The command line options should be familiar to old shout users, although 
-some options have been renamed.
-	    </p>
-            <ol type=1>
-             <li> <a name="configure_commandlineoptions"> Command line options </a>
-	      <p>
-		Options:
-		<ul>
-			<li>-B (Background (daemon mode))</li>
-			<li>-b &lt;stream bitrate&gt;</li>
-			<li>-C &lt;crossfade seconds&gt;</li>
-			<li>-c &lt;configfile&gt;</li>
-			<li>-D &lt;base directory&gt;</li>
-			<li>-d &lt;stream description&gt;</li>
-			<li>-f &lt;dumpfile on server&gt;</li>
-			<li>-F &lt;playlist&gt;</li>
-			<li>-g &lt;stream genre&gt;</li>
-			<li>-h &lt;host&gt;</li>
-			<li>-i (use icy headers)</li>
-			<li>-M &lt;interpreter module&gt;</li>
-			<li>-m &lt;mountpoint&gt;</li>
-			<li>-n &lt;stream name&gt;</li>
-			<li>-p &lt;port&gt;</li>
-			<li>-P &lt;password&gt;</li>
-			<li>-r (randomize playlist)</li>
-			<li>-s (private stream)</li>
-			<li>-S &lt;perl|python|builtin&gt;</li>
-			<li>-u &lt;stream url&gt;</li>
-			<li>-N &lt;Reencoded number of channels&gt;</li>
-			<li>-H &lt;Reencoded sample rate&gt;</li>
-		</ul>
-	      </p>
-	     </li>
-Note that each time you specify a mount point with <tt>-m</tt> you are
-creating a new stream, and subsequent stream options will apply only
-to it.
-             <li> <a name="configure_configurationfile"> Configuration file (ices.conf) </a> 
-		<p>
-Here's a sample configuration file. It's the same as the
-ices.conf.dist that is included in the ices distribution.
-You can specify multiple stream sections with different mountpoints,
-names, and reencoding options.
-		<pre>
-
-			&lt;?xml version="1.0"?&gt;
-			&lt;ices:Configuration xmlns:ices="http://www.icecast.org/projects/ices"&gt;
-			&lt;Playlist&gt;
-				&lt;File&gt;apan.txt&lt;/File&gt;
-				&lt;Randomize&gt;1&lt;/Randomize&gt;
-				&lt;Type&gt;builtin&lt;/Type&gt;
-				&lt;Module&gt;ices&lt;/Module&gt;
-			        &lt;Crossfade&gt;0;&lt;Crossfade&gt;
-			&lt;/Playlist&gt;
-			&lt;Server&gt;
-				&lt;Hostname&gt;localhost&lt;/Hostname&gt;
-				&lt;Port&gt;8000&lt;/Port&gt;
-				&lt;Password&gt;letmein&lt;/Password&gt;
-				&lt;Protocol&gt;xaudiocast&lt;/Protocol&gt;
-			&lt;/Server&gt;
-			&lt;Execution&gt;
-				&lt;Background&gt;0&lt;/Background&gt;
-				&lt;Verbose&gt;1&lt;/Verbose&gt;
-				&lt;Base_Directory&gt;/tmp&lt;/Base_Directory&gt;
-			&lt;/Execution&gt;
-			&lt;Stream&gt;
-				&lt;Name&gt;Cool ices default name from XML&lt;/Name&gt;
-				&lt;Genre&gt;Cool ices genre from XML&lt;/Genre&gt;
-				&lt;Description&gt;Cool ices description from XML&lt;/Description&gt;
-				&lt;URL&gt;Cool ices URL from XML&lt;/URL&gt;
-				&lt;Bitrate&gt;128&lt;/Bitrate&gt;
-				&lt;Public&gt;1&lt;/Public&gt;
-				&lt;Reencode&gt;0&lt;/Reencode&gt;
-				&lt;Samplerate&gt;-1&lt;/Samplerate&gt;
-				&lt;Channels&gt;-1&lt;/Channels&gt;
-			&lt;/Stream&gt;
-			&lt;/ices:Configuration&gt;
-		</pre>
-		</p>
-	    </li>
-	    <li> <a name="configure_options">Configurations options </a>
-		<p>
-		     This describes all the different options in ices.
-		     <ul>
-			<li> Server Hostname<br>
-				Command line option: -h &lt;host&gt;<br>
-				Config file tag: Server/Hostname<br>
-				This is the name, or ip, of the host ices should connect to.
-				It has to run a streaming server, capable of the xaudiocast
-				or icy protocol.<br>
-				This value defaults to localhost.
-			</li>
-
-			<li> Server Port<br>
-				Command line option: -p &lt;port&gt;<br>
-				Config file tag: Server/Port<br>
-				This is the port the server is listening on, by default 8000.
-			</li>
-
-			<li> Server Password <br>
-				Command line option: -P &lt;password&gt; <br>
-				Config file tag: Server/Password <br>
-				The encoder password for the server. If this is not correct, 
-				then ices cannot log in on the server, and ices will exit.
-			</li>
-
-			<li> Server Protocol <br>
-				Command line option: -i for icy-headers <br>
-				Config file tag: Server/Protocol <br>
-				Either xaudiocast or icy. Use xaudiocast if you can, and icy if you must.
-			</li>
-
-			<li>  Execution Background <br>
-				Command line option: -B <br>
-				Config file tag: Execution/Background <br>
-				This will launch ices in the background, as a daemon.
-			</li>
-
-			<li> Execution Verbose <br>
-				Command line option: -v <br> 
-				Config file tag: Execution/Verbose <br>
-				Normally ices outputs what stream is playing and a small amount of extra information.  
-				With verbose turned on, you get a whole lot of debugging information and lots of track info.  
-			</li>
-
-			<li> Execution Base Directory <br>
-				Command line option: -D &lt;directory&gt; <br>
-				Config file tag: Execution/Base_directory <br>
-				ices uses this directory for cue files, log files and temporary playlist files.
-				You need write permissions in this directory. The default is /tmp
-			</li>
-
-		      <li> Stream Mountpoint <br>
-Command line option: -m &lt;mountpoint&gt;<br>
-Config file tag: Stream/Mountpoint<br>
-This is the mountpoint of the stream on the icecast server, if using
-the x-audiocast protocol.
-			<li> Stream Name <br>
-				Command line option: -n &lt;stream name&gt; <br>
-				Config file tag: Stream/Name<br>
-				This is the name of the stream, not to be confused with the name of the song playing.<br>
-			</li>
-
-			<li> Stream Genre <br>
-				Command line option: -g &lt;stream genre&gt; <br>
-				Config file tag: Stream/Genre <br>
-				This is the genre of your stream, e.g Jazz or Static.
-			</li>
-	
-			<li> Stream Description <br>
-				Command line option: -d &lt;stream description&gt; <br>
-				Config file tag: Stream/Description <br>
-				This option is a description of your stream. 
-			</li>
-
-			<li> Stream URL <br>
-				Command line option: -u &lt;URL&gt; <br>
-				Config file tag: Stream/URL <br>
-				This should be a URL describing your stream.
-			</li>
-
-			<li> Stream Bitrate <br>
-				Command line option: -b &lt;bitrate&gt; <br> 
-				Config file tag: Stream/Bitrate <br>
-				If you turn on reencoding then this will be the bitrate of the stream,
-				otherwize the actual bitrate of the stream is the bitrate your files
-				are encoded at, and this value is for displaying purposes only.<br>
-				Read the last 3 lines again, please.
-			</li>
-
-			<li> Stream Public <br>
-				Command line option: -s (makes stream private) <br>
-				Config file tag: Stream/Public <br>
-				This regulates whether the icecast server will display your stream on a directory server. Default is 1 (yes). <br>
-			</li>
-
-			<li> Stream Reencode <br>
-			Command line option: -R (turns reencoding on) <br>
-			Config file tag: Stream/Reencode <br>
-			When you turn this option on, ices (if compiled with libmp3lame support) will reencode your mp3 files 
-			on the fly to whatever bitrate you specify
-		      with the Stream Bitrate option, unless
-		      the file bitrate is the same as the
-		      stream bitrate.<br>
-			PLEASE note that if your files are corrupt, this might crash ices because the library used to decode (mpglib) is not very stable.
-			I suggest you check your files with mp3check or some other mp3 verification program before you add them to your playlist.
-			Just popping them into your favourite player and checking the sound is definitely not enough.<br>
-			For legal reasons, this option is not available on the binary distributions.  
-			</li>
-
-			<li> Stream Samplerate <br>
-				Command line option: -H &lt;samplerate&gt; <br>
-				Config file tag: Stream/Samplerate <br>
-				Use this to force reencoding to output mp3 data with this samplerate.
-			</li>
-
-			<li> Stream Channels <br>
-				Command line option: -N &lt;number of channel&gt; <br>
-				Config file tag: Stream/Channels <br>
-				Use this to force reencoding to output mp3 data with this many channels.
-			</li>
-
-			<li> Playlist File <br>
-				Command line option: -F &lt;file&gt; <br>
-				Config file tag: Playlist/File <br>
-				This is the file where ices originally looks for files to play. <br>
-				When using playlist modules in perl or python, this argument
-				is ignored.
-			</li>
-
-			<li> Playlist Randomize <br>
-				Command line option: -r (randomizes file) <br>
-				Config file tag: Playlist/Randomize <br>
-				This option is passed to the playlist handler, and tells it
-				to randomize the playlist.
-			</li>
-
-			<li> Playlist Type <br>
-				Command line option: -S &lt;perl|python|builtin&gt; <br>
-				Config file tag: Playlist/Type <br>
-				By default, ices using a builtin playlist handler. It handles randomization and not
-				much more. Most people want
-			      sophisticated playlist handlers that
-			      interface with databases
-				and keep track of god knows what. ices handles embedded python and embedded perl,
-				so now you can write your own modules, without modifying ices, that do just about
-				anything. Use this option to change the playlist handler type from builtin (default),
-				to python or perl.
-			</li>
-
-			<li>  Playlist Module <br>
-			      Command line option: -M &lt;module&gt; <br>
-			      Config file tag: Playlist/Module <br>
-			      Use this option to execute a different python or perl module than the default. <br>
-			      Default for python is ices.py and default for perl is ices.pm, although do NOT specify the file extension for the module. Use 'whatever' instead of 'whatever.pm' or 'whatever.py'<br>
-			</li>
-
-			<li>Crossfade<br/>
-			    Command line option: -C &lt;seconds&gt;   <br/>
-			    Config file tag: Playlist/Crossfade<br>
-If this option is specified and reencoding is enabled, ices will
-crossfade <tt>seconds</tt> between tracks.
-		</ul>
-	      </p>
-         </ol>
-	 </li>
-
-	 <li> <a name="section_licensing"> Licensing </a>
-	 <p>
-	 ices is licensed under the Gnu General Public License, and for more info about that
-	 I suggest you read the file named COPYING.
-	 </p>
-	 </li>
-
-	<li> <a name="section_developer">Developers resources</a>
-	     <p> If you want to write your own streaming software, or perhaps a nice streaming mp3 client, go to
-		<a href="http://developer.icecast.org/">developer.icecast.org</a>.
-	    </p>
-	</li>
-
-</ol>
-
-<hr width="10%">
-
-<p align=right> This document was mostly written by Alexander Haväng
-  [eel at icecast.org].<br>
-
-</p>
-
-</body>
-</html>
-

Copied: icecast/branches/ices0/pipe/doc/icesmanual.html (from rev 8704, icecast/trunk/ices0/doc/icesmanual.html)

Modified: icecast/branches/ices0/pipe/src/Makefile.am
===================================================================
--- icecast/trunk/ices0/src/Makefile.am	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/src/Makefile.am	2005-02-04 06:57:21 UTC (rev 8828)
@@ -8,8 +8,8 @@
 	cue.h metadata.h in_vorbis.h mp3.h in_mp4.h in_flac.h id3.h signals.h \
 	reencode.h ices_config.h
 
-ices_SOURCES = ices.c log.c setup.c stream.c util.c mp3.c cue.c metadata.c \
-	id3.c signals.c crossfade.c
+ices_SOURCES = crossfade.c cue.c encode_pipe.c ices.c id3.c log.c metadata.c \
+	mp3.c setup.c signals.c stream.c util.c
 
 EXTRA_ices_SOURCES = ices_config.c reencode.c in_vorbis.c in_mp4.c in_flac.c
 

Modified: icecast/branches/ices0/pipe/src/definitions.h
===================================================================
--- icecast/trunk/ices0/src/definitions.h	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/src/definitions.h	2005-02-04 06:57:21 UTC (rev 8828)
@@ -100,6 +100,7 @@
 #include "playlist/playlist.h"
 
 ices_plugin_t *crossfade_plugin(int secs);
+ices_encoder_t *pipe_encoder(void);
 
 #define BUFSIZE 8192
 #define ICES_DEFAULT_HOST "127.0.0.1"

Deleted: icecast/branches/ices0/pipe/src/ices_config.c
===================================================================
--- icecast/trunk/ices0/src/ices_config.c	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/src/ices_config.c	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,294 +0,0 @@
-/* parse.c
- * - Functions for xml file parsing
- * Copyright (c) 2000 Alexander Haväng
- * Copyright (c) 2001-4 Brendan Cully
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * 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.
- *
- * $Id$
- */
-
-#include "definitions.h"
-
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-
-/* Private function declarations */
-static int parse_file (const char *configfile, ices_config_t *ices_config);
-static void parse_playlist_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ices_config_t *ices_config);
-static void parse_execution_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ices_config_t *ices_config);
-static void parse_server_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,
-				ices_stream_t *ices_config);
-static void parse_stream_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ices_stream_t *stream);
-static char* ices_xml_read_node (xmlDocPtr doc, xmlNodePtr node);
-
-/* Global function definitions */
-
-/* Top level XML configfile parser */
-int
-ices_xml_parse_config_file (ices_config_t *ices_config, const char *configfile)
-{
-  char namespace[1024];
-
-  if (!ices_util_verify_file (configfile)) {
-    ices_log_error ("XML Parser Error: Could not open configfile. [%s]  Error: [%s]", configfile, ices_util_strerror (errno, namespace, 1024));
-    return 0;
-  }
-
-  /* Setup the parser options */
-  LIBXML_TEST_VERSION
-  xmlKeepBlanksDefault(0);
-	
-  /* Parse the file and be happy */
-  return parse_file (configfile, ices_config);
-}
-
-/* I hope you can tell this is my first try at xml and libxml :)  */
-static int
-parse_file (const char *configfile, ices_config_t *ices_config)
-{
-  xmlDocPtr doc;
-  xmlNsPtr ns;
-  xmlNodePtr cur;
-
-  /* we support multiple stream nodes */
-  int nstreams = 0;
-  ices_stream_t* stream = ices_config->streams;
-
-  /* This does the actual parsing */
-  if (!(doc = xmlParseFile (configfile))) {
-    ices_log_error ("XML Parser: Error while parsing %s", configfile);
-    return 0;
-  }
-	
-  /* Gimme the root element dammit! */
-  if (!(cur = xmlDocGetRootElement (doc))) {
-    ices_log_error ("XML Parser: Empty documenent %s", configfile);
-    xmlFreeDoc (doc);
-    return 0;
-  }
-	
-  /* Verify that the document is of the right type in the right namespace */
-  if (!(ns = xmlSearchNsByHref (doc, cur, (unsigned char *)"http://www.icecast.org/projects/ices"))) {
-    ices_log_error ("XML Parser: Document of invalid type, no ices namespace found");
-    xmlFreeDoc (doc);
-    return 0;
-  }
-
-  /* First element should be configuration */
-  if (!cur->name || (strcmp (cur->name, "Configuration"))) {
-    ices_log_error ("XML Parser: Document of invalid type, root node is not 'Configuration'");
-    xmlFreeDoc (doc);
-    return 0;
-  }
-
-  /* Get the configuration tree */
-  /* Tree traversal */
-  cur = cur->xmlChildrenNode;
-
-#ifdef HAVE_LIBXML_PARSER_H
-  while (cur && xmlIsBlankNode (cur)) {
-    cur = cur->next;
-  }
-#endif
-
-  if (cur == NULL) {
-    /* Right type of document, but no configuration, guess that is ok */
-    xmlFreeDoc (doc);
-    return 1;
-  }
-
-  /* Separate the parsing into different submodules,
-   * Server, Stream, Playlist and Execution */
-  for (; cur != NULL; cur = cur->next) {
-    if (cur->type == XML_COMMENT_NODE)
-      continue;
-    if (strcmp (cur->name, "Stream") == 0) {
-      /* first stream is preallocated */
-      if (nstreams) {
-	stream->next = (ices_stream_t*)malloc (sizeof (ices_stream_t));
-	stream = stream->next;
-	/* in case fields are omitted in the config file */
-	ices_setup_parse_stream_defaults (stream);
-      }
-
-      parse_stream_node (doc, ns, cur->xmlChildrenNode, stream);
-
-      nstreams++;
-    } else if (strcmp (cur->name, "Playlist") == 0) {
-      parse_playlist_node (doc, ns, cur->xmlChildrenNode, ices_config);
-    } else if (strcmp (cur->name, "Execution") == 0) {
-      parse_execution_node (doc, ns, cur->xmlChildrenNode, ices_config);
-    } else {
-      ices_log ("Unknown Node: %s", cur->name);
-    }
-  }
-	
-  /* Be a good boy and cleanup */
-  xmlFreeDoc (doc);
-  return 1;
-}
-
-/* Parse the stream specific configuration */
-static void
-parse_stream_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,
-			     ices_stream_t *stream)
-{
-  for (; cur; cur = cur->next) {
-    if (cur->type == XML_COMMENT_NODE)
-      continue;
-
-    if (strcmp (cur->name, "Server") == 0) {
-      parse_server_node (doc, ns, cur->xmlChildrenNode, stream);
-    } else if (strcmp (cur->name, "Name") == 0) {
-      ices_util_free (stream->name);
-      stream->name = ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Genre") == 0) {
-      ices_util_free (stream->genre);
-      stream->genre = ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Description") == 0) {
-      ices_util_free (stream->description);
-      stream->description = ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "URL") == 0) {
-      ices_util_free (stream->url);
-      stream->url = ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Mountpoint") == 0) {
-      ices_util_free (stream->mount);
-      stream->mount = ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Dumpfile") == 0) {
-      ices_util_free (stream->dumpfile);
-      stream->dumpfile = ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Bitrate") == 0) {
-      stream->bitrate = atoi (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Public") == 0) {
-      stream->ispublic = atoi (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Reencode") == 0) {
-      int res = atoi (ices_xml_read_node (doc, cur));
-
-#ifndef HAVE_LIBLAME
-      if (res == 1) {
-	ices_log ("Support for reencoding with liblame was not found. You can't reencode this.");
-	ices_setup_shutdown ();
-      }
-#endif
-			
-      stream->reencode = res;
-    } else if (strcmp (cur->name, "Samplerate") == 0) {
-      stream->out_samplerate = atoi (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Channels") == 0) {
-      stream->out_numchannels = atoi (ices_xml_read_node (doc, cur));
-    } else {
-      ices_log ("Unknown Stream keyword: %s", cur->name);
-    }
-  }
-}
-
-/* Parse the server specific configuration */
-static void
-parse_server_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,
-		   ices_stream_t *ices_config)
-{
-  for (; cur; cur = cur->next) {
-    if (cur->type == XML_COMMENT_NODE)
-      continue;
-
-    if (strcmp (cur->name, "Port") == 0) {
-      ices_config->port = atoi (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Hostname") == 0) {
-      ices_util_free (ices_config->host);
-      ices_config->host = ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Password") == 0) {
-      ices_util_free (ices_config->password);
-      ices_config->password = ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Protocol") == 0) {
-      unsigned char *str = ices_xml_read_node (doc, cur);
-
-      if (str && (strcasecmp(str, "icy") == 0))
-	ices_config->protocol = icy_protocol_e;
-      else if (str && (strcasecmp(str, "http") == 0))
-	ices_config->protocol = http_protocol_e;
-      else
-	ices_config->protocol = xaudiocast_protocol_e;
-    } else {
-      ices_log ("Unknown Server keyword: %s", cur->name);
-    }
-  }
-}
-
-/* Parse the execution specific options */
-static void
-parse_execution_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,
-				ices_config_t *ices_config)
-{
-  for (; cur; cur = cur->next) {
-    if (cur->type == XML_COMMENT_NODE)
-      continue;
-
-    if (strcmp (cur->name, "Background") == 0) {
-      ices_config->daemon = atoi (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Verbose") == 0) {
-      ices_config->verbose = atoi (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "BaseDirectory") == 0) {
-      if (ices_config->base_directory)
-	ices_config->base_directory =
-	  ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else {
-      ices_log ("Unknown Execution keyword: %s", cur->name);
-    }
-  }
-}
-
-/* Parse the playlist specific configuration */
-static void
-parse_playlist_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ices_config_t *ices_config)
-{
-  int i;
-
-  for (; cur; cur = cur->next) {
-    if (cur->type == XML_COMMENT_NODE)
-      continue;
-
-    if (strcmp (cur->name, "Randomize") == 0) {
-      ices_config->pm.randomize = atoi (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Type") == 0) {
-      unsigned char *str = ices_xml_read_node (doc, cur);
-      if (str && (strcmp (str, "python") == 0))
-	ices_config->pm.playlist_type = ices_playlist_python_e;
-      else if (str && (strcmp (str, "perl") == 0))
-	ices_config->pm.playlist_type = ices_playlist_perl_e;
-      else
-	ices_config->pm.playlist_type = ices_playlist_builtin_e;
-    } else if (strcmp (cur->name, "File") == 0) {
-      ices_util_free (ices_config->pm.playlist_file);
-      ices_config->pm.playlist_file =
-	ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Module") == 0) {
-      ices_util_free (ices_config->pm.module);
-      ices_config->pm.module =
-	ices_util_strdup (ices_xml_read_node (doc, cur));
-    } else if (strcmp (cur->name, "Crossfade") == 0) {
-      if ((i = atoi (ices_xml_read_node (doc, cur))) > 0)
-	/* TODO: stack plugins */
-	ices_config->plugins = crossfade_plugin(i);
-    } else {
-      ices_log ("Unknown playlist keyword: %s", cur->name);
-    }
-  }		
-}
-
-static char* ices_xml_read_node (xmlDocPtr doc, xmlNodePtr node)
-{
-  return (char *)xmlNodeListGetString (doc, node->xmlChildrenNode, 1);
-}

Copied: icecast/branches/ices0/pipe/src/ices_config.c (from rev 8704, icecast/trunk/ices0/src/ices_config.c)
===================================================================
--- icecast/trunk/ices0/src/ices_config.c	2005-01-09 23:10:32 UTC (rev 8704)
+++ icecast/branches/ices0/pipe/src/ices_config.c	2005-02-04 06:57:21 UTC (rev 8828)
@@ -0,0 +1,298 @@
+/* parse.c
+ * - Functions for xml file parsing
+ * Copyright (c) 2000 Alexander Haväng
+ * Copyright (c) 2001-4 Brendan Cully
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * 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.
+ *
+ * $Id$
+ */
+
+#include "definitions.h"
+
+#include <libxml/parser.h>
+#include <libxml/xmlmemory.h>
+
+/* Private function declarations */
+static int parse_file (const char *configfile, ices_config_t *ices_config);
+static void parse_playlist_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ices_config_t *ices_config);
+static void parse_execution_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ices_config_t *ices_config);
+static void parse_server_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,
+				ices_stream_t *ices_config);
+static void parse_stream_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ices_stream_t *stream);
+static char* ices_xml_read_node (xmlDocPtr doc, xmlNodePtr node);
+
+/* Global function definitions */
+
+/* Top level XML configfile parser */
+int
+ices_xml_parse_config_file (ices_config_t *ices_config, const char *configfile)
+{
+  char namespace[1024];
+
+  if (!ices_util_verify_file (configfile)) {
+    ices_log_error ("XML Parser Error: Could not open configfile. [%s]  Error: [%s]", configfile, ices_util_strerror (errno, namespace, 1024));
+    return 0;
+  }
+
+  /* Setup the parser options */
+  LIBXML_TEST_VERSION
+  xmlKeepBlanksDefault(0);
+	
+  /* Parse the file and be happy */
+  return parse_file (configfile, ices_config);
+}
+
+/* I hope you can tell this is my first try at xml and libxml :)  */
+static int
+parse_file (const char *configfile, ices_config_t *ices_config)
+{
+  xmlDocPtr doc;
+  xmlNsPtr ns;
+  xmlNodePtr cur;
+
+  /* we support multiple stream nodes */
+  int nstreams = 0;
+  ices_stream_t* stream = ices_config->streams;
+
+  /* This does the actual parsing */
+  if (!(doc = xmlParseFile (configfile))) {
+    ices_log_error ("XML Parser: Error while parsing %s", configfile);
+    return 0;
+  }
+	
+  /* Gimme the root element dammit! */
+  if (!(cur = xmlDocGetRootElement (doc))) {
+    ices_log_error ("XML Parser: Empty documenent %s", configfile);
+    xmlFreeDoc (doc);
+    return 0;
+  }
+	
+  /* Verify that the document is of the right type in the right namespace */
+  if (!(ns = xmlSearchNsByHref (doc, cur, (unsigned char *)"http://www.icecast.org/projects/ices"))) {
+    ices_log_error ("XML Parser: Document of invalid type, no ices namespace found");
+    xmlFreeDoc (doc);
+    return 0;
+  }
+
+  /* First element should be configuration */
+  if (!cur->name || (strcmp (cur->name, "Configuration"))) {
+    ices_log_error ("XML Parser: Document of invalid type, root node is not 'Configuration'");
+    xmlFreeDoc (doc);
+    return 0;
+  }
+
+  /* Get the configuration tree */
+  /* Tree traversal */
+  cur = cur->xmlChildrenNode;
+
+#ifdef HAVE_LIBXML_PARSER_H
+  while (cur && xmlIsBlankNode (cur)) {
+    cur = cur->next;
+  }
+#endif
+
+  if (cur == NULL) {
+    /* Right type of document, but no configuration, guess that is ok */
+    xmlFreeDoc (doc);
+    return 1;
+  }
+
+  /* Separate the parsing into different submodules,
+   * Server, Stream, Playlist and Execution */
+  for (; cur != NULL; cur = cur->next) {
+    if (cur->type == XML_COMMENT_NODE)
+      continue;
+    if (strcmp (cur->name, "Stream") == 0) {
+      /* first stream is preallocated */
+      if (nstreams) {
+	stream->next = (ices_stream_t*)malloc (sizeof (ices_stream_t));
+	stream = stream->next;
+	/* in case fields are omitted in the config file */
+	ices_setup_parse_stream_defaults (stream);
+      }
+
+      parse_stream_node (doc, ns, cur->xmlChildrenNode, stream);
+
+      nstreams++;
+    } else if (strcmp (cur->name, "Playlist") == 0) {
+      parse_playlist_node (doc, ns, cur->xmlChildrenNode, ices_config);
+    } else if (strcmp (cur->name, "Execution") == 0) {
+      parse_execution_node (doc, ns, cur->xmlChildrenNode, ices_config);
+    } else {
+      ices_log ("Unknown Node: %s", cur->name);
+    }
+  }
+	
+  /* Be a good boy and cleanup */
+  xmlFreeDoc (doc);
+  return 1;
+}
+
+/* Parse the stream specific configuration */
+static void
+parse_stream_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,
+			     ices_stream_t *stream)
+{
+  for (; cur; cur = cur->next) {
+    if (cur->type == XML_COMMENT_NODE)
+      continue;
+
+    if (strcmp (cur->name, "Server") == 0) {
+      parse_server_node (doc, ns, cur->xmlChildrenNode, stream);
+    } else if (strcmp (cur->name, "Name") == 0) {
+      ices_util_free (stream->name);
+      stream->name = ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Genre") == 0) {
+      ices_util_free (stream->genre);
+      stream->genre = ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Description") == 0) {
+      ices_util_free (stream->description);
+      stream->description = ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "URL") == 0) {
+      ices_util_free (stream->url);
+      stream->url = ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Mountpoint") == 0) {
+      ices_util_free (stream->mount);
+      stream->mount = ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Dumpfile") == 0) {
+      ices_util_free (stream->dumpfile);
+      stream->dumpfile = ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Bitrate") == 0) {
+      stream->bitrate = atoi (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Public") == 0) {
+      stream->ispublic = atoi (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Reencode") == 0) {
+      int res = atoi (ices_xml_read_node (doc, cur));
+      if (res == 1)
+        stream->encoder = pipe_encoder();
+
+#ifndef HAVE_LIBLAME
+      if (res == 1) {
+	ices_log ("Support for reencoding with liblame was not found. You can't reencode this.");
+	ices_setup_shutdown ();
+      }
+#endif
+			
+      stream->reencode = res;
+    } else if (strcmp (cur->name, "Samplerate") == 0) {
+      stream->out_samplerate = atoi (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Channels") == 0) {
+      stream->out_numchannels = atoi (ices_xml_read_node (doc, cur));
+    } else {
+      ices_log ("Unknown Stream keyword: %s", cur->name);
+    }
+  }
+}
+
+/* Parse the server specific configuration */
+static void
+parse_server_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,
+		   ices_stream_t *ices_config)
+{
+  for (; cur; cur = cur->next) {
+    if (cur->type == XML_COMMENT_NODE)
+      continue;
+
+    if (strcmp (cur->name, "Port") == 0) {
+      ices_config->port = atoi (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Hostname") == 0) {
+      ices_util_free (ices_config->host);
+      ices_config->host = ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Password") == 0) {
+      ices_util_free (ices_config->password);
+      ices_config->password = ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Protocol") == 0) {
+      unsigned char *str = ices_xml_read_node (doc, cur);
+
+      if (str && (strcasecmp(str, "icy") == 0))
+	ices_config->protocol = icy_protocol_e;
+      else if (str && (strcasecmp(str, "http") == 0))
+	ices_config->protocol = http_protocol_e;
+      else
+	ices_config->protocol = xaudiocast_protocol_e;
+    } else {
+      ices_log ("Unknown Server keyword: %s", cur->name);
+    }
+  }
+}
+
+/* Parse the execution specific options */
+static void
+parse_execution_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,
+				ices_config_t *ices_config)
+{
+  for (; cur; cur = cur->next) {
+    if (cur->type == XML_COMMENT_NODE)
+      continue;
+
+    if (strcmp (cur->name, "Background") == 0) {
+      ices_config->daemon = atoi (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Verbose") == 0) {
+      ices_config->verbose = atoi (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "BaseDirectory") == 0) {
+      if (ices_config->base_directory)
+	ices_config->base_directory =
+	  ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else {
+      ices_log ("Unknown Execution keyword: %s", cur->name);
+    }
+  }
+}
+
+/* Parse the playlist specific configuration */
+static void
+parse_playlist_node (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ices_config_t *ices_config)
+{
+  int i;
+
+  for (; cur; cur = cur->next) {
+    if (cur->type == XML_COMMENT_NODE)
+      continue;
+
+    if (strcmp (cur->name, "Randomize") == 0) {
+      ices_config->pm.randomize = atoi (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Type") == 0) {
+      unsigned char *str = ices_xml_read_node (doc, cur);
+      if (str && (strcmp (str, "python") == 0))
+	ices_config->pm.playlist_type = ices_playlist_python_e;
+      else if (str && (strcmp (str, "perl") == 0))
+	ices_config->pm.playlist_type = ices_playlist_perl_e;
+      else if (str && (strcmp (str, "script") == 0))
+	ices_config->pm.playlist_type = ices_playlist_script_e;
+      else
+	ices_config->pm.playlist_type = ices_playlist_builtin_e;
+    } else if (strcmp (cur->name, "File") == 0) {
+      ices_util_free (ices_config->pm.playlist_file);
+      ices_config->pm.playlist_file =
+	ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Module") == 0) {
+      ices_util_free (ices_config->pm.module);
+      ices_config->pm.module =
+	ices_util_strdup (ices_xml_read_node (doc, cur));
+    } else if (strcmp (cur->name, "Crossfade") == 0) {
+      if ((i = atoi (ices_xml_read_node (doc, cur))) > 0)
+	/* TODO: stack plugins */
+	ices_config->plugins = crossfade_plugin(i);
+    } else {
+      ices_log ("Unknown playlist keyword: %s", cur->name);
+    }
+  }		
+}
+
+static char* ices_xml_read_node (xmlDocPtr doc, xmlNodePtr node)
+{
+  return (char *)xmlNodeListGetString (doc, node->xmlChildrenNode, 1);
+}

Deleted: icecast/branches/ices0/pipe/src/icestypes.h
===================================================================
--- icecast/trunk/ices0/src/icestypes.h	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/src/icestypes.h	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,130 +0,0 @@
-/* icestypes.h
- * - Datatypes for ices
- * Copyright (c) 2000 Alexander Haväng
- * Copyright (c) 2001-4 Brendan Cully <brendan at xiph.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * 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.
- *
- */
-
-#ifndef _ICES_ICESTYPES_H
-#define _ICES_ICESTYPES_H
-
-typedef enum {
-  icy_protocol_e,
-  xaudiocast_protocol_e,
-  http_protocol_e
-} protocol_t;
-
-typedef enum {
-  ices_playlist_builtin_e,
-  ices_playlist_python_e,
-  ices_playlist_perl_e
-} playlist_type_t;
-
-typedef struct ices_stream_St {
-  shout_t* conn;
-  time_t connect_delay;
-  int errs;
-  void* encoder_state;
-
-  char *host;
-  int port;
-  char *password;
-  protocol_t protocol;
-
-  char* mount;
-  char* dumpfile;
-
-  char* name;
-  char* genre;
-  char* description;
-  char* url;
-  int ispublic;
-
-  int reencode;
-  int bitrate;
-  int out_samplerate;
-  int out_numchannels;
-
-  struct ices_stream_St* next;
-} ices_stream_t;
-
-typedef struct {
-  playlist_type_t playlist_type;
-  int randomize;
-  char* playlist_file;
-  char* module;
-
-  char* (*get_next) (void);     /* caller frees result */
-  char* (*get_metadata) (void); /* caller frees result */
-  int (*get_lineno) (void);
-  int (*reload) (void);
-  void (*shutdown) (void);
-} playlist_module_t;
-
-/* -- input stream types -- */
-typedef enum {
-  ICES_INPUT_VORBIS,
-  ICES_INPUT_MP3,
-  ICES_INPUT_MP4,
-  ICES_INPUT_FLAC
-} input_type_t;
-
-typedef struct _input_stream_t {
-  input_type_t type;
-
-  char* path;
-  int fd;
-  size_t filesize;
-  size_t bytes_read;
-  unsigned int bitrate;
-  unsigned int samplerate;
-  unsigned int channels;
-
-  void* data;
-
-  ssize_t (*read)(struct _input_stream_t* self, void* buf, size_t len);
-  /* len is the size in bytes of left or right. The two buffers must be
-   * the same size. */
-  ssize_t (*readpcm)(struct _input_stream_t* self, size_t len, int16_t* left,
-		     int16_t* right);
-  int (*close)(struct _input_stream_t* self);
-} input_stream_t;
-
-typedef struct _ices_plugin {
-  const char *name;
-
-  int (*init)(void);
-  void (*new_track)(input_stream_t *source);
-  int (*process)(int ilen, int16_t *il, int16_t *ir);
-  void (*shutdown)(void);
-
-  struct _ices_plugin *next;
-} ices_plugin_t;
-
-typedef struct {
-  int daemon;
-  int verbose;
-  int reencode;
-  char *configfile;
-  char *base_directory;
-  FILE *logfile;
-
-  ices_stream_t* streams;
-  playlist_module_t pm;
-  ices_plugin_t *plugins;
-} ices_config_t;
-#endif

Copied: icecast/branches/ices0/pipe/src/icestypes.h (from rev 8704, icecast/trunk/ices0/src/icestypes.h)
===================================================================
--- icecast/trunk/ices0/src/icestypes.h	2005-01-09 23:10:32 UTC (rev 8704)
+++ icecast/branches/ices0/pipe/src/icestypes.h	2005-02-04 06:57:21 UTC (rev 8828)
@@ -0,0 +1,144 @@
+/* icestypes.h
+ * - Datatypes for ices
+ * Copyright (c) 2000 Alexander Haväng
+ * Copyright (c) 2001-4 Brendan Cully <brendan at xiph.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * 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.
+ *
+ */
+
+#ifndef _ICES_ICESTYPES_H
+#define _ICES_ICESTYPES_H
+
+typedef enum {
+  icy_protocol_e,
+  xaudiocast_protocol_e,
+  http_protocol_e
+} protocol_t;
+
+typedef enum {
+  ices_playlist_builtin_e,
+  ices_playlist_script_e,
+  ices_playlist_python_e,
+  ices_playlist_perl_e
+} playlist_type_t;
+
+typedef struct {
+  playlist_type_t playlist_type;
+  int randomize;
+  char* playlist_file;
+  char* module;
+
+  char* (*get_next) (void);     /* caller frees result */
+  char* (*get_metadata) (void); /* caller frees result */
+  int (*get_lineno) (void);
+  int (*reload) (void);
+  void (*shutdown) (void);
+} playlist_module_t;
+
+/* -- input stream types -- */
+typedef enum {
+  ICES_INPUT_VORBIS,
+  ICES_INPUT_MP3,
+  ICES_INPUT_MP4,
+  ICES_INPUT_FLAC
+} input_type_t;
+
+typedef struct _input_stream_t {
+  input_type_t type;
+
+  char* path;
+  int fd;
+  size_t filesize;
+  size_t bytes_read;
+  unsigned int bitrate;
+  unsigned int samplerate;
+  unsigned int channels;
+
+  void* data;
+
+  ssize_t (*read)(struct _input_stream_t* self, void* buf, size_t len);
+  /* len is the size in bytes of left or right. The two buffers must be
+   * the same size. */
+  ssize_t (*readpcm)(struct _input_stream_t* self, size_t len, int16_t* left,
+		     int16_t* right);
+  int (*close)(struct _input_stream_t* self);
+} input_stream_t;
+
+struct _ices_encoder_t;
+typedef struct _ices_encoder_t ices_encoder_t;
+
+typedef struct ices_stream_St {
+  shout_t* conn;
+  time_t connect_delay;
+  int errs;
+  ices_encoder_t* encoder;
+  void* encoder_state;
+  void* enc2_state;
+  
+  char *host;
+  int port;
+  char *password;
+  protocol_t protocol;
+  
+  char* mount;
+  char* dumpfile;
+  
+  char* name;
+  char* genre;
+  char* description;
+  char* url;
+  int ispublic;
+  
+  int reencode;
+  int bitrate;
+  int out_samplerate;
+  int out_numchannels;
+  
+  struct ices_stream_St* next;
+} ices_stream_t;
+
+struct _ices_encoder_t {
+  int (*init)(ices_stream_t* stream);
+  int (*new_source)(ices_stream_t* stream, input_stream_t* source);
+  int (*encode)(ices_stream_t* stream, int samples, int16_t* left,
+                int16_t* right, unsigned char* out, size_t olen);
+  void (*shutdown)(void);
+};
+
+typedef struct _ices_plugin {
+  const char *name;
+
+  int (*init)(void);
+  void (*new_source)(input_stream_t *source);
+  int (*process)(int ilen, int16_t *il, int16_t *ir);
+  void (*shutdown)(void);
+
+  struct _ices_plugin *next;
+} ices_plugin_t;
+
+typedef struct {
+  int daemon;
+  int verbose;
+  int reencode;
+  char *configfile;
+  char *base_directory;
+  FILE *logfile;
+
+  ices_stream_t* streams;
+  playlist_module_t pm;
+  ices_plugin_t *plugins;
+} ices_config_t;
+#endif

Deleted: icecast/branches/ices0/pipe/src/playlist/Makefile.am
===================================================================
--- icecast/trunk/ices0/src/playlist/Makefile.am	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/src/playlist/Makefile.am	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,12 +0,0 @@
-## Process this with automake to create Makefile.in
-
-INCLUDES = -DICES_MODULEDIR=\"$(moddir)\" -I$(top_srcdir)/src
-
-noinst_LIBRARIES = libplaylist.a
-noinst_HEADERS = playlist.h pm_builtin.h rand.h
-
-libplaylist_a_SOURCES = playlist.c pm_builtin.c rand.c
-EXTRA_libplaylist_a_SOURCES = pm_python.c pm_perl.c
-
-libplaylist_a_LIBADD = $(PLAYLIST_OBJECTS)
-libplaylist_a_DEPENDENCIES = $(libplaylist_a_LIBADD)

Copied: icecast/branches/ices0/pipe/src/playlist/Makefile.am (from rev 8704, icecast/trunk/ices0/src/playlist/Makefile.am)

Deleted: icecast/branches/ices0/pipe/src/playlist/playlist.c
===================================================================
--- icecast/trunk/ices0/src/playlist/playlist.c	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/src/playlist/playlist.c	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,120 +0,0 @@
-/* playlist.c
- * - Functions for playlist handling
- * Copyright (c) 2000 Alexander Haväng
- * Copyright (c) 2001-2 Brendan Cully
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * 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.
- *
- */
-
-#include "definitions.h"
-#include "playlist.h"
-
-extern ices_config_t ices_config;
-static int playlist_init = 0;
-
-/* Global function definitions */
-
-/* Wrapper function for the specific playlist handler's current line number.
- * This might not be available if your playlist is a database or something
- * weird, but it's just for the cue file so it doesn't matter much */
-int
-ices_playlist_get_current_lineno (void)
-{
-  if (ices_config.pm.get_lineno)
-     return ices_config.pm.get_lineno ();
-
-  return 0;
-}
-
-/* Wrapper for the playlist handler's next file function.
- * Remember that if this returns non-NULL then the return
- * value is free()ed by the caller. */
-char *
-ices_playlist_get_next (void)
-{
-  return ices_config.pm.get_next ();
-}
-
-/* Allows a script to override file metadata if it wants. Returns NULL
- *   to mean 'do it yourself'. Modules need not implement this. */
-char*
-ices_playlist_get_metadata (void)
-{
-  if (ices_config.pm.get_metadata)
-    return ices_config.pm.get_metadata ();
-
-  return NULL;
-}
-
-/* Initialize the toplevel playlist handler */
-int
-ices_playlist_initialize (void)
-{
-  int rc = -1;
-
-  ices_log_debug ("Initializing playlist handler...");
-
-  ices_config.pm.reload = NULL;
-
-  switch (ices_config.pm.playlist_type) {
-    case ices_playlist_builtin_e:
-      rc = ices_playlist_builtin_initialize (&ices_config.pm);
-      break;
-    case ices_playlist_python_e:
-#ifdef HAVE_LIBPYTHON
-      rc = ices_playlist_python_initialize (&ices_config.pm);
-#else
-      ices_log_error ("This binary has no support for embedded python");
-#endif
-      break;
-    case ices_playlist_perl_e:
-#ifdef HAVE_LIBPERL
-      rc = ices_playlist_perl_initialize (&ices_config.pm);
-#else
-      ices_log_error ("This binary has no support for embedded perl");
-#endif
-      break;
-    default:
-      ices_log_error ("Unknown playlist module!");
-      break;
-  }
-
-  if (rc < 0) {
-    ices_log ("Initialization of playlist handler failed. [%s]", ices_log_get_error ());
-    ices_setup_shutdown ();
-  }
-
-  playlist_init = 1;
-  return rc;
-}
-
-/* Reload the playlist module */
-int
-ices_playlist_reload (void)
-{
-  if (ices_config.pm.reload)
-    return ices_config.pm.reload ();
-
-  return 0;
-}
-
-/* Shutdown the playlist handler */
-void
-ices_playlist_shutdown (void)
-{
-  if (playlist_init)
-    ices_config.pm.shutdown ();
-}

Copied: icecast/branches/ices0/pipe/src/playlist/playlist.c (from rev 8704, icecast/trunk/ices0/src/playlist/playlist.c)

Deleted: icecast/branches/ices0/pipe/src/playlist/playlist.h
===================================================================
--- icecast/trunk/ices0/src/playlist/playlist.h	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/src/playlist/playlist.h	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,41 +0,0 @@
-/* playlist.h
- * - playlist function declarations for ices
- * Copyright (c) 2000 Alexander Haväng
- * Copyright (c) 2001-2 Brendan Cully
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * 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.
- *
- */
-
-#ifndef PLAYLIST_H
-#define PLAYLIST_H 1
-
-/* Public function declarations */
-int ices_playlist_get_current_lineno (void);
-char *ices_playlist_get_next (void);
-char* ices_playlist_get_metadata (void);
-int ices_playlist_initialize (void);
-int ices_playlist_reload (void);
-void ices_playlist_shutdown (void);
-
-int ices_playlist_builtin_initialize (playlist_module_t* pm);
-#ifdef HAVE_LIBPYTHON
-int ices_playlist_python_initialize (playlist_module_t* pm);
-#endif
-#ifdef HAVE_LIBPERL
-int ices_playlist_perl_initialize (playlist_module_t* pm);
-#endif
-
-#endif

Copied: icecast/branches/ices0/pipe/src/playlist/playlist.h (from rev 8704, icecast/trunk/ices0/src/playlist/playlist.h)

Copied: icecast/branches/ices0/pipe/src/playlist/pm_script.c (from rev 8704, icecast/trunk/ices0/src/playlist/pm_script.c)

Copied: icecast/branches/ices0/pipe/src/playlist/pm_script.h (from rev 8704, icecast/trunk/ices0/src/playlist/pm_script.h)

Deleted: icecast/branches/ices0/pipe/src/setup.c
===================================================================
--- icecast/trunk/ices0/src/setup.c	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/src/setup.c	2005-02-04 06:57:21 UTC (rev 8828)
@@ -1,655 +0,0 @@
-/* setup.c
- * - Functions for initialization in ices
- * Copyright (c) 2000 Alexander Haväng
- * Copyright (c) 2002-4 Brendan Cully <brendan at xiph.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * 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.
- *
- */
-
-#include "definitions.h"
-#include "metadata.h"
-
-/* Local function declarations */
-static void ices_setup_parse_options (ices_config_t *ices_config);
-static void ices_setup_parse_defaults (ices_config_t *ices_config);
-#ifdef HAVE_LIBXML
-static void ices_setup_parse_config_file (ices_config_t *ices_config, const char *configfile);
-#endif
-static void ices_setup_parse_command_line (ices_config_t *ices_config, char **argv, int argc);
-static void ices_setup_parse_command_line_for_new_configfile (ices_config_t *ices_config, char **argv, int argc);
-static void ices_setup_activate_libshout_changes (const ices_config_t *ices_config);
-static void ices_setup_usage (void);
-static void ices_setup_version (void);
-static void ices_setup_update_pidfile (int icespid);
-static void ices_setup_daemonize (void);
-static void ices_free_all (ices_config_t *ices_config);
-
-extern ices_config_t ices_config;
-
-/* Global function definitions */
-
-/* Top level initialization function for ices.
- * It will parse options, initialize modules,
- * and if requested, become a daemon. */
-void
-ices_setup_initialize (void)
-{
-  ices_stream_t* stream;
-  ices_plugin_t* plugin;
-  
-  shout_init();
-
-  /* Setup signal handlers */
-  ices_signals_setup ();
-
-  /* Parse the options in the config file, and the command line */
-  ices_setup_parse_options (&ices_config);
-
-  if (ices_config.daemon)
-    ices_setup_daemonize ();
-
-  /* Open logfiles */
-  ices_log_initialize ();
-
-  /* Initialize the libshout structure */
-  for (stream = ices_config.streams; stream; stream = stream->next) {
-    if (!(stream->conn = shout_new ())) {
-      ices_log ("Could not create shout interface");
-      ices_setup_shutdown ();
-    }
-  }
-
-  ices_setup_activate_libshout_changes (&ices_config);
-
-  /* Initialize the playlist handler */
-  ices_playlist_initialize ();
-
-#ifdef HAVE_LIBLAME
-  /* Initialize liblame for reeencoding */
-  ices_reencode_initialize ();
-
-  while (ices_config.plugins && ices_config.plugins->init() < 0)
-    ices_config.plugins = ices_config.plugins->next;
-
-  for (plugin = ices_config.plugins; plugin && plugin->next; plugin = plugin->next)
-    if (plugin->next->init() < 0)
-      plugin->next = plugin->next->next;
-#endif
-
-  ices_log_debug("Startup complete\n");
-}
-
-/* Top level ices shutdown function.
- * This is the _only_ way out of here */
-void
-ices_setup_shutdown (void)
-{
-  ices_stream_t* stream;
-  ices_plugin_t* plugin;
-
-  /* Tell libshout to disconnect from server */
-  for (stream = ices_config.streams; stream; stream = stream->next)
-    if (stream->conn)
-      shout_close (stream->conn);
-
-#ifdef HAVE_LIBLAME
-  for (plugin = ices_config.plugins; plugin; plugin = plugin->next)
-    plugin->shutdown();
-
-  /* Order the reencoding engine to shutdown */
-  ices_reencode_shutdown ();
-#endif
-
-  /* Tell the playlist module to shutdown and cleanup */
-  ices_playlist_shutdown ();
-
-  /* Cleanup the cue file (the cue module has no init yet) */
-  ices_cue_shutdown ();
-
-  /* Make sure we're not leaving any memory allocated around when
-   * we exit. This makes it easier to find memory leaks, and 
-   * some systems actually don't clean up that well */
-  ices_free_all (&ices_config);
-	
-  /* Let the log and console know we went down ok */
-  ices_log ("Ices Exiting...");
-
-  /* Close logfiles */
-  ices_log_shutdown ();
-	
-  shout_shutdown();
-
-  /* Down and down we go... */
-  exit (1);
-}
-
-/* Local function definitions */
-
-/* Top level option parsing function.
- * Sets of options object (ices_config), with:
- * - Hardcoded defaults
- * - Configfile settings
- * - Command line options */
-static void
-ices_setup_parse_options (ices_config_t *ices_config)
-{
-  /* Get default values for the settings */
-  ices_setup_parse_defaults (ices_config);
-
-  /* Look for given configfile on the commandline */
-  ices_setup_parse_command_line_for_new_configfile (ices_config, ices_util_get_argv(), ices_util_get_argc ());
-
-#ifdef HAVE_LIBXML
-  /* Parse the configfile */
-  ices_setup_parse_config_file (ices_config, ices_config->configfile);
-#endif
-	
-  /* Parse the commandline */
-  ices_setup_parse_command_line (ices_config, ices_util_get_argv(), ices_util_get_argc());
-}
-
-/* Function for placing hardcoded defaults in the 
- * options object (ices_config) */
-static void
-ices_setup_parse_defaults (ices_config_t *ices_config)
-{
-  ices_config->configfile = ices_util_strdup (ICES_DEFAULT_CONFIGFILE);
-  ices_config->daemon = ICES_DEFAULT_DAEMON;
-  ices_config->base_directory = ices_util_strdup (ICES_DEFAULT_BASE_DIRECTORY);
-  ices_config->verbose = ICES_DEFAULT_VERBOSE;
-  ices_config->reencode = 0;
-
-  ices_config->pm.playlist_file =
-    ices_util_strdup (ICES_DEFAULT_PLAYLIST_FILE);
-  ices_config->pm.module = ices_util_strdup (ICES_DEFAULT_MODULE);
-  ices_config->pm.randomize = ICES_DEFAULT_RANDOMIZE_PLAYLIST;
-  ices_config->pm.playlist_type = ICES_DEFAULT_PLAYLIST_TYPE;
-
-  ices_config->streams = (ices_stream_t*) malloc (sizeof (ices_stream_t));
-
-  ices_setup_parse_stream_defaults (ices_config->streams);
-}
-
-/* Place hardcoded defaults into an ices_stream_t object */
-void
-ices_setup_parse_stream_defaults (ices_stream_t* stream)
-{
-  stream->conn = NULL;
-  stream->host = ices_util_strdup (ICES_DEFAULT_HOST);
-  stream->port = ICES_DEFAULT_PORT;
-  stream->password = ices_util_strdup (ICES_DEFAULT_PASSWORD);
-  stream->protocol = ICES_DEFAULT_PROTOCOL;
-
-  stream->mount = ices_util_strdup (ICES_DEFAULT_MOUNT);
-  stream->dumpfile = NULL;
-  
-  stream->name = ices_util_strdup (ICES_DEFAULT_NAME);
-  stream->genre = ices_util_strdup (ICES_DEFAULT_GENRE);
-  stream->description = ices_util_strdup (ICES_DEFAULT_DESCRIPTION);
-  stream->url = ices_util_strdup (ICES_DEFAULT_URL);
-  stream->ispublic = ICES_DEFAULT_ISPUBLIC;
-
-  stream->bitrate = ICES_DEFAULT_BITRATE;
-  stream->reencode = ICES_DEFAULT_REENCODE;
-  stream->out_numchannels = -1;
-  stream->out_samplerate = -1;
-
-  stream->encoder_state = NULL;
-  stream->connect_delay = 0;
-
-  stream->next = NULL;
-}
-
-/* Frees ices_stream_t data (but not the object itself) */
-static void
-ices_setup_free_stream (ices_stream_t* stream)
-{
-  if (stream->conn)
-    shout_free (stream->conn);
-  ices_util_free (stream->host);
-  ices_util_free (stream->password);
-
-  ices_util_free (stream->mount);
-  ices_util_free (stream->dumpfile);
-
-  ices_util_free (stream->name);
-  ices_util_free (stream->genre);
-  ices_util_free (stream->description);
-  ices_util_free (stream->url);
-}
-
-/* Function to free() all allocated memory when ices shuts down. */
-static void
-ices_free_all (ices_config_t *ices_config)
-{
-  ices_stream_t *stream, *next;
-
-  ices_util_free (ices_config->configfile);
-  ices_util_free (ices_config->base_directory);
-
-  ices_util_free (ices_config->pm.playlist_file);
-  ices_util_free (ices_config->pm.module);
-
-  for (stream = ices_config->streams; stream; stream = next)
-  {
-    next = stream->next;
-
-    ices_setup_free_stream (stream);
-    ices_util_free (stream);
-  }
-}
-
-#ifdef HAVE_LIBXML
-/* Tell the xml module to parse the config file. */
-static void
-ices_setup_parse_config_file (ices_config_t *ices_config, const char *configfile)
-{
-  char namespace[1024];
-  const char *realname = NULL;
-  int ret;
-
-  if (ices_util_verify_file (configfile)) {
-    realname = configfile;
-  } else {
-    sprintf (namespace, "%s/%s", ICES_ETCDIR, configfile);
-    if (ices_util_verify_file (namespace))
-      realname = &namespace[0];
-  }
-	
-  if (realname) {
-    ret = ices_xml_parse_config_file (ices_config, realname);
-
-    if (ret == -1) {
-      /* ret == -1 means we have no libxml support */
-      ices_log_debug ("%s", ices_log_get_error ());
-    } else if (ret == 0) {
-      /* A real error */
-      ices_log ("%s", ices_log_get_error ());
-    }
-  }
-}
-#endif
-
-/* This function looks through the command line options for a new
- * configfile. */
-static void
-ices_setup_parse_command_line_for_new_configfile (ices_config_t *ices_config, char **argv, int argc)
-{
-  int arg;
-  char *s;
-
-  arg = 1;
-
-  while (arg < argc) {
-    s = argv[arg];
-
-    if (s[0] == '-') {
-      switch (s[1]) {
-      case 'c':
-	arg++;
-	if (ices_config->configfile)
-	  ices_util_free (ices_config->configfile);
-	ices_config->configfile = ices_util_strdup (argv[arg]);
-#ifndef HAVE_LIBXML
-	fprintf (stderr, "Cannot use config file (no XML support).\n");
-	ices_setup_shutdown ();
-#endif
-	break;
-      }
-    }
-    arg++;
-  }
-}
-
-/* This function parses the command line options */
-static void
-ices_setup_parse_command_line (ices_config_t *ices_config, char **argv,
-			       int argc)
-{
-  int arg;
-  char *s;
-  ices_stream_t* stream = ices_config->streams;
-  /* each -m option creates a new stream, subsequent options are applied
-   * to it. */
-  int nstreams = 1;
-
-  arg = 1;
-
-  while (arg < argc) {
-    s = argv[arg];
-
-    if (s[0] == '-') {
-      if ((strchr ("BRrsVv", s[1]) == NULL) && arg >= (argc - 1)) {
-	fprintf (stderr, "Option %c requires an argument!\n", s[1]);
-	ices_setup_usage ();
-	ices_setup_shutdown ();
-	return;
-      }
-
-      switch (s[1]) {
-        case 'B':
-	  ices_config->daemon = 1;
-	  break;
-        case 'b':
-	  arg++;
-	  stream->bitrate = atoi (argv[arg]);
-	  break;
-        case 'C':
-	  arg++;
-	  if (atoi(argv[arg]) > 0)
-	    /* TODO: stack plugins */
-	    ices_config->plugins = crossfade_plugin(atoi(argv[arg]));
-        case 'c':
-	  arg++;
-	  break;
-        case 'd':
-	  arg++;
-	  ices_util_free (stream->description);
-	  stream->description = ices_util_strdup (argv[arg]);
-	  break;
-        case 'D':
-	  arg++;
-	  ices_util_free (ices_config->base_directory);
-	  ices_config->base_directory = ices_util_strdup (argv[arg]);
-	  break;
-        case 'F':
-	  arg++;
-	  ices_util_free (ices_config->pm.playlist_file);
-	  ices_config->pm.playlist_file = ices_util_strdup (argv[arg]);
-	  break;
-        case 'f':
-	  arg++;
-	  ices_util_free (stream->dumpfile);
-	  stream->dumpfile = ices_util_strdup (argv[arg]);
-	  break;
-        case 'g':
-	  arg++;
-	  ices_util_free (stream->genre);
-	  stream->genre = ices_util_strdup (argv[arg]);
-	  break;
-        case 'h':
-	  arg++;
-	  ices_util_free (stream->host);
-	  stream->host = ices_util_strdup (argv[arg]);
-	  break;
-        case 'H':
-	  arg++;
-	  stream->out_samplerate = atoi (argv[arg]);
-	  break;
-        case 'M':
-	  arg++;
-	  ices_util_free (ices_config->pm.module);
-	  ices_config->pm.module = ices_util_strdup (argv[arg]);
-	  break;
-        case 'm':
-	  arg++;
-	  if (nstreams > 1) {
-	    stream->next =
-	      (ices_stream_t*) malloc (sizeof (ices_stream_t));
-	    stream = stream->next;
-	    ices_setup_parse_stream_defaults (stream);
-	  }
-	  ices_util_free (stream->mount);
-	  stream->mount = ices_util_strdup (argv[arg]);
-	  nstreams++;
-	  break;
-        case 'N':
-	  arg++;
-	  stream->out_numchannels = atoi (argv[arg]);
-	  break;
-        case 'n':
-	  arg++;
-	  ices_util_free (stream->name);
-	  stream->name = ices_util_strdup (argv[arg]);
-	  break;
-        case 'P':
-	  arg++;
-	  ices_util_free (stream->password);
-	  stream->password = ices_util_strdup (argv[arg]);
-	  break;
-        case 'p':
-	  arg++;
-	  stream->port = atoi (argv[arg]);
-	  break;
-        case 'R':
-#ifdef HAVE_LIBLAME
-	  stream->reencode = 1;
-#else
-	  fprintf (stderr, "This ices wasn't compiled with reencoding support\n");
-	  ices_setup_shutdown ();
-#endif
-	  break;
-        case 'r':
-	  ices_config->pm.randomize = 1;
-	  break;
-        case 'S':
-	  arg++;
-	  if (strcmp (argv[arg], "python") == 0)
-	    ices_config->pm.playlist_type = ices_playlist_python_e;
-	  else if (strcmp (argv[arg], "perl") == 0)
-	    ices_config->pm.playlist_type = ices_playlist_perl_e;
-	  else 
-	    ices_config->pm.playlist_type = ices_playlist_builtin_e;
-	  break;
-        case 's':
-	  stream->ispublic = 0;
-	  break;
-        case 't':
-	  arg++;
-	  if (!strcmp (argv[arg], "http"))
-	    stream->protocol = http_protocol_e;
-	  else if (!strcmp (argv[arg], "xaudiocast"))
-	    stream->protocol = xaudiocast_protocol_e;
-	  else if (!strcmp (argv[arg], "icy"))
-	    stream->protocol = icy_protocol_e;
-	  else {
-	    fprintf (stderr, "Unknown protocol %s. Use 'http', 'xaudiocast' or 'icy'.\n", argv[arg]);
-	    ices_setup_shutdown ();
-	  }
-	  break;
-        case 'u':
-	  arg++;
-	  ices_util_free (stream->url);
-	  stream->url = ices_util_strdup (argv[arg]);
-	  break;
-        case 'V':
-	  ices_setup_version ();
-	  exit (0);
-        case 'v':
-	  ices_config->verbose = 1;
-	  break;
-        default:
-	  ices_setup_usage ();
-	  break;
-      }
-    }
-    arg++;
-  }
-}
-
-/* This function takes all the new configuration and copies it to the
-   libshout object. */
-static void
-ices_setup_activate_libshout_changes (const ices_config_t *ices_config)
-{
-  ices_stream_t* stream;
-  shout_t* conn;
-  int streamno = 0;
-  char useragent[64];
-  char bitrate[8];
-
-  snprintf(useragent, sizeof(useragent), "ices/" VERSION " libshout/%s",
-    shout_version(NULL, NULL, NULL));
-
-  for (stream = ices_config->streams; stream; stream = stream->next) {
-    conn = stream->conn;
-
-    shout_set_host (conn, stream->host);
-    shout_set_port (conn, stream->port);
-    shout_set_password (conn, stream->password);
-    shout_set_format (conn, SHOUT_FORMAT_MP3);
-    if (stream->protocol == icy_protocol_e)
-      shout_set_protocol(conn, SHOUT_PROTOCOL_ICY);
-    else if (stream->protocol == http_protocol_e)
-      shout_set_protocol(conn, SHOUT_PROTOCOL_HTTP);
-    else
-      shout_set_protocol(conn, SHOUT_PROTOCOL_XAUDIOCAST);
-    if (stream->dumpfile)
-      shout_set_dumpfile(conn, stream->dumpfile);
-    shout_set_name (conn, stream->name);
-    shout_set_url (conn, stream->url);
-    shout_set_genre (conn, stream->genre);
-    shout_set_description (conn, stream->description);
-
-    snprintf(bitrate, sizeof(bitrate), "%d", stream->bitrate);
-    shout_set_audio_info (conn, SHOUT_AI_BITRATE, bitrate);
-
-    shout_set_public (conn, stream->ispublic);
-    shout_set_mount (conn, stream->mount);
-    shout_set_agent (conn, useragent);
-
-    ices_log_debug ("Sending following information to libshout:");
-    ices_log_debug ("Stream: %d", streamno);
-    ices_log_debug ("Host: %s:%d (protocol: %s)", shout_get_host (conn),
-                    shout_get_port (conn),
-		    stream->protocol == icy_protocol_e ? "icy" :
-		      stream->protocol == http_protocol_e ? "http" : "xaudiocast");
-    ices_log_debug ("Mount: %s, Password: %s", shout_get_mount (conn), shout_get_password (conn));
-    ices_log_debug ("Name: %s\tURL: %s", shout_get_name (conn), shout_get_url(conn));
-    ices_log_debug ("Genre: %s\tDesc: %s", shout_get_genre (conn),
-		    shout_get_description (conn));
-    ices_log_debug ("Bitrate: %s\tPublic: %d", shout_get_audio_info (conn, SHOUT_AI_BITRATE),
-		    shout_get_public (conn));
-    ices_log_debug ("Dump file: %s", ices_util_nullcheck (shout_get_dumpfile (conn)));
-    streamno++;
-  }
-}
-
-/* Display all command line options for ices */
-static void
-ices_setup_usage (void)
-{
-  printf ("This is ices " VERSION "\n"
-	  "ices <options>\n"
-	  "Options:\n"
-	  "\t-B (Background (daemon mode))\n"
-	  "\t-b <stream bitrate>\n"
-	  "\t-C <crossfade seconds>\n");
-  printf ("\t-c <configfile>\n");
-  printf ("\t-D <base directory>\n");
-  printf ("\t-d <stream description>\n");
-  printf ("\t-f <dumpfile on server>\n");
-  printf ("\t-F <playlist>\n");
-  printf ("\t-g <stream genre>\n");
-  printf ("\t-h <host>\n");
-  printf ("\t-M <interpreter module>\n");
-  printf ("\t-m <mountpoint>\n");
-  printf ("\t-n <stream name>\n");
-  printf ("\t-p <port>\n");
-  printf ("\t-P <password>\n");
-  printf ("\t-R (activate reencoding)\n");
-  printf ("\t-r (randomize playlist)\n");
-  printf ("\t-s (private stream)\n");
-  printf ("\t-S <perl|python|builtin>\n");
-  printf ("\t-t <http|xaudiocast|icy>\n");
-  printf ("\t-u <stream url>\n");
-  printf ("\t-v (verbose output)\n");
-  printf ("\t-H <reencoded sample rate>\n");
-  printf ("\t-N <reencoded number of channels>\n");
-}
-
-/* display version information */
-static void
-ices_setup_version (void)
-{
-  printf ("ices " VERSION "\nFeatures: "
-#ifdef HAVE_LIBLAME
-  "LAME "
-#endif
-#ifdef HAVE_LIBPERL
-  "Perl "
-#endif
-#ifdef HAVE_LIBPYTHON
-  "python "
-#endif
-#ifdef HAVE_LIBXML
-  "libxml "
-#endif
-#ifdef HAVE_LIBVORBISFILE
-  "Vorbis "
-#endif
-#ifdef HAVE_LIBFLAC
-  "FLAC "
-#endif
-#ifdef HAVE_LIBFAAD
-  "MP4"
-#endif
-  "\n"
-  "System configuration file: " ICES_ETCDIR "/ices.conf\n"
-#if defined (HAVE_LIBPERL) || defined (HAVE_LIBPYTHON)
-  "Playlist module directory: " ICES_MODULEDIR "\n"
-#endif
-    );
-}
-
-/* Put ices in the background, as a daemon */
-static void
-ices_setup_daemonize (void)
-{
-  int icespid = fork ();
-
-  if (icespid == -1) {
-    ices_log ("ERROR: Cannot fork(), that means no daemon, sorry!");
-    return;
-  }
-
-  if (icespid != 0) {
-    /* Update the pidfile (so external applications know what pid
-       ices is running with. */
-    printf ("Into the land of the dreaded daemons we go... (pid: %d)\n", icespid);
-    ices_setup_shutdown ();
-  }
-#ifdef HAVE_SETSID
-  setsid ();
-#endif
-
-  ices_log_daemonize ();
-  ices_setup_update_pidfile (getpid());
-}
-
-/* Update a file called ices.pid with the given process id */
-static void
-ices_setup_update_pidfile (int icespid)
-{
-  char buf[1024];
-  FILE* pidfd;
-
-  if (! ices_config.base_directory) {
-    ices_log_error ("Base directory is invalid");
-    return;
-  }
-
-  snprintf (buf, sizeof (buf), "%s/ices.pid", ices_config.base_directory);
-
-  pidfd = ices_util_fopen_for_writing (buf);
-	
-  if (pidfd) {
-    fprintf (pidfd, "%d", icespid);
-    ices_util_fclose (pidfd);
-  }
-}
-
-		

Copied: icecast/branches/ices0/pipe/src/setup.c (from rev 8704, icecast/trunk/ices0/src/setup.c)
===================================================================
--- icecast/trunk/ices0/src/setup.c	2005-01-09 23:10:32 UTC (rev 8704)
+++ icecast/branches/ices0/pipe/src/setup.c	2005-02-04 06:57:21 UTC (rev 8828)
@@ -0,0 +1,664 @@
+/* setup.c
+ * - Functions for initialization in ices
+ * Copyright (c) 2000 Alexander Haväng
+ * Copyright (c) 2002-4 Brendan Cully <brendan at xiph.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * 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.
+ *
+ */
+
+#include "definitions.h"
+#include "metadata.h"
+
+/* Local function declarations */
+static void ices_setup_parse_options (ices_config_t *ices_config);
+static void ices_setup_parse_defaults (ices_config_t *ices_config);
+#ifdef HAVE_LIBXML
+static void ices_setup_parse_config_file (ices_config_t *ices_config, const char *configfile);
+#endif
+static void ices_setup_parse_command_line (ices_config_t *ices_config, char **argv, int argc);
+static void ices_setup_parse_command_line_for_new_configfile (ices_config_t *ices_config, char **argv, int argc);
+static void ices_setup_activate_libshout_changes (const ices_config_t *ices_config);
+static void ices_setup_usage (void);
+static void ices_setup_version (void);
+static void ices_setup_update_pidfile (int icespid);
+static void ices_setup_daemonize (void);
+static void ices_free_all (ices_config_t *ices_config);
+
+extern ices_config_t ices_config;
+
+/* Global function definitions */
+
+/* Top level initialization function for ices.
+ * It will parse options, initialize modules,
+ * and if requested, become a daemon. */
+void
+ices_setup_initialize (void)
+{
+  ices_stream_t* stream;
+  ices_plugin_t* plugin;
+  
+  shout_init();
+
+  /* Setup signal handlers */
+  ices_signals_setup ();
+
+  /* Parse the options in the config file, and the command line */
+  ices_setup_parse_options (&ices_config);
+
+  if (ices_config.daemon)
+    ices_setup_daemonize ();
+
+  /* Open logfiles */
+  ices_log_initialize ();
+
+  /* Initialize the libshout structure */
+  for (stream = ices_config.streams; stream; stream = stream->next) {
+    if (!(stream->conn = shout_new ())) {
+      ices_log ("Could not create shout interface");
+      ices_setup_shutdown ();
+    }
+  }
+
+  ices_setup_activate_libshout_changes (&ices_config);
+
+  /* Initialize the playlist handler */
+  ices_playlist_initialize ();
+
+#ifdef HAVE_LIBLAME
+  /* Initialize liblame for reeencoding */
+  ices_reencode_initialize ();
+
+  while (ices_config.plugins && ices_config.plugins->init() < 0)
+    ices_config.plugins = ices_config.plugins->next;
+
+  for (plugin = ices_config.plugins; plugin && plugin->next; plugin = plugin->next)
+    if (plugin->next->init() < 0)
+      plugin->next = plugin->next->next;
+#endif
+
+  ices_log_debug("Startup complete\n");
+}
+
+/* Top level ices shutdown function.
+ * This is the _only_ way out of here */
+void
+ices_setup_shutdown (void)
+{
+  ices_stream_t* stream;
+  ices_plugin_t* plugin;
+
+  /* Tell libshout to disconnect from server */
+  for (stream = ices_config.streams; stream; stream = stream->next)
+    if (stream->conn)
+      shout_close (stream->conn);
+
+#ifdef HAVE_LIBLAME
+  for (plugin = ices_config.plugins; plugin; plugin = plugin->next)
+    plugin->shutdown();
+
+  /* Order the reencoding engine to shutdown */
+  ices_reencode_shutdown ();
+#endif
+
+  /* Tell the playlist module to shutdown and cleanup */
+  ices_playlist_shutdown ();
+
+  /* Cleanup the cue file (the cue module has no init yet) */
+  ices_cue_shutdown ();
+
+  /* Make sure we're not leaving any memory allocated around when
+   * we exit. This makes it easier to find memory leaks, and 
+   * some systems actually don't clean up that well */
+  ices_free_all (&ices_config);
+	
+  /* Let the log and console know we went down ok */
+  ices_log ("Ices Exiting...");
+
+  /* Close logfiles */
+  ices_log_shutdown ();
+	
+  shout_shutdown();
+
+  /* Down and down we go... */
+  exit (1);
+}
+
+/* Local function definitions */
+
+/* Top level option parsing function.
+ * Sets of options object (ices_config), with:
+ * - Hardcoded defaults
+ * - Configfile settings
+ * - Command line options */
+static void
+ices_setup_parse_options (ices_config_t *ices_config)
+{
+  /* Get default values for the settings */
+  ices_setup_parse_defaults (ices_config);
+
+  /* Look for given configfile on the commandline */
+  ices_setup_parse_command_line_for_new_configfile (ices_config, ices_util_get_argv(), ices_util_get_argc ());
+
+#ifdef HAVE_LIBXML
+  /* Parse the configfile */
+  ices_setup_parse_config_file (ices_config, ices_config->configfile);
+#endif
+	
+  /* Parse the commandline */
+  ices_setup_parse_command_line (ices_config, ices_util_get_argv(), ices_util_get_argc());
+}
+
+/* Function for placing hardcoded defaults in the 
+ * options object (ices_config) */
+static void
+ices_setup_parse_defaults (ices_config_t *ices_config)
+{
+  ices_config->configfile = ices_util_strdup (ICES_DEFAULT_CONFIGFILE);
+  ices_config->daemon = ICES_DEFAULT_DAEMON;
+  ices_config->base_directory = ices_util_strdup (ICES_DEFAULT_BASE_DIRECTORY);
+  ices_config->verbose = ICES_DEFAULT_VERBOSE;
+  ices_config->reencode = 0;
+
+  ices_config->pm.playlist_file =
+    ices_util_strdup (ICES_DEFAULT_PLAYLIST_FILE);
+  ices_config->pm.module = ices_util_strdup (ICES_DEFAULT_MODULE);
+  ices_config->pm.randomize = ICES_DEFAULT_RANDOMIZE_PLAYLIST;
+  ices_config->pm.playlist_type = ICES_DEFAULT_PLAYLIST_TYPE;
+
+  ices_config->streams = (ices_stream_t*) malloc (sizeof (ices_stream_t));
+
+  ices_setup_parse_stream_defaults (ices_config->streams);
+}
+
+/* Place hardcoded defaults into an ices_stream_t object */
+void
+ices_setup_parse_stream_defaults (ices_stream_t* stream)
+{
+  stream->conn = NULL;
+  stream->host = ices_util_strdup (ICES_DEFAULT_HOST);
+  stream->port = ICES_DEFAULT_PORT;
+  stream->password = ices_util_strdup (ICES_DEFAULT_PASSWORD);
+  stream->protocol = ICES_DEFAULT_PROTOCOL;
+
+  stream->mount = ices_util_strdup (ICES_DEFAULT_MOUNT);
+  stream->dumpfile = NULL;
+  
+  stream->name = ices_util_strdup (ICES_DEFAULT_NAME);
+  stream->genre = ices_util_strdup (ICES_DEFAULT_GENRE);
+  stream->description = ices_util_strdup (ICES_DEFAULT_DESCRIPTION);
+  stream->url = ices_util_strdup (ICES_DEFAULT_URL);
+  stream->ispublic = ICES_DEFAULT_ISPUBLIC;
+
+  stream->bitrate = ICES_DEFAULT_BITRATE;
+  stream->reencode = ICES_DEFAULT_REENCODE;
+  stream->out_numchannels = -1;
+  stream->out_samplerate = -1;
+
+  stream->encoder = NULL;
+  stream->encoder_state = NULL;
+  stream->connect_delay = 0;
+
+  stream->next = NULL;
+}
+
+/* Frees ices_stream_t data (but not the object itself) */
+static void
+ices_setup_free_stream (ices_stream_t* stream)
+{
+  if (stream->conn)
+    shout_free (stream->conn);
+  ices_util_free (stream->host);
+  ices_util_free (stream->password);
+
+  ices_util_free (stream->mount);
+  ices_util_free (stream->dumpfile);
+
+  ices_util_free (stream->name);
+  ices_util_free (stream->genre);
+  ices_util_free (stream->description);
+  ices_util_free (stream->url);
+}
+
+/* Function to free() all allocated memory when ices shuts down. */
+static void
+ices_free_all (ices_config_t *ices_config)
+{
+  ices_stream_t *stream, *next;
+
+  ices_util_free (ices_config->configfile);
+  ices_util_free (ices_config->base_directory);
+
+  ices_util_free (ices_config->pm.playlist_file);
+  ices_util_free (ices_config->pm.module);
+
+  for (stream = ices_config->streams; stream; stream = next)
+  {
+    next = stream->next;
+
+    ices_setup_free_stream (stream);
+    ices_util_free (stream);
+  }
+}
+
+#ifdef HAVE_LIBXML
+/* Tell the xml module to parse the config file. */
+static void
+ices_setup_parse_config_file (ices_config_t *ices_config, const char *configfile)
+{
+  char namespace[1024];
+  const char *realname = NULL;
+  int ret;
+
+  if (ices_util_verify_file (configfile)) {
+    realname = configfile;
+  } else {
+    sprintf (namespace, "%s/%s", ICES_ETCDIR, configfile);
+    if (ices_util_verify_file (namespace))
+      realname = &namespace[0];
+  }
+	
+  if (realname) {
+    ret = ices_xml_parse_config_file (ices_config, realname);
+
+    if (ret == -1) {
+      /* ret == -1 means we have no libxml support */
+      ices_log_debug ("%s", ices_log_get_error ());
+    } else if (ret == 0) {
+      /* A real error */
+      ices_log ("%s", ices_log_get_error ());
+    }
+  }
+}
+#endif
+
+/* This function looks through the command line options for a new
+ * configfile. */
+static void
+ices_setup_parse_command_line_for_new_configfile (ices_config_t *ices_config, char **argv, int argc)
+{
+  int arg;
+  char *s;
+
+  arg = 1;
+
+  while (arg < argc) {
+    s = argv[arg];
+
+    if (s[0] == '-') {
+      switch (s[1]) {
+      case 'c':
+	arg++;
+	if (ices_config->configfile)
+	  ices_util_free (ices_config->configfile);
+	ices_config->configfile = ices_util_strdup (argv[arg]);
+#ifndef HAVE_LIBXML
+	fprintf (stderr, "Cannot use config file (no XML support).\n");
+	ices_setup_shutdown ();
+#endif
+	break;
+      }
+    }
+    arg++;
+  }
+}
+
+/* This function parses the command line options */
+static void
+ices_setup_parse_command_line (ices_config_t *ices_config, char **argv,
+			       int argc)
+{
+  int arg;
+  char *s;
+  ices_stream_t* stream = ices_config->streams;
+  /* each -m option creates a new stream, subsequent options are applied
+   * to it. */
+  int nstreams = 1;
+
+  arg = 1;
+
+  while (arg < argc) {
+    s = argv[arg];
+
+    if (s[0] == '-') {
+      if ((strchr ("BRrsVv", s[1]) == NULL) && arg >= (argc - 1)) {
+	fprintf (stderr, "Option %c requires an argument!\n", s[1]);
+	ices_setup_usage ();
+	ices_setup_shutdown ();
+	return;
+      }
+
+      switch (s[1]) {
+        case 'B':
+	  ices_config->daemon = 1;
+	  break;
+        case 'b':
+	  arg++;
+	  stream->bitrate = atoi (argv[arg]);
+	  break;
+        case 'C':
+	  arg++;
+	  if (atoi(argv[arg]) > 0)
+	    /* TODO: stack plugins */
+	    ices_config->plugins = crossfade_plugin(atoi(argv[arg]));
+        case 'c':
+	  arg++;
+	  break;
+        case 'd':
+	  arg++;
+	  ices_util_free (stream->description);
+	  stream->description = ices_util_strdup (argv[arg]);
+	  break;
+        case 'D':
+	  arg++;
+	  ices_util_free (ices_config->base_directory);
+	  ices_config->base_directory = ices_util_strdup (argv[arg]);
+	  break;
+        case 'F':
+	  arg++;
+	  ices_util_free (ices_config->pm.playlist_file);
+	  ices_config->pm.playlist_file = ices_util_strdup (argv[arg]);
+	  break;
+        case 'f':
+	  arg++;
+	  ices_util_free (stream->dumpfile);
+	  stream->dumpfile = ices_util_strdup (argv[arg]);
+	  break;
+        case 'g':
+	  arg++;
+	  ices_util_free (stream->genre);
+	  stream->genre = ices_util_strdup (argv[arg]);
+	  break;
+        case 'h':
+	  arg++;
+	  ices_util_free (stream->host);
+	  stream->host = ices_util_strdup (argv[arg]);
+	  break;
+        case 'H':
+	  arg++;
+	  stream->out_samplerate = atoi (argv[arg]);
+	  break;
+        case 'M':
+	  arg++;
+	  ices_util_free (ices_config->pm.module);
+	  ices_config->pm.module = ices_util_strdup (argv[arg]);
+	  break;
+        case 'm':
+	  arg++;
+	  if (nstreams > 1) {
+	    stream->next =
+	      (ices_stream_t*) malloc (sizeof (ices_stream_t));
+	    stream = stream->next;
+	    ices_setup_parse_stream_defaults (stream);
+	  }
+	  ices_util_free (stream->mount);
+	  stream->mount = ices_util_strdup (argv[arg]);
+	  nstreams++;
+	  break;
+        case 'N':
+	  arg++;
+	  stream->out_numchannels = atoi (argv[arg]);
+	  break;
+        case 'n':
+	  arg++;
+	  ices_util_free (stream->name);
+	  stream->name = ices_util_strdup (argv[arg]);
+	  break;
+        case 'P':
+	  arg++;
+	  ices_util_free (stream->password);
+	  stream->password = ices_util_strdup (argv[arg]);
+	  break;
+        case 'p':
+	  arg++;
+	  stream->port = atoi (argv[arg]);
+	  break;
+        case 'R':
+#ifdef HAVE_LIBLAME
+	  stream->reencode = 1;
+          stream->encoder = pipe_encoder();
+#else
+	  fprintf (stderr, "This ices wasn't compiled with reencoding support\n");
+	  ices_setup_shutdown ();
+#endif
+	  break;
+        case 'r':
+	  ices_config->pm.randomize = 1;
+	  break;
+        case 'S':
+	  arg++;
+	  if (strcmp (argv[arg], "python") == 0)
+	    ices_config->pm.playlist_type = ices_playlist_python_e;
+	  else if (strcmp (argv[arg], "perl") == 0)
+	    ices_config->pm.playlist_type = ices_playlist_perl_e;
+	  else if (strcmp (argv[arg], "script") == 0)
+	    ices_config->pm.playlist_type = ices_playlist_script_e;
+	  else 
+	    ices_config->pm.playlist_type = ices_playlist_builtin_e;
+	  break;
+        case 's':
+	  stream->ispublic = 0;
+	  break;
+        case 't':
+	  arg++;
+	  if (!strcmp (argv[arg], "http"))
+	    stream->protocol = http_protocol_e;
+	  else if (!strcmp (argv[arg], "xaudiocast"))
+	    stream->protocol = xaudiocast_protocol_e;
+	  else if (!strcmp (argv[arg], "icy"))
+	    stream->protocol = icy_protocol_e;
+	  else {
+	    fprintf (stderr, "Unknown protocol %s. Use 'http', 'xaudiocast' or 'icy'.\n", argv[arg]);
+	    ices_setup_shutdown ();
+	  }
+	  break;
+        case 'u':
+	  arg++;
+	  ices_util_free (stream->url);
+	  stream->url = ices_util_strdup (argv[arg]);
+	  break;
+        case 'V':
+	  ices_setup_version ();
+	  exit (0);
+        case 'v':
+	  ices_config->verbose = 1;
+	  break;
+        default:
+	  ices_setup_usage ();
+	  break;
+      }
+    }
+    arg++;
+  }
+}
+
+/* This function takes all the new configuration and copies it to the
+   libshout object. */
+static void
+ices_setup_activate_libshout_changes (const ices_config_t *ices_config)
+{
+  ices_stream_t* stream;
+  shout_t* conn;
+  int streamno = 0;
+  char useragent[64];
+  char bitrate[8];
+
+  snprintf(useragent, sizeof(useragent), "ices/" VERSION " libshout/%s",
+    shout_version(NULL, NULL, NULL));
+
+  for (stream = ices_config->streams; stream; stream = stream->next) {
+    conn = stream->conn;
+
+    shout_set_host (conn, stream->host);
+    shout_set_port (conn, stream->port);
+    shout_set_password (conn, stream->password);
+    shout_set_format (conn, SHOUT_FORMAT_MP3);
+    if (stream->protocol == icy_protocol_e)
+      shout_set_protocol(conn, SHOUT_PROTOCOL_ICY);
+    else if (stream->protocol == http_protocol_e)
+      shout_set_protocol(conn, SHOUT_PROTOCOL_HTTP);
+    else
+      shout_set_protocol(conn, SHOUT_PROTOCOL_XAUDIOCAST);
+    if (stream->dumpfile)
+      shout_set_dumpfile(conn, stream->dumpfile);
+    shout_set_name (conn, stream->name);
+    shout_set_url (conn, stream->url);
+    shout_set_genre (conn, stream->genre);
+    shout_set_description (conn, stream->description);
+
+    snprintf(bitrate, sizeof(bitrate), "%d", stream->bitrate);
+    shout_set_audio_info (conn, SHOUT_AI_BITRATE, bitrate);
+
+    shout_set_public (conn, stream->ispublic);
+    shout_set_mount (conn, stream->mount);
+    shout_set_agent (conn, useragent);
+
+    ices_log_debug ("Sending following information to libshout:");
+    ices_log_debug ("Stream: %d", streamno);
+    ices_log_debug ("Host: %s:%d (protocol: %s)", shout_get_host (conn),
+                    shout_get_port (conn),
+		    stream->protocol == icy_protocol_e ? "icy" :
+		      stream->protocol == http_protocol_e ? "http" : "xaudiocast");
+    ices_log_debug ("Mount: %s, Password: %s", shout_get_mount (conn), shout_get_password (conn));
+    ices_log_debug ("Name: %s\tURL: %s", shout_get_name (conn), shout_get_url(conn));
+    ices_log_debug ("Genre: %s\tDesc: %s", shout_get_genre (conn),
+		    shout_get_description (conn));
+    ices_log_debug ("Bitrate: %s\tPublic: %d", shout_get_audio_info (conn, SHOUT_AI_BITRATE),
+		    shout_get_public (conn));
+    ices_log_debug ("Dump file: %s", ices_util_nullcheck (shout_get_dumpfile (conn)));
+    
+    /* other stream init goes here I guess */
+    if (stream->encoder)
+      stream->encoder->init(stream);
+    
+    streamno++;
+  }
+}
+
+/* Display all command line options for ices */
+static void
+ices_setup_usage (void)
+{
+  printf ("This is ices " VERSION "\n"
+	  "ices <options>\n"
+	  "Options:\n"
+	  "\t-B (Background (daemon mode))\n"
+	  "\t-b <stream bitrate>\n"
+	  "\t-C <crossfade seconds>\n");
+  printf ("\t-c <configfile>\n");
+  printf ("\t-D <base directory>\n");
+  printf ("\t-d <stream description>\n");
+  printf ("\t-f <dumpfile on server>\n");
+  printf ("\t-F <playlist>\n");
+  printf ("\t-g <stream genre>\n");
+  printf ("\t-h <host>\n");
+  printf ("\t-M <interpreter module>\n");
+  printf ("\t-m <mountpoint>\n");
+  printf ("\t-n <stream name>\n");
+  printf ("\t-p <port>\n");
+  printf ("\t-P <password>\n");
+  printf ("\t-R (activate reencoding)\n");
+  printf ("\t-r (randomize playlist)\n");
+  printf ("\t-s (private stream)\n");
+  printf ("\t-S <perl|python|builtin>\n");
+  printf ("\t-t <http|xaudiocast|icy>\n");
+  printf ("\t-u <stream url>\n");
+  printf ("\t-v (verbose output)\n");
+  printf ("\t-H <reencoded sample rate>\n");
+  printf ("\t-N <reencoded number of channels>\n");
+}
+
+/* display version information */
+static void
+ices_setup_version (void)
+{
+  printf ("ices " VERSION "\nFeatures: "
+#ifdef HAVE_LIBLAME
+  "LAME "
+#endif
+#ifdef HAVE_LIBPERL
+  "Perl "
+#endif
+#ifdef HAVE_LIBPYTHON
+  "python "
+#endif
+#ifdef HAVE_LIBXML
+  "libxml "
+#endif
+#ifdef HAVE_LIBVORBISFILE
+  "Vorbis "
+#endif
+#ifdef HAVE_LIBFLAC
+  "FLAC "
+#endif
+#ifdef HAVE_LIBFAAD
+  "MP4"
+#endif
+  "\n"
+  "System configuration file: " ICES_ETCDIR "/ices.conf\n"
+#if defined (HAVE_LIBPERL) || defined (HAVE_LIBPYTHON)
+  "Playlist module directory: " ICES_MODULEDIR "\n"
+#endif
+    );
+}
+
+/* Put ices in the background, as a daemon */
+static void
+ices_setup_daemonize (void)
+{
+  int icespid = fork ();
+
+  if (icespid == -1) {
+    ices_log ("ERROR: Cannot fork(), that means no daemon, sorry!");
+    return;
+  }
+
+  if (icespid != 0) {
+    /* Update the pidfile (so external applications know what pid
+       ices is running with. */
+    printf ("Into the land of the dreaded daemons we go... (pid: %d)\n", icespid);
+    ices_setup_shutdown ();
+  }
+#ifdef HAVE_SETSID
+  setsid ();
+#endif
+
+  ices_log_daemonize ();
+  ices_setup_update_pidfile (getpid());
+}
+
+/* Update a file called ices.pid with the given process id */
+static void
+ices_setup_update_pidfile (int icespid)
+{
+  char buf[1024];
+  FILE* pidfd;
+
+  if (! ices_config.base_directory) {
+    ices_log_error ("Base directory is invalid");
+    return;
+  }
+
+  snprintf (buf, sizeof (buf), "%s/ices.pid", ices_config.base_directory);
+
+  pidfd = ices_util_fopen_for_writing (buf);
+	
+  if (pidfd) {
+    fprintf (pidfd, "%d", icespid);
+    ices_util_fclose (pidfd);
+  }
+}
+
+		

Modified: icecast/branches/ices0/pipe/src/stream.c
===================================================================
--- icecast/trunk/ices0/src/stream.c	2005-01-09 09:53:20 UTC (rev 8703)
+++ icecast/branches/ices0/pipe/src/stream.c	2005-02-04 06:57:21 UTC (rev 8828)
@@ -170,16 +170,28 @@
 
   if (config->reencode) {
     ices_reencode_reset (source);
+    
     if (config->plugins) {
       decode = 1;
       for (plugin = config->plugins; plugin; plugin = plugin->next)
-	plugin->new_track(source);
-    } else
-      for (stream = config->streams; stream; stream = stream->next)
+	plugin->new_source(source);
+    } else {
+      for (stream = config->streams; stream; stream = stream->next) {
 	if (stream->reencode && stream_needs_reencoding (source, stream)) {
 	  decode = 1;
 	  break;
 	}
+      }
+    }
+    
+    for (stream = config->streams; stream; stream = stream->next) {
+      if (stream->encoder) {
+        if (!stream->encoder->new_source(stream, source)) {
+          ices_log_error("Could not reset encoder");
+          return -1;
+        }
+      }
+    }
   }
 
   if (decode) {
@@ -254,8 +266,13 @@
 	          obuf.data = tmpbuf;
 	          ices_log_debug ("Grew output buffer to %d bytes", obuf.len);
 	        }
+#if 0
 	        if ((olen = ices_reencode (stream, samples, left, rightp, obuf.data,
 	            obuf.len)) < -1) {
+#else
+                if ((olen = stream->encoder->encode (stream, samples, left, rightp, obuf.data,
+                     obuf.len)) < -1) {
+#endif
 	          ices_log_error ("Reencoding error, aborting track");
 	          goto err;
 	        } else if (olen == -1) {



More information about the commits mailing list