From c14d9259c1cb0ab1a3de172915ec65cbb1f6b8cd Mon Sep 17 00:00:00 2001 From: darkeye Date: Wed, 29 Aug 2001 21:08:30 +0000 Subject: [PATCH] made some description options in the darkice config file optional --- darkice/trunk/man/darkice.1 | 8 +++---- darkice/trunk/src/CastSink.cpp | 33 +++++++++++++++++--------- darkice/trunk/src/CastSink.h | 31 +++++++++++++----------- darkice/trunk/src/DarkIce.cpp | 21 ++++++++++------- darkice/trunk/src/IceCast.cpp | 43 +++++++++++++++++++++------------- darkice/trunk/src/IceCast.h | 19 ++++++++------- 6 files changed, 93 insertions(+), 62 deletions(-) diff --git a/darkice/trunk/man/darkice.1 b/darkice/trunk/man/darkice.1 index fa25e4b..756eb79 100644 --- a/darkice/trunk/man/darkice.1 +++ b/darkice/trunk/man/darkice.1 @@ -146,6 +146,10 @@ server .TP .I mountPoint Mount point for the stream on the server + +.PP +Optional values: + .TP .I name Name of the stream @@ -161,10 +165,6 @@ Genre of the stream .TP .I public "yes" or "no", wether the stream is public - -.PP -Optional values: - .TP .I remoteDumpFile The file the diff --git a/darkice/trunk/src/CastSink.cpp b/darkice/trunk/src/CastSink.cpp index 49aff9c..123bada 100644 --- a/darkice/trunk/src/CastSink.cpp +++ b/darkice/trunk/src/CastSink.cpp @@ -57,26 +57,26 @@ void CastSink :: init ( TcpSocket * socket, const char * password, const char * mountPoint, - const char * remoteDumpFile, + unsigned int bitRate, const char * name, const char * description, const char * url, const char * genre, - unsigned int bitRate, bool isPublic, + const char * remoteDumpFile, unsigned int bufferDuration ) throw ( Exception ) { this->socket = socket; this->password = Util::strDup( password); this->mountPoint = Util::strDup( mountPoint); - this->remoteDumpFile = remoteDumpFile ? Util::strDup( remoteDumpFile) : 0; - this->name = Util::strDup( name); - this->description = Util::strDup( description); - this->url = Util::strDup( url); - this->genre = Util::strDup( genre); this->bitRate = bitRate; + this->name = name ? Util::strDup( name) : 0; + this->description = description ? Util::strDup( description) : 0; + this->url = url ? Util::strDup( url) : 0; + this->genre = genre ? Util::strDup( genre) : 0; this->isPublic = isPublic; + this->remoteDumpFile = remoteDumpFile ? Util::strDup( remoteDumpFile) : 0; this->bufferDuration = bufferDuration; bufferedSink = new BufferedSink( socket, @@ -97,13 +97,21 @@ CastSink :: strip ( void ) throw ( Exception ) delete[] password; delete[] mountPoint; + if ( name ) { + delete[] name; + } + if ( description ) { + delete[] description; + } + if ( url ) { + delete[] url; + } + if ( genre ) { + delete[] genre; + } if ( remoteDumpFile ) { delete[] remoteDumpFile; } - delete[] name; - delete[] description; - delete[] url; - delete[] genre; } @@ -136,6 +144,9 @@ CastSink :: open ( void ) throw ( Exception ) $Source$ $Log$ + Revision 1.4 2001/08/29 21:08:30 darkeye + made some description options in the darkice config file optional + Revision 1.3 2000/11/12 14:54:50 darkeye added kdoc-style documentation comments diff --git a/darkice/trunk/src/CastSink.h b/darkice/trunk/src/CastSink.h index 324f285..d99a5c0 100644 --- a/darkice/trunk/src/CastSink.h +++ b/darkice/trunk/src/CastSink.h @@ -143,13 +143,13 @@ class CastSink : public Sink init ( TcpSocket * socket, const char * password, const char * mountPoint, - const char * remoteDumpFile, + unsigned int bitRate, const char * name, const char * description, const char * url, const char * genre, - unsigned int bitRate, bool isPublic, + const char * remoteDumpFile, unsigned int bufferDuration ) throw ( Exception ); @@ -230,26 +230,26 @@ class CastSink : public Sink CastSink ( TcpSocket * socket, const char * password, const char * mountPoint, - const char * remoteDumpFile, - const char * name, - const char * description, - const char * url, - const char * genre, unsigned int bitRate, - bool isPublic, + const char * name = 0, + const char * description = 0, + const char * url = 0, + const char * genre = 0, + bool isPublic = false, + const char * remoteDumpFile = 0, unsigned int bufferDuration = 10 ) throw ( Exception ) { init( socket, password, mountPoint, - remoteDumpFile, + bitRate, name, description, url, genre, - bitRate, isPublic, + remoteDumpFile, bufferDuration ); } @@ -265,13 +265,13 @@ class CastSink : public Sink init( cs.socket.get(), cs.password, cs.mountPoint, - cs.remoteDumpFile, + cs.bitRate, cs.name, cs.description, cs.url, cs.genre, - cs.bitRate, cs.isPublic, + cs.remoteDumpFile, cs.bufferDuration ); } @@ -302,13 +302,13 @@ class CastSink : public Sink init( cs.socket.get(), cs.password, cs.mountPoint, - cs.remoteDumpFile, + cs.bitRate, cs.name, cs.description, cs.url, cs.genre, - cs.bitRate, cs.isPublic, + cs.remoteDumpFile, cs.bufferDuration ); } return *this; @@ -516,6 +516,9 @@ class CastSink : public Sink $Source$ $Log$ + Revision 1.5 2001/08/29 21:08:30 darkeye + made some description options in the darkice config file optional + Revision 1.4 2000/11/12 14:54:50 darkeye added kdoc-style documentation comments diff --git a/darkice/trunk/src/DarkIce.cpp b/darkice/trunk/src/DarkIce.cpp index 121d22f..3805840 100644 --- a/darkice/trunk/src/DarkIce.cpp +++ b/darkice/trunk/src/DarkIce.cpp @@ -200,12 +200,12 @@ DarkIce :: configLameLib ( const Config & config, password = cs->getForSure( "password", " missing in section ", lame); mountPoint = cs->getForSure( "mountPoint"," missing in section ",lame); remoteDumpFile = cs->get( "remoteDumpFile"); - name = cs->getForSure( "name", " missing in section ", lame); - description = cs->getForSure("description"," missing in section ",lame); - url = cs->getForSure( "url", " missing in section ", lame); - genre = cs->getForSure( "genre", " missing in section ", lame); - str = cs->getForSure( "public", " missing in section ", lame); - isPublic = Util::strEq( str, "yes") ? true : false; + name = cs->get( "name"); + description = cs->get("description"); + url = cs->get( "url"); + genre = cs->get( "genre"); + str = cs->get( "public"); + isPublic = str ? (Util::strEq( str, "yes") ? true : false) : false; str = cs->get( "lowpass"); lowpass = str ? Util::strToL( str) : 0; str = cs->get( "highpass"); @@ -225,13 +225,13 @@ DarkIce :: configLameLib ( const Config & config, lameLibOuts[u].ice = new IceCast( lameLibOuts[u].socket.get(), password, mountPoint, - remoteDumpFile, + bitrate, name, description, url, genre, - bitrate, - isPublic ); + isPublic, + remoteDumpFile ); lameLibOuts[u].encoder = new LameLibEncoder( lameLibOuts[u].ice.get(), dsp.get(), @@ -380,6 +380,9 @@ DarkIce :: run ( void ) throw ( Exception ) $Source$ $Log$ + Revision 1.14 2001/08/29 21:08:30 darkeye + made some description options in the darkice config file optional + Revision 1.13 2001/08/26 20:44:30 darkeye removed external command-line encoder support replaced it with a shared-object support for lame with the possibility diff --git a/darkice/trunk/src/IceCast.cpp b/darkice/trunk/src/IceCast.cpp index fd5ff06..9ba496d 100644 --- a/darkice/trunk/src/IceCast.cpp +++ b/darkice/trunk/src/IceCast.cpp @@ -120,25 +120,33 @@ IceCast :: sendLogin ( void ) throw ( Exception ) } /* send the x-audiocast headers */ - str = "x-audiocast-name: "; - sink->write( str, strlen( str)); - str = getName(); - sink->write( str, strlen( str)); + if ( getName() ) { + str = "x-audiocast-name: "; + sink->write( str, strlen( str)); + str = getName(); + sink->write( str, strlen( str)); + } - str = "\nx-audiocast-description: "; - sink->write( str, strlen( str)); - str = getDescription(); - sink->write( str, strlen( str)); + if ( getDescription() ) { + str = "\nx-audiocast-description: "; + sink->write( str, strlen( str)); + str = getDescription(); + sink->write( str, strlen( str)); + } - str = "\nx-audiocast-url: "; - sink->write( str, strlen( str)); - str = getUrl(); - sink->write( str, strlen( str)); + if ( getUrl() ) { + str = "\nx-audiocast-url: "; + sink->write( str, strlen( str)); + str = getUrl(); + sink->write( str, strlen( str)); + } - str = "\nx-audiocast-genre: "; - sink->write( str, strlen( str)); - str = getGenre(); - sink->write( str, strlen( str)); + if ( getGenre() ) { + str = "\nx-audiocast-genre: "; + sink->write( str, strlen( str)); + str = getGenre(); + sink->write( str, strlen( str)); + } str = "\nx-audiocast-bitrate: "; sink->write( str, strlen( str)); @@ -186,6 +194,9 @@ IceCast :: sendLogin ( void ) throw ( Exception ) $Source$ $Log$ + Revision 1.5 2001/08/29 21:08:30 darkeye + made some description options in the darkice config file optional + Revision 1.4 2000/11/12 14:54:50 darkeye added kdoc-style documentation comments diff --git a/darkice/trunk/src/IceCast.h b/darkice/trunk/src/IceCast.h index 21e10d3..72c2fae 100644 --- a/darkice/trunk/src/IceCast.h +++ b/darkice/trunk/src/IceCast.h @@ -107,25 +107,25 @@ class IceCast : public CastSink IceCast ( TcpSocket * socket, const char * password, const char * mountPoint, - const char * remoteDumpFile, - const char * name, - const char * description, - const char * url, - const char * genre, unsigned int bitRate, - bool isPublic, + const char * name = 0, + const char * description = 0, + const char * url = 0, + const char * genre = 0, + bool isPublic = false, + const char * remoteDumpFile = 0, unsigned int bufferDuration = 10 ) throw ( Exception ) : CastSink( socket, password, mountPoint, - remoteDumpFile, + bitRate, name, description, url, genre, - bitRate, isPublic, + remoteDumpFile, bufferDuration ) { } @@ -184,6 +184,9 @@ class IceCast : public CastSink $Source$ $Log$ + Revision 1.5 2001/08/29 21:08:30 darkeye + made some description options in the darkice config file optional + Revision 1.4 2000/11/12 14:54:50 darkeye added kdoc-style documentation comments