|
a/upmpd/upmpd.cxx |
|
b/upmpd/upmpd.cxx |
|
... |
|
... |
40 |
#include "upmpdutils.hxx"
|
40 |
#include "upmpdutils.hxx"
|
41 |
#include "rendering.hxx"
|
41 |
#include "rendering.hxx"
|
42 |
#include "avtransport.hxx"
|
42 |
#include "avtransport.hxx"
|
43 |
#include "conman.hxx"
|
43 |
#include "conman.hxx"
|
44 |
#include "ohproduct.hxx"
|
44 |
#include "ohproduct.hxx"
|
|
|
45 |
#include "ohinfo.hxx"
|
45 |
|
46 |
|
46 |
static const string dfltFriendlyName("UpMpd");
|
47 |
static const string dfltFriendlyName("UpMpd");
|
47 |
|
48 |
|
48 |
// Note: if we ever need this to work without cxx11, there is this:
|
49 |
// Note: if we ever need this to work without cxx11, there is this:
|
49 |
// http://www.tutok.sk/fastgl/callback.html
|
50 |
// http://www.tutok.sk/fastgl/callback.html
|
50 |
UpMpd::UpMpd(const string& deviceid,
|
51 |
UpMpd::UpMpd(const string& deviceid,
|
51 |
const unordered_map<string, string>& xmlfiles,
|
52 |
const unordered_map<string, string>& xmlfiles,
|
52 |
MPDCli *mpdcli, Options opts)
|
53 |
MPDCli *mpdcli, Options opts)
|
53 |
: UpnpDevice(deviceid, xmlfiles), m_mpdcli(mpdcli),
|
54 |
: UpnpDevice(deviceid, xmlfiles), m_mpdcli(mpdcli), m_mpds(0),
|
54 |
m_options(opts)
|
55 |
m_options(opts)
|
55 |
{
|
56 |
{
|
|
|
57 |
// Note: the order is significant here as it will be used when
|
|
|
58 |
// calling the getStatus() methods, and we want AVTransport to
|
|
|
59 |
// update the mpd status for OHInfo
|
56 |
m_services.push_back(new UpMpdRenderCtl(this));
|
60 |
m_services.push_back(new UpMpdRenderCtl(this));
|
57 |
m_services.push_back(new UpMpdAVTransport(this));
|
61 |
m_services.push_back(new UpMpdAVTransport(this));
|
58 |
m_services.push_back(new UpMpdConMan(this));
|
62 |
m_services.push_back(new UpMpdConMan(this));
|
59 |
m_services.push_back(new OHProduct(this));
|
63 |
m_services.push_back(new OHProduct(this));
|
|
|
64 |
m_services.push_back(new OHInfo(this));
|
60 |
}
|
65 |
}
|
61 |
|
66 |
|
62 |
UpMpd::~UpMpd()
|
67 |
UpMpd::~UpMpd()
|
63 |
{
|
68 |
{
|
64 |
for (vector<UpnpService*>::iterator it = m_services.begin();
|
69 |
for (vector<UpnpService*>::iterator it = m_services.begin();
|
65 |
it != m_services.end(); it++) {
|
70 |
it != m_services.end(); it++) {
|
66 |
delete(*it);
|
71 |
delete(*it);
|
67 |
}
|
72 |
}
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
const MpdStatus& UpMpd::getMpdStatus()
|
|
|
76 |
{
|
|
|
77 |
m_mpds = &m_mpdcli->getStatus();
|
|
|
78 |
return *m_mpds;
|
68 |
}
|
79 |
}
|
69 |
|
80 |
|
70 |
/////////////////////////////////////////////////////////////////////
|
81 |
/////////////////////////////////////////////////////////////////////
|
71 |
// Main program
|
82 |
// Main program
|
72 |
|
83 |
|
|
... |
|
... |
111 |
|
122 |
|
112 |
static string datadir(DATADIR "/");
|
123 |
static string datadir(DATADIR "/");
|
113 |
static string configdir(CONFIGDIR "/");
|
124 |
static string configdir(CONFIGDIR "/");
|
114 |
|
125 |
|
115 |
// Our XML description data. !Keep description.xml first!
|
126 |
// Our XML description data. !Keep description.xml first!
|
116 |
static const char *xmlfilenames[] = {/* keep first */ "description.xml",
|
127 |
static const char *xmlfilenames[] =
|
|
|
128 |
{/* keep first */ "description.xml",
|
117 |
"RenderingControl.xml", "AVTransport.xml", "ConnectionManager.xml",
|
129 |
"RenderingControl.xml", "AVTransport.xml", "ConnectionManager.xml",
|
118 |
"OHProduct.xml",
|
130 |
"OHProduct.xml", "OHInfo.xml",
|
119 |
};
|
131 |
};
|
120 |
|
132 |
|
121 |
static const int xmlfilenamescnt = sizeof(xmlfilenames) / sizeof(char *);
|
133 |
static const int xmlfilenamescnt = sizeof(xmlfilenames) / sizeof(char *);
|
122 |
|
134 |
|
123 |
int main(int argc, char *argv[])
|
135 |
int main(int argc, char *argv[])
|