added Darwin Streaming Server mount point patch, closes #29
This commit is contained in:
parent
5fb33b2c45
commit
dc5aaa9faf
|
@ -31,4 +31,5 @@ with contributions by:
|
||||||
Clyde Stubbs <clyde@htsoft.com>
|
Clyde Stubbs <clyde@htsoft.com>
|
||||||
Jens Maurer <Jens.Maurer@gmx.net>
|
Jens Maurer <Jens.Maurer@gmx.net>
|
||||||
Elod Horvath <elod@itfais.com>
|
Elod Horvath <elod@itfais.com>
|
||||||
|
Pierre Souchay <pierre@souchay.net>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
Darkice 0.19 to be released
|
||||||
|
|
||||||
|
o added mount point option for Darwin Streaming Server
|
||||||
|
thanks to Pierre Souchay <pierre@souchay.net>
|
||||||
|
|
||||||
26-04-2007 DarkIce 0.18.1 released
|
26-04-2007 DarkIce 0.18.1 released
|
||||||
|
|
||||||
o enable real-time scheduling for non-super-users, if they have
|
o enable real-time scheduling for non-super-users, if they have
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH darkice 1 "April 26, 2007" "DarkIce" "DarkIce live audio streamer"
|
.TH darkice 1 "November 20, 2007" "DarkIce" "DarkIce live audio streamer"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
darkice \- an icecast / shoutcast live audio streamer
|
darkice \- an icecast / shoutcast live audio streamer
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -105,6 +105,7 @@ Developed with contributions by
|
||||||
Clyde Stubbs <clyde@htsoft.com>
|
Clyde Stubbs <clyde@htsoft.com>
|
||||||
Jens Maurer <Jens.Maurer@gmx.net>
|
Jens Maurer <Jens.Maurer@gmx.net>
|
||||||
Elod Horvath <elod@itfais.com>
|
Elod Horvath <elod@itfais.com>
|
||||||
|
Pierre Souchay <pierre@souchay.net>
|
||||||
|
|
||||||
.SH LINKS
|
.SH LINKS
|
||||||
Project homepage:
|
Project homepage:
|
||||||
|
|
|
@ -367,6 +367,10 @@ server
|
||||||
.PP
|
.PP
|
||||||
Optional values:
|
Optional values:
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.I mountPoint
|
||||||
|
Mount point for the stream on the server. Only works on Darwin Streaming
|
||||||
|
Server, the original Shoutcast server does not support mount points
|
||||||
.TP
|
.TP
|
||||||
.I sampleRate
|
.I sampleRate
|
||||||
The sample rate of the encoded mp3 output. If not specified, defaults
|
The sample rate of the encoded mp3 output. If not specified, defaults
|
||||||
|
|
|
@ -362,26 +362,26 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
|
|
||||||
#ifdef HAVE_LAME_LIB
|
#ifdef HAVE_LAME_LIB
|
||||||
if ( Util::strEq( str, "mp3") ) {
|
if ( Util::strEq( str, "mp3") ) {
|
||||||
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
|
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
|
||||||
dsp.get(),
|
dsp.get(),
|
||||||
bitrateMode,
|
bitrateMode,
|
||||||
bitrate,
|
bitrate,
|
||||||
quality,
|
quality,
|
||||||
sampleRate,
|
sampleRate,
|
||||||
channel,
|
channel,
|
||||||
lowpass,
|
lowpass,
|
||||||
highpass );
|
highpass );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_TWOLAME_LIB
|
#ifdef HAVE_TWOLAME_LIB
|
||||||
if ( Util::strEq( str, "mp2") ) {
|
if ( Util::strEq( str, "mp2") ) {
|
||||||
audioOuts[u].encoder = new TwoLameLibEncoder(
|
audioOuts[u].encoder = new TwoLameLibEncoder(
|
||||||
audioOuts[u].server.get(),
|
audioOuts[u].server.get(),
|
||||||
dsp.get(),
|
dsp.get(),
|
||||||
bitrateMode,
|
bitrateMode,
|
||||||
bitrate,
|
bitrate,
|
||||||
sampleRate,
|
sampleRate,
|
||||||
channel );
|
channel );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -697,6 +697,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
const char * url = 0;
|
const char * url = 0;
|
||||||
const char * genre = 0;
|
const char * genre = 0;
|
||||||
bool isPublic = false;
|
bool isPublic = false;
|
||||||
|
const char * mountPoint = 0;
|
||||||
int lowpass = 0;
|
int lowpass = 0;
|
||||||
int highpass = 0;
|
int highpass = 0;
|
||||||
const char * irc = 0;
|
const char * irc = 0;
|
||||||
|
@ -755,6 +756,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
port = Util::strToL( str);
|
port = Util::strToL( str);
|
||||||
password = cs->getForSure("password"," missing in section ",stream);
|
password = cs->getForSure("password"," missing in section ",stream);
|
||||||
name = cs->get( "name");
|
name = cs->get( "name");
|
||||||
|
mountPoint = cs->get( "mountPoint" );
|
||||||
url = cs->get( "url");
|
url = cs->get( "url");
|
||||||
genre = cs->get( "genre");
|
genre = cs->get( "genre");
|
||||||
str = cs->get( "public");
|
str = cs->get( "public");
|
||||||
|
@ -803,6 +805,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
audioOuts[u].socket = new TcpSocket( server, port);
|
audioOuts[u].socket = new TcpSocket( server, port);
|
||||||
audioOuts[u].server = new ShoutCast( audioOuts[u].socket.get(),
|
audioOuts[u].server = new ShoutCast( audioOuts[u].socket.get(),
|
||||||
password,
|
password,
|
||||||
|
mountPoint,
|
||||||
bitrate,
|
bitrate,
|
||||||
name,
|
name,
|
||||||
url,
|
url,
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
#error need math.h
|
#error need math.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
#include "Source.h"
|
#include "Source.h"
|
||||||
|
@ -87,12 +89,14 @@ static const char fileid[] = "$Id$";
|
||||||
void
|
void
|
||||||
ShoutCast :: init ( const char * irc,
|
ShoutCast :: init ( const char * irc,
|
||||||
const char * aim,
|
const char * aim,
|
||||||
const char * icq )
|
const char * icq,
|
||||||
|
const char * mountPoint )
|
||||||
throw ( Exception )
|
throw ( Exception )
|
||||||
{
|
{
|
||||||
this->irc = irc ? Util::strDup( irc) : 0;
|
this->irc = irc ? Util::strDup( irc) : 0;
|
||||||
this->aim = aim ? Util::strDup( aim) : 0;
|
this->aim = aim ? Util::strDup( aim) : 0;
|
||||||
this->icq = icq ? Util::strDup( icq) : 0;
|
this->icq = icq ? Util::strDup( icq) : 0;
|
||||||
|
this->mountPoint = mountPoint ? Util::strDup( mountPoint ) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,6 +115,9 @@ ShoutCast :: strip ( void ) throw ( Exception )
|
||||||
if ( icq ) {
|
if ( icq ) {
|
||||||
delete[] icq;
|
delete[] icq;
|
||||||
}
|
}
|
||||||
|
if (mountPoint ){
|
||||||
|
delete[] mountPoint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,6 +132,9 @@ ShoutCast :: sendLogin ( void ) throw ( Exception )
|
||||||
const char * str;
|
const char * str;
|
||||||
char resp[STRBUF_SIZE];
|
char resp[STRBUF_SIZE];
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
bool needsMountPoint = false;
|
||||||
|
const char * mountPoint = getMountPoint();
|
||||||
|
|
||||||
|
|
||||||
if ( !source->isOpen() ) {
|
if ( !source->isOpen() ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -133,10 +143,38 @@ ShoutCast :: sendLogin ( void ) throw ( Exception )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We will add SOURCE only if really needed: if the mountPoint is not null
|
||||||
|
// and is different of "/". This is to keep maximum compatibility with
|
||||||
|
// NullSoft Shoutcast server.
|
||||||
|
if (mountPoint != 0L
|
||||||
|
&& strlen(mountPoint) > 0 && 0 != strcmp("/", mountPoint)) {
|
||||||
|
needsMountPoint = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostringstream os;
|
||||||
|
|
||||||
|
if (needsMountPoint) {
|
||||||
|
os << "SOURCE ";
|
||||||
|
}
|
||||||
|
|
||||||
/* first line is the password in itself */
|
/* first line is the password in itself */
|
||||||
str = getPassword();
|
os << getPassword();
|
||||||
sink->write( str, strlen( str));
|
os << "\n";
|
||||||
str = "\n";
|
|
||||||
|
// send the mount point
|
||||||
|
if (needsMountPoint) {
|
||||||
|
os << " ";
|
||||||
|
if (strncmp("/", mountPoint, 1) != 0) {
|
||||||
|
os << "/";
|
||||||
|
}
|
||||||
|
os << mountPoint;
|
||||||
|
os << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
str = os.str().c_str();
|
||||||
|
|
||||||
|
// Ok, now we send login which will be different of classical Shoutcast
|
||||||
|
// if mountPoint is not null and is different from "/" ...
|
||||||
sink->write( str, strlen( str));
|
sink->write( str, strlen( str));
|
||||||
sink->flush();
|
sink->flush();
|
||||||
|
|
||||||
|
|
|
@ -75,18 +75,25 @@ class ShoutCast : public CastSink
|
||||||
*/
|
*/
|
||||||
char * icq;
|
char * icq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The optional mountPoint
|
||||||
|
*/
|
||||||
|
char * mountPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initalize the object.
|
* Initalize the object.
|
||||||
*
|
*
|
||||||
* @param irc IRC info string for the stream.
|
* @param irc IRC info string for the stream.
|
||||||
* @param aim AIM info string for the stream.
|
* @param aim AIM info string for the stream.
|
||||||
* @param icq ICQ info string for the stream.
|
* @param icq ICQ info string for the stream.
|
||||||
|
* @param mountPoint Optional mount point information
|
||||||
* @exception Exception
|
* @exception Exception
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
init ( const char * irc,
|
init ( const char * irc,
|
||||||
const char * aim,
|
const char * aim,
|
||||||
const char * icq )
|
const char * icq,
|
||||||
|
const char * mountPoint )
|
||||||
throw ( Exception );
|
throw ( Exception );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,6 +135,7 @@ class ShoutCast : public CastSink
|
||||||
*
|
*
|
||||||
* @param socket socket connection to the server.
|
* @param socket socket connection to the server.
|
||||||
* @param password password to the server.
|
* @param password password to the server.
|
||||||
|
* @param mountPoint Optional mount point for DSS.
|
||||||
* @param name name of the stream.
|
* @param name name of the stream.
|
||||||
* @param url URL associated with the stream.
|
* @param url URL associated with the stream.
|
||||||
* @param genre genre of the stream.
|
* @param genre genre of the stream.
|
||||||
|
@ -145,6 +153,7 @@ class ShoutCast : public CastSink
|
||||||
inline
|
inline
|
||||||
ShoutCast ( TcpSocket * socket,
|
ShoutCast ( TcpSocket * socket,
|
||||||
const char * password,
|
const char * password,
|
||||||
|
const char * mountPoint,
|
||||||
unsigned int bitRate,
|
unsigned int bitRate,
|
||||||
const char * name = 0,
|
const char * name = 0,
|
||||||
const char * url = 0,
|
const char * url = 0,
|
||||||
|
@ -166,7 +175,7 @@ class ShoutCast : public CastSink
|
||||||
streamDump,
|
streamDump,
|
||||||
bufferDuration )
|
bufferDuration )
|
||||||
{
|
{
|
||||||
init( irc, aim, icq);
|
init( irc, aim, icq, mountPoint );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,7 +187,7 @@ class ShoutCast : public CastSink
|
||||||
ShoutCast( const ShoutCast & cs ) throw ( Exception )
|
ShoutCast( const ShoutCast & cs ) throw ( Exception )
|
||||||
: CastSink( cs )
|
: CastSink( cs )
|
||||||
{
|
{
|
||||||
init( cs.getIrc(), cs.getAim(), cs.getIcq());
|
init( cs.getIrc(), cs.getAim(), cs.getIcq(), cs.getMountPoint());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -205,11 +214,26 @@ class ShoutCast : public CastSink
|
||||||
if ( this != &cs ) {
|
if ( this != &cs ) {
|
||||||
strip();
|
strip();
|
||||||
CastSink::operator=( cs );
|
CastSink::operator=( cs );
|
||||||
init( cs.getIrc(), cs.getAim(), cs.getIcq());
|
init( cs.getIrc(), cs.getAim(), cs.getIcq(), getMountPoint());
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mount point of the stream on the server.
|
||||||
|
* The mount point can be null if it has not been set
|
||||||
|
* (typical Shoutcast server) or not null (for instance
|
||||||
|
* with Darwin Streaming Server). In that case, the
|
||||||
|
* authentication process will be slightly different.
|
||||||
|
*
|
||||||
|
* @return the mount point of the stream on the server.
|
||||||
|
*/
|
||||||
|
inline const char *
|
||||||
|
getMountPoint ( void ) const throw ()
|
||||||
|
{
|
||||||
|
return mountPoint;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the IRC info string for the stream.
|
* Get the IRC info string for the stream.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue