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
|
||||
Kristjan G. Bjarnason <kgb@gangverk.is>
|
||||
Nicu Pavel <npavel@ituner.com>
|
||||
Kai Krakow <kai@kaishome.de>
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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
|
||||
|
||||
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
|
||||
darkice.cfg \- configuration file for darkice
|
||||
.SH DESCRIPTION
|
||||
|
@ -126,6 +126,10 @@ Optional values:
|
|||
The sample rate of the encoded mp3 output. If not specified, defaults
|
||||
to the value of the input sample rate.
|
||||
.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
|
||||
Name of the stream
|
||||
.TP
|
||||
|
@ -299,6 +303,10 @@ Optional values:
|
|||
The sample rate of the encoded mp3 output. If not specified, defaults
|
||||
to the value of the input sample rate.
|
||||
.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
|
||||
Name of the stream
|
||||
.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".
|
||||
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
|
||||
22.05kHz.
|
||||
22.05kHz and 1 channel (mono).
|
||||
The stream will be reachable at
|
||||
.I http://yp.your-ice-server.com:8000/live96
|
||||
to mp3 players.
|
||||
|
@ -507,6 +515,7 @@ channel = 2
|
|||
|
||||
[icecast-0]
|
||||
sampleRate = 22050
|
||||
channel = 1
|
||||
bitrateMode = abr
|
||||
bitrate = 96
|
||||
lowpass = 10500
|
||||
|
|
|
@ -201,6 +201,7 @@ DarkIce :: configIceCast ( const Config & config,
|
|||
const char * str;
|
||||
|
||||
unsigned int sampleRate = 0;
|
||||
unsigned int channel = 0;
|
||||
AudioEncoder::BitrateMode bitrateMode;
|
||||
unsigned int bitrate = 0;
|
||||
double quality = 0.0;
|
||||
|
@ -221,6 +222,8 @@ DarkIce :: configIceCast ( const Config & config,
|
|||
|
||||
str = cs->get( "sampleRate");
|
||||
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
||||
str = cs->get( "channel");
|
||||
channel = str ? Util::strToL( str) : dsp->getChannel();
|
||||
|
||||
str = cs->get( "bitrate");
|
||||
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
|
||||
audioOuts[u].socket = new TcpSocket( server, port);
|
||||
audioOuts[u].server = new IceCast( audioOuts[u].socket.get(),
|
||||
|
@ -314,7 +310,8 @@ DarkIce :: configIceCast ( const Config & config,
|
|||
genre,
|
||||
isPublic,
|
||||
remoteDumpFile,
|
||||
localDumpFile );
|
||||
localDumpFile,
|
||||
bufferSecs );
|
||||
|
||||
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
|
||||
dsp.get(),
|
||||
|
@ -322,7 +319,7 @@ DarkIce :: configIceCast ( const Config & config,
|
|||
bitrate,
|
||||
quality,
|
||||
sampleRate,
|
||||
dsp->getChannel(),
|
||||
channel,
|
||||
lowpass,
|
||||
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
|
||||
audioOuts[u].socket = new TcpSocket( server, port);
|
||||
audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(),
|
||||
|
@ -477,7 +467,8 @@ DarkIce :: configIceCast2 ( const Config & config,
|
|||
url,
|
||||
genre,
|
||||
isPublic,
|
||||
localDumpFile );
|
||||
localDumpFile,
|
||||
bufferSecs );
|
||||
|
||||
switch ( format ) {
|
||||
case IceCast2::mp3:
|
||||
|
@ -562,6 +553,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
|||
const char * str;
|
||||
|
||||
unsigned int sampleRate = 0;
|
||||
unsigned int channel = 0;
|
||||
AudioEncoder::BitrateMode bitrateMode;
|
||||
unsigned int bitrate = 0;
|
||||
double quality = 0.0;
|
||||
|
@ -582,6 +574,8 @@ DarkIce :: configShoutCast ( const Config & config,
|
|||
|
||||
str = cs->get( "sampleRate");
|
||||
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
|
||||
str = cs->get( "channel");
|
||||
channel = str ? Util::strToL( str) : dsp->getChannel();
|
||||
|
||||
str = cs->get( "bitrate");
|
||||
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
|
||||
audioOuts[u].socket = new TcpSocket( server, port);
|
||||
audioOuts[u].server = new ShoutCast( audioOuts[u].socket.get(),
|
||||
|
@ -672,7 +659,8 @@ DarkIce :: configShoutCast ( const Config & config,
|
|||
irc,
|
||||
aim,
|
||||
icq,
|
||||
localDumpFile );
|
||||
localDumpFile,
|
||||
bufferSecs );
|
||||
|
||||
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
|
||||
dsp.get(),
|
||||
|
@ -680,7 +668,7 @@ DarkIce :: configShoutCast ( const Config & config,
|
|||
bitrate,
|
||||
quality,
|
||||
sampleRate,
|
||||
dsp->getChannel(),
|
||||
channel,
|
||||
lowpass,
|
||||
highpass );
|
||||
|
||||
|
@ -976,6 +964,9 @@ DarkIce :: run ( void ) throw ( Exception )
|
|||
$Source$
|
||||
|
||||
$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
|
||||
added support for Ogg Vorbis 1.0, removed support for rc2
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ LameLibEncoder :: open ( void )
|
|||
}
|
||||
|
||||
if ( 0 > lame_set_mode( lameGlobalFlags,
|
||||
getInChannel() == 1 ? MONO : JOINT_STEREO) ) {
|
||||
getOutChannel() == 1 ? MONO : JOINT_STEREO) ) {
|
||||
throw Exception( __FILE__, __LINE__,
|
||||
"lame lib setting mode error",
|
||||
JOINT_STEREO );
|
||||
|
@ -268,15 +268,21 @@ LameLibEncoder :: write ( const void * buf,
|
|||
}
|
||||
|
||||
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__,
|
||||
"unsupported number of channels for the encoder",
|
||||
channels );
|
||||
"unsupported number of input channels for the encoder",
|
||||
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 int processed = len - (len % sampleSize);
|
||||
unsigned int nSamples = processed / sampleSize;
|
||||
|
@ -284,13 +290,13 @@ LameLibEncoder :: write ( const void * buf,
|
|||
short int * rightBuffer = new short int[nSamples];
|
||||
|
||||
if ( bitsPerSample == 8 ) {
|
||||
Util::conv8( b, processed, leftBuffer, rightBuffer, channels);
|
||||
Util::conv8( b, processed, leftBuffer, rightBuffer, inChannels);
|
||||
} else if ( bitsPerSample == 16 ) {
|
||||
Util::conv16( b,
|
||||
processed,
|
||||
leftBuffer,
|
||||
rightBuffer,
|
||||
channels,
|
||||
inChannels,
|
||||
isInBigEndian());
|
||||
} else {
|
||||
delete[] leftBuffer;
|
||||
|
@ -307,7 +313,7 @@ LameLibEncoder :: write ( const void * buf,
|
|||
|
||||
ret = lame_encode_buffer( lameGlobalFlags,
|
||||
leftBuffer,
|
||||
channels == 2 ? rightBuffer : leftBuffer,
|
||||
inChannels == 2 ? rightBuffer : leftBuffer,
|
||||
nSamples,
|
||||
mp3Buf,
|
||||
mp3Size );
|
||||
|
@ -388,6 +394,9 @@ LameLibEncoder :: close ( void ) throw ( Exception )
|
|||
$Source$
|
||||
|
||||
$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
|
||||
bugfix for the previous fix :)
|
||||
|
||||
|
|
|
@ -123,11 +123,6 @@ class LameLibEncoder : public AudioEncoder, public virtual Reporter
|
|||
"specified bits per sample not supported",
|
||||
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$
|
||||
|
||||
$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
|
||||
added cbr, abr and vbr setting feature with encoding quality
|
||||
|
||||
|
|
Loading…
Reference in New Issue