|
a/libupnpp/control/mediarenderer.cxx |
|
b/libupnpp/control/mediarenderer.cxx |
|
... |
|
... |
43 |
{
|
43 |
{
|
44 |
const string::size_type sz(DType.size()-2);
|
44 |
const string::size_type sz(DType.size()-2);
|
45 |
return !DType.compare(0, sz, st, 0, sz);
|
45 |
return !DType.compare(0, sz, st, 0, sz);
|
46 |
}
|
46 |
}
|
47 |
|
47 |
|
|
|
48 |
// Look at all service descriptions and store parent devices for
|
|
|
49 |
// either UPnP RenderingControl or OpenHome Product. Some entries will
|
|
|
50 |
// be set multiple times, which does not matter
|
48 |
static bool MDAccum(unordered_map<string, UPnPDeviceDesc>* out,
|
51 |
static bool MDAccum(unordered_map<string, UPnPDeviceDesc>* out,
|
49 |
const string& friendlyName,
|
52 |
const string& friendlyName,
|
50 |
const UPnPDeviceDesc& device,
|
53 |
const UPnPDeviceDesc& device,
|
51 |
const UPnPServiceDesc& service)
|
54 |
const UPnPServiceDesc& service)
|
52 |
{
|
55 |
{
|
53 |
//LOGDEB("MDAccum: friendlyname: " << friendlyName <<
|
56 |
//LOGDEB("MDAccum: friendlyname: " << friendlyName <<
|
54 |
// " dev friendlyName " << device.friendlyName << endl);
|
57 |
// " dev friendlyName " << device.friendlyName << endl);
|
|
|
58 |
if (
|
55 |
if (RenderingControl::isRDCService(service.serviceType) &&
|
59 |
(RenderingControl::isRDCService(service.serviceType) ||
|
56 |
(friendlyName.empty() ? true :
|
60 |
OHProduct::isOHPrService(service.serviceType))
|
|
|
61 |
&&
|
57 |
!friendlyName.compare(device.friendlyName))) {
|
62 |
(friendlyName.empty() || !friendlyName.compare(device.friendlyName))) {
|
58 |
//LOGDEB("MDAccum setting " << device.UDN << endl);
|
63 |
//LOGDEB("MDAccum setting " << device.UDN << endl);
|
59 |
(*out)[device.UDN] = device;
|
64 |
(*out)[device.UDN] = device;
|
60 |
}
|
65 |
}
|
61 |
return true;
|
66 |
return true;
|
62 |
}
|
67 |
}
|
|
... |
|
... |
95 |
rdcl = RDCH(new RenderingControl(m_desc, *it));
|
100 |
rdcl = RDCH(new RenderingControl(m_desc, *it));
|
96 |
break;
|
101 |
break;
|
97 |
}
|
102 |
}
|
98 |
}
|
103 |
}
|
99 |
if (!rdcl)
|
104 |
if (!rdcl)
|
100 |
LOGERR("MediaRenderer::rdc: RenderingControl service not found" << endl);
|
105 |
LOGDEB("MediaRenderer: RenderingControl service not found" << endl);
|
101 |
m_rdc = rdcl;
|
106 |
m_rdc = rdcl;
|
102 |
return rdcl;
|
107 |
return rdcl;
|
103 |
}
|
108 |
}
|
104 |
|
109 |
|
105 |
AVTH MediaRenderer::avt()
|
110 |
AVTH MediaRenderer::avt()
|
|
... |
|
... |
112 |
avtl = AVTH(new AVTransport(m_desc, *it));
|
117 |
avtl = AVTH(new AVTransport(m_desc, *it));
|
113 |
break;
|
118 |
break;
|
114 |
}
|
119 |
}
|
115 |
}
|
120 |
}
|
116 |
if (!avtl)
|
121 |
if (!avtl)
|
117 |
LOGERR("MediaRenderer::avt: AVTransport service not found" << endl);
|
122 |
LOGDEB("MediaRenderer: AVTransport service not found" << endl);
|
118 |
m_avt = avtl;
|
123 |
m_avt = avtl;
|
119 |
return avtl;
|
124 |
return avtl;
|
120 |
}
|
125 |
}
|
121 |
|
126 |
|
122 |
OHPRH MediaRenderer::ohpr()
|
127 |
OHPRH MediaRenderer::ohpr()
|
|
... |
|
... |
129 |
ohprl = OHPRH(new OHProduct(m_desc, *it));
|
134 |
ohprl = OHPRH(new OHProduct(m_desc, *it));
|
130 |
break;
|
135 |
break;
|
131 |
}
|
136 |
}
|
132 |
}
|
137 |
}
|
133 |
if (!ohprl)
|
138 |
if (!ohprl)
|
134 |
LOGINF("MediaRenderer::ohpr: OHProduct service not found" << endl);
|
139 |
LOGDEB("MediaRenderer: OHProduct service not found" << endl);
|
135 |
m_ohpr = ohprl;
|
140 |
m_ohpr = ohprl;
|
136 |
return ohprl;
|
141 |
return ohprl;
|
137 |
}
|
142 |
}
|
138 |
|
143 |
|
139 |
OHPLH MediaRenderer::ohpl()
|
144 |
OHPLH MediaRenderer::ohpl()
|
|
... |
|
... |
146 |
ohpll = OHPLH(new OHPlaylist(m_desc, *it));
|
151 |
ohpll = OHPLH(new OHPlaylist(m_desc, *it));
|
147 |
break;
|
152 |
break;
|
148 |
}
|
153 |
}
|
149 |
}
|
154 |
}
|
150 |
if (!ohpll)
|
155 |
if (!ohpll)
|
151 |
LOGINF("MediaRenderer::ohpl: OHPlaylist service not found" << endl);
|
156 |
LOGDEB("MediaRenderer: OHPlaylist service not found" << endl);
|
152 |
m_ohpl = ohpll;
|
157 |
m_ohpl = ohpll;
|
153 |
return ohpll;
|
158 |
return ohpll;
|
154 |
}
|
159 |
}
|
155 |
|
160 |
|
156 |
OHTMH MediaRenderer::ohtm()
|
161 |
OHTMH MediaRenderer::ohtm()
|
|
... |
|
... |
163 |
ohtml = OHTMH(new OHTime(m_desc, *it));
|
168 |
ohtml = OHTMH(new OHTime(m_desc, *it));
|
164 |
break;
|
169 |
break;
|
165 |
}
|
170 |
}
|
166 |
}
|
171 |
}
|
167 |
if (!ohtml)
|
172 |
if (!ohtml)
|
168 |
LOGINF("MediaRenderer::ohtm: OHTime service not found" << endl);
|
173 |
LOGDEB("MediaRenderer: OHTime service not found" << endl);
|
169 |
m_ohtm = ohtml;
|
174 |
m_ohtm = ohtml;
|
170 |
return ohtml;
|
175 |
return ohtml;
|
171 |
}
|
176 |
}
|
172 |
|
177 |
|
|
|
178 |
OHVLH MediaRenderer::ohvl()
|
|
|
179 |
{
|
|
|
180 |
auto ohvll = m_ohvl.lock();
|
|
|
181 |
if (ohvll)
|
|
|
182 |
return ohvll;
|
|
|
183 |
for (auto it = m_desc.services.begin(); it != m_desc.services.end(); it++) {
|
|
|
184 |
if (OHVolume::isOHVLService(it->serviceType)) {
|
|
|
185 |
ohvll = OHVLH(new OHVolume(m_desc, *it));
|
|
|
186 |
break;
|
|
|
187 |
}
|
|
|
188 |
}
|
|
|
189 |
if (!ohvll)
|
|
|
190 |
LOGDEB("MediaRenderer: OHVolume service not found" << endl);
|
|
|
191 |
m_ohvl = ohvll;
|
|
|
192 |
return ohvll;
|
173 |
}
|
193 |
}
|
|
|
194 |
|
|
|
195 |
}
|