|
a/src/sc2mpd.cpp |
|
b/src/sc2mpd.cpp |
|
... |
|
... |
93 |
using namespace OpenHome::Av;
|
93 |
using namespace OpenHome::Av;
|
94 |
|
94 |
|
95 |
|
95 |
|
96 |
class OhmReceiverDriver : public IOhmReceiverDriver, public IOhmMsgProcessor {
|
96 |
class OhmReceiverDriver : public IOhmReceiverDriver, public IOhmMsgProcessor {
|
97 |
public:
|
97 |
public:
|
98 |
OhmReceiverDriver(AudioEater* eater, int port);
|
98 |
OhmReceiverDriver(AudioEater* eater, int port, const string&);
|
99 |
|
99 |
|
100 |
private:
|
100 |
private:
|
101 |
// IOhmReceiverDriver
|
101 |
// IOhmReceiverDriver
|
102 |
virtual void Add(OhmMsg& aMsg);
|
102 |
virtual void Add(OhmMsg& aMsg);
|
103 |
virtual void Timestamp(OhmMsg& aMsg);
|
103 |
virtual void Timestamp(OhmMsg& aMsg);
|
|
... |
|
... |
139 |
};
|
139 |
};
|
140 |
Observer m_obs;
|
140 |
Observer m_obs;
|
141 |
AudioEater *m_eater;
|
141 |
AudioEater *m_eater;
|
142 |
};
|
142 |
};
|
143 |
|
143 |
|
144 |
OhmReceiverDriver::OhmReceiverDriver(AudioEater *eater, int port)
|
144 |
OhmReceiverDriver::OhmReceiverDriver(AudioEater *eater, int port,
|
|
|
145 |
const string& ad)
|
145 |
: m_eater(eater)
|
146 |
: m_eater(eater)
|
146 |
{
|
147 |
{
|
147 |
AudioEater::Context *ctxt = new AudioEater::Context(&audioqueue, port);
|
148 |
AudioEater::Context *ctxt = new AudioEater::Context(&audioqueue, port);
|
|
|
149 |
ctxt->alsadevice = ad;
|
148 |
audioqueue.start(1, m_eater->worker, ctxt);
|
150 |
audioqueue.start(1, m_eater->worker, ctxt);
|
149 |
}
|
151 |
}
|
150 |
|
152 |
|
151 |
void OhmReceiverDriver::Add(OhmMsg& aMsg)
|
153 |
void OhmReceiverDriver::Add(OhmMsg& aMsg)
|
152 |
{
|
154 |
{
|
|
... |
|
... |
407 |
int port = 8768;
|
409 |
int port = 8768;
|
408 |
string value;
|
410 |
string value;
|
409 |
if (config.get("schttpport", value)) {
|
411 |
if (config.get("schttpport", value)) {
|
410 |
port = atoi(value.c_str());
|
412 |
port = atoi(value.c_str());
|
411 |
}
|
413 |
}
|
|
|
414 |
string alsadevice("default");
|
|
|
415 |
config.get("scalsadevice", alsadevice);
|
412 |
config.get("sclogfilename", logfilename);
|
416 |
config.get("sclogfilename", logfilename);
|
413 |
if (config.get("scloglevel", value))
|
417 |
if (config.get("scloglevel", value))
|
414 |
loglevel = atoi(value.c_str());
|
418 |
loglevel = atoi(value.c_str());
|
415 |
if (Logger::getTheLog(logfilename) == 0) {
|
419 |
if (Logger::getTheLog(logfilename) == 0) {
|
416 |
cerr << "Can't initialize log" << endl;
|
420 |
cerr << "Can't initialize log" << endl;
|
|
... |
|
... |
421 |
LOGINF("scmpdcli: using subnet " << (subnet & 0xff) << "." <<
|
425 |
LOGINF("scmpdcli: using subnet " << (subnet & 0xff) << "." <<
|
422 |
((subnet >> 8) & 0xff) << "." << ((subnet >> 16) & 0xff) << "." <<
|
426 |
((subnet >> 8) & 0xff) << "." << ((subnet >> 16) & 0xff) << "." <<
|
423 |
((subnet >> 24) & 0xff) << endl);
|
427 |
((subnet >> 24) & 0xff) << endl);
|
424 |
|
428 |
|
425 |
OhmReceiverDriver* driver = new OhmReceiverDriver(
|
429 |
OhmReceiverDriver* driver = new OhmReceiverDriver(
|
426 |
optionDevice.Value() ? &alsaAudioEater : &httpAudioEater, port);
|
430 |
optionDevice.Value() ? &alsaAudioEater : &httpAudioEater, port,
|
|
|
431 |
alsadevice);
|
427 |
|
432 |
|
428 |
OhmReceiver* receiver = new OhmReceiver(lib->Env(), adapter, ttl, *driver);
|
433 |
OhmReceiver* receiver = new OhmReceiver(lib->Env(), adapter, ttl, *driver);
|
429 |
|
434 |
|
430 |
CpStack* cpStack = lib->StartCp(subnet);
|
435 |
CpStack* cpStack = lib->StartCp(subnet);
|
431 |
cpStack = cpStack; // avoid unused variable warning
|
436 |
cpStack = cpStack; // avoid unused variable warning
|