added possibility to stream in mono when recording in stereo
This commit is contained in:
parent
cdaeb85b0b
commit
e3e1e11d73
|
@ -13,4 +13,5 @@ with contributions by:
|
||||||
the OSALP team, http://osalp.sourceforge.net
|
the OSALP team, http://osalp.sourceforge.net
|
||||||
Kristjan G. Bjarnason <kgb@gangverk.is>
|
Kristjan G. Bjarnason <kgb@gangverk.is>
|
||||||
Nicu Pavel <npavel@ituner.com>
|
Nicu Pavel <npavel@ituner.com>
|
||||||
|
Kai Krakow <kai@kaishome.de>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
DarkIce next version
|
DarkIce next version
|
||||||
|
|
||||||
|
o added possibility to stream in mono even when recording in stereo,
|
||||||
|
thus enabling mono and stereo streams with the same darkice instance.
|
||||||
|
only for mp3 streams at the moment
|
||||||
|
thanks to Kai Krakow <kai@kaishome.de>
|
||||||
o bug fix: resampling audio for vorbis streams bugs fixed
|
o bug fix: resampling audio for vorbis streams bugs fixed
|
||||||
|
|
||||||
02-08-2002: DarkIce 0.10.1 released
|
02-08-2002: DarkIce 0.10.1 released
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH darkice.cfg 5 "April 13, 2002" "DarkIce" "DarkIce live audio streamer"
|
.TH darkice.cfg 5 "August 3, 2002" "DarkIce" "DarkIce live audio streamer"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
darkice.cfg \- configuration file for darkice
|
darkice.cfg \- configuration file for darkice
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
@ -126,6 +126,10 @@ Optional values:
|
||||||
The sample rate of the encoded mp3 output. If not specified, defaults
|
The sample rate of the encoded mp3 output. If not specified, defaults
|
||||||
to the value of the input sample rate.
|
to the value of the input sample rate.
|
||||||
.TP
|
.TP
|
||||||
|
.I channel
|
||||||
|
Number of channels for the mp3 output (e.g. 1 for mono, 2 for stereo).
|
||||||
|
If not specified, defaults to the value of the input sample rate.
|
||||||
|
.TP
|
||||||
.I name
|
.I name
|
||||||
Name of the stream
|
Name of the stream
|
||||||
.TP
|
.TP
|
||||||
|
@ -299,6 +303,10 @@ Optional values:
|
||||||
The sample rate of the encoded mp3 output. If not specified, defaults
|
The sample rate of the encoded mp3 output. If not specified, defaults
|
||||||
to the value of the input sample rate.
|
to the value of the input sample rate.
|
||||||
.TP
|
.TP
|
||||||
|
.I channel
|
||||||
|
Number of channels for the mp3 output (e.g. 1 for mono, 2 for stereo).
|
||||||
|
If not specified, defaults to the value of the input sample rate.
|
||||||
|
.TP
|
||||||
.I name
|
.I name
|
||||||
Name of the stream
|
Name of the stream
|
||||||
.TP
|
.TP
|
||||||
|
@ -476,7 +484,7 @@ It will build up a connection to an
|
||||||
server yp.your-ice-server.com on port 8000 with the password "ice-hackme".
|
server yp.your-ice-server.com on port 8000 with the password "ice-hackme".
|
||||||
The sound for this stream will be cut at 10500 Hz from above.
|
The sound for this stream will be cut at 10500 Hz from above.
|
||||||
The stream will be encoded to average bit rate 96 kb/s mp3 and resampled to
|
The stream will be encoded to average bit rate 96 kb/s mp3 and resampled to
|
||||||
22.05kHz.
|
22.05kHz and 1 channel (mono).
|
||||||
The stream will be reachable at
|
The stream will be reachable at
|
||||||
.I http://yp.your-ice-server.com:8000/live96
|
.I http://yp.your-ice-server.com:8000/live96
|
||||||
to mp3 players.
|
to mp3 players.
|
||||||
|
@ -507,6 +515,7 @@ channel = 2
|
||||||
|
|
||||||
[icecast-0]
|
[icecast-0]
|
||||||
sampleRate = 22050
|
sampleRate = 22050
|
||||||
|
channel = 1
|
||||||
bitrateMode = abr
|
bitrateMode = abr
|
||||||
bitrate = 96
|
bitrate = 96
|
||||||
lowpass = 10500
|
lowpass = 10500
|
||||||
|
|
|
@ -201,6 +201,7 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
const char * str;
|
const char * str;
|
||||||
|
|
||||||
unsigned int sampleRate = 0;
|
unsigned int sampleRate = 0;
|
||||||
|
unsigned int channel = 0;
|
||||||
AudioEncoder::BitrateMode bitrateMode;
|
AudioEncoder::BitrateMode bitrateMode;
|
||||||
unsigned int bitrate = 0;
|
unsigned int bitrate = 0;
|
||||||
double quality = 0.0;
|
double quality = 0.0;
|
||||||
|
@ -221,6 +222,8 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
|
|
||||||
str = cs->get( "sampleRate");
|
str = cs->get( "sampleRate");
|
||||||
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
||||||
|
str = cs->get( "channel");
|
||||||
|
channel = str ? Util::strToL( str) : dsp->getChannel();
|
||||||
|
|
||||||
str = cs->get( "bitrate");
|
str = cs->get( "bitrate");
|
||||||
bitrate = str ? Util::strToL( str) : 0;
|
bitrate = str ? Util::strToL( str) : 0;
|
||||||
|
@ -295,13 +298,6 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// encoder related stuff
|
|
||||||
unsigned int bs = bufferSecs *
|
|
||||||
(dsp->getBitsPerSample() / 8) *
|
|
||||||
dsp->getChannel() *
|
|
||||||
dsp->getSampleRate();
|
|
||||||
reportEvent( 6, "using buffer size", bs);
|
|
||||||
|
|
||||||
// streaming related stuff
|
// streaming related stuff
|
||||||
audioOuts[u].socket = new TcpSocket( server, port);
|
audioOuts[u].socket = new TcpSocket( server, port);
|
||||||
audioOuts[u].server = new IceCast( audioOuts[u].socket.get(),
|
audioOuts[u].server = new IceCast( audioOuts[u].socket.get(),
|
||||||
|
@ -314,7 +310,8 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
genre,
|
genre,
|
||||||
isPublic,
|
isPublic,
|
||||||
remoteDumpFile,
|
remoteDumpFile,
|
||||||
localDumpFile );
|
localDumpFile,
|
||||||
|
bufferSecs );
|
||||||
|
|
||||||
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
|
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
|
||||||
dsp.get(),
|
dsp.get(),
|
||||||
|
@ -322,7 +319,7 @@ DarkIce :: configIceCast ( const Config & config,
|
||||||
bitrate,
|
bitrate,
|
||||||
quality,
|
quality,
|
||||||
sampleRate,
|
sampleRate,
|
||||||
dsp->getChannel(),
|
channel,
|
||||||
lowpass,
|
lowpass,
|
||||||
highpass );
|
highpass );
|
||||||
|
|
||||||
|
@ -458,13 +455,6 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// encoder related stuff
|
|
||||||
unsigned int bs = bufferSecs *
|
|
||||||
(dsp->getBitsPerSample() / 8) *
|
|
||||||
dsp->getChannel() *
|
|
||||||
dsp->getSampleRate();
|
|
||||||
reportEvent( 6, "using buffer size", bs);
|
|
||||||
|
|
||||||
// streaming related stuff
|
// streaming related stuff
|
||||||
audioOuts[u].socket = new TcpSocket( server, port);
|
audioOuts[u].socket = new TcpSocket( server, port);
|
||||||
audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(),
|
audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(),
|
||||||
|
@ -477,7 +467,8 @@ DarkIce :: configIceCast2 ( const Config & config,
|
||||||
url,
|
url,
|
||||||
genre,
|
genre,
|
||||||
isPublic,
|
isPublic,
|
||||||
localDumpFile );
|
localDumpFile,
|
||||||
|
bufferSecs );
|
||||||
|
|
||||||
switch ( format ) {
|
switch ( format ) {
|
||||||
case IceCast2::mp3:
|
case IceCast2::mp3:
|
||||||
|
@ -562,6 +553,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
const char * str;
|
const char * str;
|
||||||
|
|
||||||
unsigned int sampleRate = 0;
|
unsigned int sampleRate = 0;
|
||||||
|
unsigned int channel = 0;
|
||||||
AudioEncoder::BitrateMode bitrateMode;
|
AudioEncoder::BitrateMode bitrateMode;
|
||||||
unsigned int bitrate = 0;
|
unsigned int bitrate = 0;
|
||||||
double quality = 0.0;
|
double quality = 0.0;
|
||||||
|
@ -582,6 +574,8 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
|
|
||||||
str = cs->get( "sampleRate");
|
str = cs->get( "sampleRate");
|
||||||
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
||||||
|
str = cs->get( "channel");
|
||||||
|
channel = str ? Util::strToL( str) : dsp->getChannel();
|
||||||
|
|
||||||
str = cs->get( "bitrate");
|
str = cs->get( "bitrate");
|
||||||
bitrate = str ? Util::strToL( str) : 0;
|
bitrate = str ? Util::strToL( str) : 0;
|
||||||
|
@ -653,13 +647,6 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// encoder related stuff
|
|
||||||
unsigned int bs = bufferSecs *
|
|
||||||
(dsp->getBitsPerSample() / 8) *
|
|
||||||
dsp->getChannel() *
|
|
||||||
dsp->getSampleRate();
|
|
||||||
reportEvent( 6, "using buffer size", bs);
|
|
||||||
|
|
||||||
// streaming related stuff
|
// streaming related stuff
|
||||||
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(),
|
||||||
|
@ -672,7 +659,8 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
irc,
|
irc,
|
||||||
aim,
|
aim,
|
||||||
icq,
|
icq,
|
||||||
localDumpFile );
|
localDumpFile,
|
||||||
|
bufferSecs );
|
||||||
|
|
||||||
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
|
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
|
||||||
dsp.get(),
|
dsp.get(),
|
||||||
|
@ -680,7 +668,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
||||||
bitrate,
|
bitrate,
|
||||||
quality,
|
quality,
|
||||||
sampleRate,
|
sampleRate,
|
||||||
dsp->getChannel(),
|
channel,
|
||||||
lowpass,
|
lowpass,
|
||||||
highpass );
|
highpass );
|
||||||
|
|
||||||
|
@ -976,6 +964,9 @@ DarkIce :: run ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.29 2002/08/03 12:41:18 darkeye
|
||||||
|
added possibility to stream in mono when recording in stereo
|
||||||
|
|
||||||
Revision 1.28 2002/07/20 10:59:00 darkeye
|
Revision 1.28 2002/07/20 10:59:00 darkeye
|
||||||
added support for Ogg Vorbis 1.0, removed support for rc2
|
added support for Ogg Vorbis 1.0, removed support for rc2
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ LameLibEncoder :: open ( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 0 > lame_set_mode( lameGlobalFlags,
|
if ( 0 > lame_set_mode( lameGlobalFlags,
|
||||||
getInChannel() == 1 ? MONO : JOINT_STEREO) ) {
|
getOutChannel() == 1 ? MONO : JOINT_STEREO) ) {
|
||||||
throw Exception( __FILE__, __LINE__,
|
throw Exception( __FILE__, __LINE__,
|
||||||
"lame lib setting mode error",
|
"lame lib setting mode error",
|
||||||
JOINT_STEREO );
|
JOINT_STEREO );
|
||||||
|
@ -268,15 +268,21 @@ LameLibEncoder :: write ( const void * buf,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int bitsPerSample = getInBitsPerSample();
|
unsigned int bitsPerSample = getInBitsPerSample();
|
||||||
unsigned int channels = getInChannel();
|
unsigned int inChannels = getInChannel();
|
||||||
|
unsigned int outChannels = getOutChannel();
|
||||||
|
|
||||||
if ( channels != 1 && channels != 2 ) {
|
if ( inChannels != 1 && inChannels != 2 ) {
|
||||||
throw Exception( __FILE__, __LINE__,
|
throw Exception( __FILE__, __LINE__,
|
||||||
"unsupported number of channels for the encoder",
|
"unsupported number of input channels for the encoder",
|
||||||
channels );
|
inChannels );
|
||||||
|
}
|
||||||
|
if ( outChannels != 1 && outChannels != 2 ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"unsupported number of output channels for the encoder",
|
||||||
|
outChannels );
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int sampleSize = (bitsPerSample / 8) * channels;
|
unsigned int sampleSize = (bitsPerSample / 8) * inChannels;
|
||||||
unsigned char * b = (unsigned char*) buf;
|
unsigned char * b = (unsigned char*) buf;
|
||||||
unsigned int processed = len - (len % sampleSize);
|
unsigned int processed = len - (len % sampleSize);
|
||||||
unsigned int nSamples = processed / sampleSize;
|
unsigned int nSamples = processed / sampleSize;
|
||||||
|
@ -284,13 +290,13 @@ LameLibEncoder :: write ( const void * buf,
|
||||||
short int * rightBuffer = new short int[nSamples];
|
short int * rightBuffer = new short int[nSamples];
|
||||||
|
|
||||||
if ( bitsPerSample == 8 ) {
|
if ( bitsPerSample == 8 ) {
|
||||||
Util::conv8( b, processed, leftBuffer, rightBuffer, channels);
|
Util::conv8( b, processed, leftBuffer, rightBuffer, inChannels);
|
||||||
} else if ( bitsPerSample == 16 ) {
|
} else if ( bitsPerSample == 16 ) {
|
||||||
Util::conv16( b,
|
Util::conv16( b,
|
||||||
processed,
|
processed,
|
||||||
leftBuffer,
|
leftBuffer,
|
||||||
rightBuffer,
|
rightBuffer,
|
||||||
channels,
|
inChannels,
|
||||||
isInBigEndian());
|
isInBigEndian());
|
||||||
} else {
|
} else {
|
||||||
delete[] leftBuffer;
|
delete[] leftBuffer;
|
||||||
|
@ -307,7 +313,7 @@ LameLibEncoder :: write ( const void * buf,
|
||||||
|
|
||||||
ret = lame_encode_buffer( lameGlobalFlags,
|
ret = lame_encode_buffer( lameGlobalFlags,
|
||||||
leftBuffer,
|
leftBuffer,
|
||||||
channels == 2 ? rightBuffer : leftBuffer,
|
inChannels == 2 ? rightBuffer : leftBuffer,
|
||||||
nSamples,
|
nSamples,
|
||||||
mp3Buf,
|
mp3Buf,
|
||||||
mp3Size );
|
mp3Size );
|
||||||
|
@ -388,6 +394,9 @@ LameLibEncoder :: close ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.15 2002/08/03 12:41:18 darkeye
|
||||||
|
added possibility to stream in mono when recording in stereo
|
||||||
|
|
||||||
Revision 1.14 2002/07/28 00:11:58 darkeye
|
Revision 1.14 2002/07/28 00:11:58 darkeye
|
||||||
bugfix for the previous fix :)
|
bugfix for the previous fix :)
|
||||||
|
|
||||||
|
|
|
@ -123,11 +123,6 @@ class LameLibEncoder : public AudioEncoder, public virtual Reporter
|
||||||
"specified bits per sample not supported",
|
"specified bits per sample not supported",
|
||||||
getInBitsPerSample() );
|
getInBitsPerSample() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getInChannel() != getOutChannel() ) {
|
|
||||||
throw Exception( __FILE__, __LINE__,
|
|
||||||
"different in and out channels not supported");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -436,6 +431,9 @@ class LameLibEncoder : public AudioEncoder, public virtual Reporter
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.13 2002/08/03 12:41:18 darkeye
|
||||||
|
added possibility to stream in mono when recording in stereo
|
||||||
|
|
||||||
Revision 1.12 2002/04/13 11:26:00 darkeye
|
Revision 1.12 2002/04/13 11:26:00 darkeye
|
||||||
added cbr, abr and vbr setting feature with encoding quality
|
added cbr, abr and vbr setting feature with encoding quality
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue