db/upnp/Directory: move "res" attributes to array
Reduce bloat.
This commit is contained in:
parent
a1ced29279
commit
dadd987bf4
@ -37,6 +37,16 @@ static const char *const upnptags[] = {
|
|||||||
nullptr,
|
nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char *const res_attributes[] = {
|
||||||
|
"protocolInfo",
|
||||||
|
"size",
|
||||||
|
"bitrate",
|
||||||
|
"duration",
|
||||||
|
"sampleFrequency",
|
||||||
|
"nrAudioChannels",
|
||||||
|
nullptr,
|
||||||
|
};
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
static UPnPDirObject::ItemClass
|
static UPnPDirObject::ItemClass
|
||||||
ParseItemClass(const char *name)
|
ParseItemClass(const char *name)
|
||||||
@ -96,13 +106,11 @@ protected:
|
|||||||
// <res protocolInfo="http-get:*:audio/mpeg:*" size="5171496"
|
// <res protocolInfo="http-get:*:audio/mpeg:*" size="5171496"
|
||||||
// bitrate="24576" duration="00:03:35" sampleFrequency="44100"
|
// bitrate="24576" duration="00:03:35" sampleFrequency="44100"
|
||||||
// nrAudioChannels="2">
|
// nrAudioChannels="2">
|
||||||
std::string s;
|
|
||||||
s="protocolInfo";m_tobj.m_props[s] = attributes[s];
|
for (auto i = res_attributes; *i != nullptr; ++i) {
|
||||||
s="size";m_tobj.m_props[s] = attributes[s];
|
const std::string s(*i);
|
||||||
s="bitrate";m_tobj.m_props[s] = attributes[s];
|
m_tobj.m_props[s] = attributes[s];
|
||||||
s="duration";m_tobj.m_props[s] = attributes[s];
|
}
|
||||||
s="sampleFrequency";m_tobj.m_props[s] = attributes[s];
|
|
||||||
s="nrAudioChannels";m_tobj.m_props[s] = attributes[s];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user