added support for resampling mp3 streams

This commit is contained in:
darkeye 2001-10-19 09:03:39 +00:00
parent e3fca60927
commit 9d5c687bbd
5 changed files with 28 additions and 11 deletions

View File

@ -2,6 +2,7 @@ DarkIce 0.7
o added support for FreeBSD o added support for FreeBSD
thanks to Robin P. Blanchard, <Robin_Blanchard@gactr.uga.edu> thanks to Robin P. Blanchard, <Robin_Blanchard@gactr.uga.edu>
o added support for resampling mp3 streams
18-09-2001: DarkIce 0.6 released 18-09-2001: DarkIce 0.6 released

View File

@ -8,4 +8,3 @@ o revisit real-time scheduling and one-thread-per-connection
o look into performance o look into performance
o create proper error-reporting module o create proper error-reporting module
o enable TABs in the config file o enable TABs in the config file
o add support for downsampling the input for a given output

View File

@ -108,6 +108,10 @@ Mount point for the stream on the server
.PP .PP
Optional values: Optional values:
.TP
.I sampleRate
The sample rate of the encoded mp3 output. If not specified, defaults
to the value of the input sample rate.
.TP .TP
.I name .I name
Name of the stream Name of the stream
@ -225,6 +229,10 @@ server
.PP .PP
Optional values: Optional values:
.TP
.I sampleRate
The sample rate of the encoded mp3 output. If not specified, defaults
to the value of the input sample rate.
.TP .TP
.I name .I name
Name of the stream Name of the stream
@ -260,7 +268,7 @@ A sample configuration file follows. This file makes
.B DarkIce .B DarkIce
stream for 1 minute (60 seconds) from the audio device stream for 1 minute (60 seconds) from the audio device
.I /dev/dsp .I /dev/dsp
at 22kHz, 16 bit stereo. at 22.05kHz, 16 bit stereo.
It will build up a connection to the It will build up a connection to the
.B IceCast .B IceCast
server yp.yourserver.com on port 8000 with the password "hackme". server yp.yourserver.com on port 8000 with the password "hackme".
@ -304,13 +312,14 @@ A bit more complicated sample follows. This one makes
.B DarkIce .B DarkIce
stream for 1 hour (3600 seconds) from the audio device stream for 1 hour (3600 seconds) from the audio device
.I /dev/dsp .I /dev/dsp
at 22kHz, 16 bit stereo. at 44.1kHz, 16 bit stereo.
It will build up a connection to an It will build up a connection to an
.B IceCast .B IceCast
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 96 kb/s mp3, and will be reachable at The stream will be encoded to 96 kb/s mp3 and resampled to 22.05kHz.
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.
The encoding session will be stored by The encoding session will be stored by
@ -338,6 +347,7 @@ bitsPerSample = 16
channel = 2 channel = 2
[icecast-0] [icecast-0]
sampleRate = 22050
bitrate = 96 bitrate = 96
lowpass = 10500 lowpass = 10500
server = yp.your-ice-server.com server = yp.your-ice-server.com

View File

@ -183,6 +183,7 @@ DarkIce :: configIceCast ( const Config & config,
break; break;
} }
unsigned int sampleRate = 0;
unsigned int bitrate = 0; unsigned int bitrate = 0;
const char * server = 0; const char * server = 0;
unsigned int port = 0; unsigned int port = 0;
@ -197,6 +198,8 @@ DarkIce :: configIceCast ( const Config & config,
unsigned int lowpass = 0; unsigned int lowpass = 0;
unsigned int highpass = 0; unsigned int highpass = 0;
str = cs->get( "sampleRate");
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
str = cs->getForSure("bitrate", " missing in section ", stream); str = cs->getForSure("bitrate", " missing in section ", stream);
bitrate = Util::strToL( str); bitrate = Util::strToL( str);
server = cs->getForSure( "server", " missing in section ", stream); server = cs->getForSure( "server", " missing in section ", stream);
@ -243,7 +246,7 @@ DarkIce :: configIceCast ( const Config & config,
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(), audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
dsp.get(), dsp.get(),
bitrate, bitrate,
dsp->getSampleRate(), sampleRate,
dsp->getChannel(), dsp->getChannel(),
lowpass, lowpass,
highpass ); highpass );
@ -366,6 +369,7 @@ DarkIce :: configShoutCast ( const Config & config,
break; break;
} }
unsigned int sampleRate = 0;
unsigned int bitrate = 0; unsigned int bitrate = 0;
const char * server = 0; const char * server = 0;
unsigned int port = 0; unsigned int port = 0;
@ -380,6 +384,8 @@ DarkIce :: configShoutCast ( const Config & config,
const char * aim = 0; const char * aim = 0;
const char * icq = 0; const char * icq = 0;
str = cs->get( "sampleRate");
sampleRate = str ? Util::strToL( str) : dsp->getSampleRate();
str = cs->getForSure("bitrate", " missing in section ", stream); str = cs->getForSure("bitrate", " missing in section ", stream);
bitrate = Util::strToL( str); bitrate = Util::strToL( str);
server = cs->getForSure( "server", " missing in section ", stream); server = cs->getForSure( "server", " missing in section ", stream);
@ -424,7 +430,7 @@ DarkIce :: configShoutCast ( const Config & config,
audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(), audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(),
dsp.get(), dsp.get(),
bitrate, bitrate,
dsp->getSampleRate(), sampleRate,
dsp->getChannel(), dsp->getChannel(),
lowpass, lowpass,
highpass ); highpass );
@ -568,6 +574,9 @@ DarkIce :: run ( void ) throw ( Exception )
$Source$ $Source$
$Log$ $Log$
Revision 1.20 2001/10/19 09:03:39 darkeye
added support for resampling mp3 streams
Revision 1.19 2001/09/14 19:31:06 darkeye Revision 1.19 2001/09/14 19:31:06 darkeye
added IceCast2 / vorbis support added IceCast2 / vorbis support

View File

@ -124,11 +124,6 @@ class LameLibEncoder : public AudioEncoder, public virtual Reporter
getInBitsPerSample() ); getInBitsPerSample() );
} }
if ( getOutSampleRate() != getInSampleRate() ) {
throw Exception( __FILE__, __LINE__,
"different in and out sample rate not supported");
}
if ( getInChannel() != getOutChannel() ) { if ( getInChannel() != getOutChannel() ) {
throw Exception( __FILE__, __LINE__, throw Exception( __FILE__, __LINE__,
"different in and out channels not supported"); "different in and out channels not supported");
@ -462,6 +457,9 @@ class LameLibEncoder : public AudioEncoder, public virtual Reporter
$Source$ $Source$
$Log$ $Log$
Revision 1.8 2001/10/19 09:03:39 darkeye
added support for resampling mp3 streams
Revision 1.7 2001/09/15 11:35:08 darkeye Revision 1.7 2001/09/15 11:35:08 darkeye
minor fixes minor fixes