|
a/libupnpp/control/avtransport.cxx |
|
b/libupnpp/control/avtransport.cxx |
|
... |
|
... |
102 |
|
102 |
|
103 |
void AVTransport::evtCallback(
|
103 |
void AVTransport::evtCallback(
|
104 |
const std::unordered_map<std::string, std::string>& props)
|
104 |
const std::unordered_map<std::string, std::string>& props)
|
105 |
{
|
105 |
{
|
106 |
LOGDEB1("AVTransport::evtCallback:" << endl);
|
106 |
LOGDEB1("AVTransport::evtCallback:" << endl);
|
107 |
for (auto& entry: props) {
|
107 |
for (auto it = props.begin(); it != props.end(); it++) {
|
108 |
if (entry.first.compare("LastChange")) {
|
108 |
if (it->first.compare("LastChange")) {
|
109 |
LOGINF("AVTransport:event: var not lastchange: "
|
109 |
LOGINF("AVTransport:event: var not lastchange: "
|
110 |
<< entry.first << " -> " << entry.second << endl;);
|
110 |
<< it->first << " -> " << it->second << endl;);
|
111 |
continue;
|
111 |
continue;
|
112 |
}
|
112 |
}
|
113 |
LOGDEB1("AVTransport:event: "
|
113 |
LOGDEB1("AVTransport:event: "
|
114 |
<< entry.first << " -> " << entry.second << endl;);
|
114 |
<< it->first << " -> " << it->second << endl;);
|
115 |
|
115 |
|
116 |
std::unordered_map<std::string, std::string> props1;
|
116 |
std::unordered_map<std::string, std::string> props1;
|
117 |
if (!decodeAVLastChange(entry.second, props1)) {
|
117 |
if (!decodeAVLastChange(it->second, props1)) {
|
118 |
LOGERR("AVTransport::evtCallback: bad LastChange value: "
|
118 |
LOGERR("AVTransport::evtCallback: bad LastChange value: "
|
119 |
<< entry.second << endl);
|
119 |
<< it->second << endl);
|
120 |
return;
|
120 |
return;
|
121 |
}
|
121 |
}
|
122 |
for (auto& entry1: props1) {
|
122 |
for (auto it1 = props1.begin(); it1 != props1.end(); it1++) {
|
123 |
if (!m_reporter) {
|
123 |
if (!m_reporter) {
|
124 |
LOGDEB1("AVTransport::evtCallback: " << entry1.first << " -> "
|
124 |
LOGDEB1("AVTransport::evtCallback: " << it1->first << " -> "
|
125 |
<< entry1.second << endl);
|
125 |
<< it1->second << endl);
|
126 |
continue;
|
126 |
continue;
|
127 |
}
|
127 |
}
|
128 |
|
128 |
|
129 |
if (!entry1.first.compare("TransportState")) {
|
129 |
if (!it1->first.compare("TransportState")) {
|
130 |
m_reporter->changed(entry1.first.c_str(),
|
130 |
m_reporter->changed(it1->first.c_str(),
|
131 |
stringToTpState(entry1.second));
|
131 |
stringToTpState(it1->second));
|
132 |
|
132 |
|
133 |
} else if (!entry1.first.compare("TransportStatus")) {
|
133 |
} else if (!it1->first.compare("TransportStatus")) {
|
134 |
m_reporter->changed(entry1.first.c_str(),
|
134 |
m_reporter->changed(it1->first.c_str(),
|
135 |
stringToTpStatus(entry1.second));
|
135 |
stringToTpStatus(it1->second));
|
136 |
|
136 |
|
137 |
} else if (!entry1.first.compare("CurrentPlayMode")) {
|
137 |
} else if (!it1->first.compare("CurrentPlayMode")) {
|
138 |
m_reporter->changed(entry1.first.c_str(),
|
138 |
m_reporter->changed(it1->first.c_str(),
|
139 |
stringToPlayMode(entry1.second));
|
139 |
stringToPlayMode(it1->second));
|
140 |
|
140 |
|
141 |
} else if (!entry1.first.compare("CurrentTransportActions")) {
|
141 |
} else if (!it1->first.compare("CurrentTransportActions")) {
|
142 |
int iacts;
|
142 |
int iacts;
|
143 |
if (!CTAStringToBits(entry1.second, iacts))
|
143 |
if (!CTAStringToBits(it1->second, iacts))
|
144 |
m_reporter->changed(entry1.first.c_str(), iacts);
|
144 |
m_reporter->changed(it1->first.c_str(), iacts);
|
145 |
|
145 |
|
146 |
} else if (!entry1.first.compare("CurrentTrackURI") ||
|
146 |
} else if (!it1->first.compare("CurrentTrackURI") ||
|
147 |
!entry1.first.compare("AVTransportURI") ||
|
147 |
!it1->first.compare("AVTransportURI") ||
|
148 |
!entry1.first.compare("NextAVTransportURI")) {
|
148 |
!it1->first.compare("NextAVTransportURI")) {
|
149 |
m_reporter->changed(entry1.first.c_str(),
|
149 |
m_reporter->changed(it1->first.c_str(),
|
150 |
entry1.second.c_str());
|
150 |
it1->second.c_str());
|
151 |
|
151 |
|
152 |
} else if (!entry1.first.compare("TransportPlaySpeed") ||
|
152 |
} else if (!it1->first.compare("TransportPlaySpeed") ||
|
153 |
!entry1.first.compare("CurrentTrack") ||
|
153 |
!it1->first.compare("CurrentTrack") ||
|
154 |
!entry1.first.compare("NumberOfTracks") ||
|
154 |
!it1->first.compare("NumberOfTracks") ||
|
155 |
!entry1.first.compare("RelativeCounterPosition") ||
|
155 |
!it1->first.compare("RelativeCounterPosition") ||
|
156 |
!entry1.first.compare("AbsoluteCounterPosition") ||
|
156 |
!it1->first.compare("AbsoluteCounterPosition") ||
|
157 |
!entry1.first.compare("InstanceID")) {
|
157 |
!it1->first.compare("InstanceID")) {
|
158 |
m_reporter->changed(entry1.first.c_str(),
|
158 |
m_reporter->changed(it1->first.c_str(),
|
159 |
atoi(entry1.second.c_str()));
|
159 |
atoi(it1->second.c_str()));
|
160 |
|
160 |
|
161 |
} else if (!entry1.first.compare("CurrentMediaDuration") ||
|
161 |
} else if (!it1->first.compare("CurrentMediaDuration") ||
|
162 |
!entry1.first.compare("CurrentTrackDuration") ||
|
162 |
!it1->first.compare("CurrentTrackDuration") ||
|
163 |
!entry1.first.compare("RelativeTimePosition") ||
|
163 |
!it1->first.compare("RelativeTimePosition") ||
|
164 |
!entry1.first.compare("AbsoluteTimePosition")) {
|
164 |
!it1->first.compare("AbsoluteTimePosition")) {
|
165 |
m_reporter->changed(entry1.first.c_str(),
|
165 |
m_reporter->changed(it1->first.c_str(),
|
166 |
upnpdurationtos(entry1.second));
|
166 |
upnpdurationtos(it1->second));
|
167 |
|
167 |
|
168 |
} else if (!entry1.first.compare("AVTransportURIMetaData") ||
|
168 |
} else if (!it1->first.compare("AVTransportURIMetaData") ||
|
169 |
!entry1.first.compare("NextAVTransportURIMetaData") ||
|
169 |
!it1->first.compare("NextAVTransportURIMetaData") ||
|
170 |
!entry1.first.compare("CurrentTrackMetaData")) {
|
170 |
!it1->first.compare("CurrentTrackMetaData")) {
|
171 |
UPnPDirContent meta;
|
171 |
UPnPDirContent meta;
|
172 |
if (!meta.parse(entry1.second)) {
|
172 |
if (!meta.parse(it1->second)) {
|
173 |
LOGERR("AVTransport event: bad metadata: [" <<
|
173 |
LOGERR("AVTransport event: bad metadata: [" <<
|
174 |
entry1.second << "]" << endl);
|
174 |
it1->second << "]" << endl);
|
175 |
} else {
|
175 |
} else {
|
176 |
LOGDEB1("AVTransport event: good metadata: [" <<
|
176 |
LOGDEB1("AVTransport event: good metadata: [" <<
|
177 |
entry1.second << "]" << endl);
|
177 |
it1->second << "]" << endl);
|
178 |
if (meta.m_items.size() > 0) {
|
178 |
if (meta.m_items.size() > 0) {
|
179 |
m_reporter->changed(entry1.first.c_str(),
|
179 |
m_reporter->changed(it1->first.c_str(),
|
180 |
meta.m_items[0]);
|
180 |
meta.m_items[0]);
|
181 |
}
|
181 |
}
|
182 |
}
|
182 |
}
|
183 |
} else if (!entry1.first.compare("PlaybackStorageMedium") ||
|
183 |
} else if (!it1->first.compare("PlaybackStorageMedium") ||
|
184 |
!entry1.first.compare("PossiblePlaybackStorageMedium") ||
|
184 |
!it1->first.compare("PossiblePlaybackStorageMedium") ||
|
185 |
!entry1.first.compare("RecordStorageMedium") ||
|
185 |
!it1->first.compare("RecordStorageMedium") ||
|
186 |
!entry1.first.compare("PossibleRecordStorageMedium") ||
|
186 |
!it1->first.compare("PossibleRecordStorageMedium") ||
|
187 |
!entry1.first.compare("RecordMediumWriteStatus") ||
|
187 |
!it1->first.compare("RecordMediumWriteStatus") ||
|
188 |
!entry1.first.compare("CurrentRecordQualityMode") ||
|
188 |
!it1->first.compare("CurrentRecordQualityMode") ||
|
189 |
!entry1.first.compare("PossibleRecordQualityModes")){
|
189 |
!it1->first.compare("PossibleRecordQualityModes")){
|
190 |
m_reporter->changed(entry1.first.c_str(),entry1.second.c_str());
|
190 |
m_reporter->changed(it1->first.c_str(),it1->second.c_str());
|
191 |
|
191 |
|
192 |
} else {
|
192 |
} else {
|
193 |
LOGERR("AVTransport event: unknown variable: name [" <<
|
193 |
LOGDEB("AVTransport event: unknown variable: name [" <<
|
194 |
entry1.first << "] value [" << entry1.second << endl);
|
194 |
it1->first << "] value [" << it1->second << endl);
|
195 |
m_reporter->changed(entry1.first.c_str(),entry1.second.c_str());
|
195 |
m_reporter->changed(it1->first.c_str(),it1->second.c_str());
|
196 |
}
|
196 |
}
|
197 |
}
|
197 |
}
|
198 |
}
|
198 |
}
|
199 |
}
|
199 |
}
|
200 |
|
200 |
|