added -Wall flag to compiler and eleminated new warnings
This commit is contained in:
parent
6bb7ca8649
commit
e8a74d2f45
|
@ -108,7 +108,7 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
unsigned int bitsPerSample;
|
unsigned int bitsPerSample;
|
||||||
unsigned int channel;
|
unsigned int channel;
|
||||||
const char * device;
|
const char * device;
|
||||||
int i;
|
unsigned int u;
|
||||||
|
|
||||||
// the [general] section
|
// the [general] section
|
||||||
if ( !(cs = config.get( "general")) ) {
|
if ( !(cs = config.get( "general")) ) {
|
||||||
|
@ -148,9 +148,9 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
char * pipeInExt = ".in";
|
char * pipeInExt = ".in";
|
||||||
size_t pipeInExtLen = Util::strLen( pipeInExt);
|
size_t pipeInExtLen = Util::strLen( pipeInExt);
|
||||||
|
|
||||||
for ( i = 0; i < maxOutput; ++i ) {
|
for ( u = 0; u < maxOutput; ++u ) {
|
||||||
// ugly hack to change the section name to "lame0", "lame1", etc.
|
// ugly hack to change the section name to "lame0", "lame1", etc.
|
||||||
lame[lameLen-1] = '0' + i;
|
lame[lameLen-1] = '0' + u;
|
||||||
|
|
||||||
if ( !(cs = config.get( lame)) ) {
|
if ( !(cs = config.get( lame)) ) {
|
||||||
break;
|
break;
|
||||||
|
@ -202,22 +202,22 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
|
|
||||||
// go on and create the things
|
// go on and create the things
|
||||||
|
|
||||||
outputs[i].pid = 0;
|
outputs[u].pid = 0;
|
||||||
|
|
||||||
// the pipes
|
// the pipes
|
||||||
outputs[i].encOutPipe = new PipeSource( pipeOutName);
|
outputs[u].encOutPipe = new PipeSource( pipeOutName);
|
||||||
outputs[i].encInPipe = new PipeSink( pipeInName);
|
outputs[u].encInPipe = new PipeSink( pipeInName);
|
||||||
|
|
||||||
if ( !outputs[i].encOutPipe->exists() ) {
|
if ( !outputs[u].encOutPipe->exists() ) {
|
||||||
if ( !outputs[i].encOutPipe->create() ) {
|
if ( !outputs[u].encOutPipe->create() ) {
|
||||||
throw Exception( __FILE__, __LINE__,
|
throw Exception( __FILE__, __LINE__,
|
||||||
"can't create out pipe ",
|
"can't create out pipe ",
|
||||||
pipeOutName );
|
pipeOutName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !outputs[i].encInPipe->exists() ) {
|
if ( !outputs[u].encInPipe->exists() ) {
|
||||||
if ( !outputs[i].encInPipe->create() ) {
|
if ( !outputs[u].encInPipe->create() ) {
|
||||||
throw Exception( __FILE__, __LINE__,
|
throw Exception( __FILE__, __LINE__,
|
||||||
"can't create in pipe",
|
"can't create in pipe",
|
||||||
pipeInName );
|
pipeInName );
|
||||||
|
@ -227,16 +227,16 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
// encoder related stuff
|
// encoder related stuff
|
||||||
unsigned int bs = bufferSecs *
|
unsigned int bs = bufferSecs *
|
||||||
(bitsPerSample / 8) * channel * sampleRate;
|
(bitsPerSample / 8) * channel * sampleRate;
|
||||||
outputs[i].encIn = new BufferedSink( outputs[i].encInPipe.get(),
|
outputs[u].encIn = new BufferedSink( outputs[u].encInPipe.get(),
|
||||||
bs,
|
bs,
|
||||||
(bitsPerSample / 8) * channel );
|
(bitsPerSample / 8) * channel );
|
||||||
reportEvent( 6, "using buffer size", bs);
|
reportEvent( 6, "using buffer size", bs);
|
||||||
|
|
||||||
encConnector->attach( outputs[i].encIn.get());
|
encConnector->attach( outputs[u].encIn.get());
|
||||||
outputs[i].encoder = new LameEncoder( encoder,
|
outputs[u].encoder = new LameEncoder( encoder,
|
||||||
outputs[i].encInPipe->getFileName(),
|
outputs[u].encInPipe->getFileName(),
|
||||||
dsp.get(),
|
dsp.get(),
|
||||||
outputs[i].encOutPipe->getFileName(),
|
outputs[u].encOutPipe->getFileName(),
|
||||||
bitrate,
|
bitrate,
|
||||||
sampleRate,
|
sampleRate,
|
||||||
channel,
|
channel,
|
||||||
|
@ -245,8 +245,8 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
|
|
||||||
|
|
||||||
// streaming related stuff
|
// streaming related stuff
|
||||||
outputs[i].socket = new TcpSocket( server, port);
|
outputs[u].socket = new TcpSocket( server, port);
|
||||||
outputs[i].ice = new IceCast( outputs[i].socket.get(),
|
outputs[u].ice = new IceCast( outputs[u].socket.get(),
|
||||||
password,
|
password,
|
||||||
mountPoint,
|
mountPoint,
|
||||||
remoteDumpFile,
|
remoteDumpFile,
|
||||||
|
@ -256,11 +256,11 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
genre,
|
genre,
|
||||||
bitrate,
|
bitrate,
|
||||||
isPublic );
|
isPublic );
|
||||||
outputs[i].shoutConnector = new Connector( outputs[i].encOutPipe.get(),
|
outputs[u].shoutConnector = new Connector( outputs[u].encOutPipe.get(),
|
||||||
outputs[i].ice.get());
|
outputs[u].ice.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
noOutputs = i;
|
noOutputs = u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -271,11 +271,11 @@ bool
|
||||||
DarkIce :: encode ( void ) throw ( Exception )
|
DarkIce :: encode ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
int i;
|
unsigned int u;
|
||||||
unsigned long bytes;
|
unsigned long bytes;
|
||||||
|
|
||||||
for ( i = 0; i < noOutputs; ++i ) {
|
for ( u = 0; u < noOutputs; ++u ) {
|
||||||
outputs[i].encoder->start();
|
outputs[u].encoder->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep( 1 );
|
sleep( 1 );
|
||||||
|
@ -298,8 +298,8 @@ DarkIce :: encode ( void ) throw ( Exception )
|
||||||
|
|
||||||
encConnector->close();
|
encConnector->close();
|
||||||
|
|
||||||
for ( i = 0; i < noOutputs; ++i ) {
|
for ( u = 0; u < noOutputs; ++u ) {
|
||||||
outputs[i].encoder->stop();
|
outputs[u].encoder->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -340,22 +340,22 @@ DarkIce :: shout ( unsigned int ix ) throw ( Exception )
|
||||||
int
|
int
|
||||||
DarkIce :: run ( void ) throw ( Exception )
|
DarkIce :: run ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int u;
|
||||||
|
|
||||||
for ( i = 0; i < noOutputs; ++i ) {
|
for ( u = 0; u < noOutputs; ++u ) {
|
||||||
outputs[i].pid = fork();
|
outputs[u].pid = fork();
|
||||||
|
|
||||||
if ( outputs[i].pid == -1 ) {
|
if ( outputs[u].pid == -1 ) {
|
||||||
throw Exception( __FILE__, __LINE__, "fork error", errno);
|
throw Exception( __FILE__, __LINE__, "fork error", errno);
|
||||||
|
|
||||||
} else if ( outputs[i].pid == 0 ) {
|
} else if ( outputs[u].pid == 0 ) {
|
||||||
// this is the child
|
// this is the child
|
||||||
|
|
||||||
sleep ( 1 );
|
sleep ( 1 );
|
||||||
|
|
||||||
cout << "shouting " << i << endl << flush;
|
cout << "shouting " << u << endl << flush;
|
||||||
shout( i);
|
shout( u);
|
||||||
cout << "shouting ends " << i << endl << flush;
|
cout << "shouting ends " << u << endl << flush;
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -367,10 +367,10 @@ DarkIce :: run ( void ) throw ( Exception )
|
||||||
encode();
|
encode();
|
||||||
cout << "encoding ends" << endl << flush;
|
cout << "encoding ends" << endl << flush;
|
||||||
|
|
||||||
for ( i = 0; i < noOutputs; ++i ) {
|
for ( u = 0; u < noOutputs; ++u ) {
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
waitpid( outputs[i].pid, &status, 0);
|
waitpid( outputs[u].pid, &status, 0);
|
||||||
|
|
||||||
if ( !WIFEXITED(status) ) {
|
if ( !WIFEXITED(status) ) {
|
||||||
throw Exception( __FILE__, __LINE__,
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
@ -387,6 +387,9 @@ DarkIce :: run ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.10 2000/11/17 15:50:48 darkeye
|
||||||
|
added -Wall flag to compiler and eleminated new warnings
|
||||||
|
|
||||||
Revision 1.9 2000/11/15 18:37:37 darkeye
|
Revision 1.9 2000/11/15 18:37:37 darkeye
|
||||||
changed the transferable number of bytes to unsigned long
|
changed the transferable number of bytes to unsigned long
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
bin_PROGRAMS = darkice
|
bin_PROGRAMS = darkice
|
||||||
INCLUDES = -I../stl
|
INCLUDES = -I../stl
|
||||||
CXXFLAGS = -g
|
CXXFLAGS = -g -Wall
|
||||||
|
|
||||||
darkice_SOURCES = AudioEncoder.h\
|
darkice_SOURCES = AudioEncoder.h\
|
||||||
AudioSource.h\
|
AudioSource.h\
|
||||||
|
|
|
@ -129,8 +129,9 @@ OssDspSource :: strip ( void ) throw ( Exception )
|
||||||
bool
|
bool
|
||||||
OssDspSource :: open ( void ) throw ( Exception )
|
OssDspSource :: open ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
int format;
|
int format;
|
||||||
int i;
|
int i;
|
||||||
|
unsigned int u;
|
||||||
|
|
||||||
if ( isOpen() ) {
|
if ( isOpen() ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -162,17 +163,17 @@ OssDspSource :: open ( void ) throw ( Exception )
|
||||||
throw Exception( __FILE__, __LINE__, "can't set format", i);
|
throw Exception( __FILE__, __LINE__, "can't set format", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
i = getChannel();
|
u = getChannel();
|
||||||
if ( ioctl( fileDescriptor, SNDCTL_DSP_CHANNELS, &i) == -1 ||
|
if ( ioctl( fileDescriptor, SNDCTL_DSP_CHANNELS, &u) == -1 ||
|
||||||
i != getChannel() ) {
|
u != getChannel() ) {
|
||||||
|
|
||||||
close();
|
close();
|
||||||
throw Exception( __FILE__, __LINE__, "can't set channels", i);
|
throw Exception( __FILE__, __LINE__, "can't set channels", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
i = getSampleRate();
|
u = getSampleRate();
|
||||||
if ( ioctl( fileDescriptor, SNDCTL_DSP_SPEED, &i) == -1 ||
|
if ( ioctl( fileDescriptor, SNDCTL_DSP_SPEED, &u) == -1 ||
|
||||||
i != getSampleRate() ) {
|
u != getSampleRate() ) {
|
||||||
|
|
||||||
close();
|
close();
|
||||||
throw Exception( __FILE__, __LINE__, "can't set speed", i);
|
throw Exception( __FILE__, __LINE__, "can't set speed", i);
|
||||||
|
@ -264,6 +265,9 @@ OssDspSource :: close ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.5 2000/11/17 15:50:48 darkeye
|
||||||
|
added -Wall flag to compiler and eleminated new warnings
|
||||||
|
|
||||||
Revision 1.4 2000/11/13 20:05:07 darkeye
|
Revision 1.4 2000/11/13 20:05:07 darkeye
|
||||||
changed to workaround to start recording so that it reads one sample
|
changed to workaround to start recording so that it reads one sample
|
||||||
per channel, as opposed to only one sample (which misalignes the channels)
|
per channel, as opposed to only one sample (which misalignes the channels)
|
||||||
|
|
|
@ -89,7 +89,7 @@ PipeSink :: create ( void ) throw ( Exception )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mkfifo( getFileName(), S_IRUSR | S_IWUSR) == -1 ) {
|
if ( mkfifo( getFileName(), S_IRUSR | S_IWUSR) == -1 ) {
|
||||||
if ( errno = EEXIST ) {
|
if ( errno == EEXIST ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
throw Exception( __FILE__, __LINE__, "mkfifo error", errno);
|
throw Exception( __FILE__, __LINE__, "mkfifo error", errno);
|
||||||
|
@ -124,6 +124,9 @@ PipeSink :: open ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.5 2000/11/17 15:50:48 darkeye
|
||||||
|
added -Wall flag to compiler and eleminated new warnings
|
||||||
|
|
||||||
Revision 1.4 2000/11/11 12:33:13 darkeye
|
Revision 1.4 2000/11/11 12:33:13 darkeye
|
||||||
added kdoc-style documentation
|
added kdoc-style documentation
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ PipeSource :: create ( void ) throw ( Exception )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mkfifo( getFileName(), S_IRUSR | S_IWUSR) == -1 ) {
|
if ( mkfifo( getFileName(), S_IRUSR | S_IWUSR) == -1 ) {
|
||||||
if ( errno = EEXIST ) {
|
if ( errno == EEXIST ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
throw Exception( __FILE__, __LINE__, "mkfifo error", errno);
|
throw Exception( __FILE__, __LINE__, "mkfifo error", errno);
|
||||||
|
@ -105,6 +105,9 @@ PipeSource :: create ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.4 2000/11/17 15:50:48 darkeye
|
||||||
|
added -Wall flag to compiler and eleminated new warnings
|
||||||
|
|
||||||
Revision 1.3 2000/11/12 13:31:40 darkeye
|
Revision 1.3 2000/11/12 13:31:40 darkeye
|
||||||
added kdoc-style documentation comments
|
added kdoc-style documentation comments
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ TcpSocket :: strip ( void) throw ( Exception )
|
||||||
* Copy Constructor
|
* Copy Constructor
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
TcpSocket :: TcpSocket ( const TcpSocket & ss ) throw ( Exception )
|
TcpSocket :: TcpSocket ( const TcpSocket & ss ) throw ( Exception )
|
||||||
: Sink( ss ), Source( ss )
|
: Source( ss), Sink( ss )
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
@ -348,6 +348,9 @@ TcpSocket :: close ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.4 2000/11/17 15:50:48 darkeye
|
||||||
|
added -Wall flag to compiler and eleminated new warnings
|
||||||
|
|
||||||
Revision 1.3 2000/11/12 14:54:50 darkeye
|
Revision 1.3 2000/11/12 14:54:50 darkeye
|
||||||
added kdoc-style documentation comments
|
added kdoc-style documentation comments
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue