|
a/upmpd/ohinfo.cxx |
|
b/upmpd/ohinfo.cxx |
|
... |
|
... |
78 |
|
78 |
|
79 |
bool is_song = (mpds.state == MpdStatus::MPDS_PLAY) ||
|
79 |
bool is_song = (mpds.state == MpdStatus::MPDS_PLAY) ||
|
80 |
(mpds.state == MpdStatus::MPDS_PAUSE);
|
80 |
(mpds.state == MpdStatus::MPDS_PAUSE);
|
81 |
|
81 |
|
82 |
if (is_song) {
|
82 |
if (is_song) {
|
83 |
char cbuf[30];
|
83 |
duration = SoapArgs::i2s(mpds.songlenms / 1000);
|
84 |
sprintf(cbuf, "%u", mpds.songlenms / 1000);
|
84 |
bitrate = SoapArgs::i2s(mpds.kbrate * 1000);
|
85 |
duration = cbuf;
|
85 |
bitdepth = SoapArgs::i2s(mpds.bitdepth);
|
86 |
sprintf(cbuf, "%u", mpds.kbrate * 1000);
|
86 |
samplerate = SoapArgs::i2s(mpds.sample_rate);
|
87 |
bitrate = cbuf;
|
|
|
88 |
sprintf(cbuf, "%u", mpds.bitdepth);
|
|
|
89 |
bitdepth = cbuf;
|
|
|
90 |
sprintf(cbuf, "%u", mpds.sample_rate);
|
|
|
91 |
samplerate = cbuf;
|
|
|
92 |
} else {
|
87 |
} else {
|
93 |
duration = bitrate = bitdepth = samplerate = "0";
|
88 |
duration = bitrate = bitdepth = samplerate = "0";
|
94 |
}
|
89 |
}
|
95 |
}
|
90 |
}
|
96 |
|
91 |
|
97 |
bool OHInfo::makestate(unordered_map<string, string> &st)
|
92 |
bool OHInfo::makestate(unordered_map<string, string> &st)
|
98 |
{
|
93 |
{
|
99 |
st.clear();
|
94 |
st.clear();
|
100 |
|
95 |
|
101 |
char cbuf[30];
|
96 |
st["TrackCount"] = SoapArgs::i2s(m_dev->m_mpds ?
|
102 |
sprintf(cbuf, "%d", m_dev->m_mpds ? m_dev->m_mpds->trackcounter : 0);
|
97 |
m_dev->m_mpds->trackcounter : 0);
|
103 |
st["TrackCount"] = cbuf;
|
98 |
st["DetailsCount"] = SoapArgs::i2s(m_dev->m_mpds ?
|
104 |
sprintf(cbuf, "%d", m_dev->m_mpds ? m_dev->m_mpds->detailscounter : 0);
|
99 |
m_dev->m_mpds->detailscounter : 0);
|
105 |
st["DetailsCount"] = cbuf;
|
|
|
106 |
st["MetatextCount"] = "0";
|
100 |
st["MetatextCount"] = "0";
|
107 |
string uri, metadata;
|
101 |
string uri, metadata;
|
108 |
urimetadata(uri, metadata);
|
102 |
urimetadata(uri, metadata);
|
109 |
st["Uri"] = uri;
|
103 |
st["Uri"] = uri;
|
110 |
st["Metadata"] = metadata;
|
104 |
st["Metadata"] = metadata;
|
111 |
makedetails(st["Duration"], st["BitRate"], st["BitDepth"],
|
105 |
makedetails(st["Duration"], st["BitRate"], st["BitDepth"],st["SampleRate"]);
|
112 |
st["SampleRate"]);
|
|
|
113 |
st["Lossless"] = "0";
|
106 |
st["Lossless"] = "0";
|
114 |
st["CodecName"] = "";
|
107 |
st["CodecName"] = "";
|
115 |
st["Metatext"] = "";
|
108 |
st["Metatext"] = "";
|
116 |
return true;
|
109 |
return true;
|
117 |
}
|
110 |
}
|
|
... |
|
... |
139 |
}
|
132 |
}
|
140 |
|
133 |
|
141 |
int OHInfo::counters(const SoapArgs& sc, SoapData& data)
|
134 |
int OHInfo::counters(const SoapArgs& sc, SoapData& data)
|
142 |
{
|
135 |
{
|
143 |
LOGDEB("OHInfo::counters" << endl);
|
136 |
LOGDEB("OHInfo::counters" << endl);
|
144 |
char cbuf[30];
|
137 |
|
145 |
sprintf(cbuf, "%d", m_dev->m_mpds ? m_dev->m_mpds->trackcounter : 0);
|
138 |
data.addarg("TrackCount", SoapArgs::i2s(m_dev->m_mpds ?
|
146 |
data.addarg("TrackCount", cbuf);
|
139 |
m_dev->m_mpds->trackcounter : 0));
|
147 |
sprintf(cbuf, "%d", m_dev->m_mpds ? m_dev->m_mpds->detailscounter : 0);
|
140 |
data.addarg("DetailsCount", SoapArgs::i2s(m_dev->m_mpds ?
|
148 |
data.addarg("DetailsCount", cbuf);
|
141 |
m_dev->m_mpds->detailscounter:0));
|
149 |
data.addarg("MetatextCount", "0");
|
142 |
data.addarg("MetatextCount", "0");
|
150 |
return UPNP_E_SUCCESS;
|
143 |
return UPNP_E_SUCCESS;
|
151 |
}
|
144 |
}
|
152 |
|
145 |
|
153 |
int OHInfo::track(const SoapArgs& sc, SoapData& data)
|
146 |
int OHInfo::track(const SoapArgs& sc, SoapData& data)
|