mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-14 22:51:13 +02:00
2019-06-17 Fred Gleason <fredg@paravelsystems.com>
* Refactored logging system to use syslog(3) exclusively. * Removed the 'Facility=', 'LogDirectory=', 'CoreDumpDirectory=' and 'LogPattern=' directives from rd.conf(5).
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <samplerate.h>
|
||||
|
||||
@@ -446,13 +447,13 @@ void MainObject::jackClientStartData()
|
||||
jack_clients.push_back(new QProcess(this));
|
||||
jack_clients.back()->start(program,args);
|
||||
if(jack_clients.back()->waitForStarted()) {
|
||||
rd_config->log("caed",RDConfig::LogDebug,"started JACK Client \""+
|
||||
q->value(0).toString()+"\"");
|
||||
syslog(LOG_INFO,"started JACK Client \"%s\"",
|
||||
(const char *)q->value(0).toString().toUtf8());
|
||||
}
|
||||
else {
|
||||
rd_config->log("caed",RDConfig::LogWarning,"failed to start JACK Client \""+
|
||||
q->value(0).toString()+"\" ["+
|
||||
q->value(1).toString()+"]");
|
||||
syslog(LOG_WARNING,"failed to start JACK Client \"%s\" [%s]",
|
||||
(const char *)q->value(0).toString().toUtf8(),
|
||||
(const char *)q->value(1).toString().toUtf8());
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
@@ -466,7 +467,6 @@ void MainObject::jackInit(RDStation *station)
|
||||
#ifdef JACK
|
||||
jack_options_t jackopts=JackNullOption;
|
||||
jack_status_t jackstat=JackFailure;
|
||||
RDConfig::LogPriority prio=RDConfig::LogDebug;
|
||||
|
||||
jack_connected=false;
|
||||
jack_activated=false;
|
||||
@@ -480,7 +480,7 @@ void MainObject::jackInit(RDStation *station)
|
||||
}
|
||||
}
|
||||
if(jack_card==RD_MAX_CARDS) {
|
||||
rd_config->log("caed",RDConfig::LogInfo,"no more RD cards available");
|
||||
syslog(LOG_INFO,"no more RD cards available");
|
||||
return;
|
||||
}
|
||||
QString name=QString().sprintf("rivendell_%d",jack_card);
|
||||
@@ -496,10 +496,10 @@ void MainObject::jackInit(RDStation *station)
|
||||
QProcess *proc=new QProcess(this);
|
||||
proc->start(program,args);
|
||||
if(proc->waitForStarted()) {
|
||||
rd_config->log("caed",RDConfig::LogDebug,"JACK server started");
|
||||
syslog(LOG_INFO,"JACK server started");
|
||||
}
|
||||
else {
|
||||
rd_config->log("caed",RDConfig::LogErr,"failed to start JACK server");
|
||||
syslog(LOG_WARNING,"failed to start JACK server");
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
@@ -518,61 +518,61 @@ void MainObject::jackInit(RDStation *station)
|
||||
if(jack_client==NULL) {
|
||||
if((jackstat&JackInvalidOption)!=0) {
|
||||
fprintf (stderr, "invalid or unsupported JACK option\n");
|
||||
rd_config->log("caed",prio,"invalid or unsupported JACK option");
|
||||
syslog(LOG_WARNING,"invalid or unsupported JACK option");
|
||||
}
|
||||
|
||||
if((jackstat&JackServerError)!=0) {
|
||||
fprintf (stderr, "communication error with the JACK server\n");
|
||||
rd_config->log("caed",prio,"communication error with the JACK server");
|
||||
syslog(LOG_WARNING,"communication error with the JACK server");
|
||||
}
|
||||
|
||||
if((jackstat&JackNoSuchClient)!=0) {
|
||||
fprintf (stderr, "requested JACK client does not exist\n");
|
||||
rd_config->log("caed",prio,"requested JACK client does not exist");
|
||||
syslog(LOG_WARNING,"requested JACK client does not exist");
|
||||
}
|
||||
|
||||
if((jackstat&JackLoadFailure)!=0) {
|
||||
fprintf (stderr, "unable to load internal JACK client\n");
|
||||
rd_config->log("caed",prio,"unable to load internal JACK client");
|
||||
syslog(LOG_WARNING,"unable to load internal JACK client");
|
||||
}
|
||||
|
||||
if((jackstat&JackInitFailure)!=0) {
|
||||
fprintf (stderr, "unable to initialize JACK client\n");
|
||||
rd_config->log("caed",prio,"unable to initialize JACK client");
|
||||
syslog(LOG_WARNING,"unable to initialize JACK client");
|
||||
}
|
||||
|
||||
if((jackstat&JackShmFailure)!=0) {
|
||||
fprintf (stderr, "unable to access JACK shared memory\n");
|
||||
rd_config->log("caed",prio,"unable to access JACK shared memory");
|
||||
syslog(LOG_WARNING,"unable to access JACK shared memory");
|
||||
}
|
||||
|
||||
if((jackstat&JackVersionError)!=0) {
|
||||
fprintf (stderr, "JACK protocol version mismatch\n");
|
||||
rd_config->log("caed",prio,"JACK protocol version mismatch");
|
||||
syslog(LOG_WARNING,"JACK protocol version mismatch");
|
||||
}
|
||||
|
||||
if((jackstat&JackServerStarted)!=0) {
|
||||
fprintf (stderr, "JACK server started\n");
|
||||
rd_config->log("caed",prio,"JACK server started");
|
||||
syslog(LOG_WARNING,"JACK server started");
|
||||
}
|
||||
|
||||
if((jackstat&JackServerFailed)!=0) {
|
||||
fprintf (stderr, "unable to communication with JACK server\n");
|
||||
rd_config->log("caed",prio,"unable to communicate with JACK server");
|
||||
syslog(LOG_WARNING,"unable to communicate with JACK server");
|
||||
}
|
||||
|
||||
if((jackstat&JackNameNotUnique)!=0) {
|
||||
fprintf (stderr, "JACK client name not unique\n");
|
||||
rd_config->log("caed",prio,"JACK client name not unique");
|
||||
syslog(LOG_WARNING,"JACK client name not unique");
|
||||
}
|
||||
|
||||
if((jackstat&JackFailure)!=0) {
|
||||
fprintf (stderr, "JACK general failure\n");
|
||||
rd_config->log("caed",prio,"JACK general failure");
|
||||
syslog(LOG_WARNING,"JACK general failure");
|
||||
}
|
||||
jack_card=-1;
|
||||
fprintf (stderr, "no connection to JACK server\n");
|
||||
rd_config->log("caed",prio,"no connection to JACK server");
|
||||
syslog(LOG_WARNING,"no connection to JACK server");
|
||||
return;
|
||||
}
|
||||
jack_connected=true;
|
||||
@@ -584,7 +584,7 @@ void MainObject::jackInit(RDStation *station)
|
||||
#else
|
||||
jack_on_shutdown(jack_client,JackShutdown,0);
|
||||
#endif // HAVE_JACK_INFO_SHUTDOWN
|
||||
rd_config->log("caed",RDConfig::LogDebug,"connected to JACK server");
|
||||
syslog(LOG_INFO,"connected to JACK server");
|
||||
|
||||
//
|
||||
// Start JACK Clients
|
||||
@@ -701,7 +701,7 @@ void MainObject::jackInit(RDStation *station)
|
||||
jack_sample_rate=jack_get_sample_rate(jack_client);
|
||||
if(jack_sample_rate!=system_sample_rate) {
|
||||
fprintf (stderr,"JACK sample rate mismatch!\n");
|
||||
rd_config->log("caed",RDConfig::LogWarning,"JACK sample rate mismatch!");
|
||||
syslog(LOG_WARNING,"JACK sample rate mismatch!");
|
||||
}
|
||||
jack_activated=true;
|
||||
cae_driver[jack_card]=RDStation::Jack;
|
||||
@@ -730,17 +730,14 @@ bool MainObject::jackLoadPlayback(int card,QString wavename,int *stream)
|
||||
{
|
||||
#ifdef JACK
|
||||
if((*stream=GetJackOutputStream())<0) {
|
||||
rd_config->log("caed",RDConfig::LogErr,QString().sprintf(
|
||||
"Error: jackLoadPlayback(%s) GetJackOutputStream():%d <0",
|
||||
(const char *) wavename,
|
||||
*stream) );
|
||||
syslog(LOG_WARNING,"jackLoadPlayback(%s) GetJackOutputStream():%d <0",
|
||||
(const char *)wavename.toUtf8(),*stream);
|
||||
return false;
|
||||
}
|
||||
jack_play_wave[*stream]=new RDWaveFile(wavename);
|
||||
if(!jack_play_wave[*stream]->openWave()) {
|
||||
rd_config->log("caed",RDConfig::LogNotice,QString().sprintf(
|
||||
"Error: jackLoadPlayback(%s) openWave() failed to open file",
|
||||
(const char *) wavename) );
|
||||
syslog(LOG_WARNING,"jackLoadPlayback(%s) openWave() failed to open file",
|
||||
(const char *)wavename.toUtf8());
|
||||
delete jack_play_wave[*stream];
|
||||
jack_play_wave[*stream]=NULL;
|
||||
FreeJackOutputStream(*stream);
|
||||
@@ -757,12 +754,10 @@ bool MainObject::jackLoadPlayback(int card,QString wavename,int *stream)
|
||||
break;
|
||||
|
||||
default:
|
||||
rd_config->log("caed",RDConfig::LogNotice,
|
||||
QString().sprintf(
|
||||
"Error: jackLoadPlayback(%s) getFormatTag()%d || getBistsPerSample()%d failed",
|
||||
(const char *) wavename,
|
||||
jack_play_wave[*stream]->getFormatTag(),
|
||||
jack_play_wave[*stream]->getBitsPerSample() ));
|
||||
syslog(LOG_WARNING,"jackLoadPlayback(%s) getFormatTag()%d || getBistsPerSample()%d failed",
|
||||
(const char *) wavename.toUtf8(),
|
||||
jack_play_wave[*stream]->getFormatTag(),
|
||||
jack_play_wave[*stream]->getBitsPerSample());
|
||||
delete jack_play_wave[*stream];
|
||||
jack_play_wave[*stream]=NULL;
|
||||
FreeJackOutputStream(*stream);
|
||||
@@ -953,9 +948,9 @@ bool MainObject::jackLoadRecord(int card,int stream,int coding,int chans,
|
||||
break;
|
||||
|
||||
default:
|
||||
rd_config->log("caed",RDConfig::LogErr,QString().
|
||||
sprintf("requested unsupported channel count %d, card: %d, stream: %d",
|
||||
chans,card,stream));
|
||||
syslog(LOG_WARNING,
|
||||
"requested unsupported channel count %d, card: %d, stream: %d",
|
||||
chans,card,stream);
|
||||
delete jack_record_wave[stream];
|
||||
jack_record_wave[stream]=NULL;
|
||||
return false;
|
||||
@@ -981,9 +976,9 @@ bool MainObject::jackLoadRecord(int card,int stream,int coding,int chans,
|
||||
break;
|
||||
|
||||
default:
|
||||
rd_config->log("caed",RDConfig::LogErr,QString().
|
||||
sprintf("requested invalid audio encoding %d, card: %d, stream: %d",
|
||||
coding,card,stream));
|
||||
syslog(LOG_WARNING,
|
||||
"requested invalid audio encoding %d, card: %d, stream: %d",
|
||||
coding,card,stream);
|
||||
delete jack_record_wave[stream];
|
||||
jack_record_wave[stream]=NULL;
|
||||
return false;
|
||||
@@ -1479,9 +1474,8 @@ void MainObject::WriteJackBuffer(int stream,jack_default_audio_sample_t *buffer,
|
||||
jack_record_wave[stream]->writeWave(mpeg,s);
|
||||
}
|
||||
else {
|
||||
rd_config->log("caed",RDConfig::LogErr,QString().
|
||||
sprintf("TwoLAME encode error, card: %d, stream: %d",jack_card,
|
||||
stream));
|
||||
syslog(LOG_WARNING,
|
||||
"TwoLAME encode error, card: %d, stream: %d",jack_card,stream);
|
||||
}
|
||||
}
|
||||
if(done) {
|
||||
@@ -1684,9 +1678,8 @@ void MainObject::JackSessionSetup()
|
||||
QString dest=profile->stringValue("JackSession",dest_tag,"",&dest_ok);
|
||||
while(src_ok&&dest_ok) {
|
||||
if(jack_connect(jack_client,(const char *)src,(const char *)dest)!=0) {
|
||||
rd_config->log("caed",RDConfig::LogNotice,QString().
|
||||
sprintf("unable to connect %s to %s",
|
||||
(const char *)src,(const char *)dest));
|
||||
syslog(LOG_WARNING,"unable to connect %s to %s",
|
||||
(const char *)src.toUtf8(),(const char *)dest.toUtf8());
|
||||
}
|
||||
count++;
|
||||
src_tag=QString().sprintf("Source%d",count+1);
|
||||
|
Reference in New Issue
Block a user