|
a/src/ohproduct.cxx |
|
b/src/ohproduct.cxx |
|
... |
|
... |
46 |
static string csxml("<SourceList>\n");
|
46 |
static string csxml("<SourceList>\n");
|
47 |
|
47 |
|
48 |
// (Type, Name) list
|
48 |
// (Type, Name) list
|
49 |
static vector<pair<string, string> > o_sources;
|
49 |
static vector<pair<string, string> > o_sources;
|
50 |
|
50 |
|
51 |
OHProduct::OHProduct(UpMpd *dev, const string& friendlyname, bool hasRcv)
|
51 |
OHProduct::OHProduct(UpMpd *dev, const string& friendlyname)
|
52 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev),
|
52 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev),
|
53 |
m_sndrcv(new SenderReceiver(dev)),
|
|
|
54 |
m_roomOrName(friendlyname), m_sourceIndex(0)
|
53 |
m_roomOrName(friendlyname), m_sourceIndex(0)
|
55 |
{
|
54 |
{
|
56 |
// Playlist must stay first.
|
55 |
// Playlist must stay first.
|
57 |
o_sources.push_back(pair<string,string>("Playlist","Playlist"));
|
56 |
o_sources.push_back(pair<string,string>("Playlist","Playlist"));
|
58 |
//o_sources.push_back("UpnpAv");
|
57 |
//o_sources.push_back("UpnpAv");
|
59 |
if (hasRcv) {
|
58 |
if (m_dev->m_ohrcv) {
|
60 |
o_sources.push_back(pair<string,string>("Receiver","Receiver"));
|
59 |
o_sources.push_back(pair<string,string>("Receiver","Receiver"));
|
|
|
60 |
if (m_dev->m_sndrcv &&
|
|
|
61 |
m_dev->m_ohrcv->playMethod() == OHReceiverParams::OHRP_ALSA) {
|
|
|
62 |
// It might be possible to make things work with the MPD
|
|
|
63 |
// play method but this would be complicated (the mpd we
|
|
|
64 |
// want to get playing from sc2mpd HTTP is the
|
|
|
65 |
// original/saved one, not the current one, which is doing
|
|
|
66 |
// the playing and sending to the fifo, so we'd need to
|
|
|
67 |
// tell ohreceiver about using the right one.
|
61 |
o_sources.push_back(pair<string,string>("Playlist", "SenderReceiver"));
|
68 |
o_sources.push_back(pair<string,string>("Playlist",
|
|
|
69 |
"SenderReceiver"));
|
|
|
70 |
}
|
62 |
}
|
71 |
}
|
63 |
|
72 |
|
64 |
for (auto it = o_sources.begin(); it != o_sources.end(); it++) {
|
73 |
for (auto it = o_sources.begin(); it != o_sources.end(); it++) {
|
65 |
csxml += string(" <Source>\n") +
|
74 |
csxml += string(" <Source>\n") +
|
66 |
" <Name>" + it->second + "</Name>\n" +
|
75 |
" <Name>" + it->second + "</Name>\n" +
|
|
... |
|
... |
98 |
bind(&OHProduct::sourceXMLChangeCount, this, _1, _2));
|
107 |
bind(&OHProduct::sourceXMLChangeCount, this, _1, _2));
|
99 |
}
|
108 |
}
|
100 |
|
109 |
|
101 |
OHProduct::~OHProduct()
|
110 |
OHProduct::~OHProduct()
|
102 |
{
|
111 |
{
|
103 |
delete m_sndrcv;
|
|
|
104 |
}
|
112 |
}
|
105 |
|
113 |
|
106 |
static const string csattrs("Info Time Volume");
|
114 |
static const string csattrs("Info Time Volume");
|
107 |
static const string csversion(PACKAGE_VERSION);
|
115 |
static const string csversion(PACKAGE_VERSION);
|
108 |
static const string csmanname("UpMPDCli heavy industries Co.");
|
116 |
static const string csmanname("UpMPDCli heavy industries Co.");
|
|
... |
|
... |
240 |
LOGDEB("OHProduct::iSetSourceIndex: stopping OHPL\n");
|
248 |
LOGDEB("OHProduct::iSetSourceIndex: stopping OHPL\n");
|
241 |
m_dev->m_ohpl->iStop();
|
249 |
m_dev->m_ohpl->iStop();
|
242 |
} else if (!curnm.compare("Receiver") && m_dev->m_ohrcv) {
|
250 |
} else if (!curnm.compare("Receiver") && m_dev->m_ohrcv) {
|
243 |
LOGDEB("OHProduct::iSetSourceIndex: stopping Receiver\n");
|
251 |
LOGDEB("OHProduct::iSetSourceIndex: stopping Receiver\n");
|
244 |
m_dev->m_ohrcv->iStop();
|
252 |
m_dev->m_ohrcv->iStop();
|
245 |
} else if (!curnm.compare("Sender") && m_sndrcv) {
|
253 |
} else if (!curnm.compare("SenderReceiver") && m_dev->m_sndrcv) {
|
246 |
LOGDEB("OHProduct::iSetSourceIndex: stopping Sender/Receiver\n");
|
254 |
LOGDEB("OHProduct::iSetSourceIndex: stopping Sender/Receiver\n");
|
247 |
m_sndrcv->stop();
|
255 |
m_dev->m_sndrcv->stop();
|
248 |
}
|
256 |
}
|
249 |
|
257 |
|
250 |
string newnm = o_sources[sindex].second;
|
258 |
string newnm = o_sources[sindex].second;
|
251 |
if (!newnm.compare("Playlist")) {
|
259 |
if (!newnm.compare("Playlist")) {
|
252 |
} else if (!newnm.compare("Receiver")) {
|
260 |
} else if (!newnm.compare("Receiver")) {
|
253 |
} else if (!newnm.compare("Sender")) {
|
261 |
} else if (!newnm.compare("SenderReceiver")) {
|
254 |
m_sndrcv->start(savedms);
|
262 |
m_dev->m_sndrcv->start(savedms);
|
255 |
}
|
263 |
}
|
256 |
|
264 |
|
257 |
m_sourceIndex = sindex;
|
265 |
m_sourceIndex = sindex;
|
258 |
m_dev->loopWakeup();
|
266 |
m_dev->loopWakeup();
|
259 |
}
|
267 |
}
|