Fixed SHOUTCast password

- Darkice.cpp configShoutcast part is returned as it was on commit 710d2c26c4 . This makes DNAS 1.9.8 to work again.
- Added suggested code patches to code at DarkiceConfig.cpp and Config.cpp by Yahoosam on issu #121. So DNAS2.x now can get stream IDs
This commit is contained in:
Alejandro Olivan Alvarez 2018-07-06 12:39:17 +02:00
parent 8f52426a7e
commit ad68e8dce2
3 changed files with 44 additions and 40 deletions

View File

@ -133,11 +133,15 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
std::string::size_type ix; std::string::size_type ix;
std::string str( line); std::string str( line);
std::string str2 ("password");
if ( (ix = str.find(str2)) == str.npos ) {
/* delete everything after the first # */ /* delete everything after the first # */
if ( (ix = str.find( '#')) != str.npos ) { if ( (ix = str.find( '#')) != str.npos ) {
str.erase( ix); str.erase( ix);
} }
}
/* eat up all white space from the front */ /* eat up all white space from the front */
if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) { if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) {
str.erase( 0, ix); str.erase( 0, ix);
@ -170,4 +174,3 @@ ConfigSection :: addLine ( const char * line ) throw ( Exception )
/* now add the new key / value pair */ /* now add the new key / value pair */
return add( key.c_str(), value.c_str()); return add( key.c_str(), value.c_str());
} }

View File

@ -792,7 +792,7 @@ DarkIce :: configShoutCast ( const Config & config,
FileSink * localDumpFile = 0; FileSink * localDumpFile = 0;
bool fileAddDate = false; bool fileAddDate = false;
const char * fileDateFormat = 0; const char * fileDateFormat = 0;
BufferedSink * audioOut = 0; AudioEncoder * encoder = 0;
int bufferSize = 0; int bufferSize = 0;
str = cs->get( "sampleRate"); str = cs->get( "sampleRate");
@ -907,9 +907,7 @@ DarkIce :: configShoutCast ( const Config & config,
localDumpFile); localDumpFile);
audioOut = new BufferedSink(audioOuts[u].socket.get(), bufferSize, 1); encoder = new LameLibEncoder( audioOuts[u].server.get(),
audioOuts[u].encoder = new LameLibEncoder(
audioOut,
dsp.get(), dsp.get(),
bitrateMode, bitrateMode,
bitrate, bitrate,
@ -918,6 +916,7 @@ DarkIce :: configShoutCast ( const Config & config,
channel, channel,
lowpass, lowpass,
highpass ); highpass );
audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize());
encConnector->attach( audioOuts[u].encoder.get()); encConnector->attach( audioOuts[u].encoder.get());
#endif // HAVE_LAME_LIB #endif // HAVE_LAME_LIB

View File

@ -99,11 +99,15 @@ Config :: addLine ( const char * line ) throw ( Exception )
std::string::size_type ix; std::string::size_type ix;
std::string str( line); std::string str( line);
std::string str2 ("password");
if ( (ix = str.find(str2)) == str.npos ) {
/* delete everything after the first # */ /* delete everything after the first # */
if ( (ix = str.find( '#')) != str.npos ) { if ( (ix = str.find( '#')) != str.npos ) {
str.erase( ix); str.erase( ix);
} }
}
/* eat up all white space from the front */ /* eat up all white space from the front */
if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) { if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) {
str.erase( 0, ix); str.erase( 0, ix);
@ -162,5 +166,3 @@ Config :: read ( std::istream & is ) throw ( Exception )
addLine( line); addLine( line);
} }
} }