|
a/src/upmpd.cxx |
|
b/src/upmpd.cxx |
|
... |
|
... |
60 |
UpMpd::UpMpd(const string& deviceid, const string& friendlyname,
|
60 |
UpMpd::UpMpd(const string& deviceid, const string& friendlyname,
|
61 |
const unordered_map<string, VDirContent>& files,
|
61 |
const unordered_map<string, VDirContent>& files,
|
62 |
MPDCli *mpdcli, Options opts)
|
62 |
MPDCli *mpdcli, Options opts)
|
63 |
: UpnpDevice(deviceid, files), m_mpdcli(mpdcli), m_mpds(0),
|
63 |
: UpnpDevice(deviceid, files), m_mpdcli(mpdcli), m_mpds(0),
|
64 |
m_options(opts.options),
|
64 |
m_options(opts.options),
|
65 |
m_mcachefn(opts.cachefn)
|
65 |
m_mcachefn(opts.cachefn),
|
|
|
66 |
m_rdctl(0), m_avt(0), m_ohpr(0), m_ohpl(0), m_ohrcv(0)
|
66 |
{
|
67 |
{
|
67 |
bool avtnoev = (m_options & upmpdNoAV) != 0;
|
68 |
bool avtnoev = (m_options & upmpdNoAV) != 0;
|
68 |
// Note: the order is significant here as it will be used when
|
69 |
// Note: the order is significant here as it will be used when
|
69 |
// calling the getStatus() methods, and we want AVTransport to
|
70 |
// calling the getStatus() methods, and we want AVTransport to
|
70 |
// update the mpd status for OHInfo
|
71 |
// update the mpd status for OHInfo
|
71 |
UpMpdRenderCtl *rdctl = new UpMpdRenderCtl(this, avtnoev);
|
72 |
m_rdctl = new UpMpdRenderCtl(this, avtnoev);
|
72 |
m_services.push_back(rdctl);
|
73 |
m_services.push_back(m_rdctl);
|
73 |
UpMpdAVTransport* avt = new UpMpdAVTransport(this, avtnoev);
|
74 |
m_avt = new UpMpdAVTransport(this, avtnoev);
|
74 |
m_services.push_back(avt);
|
75 |
m_services.push_back(m_avt);
|
75 |
m_services.push_back(new UpMpdConMan(this));
|
76 |
m_services.push_back(new UpMpdConMan(this));
|
76 |
bool ohReceiver = (m_options & upmpdOhReceiver) != 0;
|
77 |
bool haveReceiver = (m_options & upmpdOhReceiver) != 0;
|
77 |
if (m_options & upmpdDoOH) {
|
78 |
if (m_options & upmpdDoOH) {
|
78 |
OHProduct *ohpr = new OHProduct(this, friendlyname, ohReceiver);
|
79 |
m_ohpr = new OHProduct(this, friendlyname, haveReceiver);
|
79 |
m_services.push_back(ohpr);
|
80 |
m_services.push_back(m_ohpr);
|
80 |
m_services.push_back(new OHInfo(this));
|
81 |
m_services.push_back(new OHInfo(this));
|
81 |
m_services.push_back(new OHTime(this));
|
82 |
m_services.push_back(new OHTime(this));
|
82 |
m_services.push_back(new OHVolume(this, rdctl));
|
83 |
m_services.push_back(new OHVolume(this));
|
83 |
OHPlaylist *ohpl = new OHPlaylist(this, rdctl, opts.ohmetasleep);
|
84 |
m_ohpl = new OHPlaylist(this, opts.ohmetasleep);
|
84 |
m_services.push_back(ohpl);
|
85 |
m_services.push_back(m_ohpl);
|
85 |
if (avt)
|
|
|
86 |
avt->setOHP(ohpl);
|
|
|
87 |
if (ohReceiver) {
|
86 |
if (haveReceiver) {
|
88 |
struct OHReceiverParams parms;
|
87 |
struct OHReceiverParams parms;
|
89 |
parms.pl = ohpl;
|
|
|
90 |
parms.pr = ohpr;
|
|
|
91 |
if (opts.schttpport)
|
88 |
if (opts.schttpport)
|
92 |
parms.httpport = opts.schttpport;
|
89 |
parms.httpport = opts.schttpport;
|
93 |
if (!opts.scplaymethod.empty()) {
|
90 |
if (!opts.scplaymethod.empty()) {
|
94 |
if (!opts.scplaymethod.compare("alsa")) {
|
91 |
if (!opts.scplaymethod.compare("alsa")) {
|
95 |
parms.pm = OHReceiverParams::OHRP_ALSA;
|
92 |
parms.pm = OHReceiverParams::OHRP_ALSA;
|
96 |
} else if (!opts.scplaymethod.compare("mpd")) {
|
93 |
} else if (!opts.scplaymethod.compare("mpd")) {
|
97 |
parms.pm = OHReceiverParams::OHRP_MPD;
|
94 |
parms.pm = OHReceiverParams::OHRP_MPD;
|
98 |
}
|
95 |
}
|
99 |
}
|
96 |
}
|
100 |
m_services.push_back(new OHReceiver(this, parms));
|
97 |
m_ohrcv = new OHReceiver(this, parms);
|
|
|
98 |
m_services.push_back(m_ohrcv);
|
101 |
}
|
99 |
}
|
102 |
}
|
100 |
}
|
103 |
}
|
101 |
}
|
104 |
|
102 |
|
105 |
UpMpd::~UpMpd()
|
103 |
UpMpd::~UpMpd()
|