|
a/upmpd/mpdcli.cxx |
|
b/upmpd/mpdcli.cxx |
|
... |
|
... |
16 |
*/
|
16 |
*/
|
17 |
#include <memory.h>
|
17 |
#include <memory.h>
|
18 |
|
18 |
|
19 |
#include <iostream>
|
19 |
#include <iostream>
|
20 |
|
20 |
|
21 |
#include <mpd/connection.h>
|
|
|
22 |
#include <mpd/password.h>
|
|
|
23 |
#include <mpd/mixer.h>
|
21 |
#include <mpd/client.h>
|
24 |
#include <mpd/status.h>
|
|
|
25 |
#include <mpd/song.h>
|
|
|
26 |
#include <mpd/tag.h>
|
|
|
27 |
#include <mpd/player.h>
|
|
|
28 |
#include <mpd/queue.h>
|
|
|
29 |
|
22 |
|
30 |
#include "libupnpp/log.hxx"
|
23 |
#include "libupnpp/log.hxx"
|
31 |
#include "mpdcli.hxx"
|
24 |
#include "mpdcli.hxx"
|
32 |
|
25 |
|
33 |
using namespace std;
|
26 |
using namespace std;
|
|
... |
|
... |
159 |
m_stat.mixrampdb = mpd_status_get_mixrampdb(mpds);
|
152 |
m_stat.mixrampdb = mpd_status_get_mixrampdb(mpds);
|
160 |
m_stat.mixrampdelay = mpd_status_get_mixrampdelay(mpds);
|
153 |
m_stat.mixrampdelay = mpd_status_get_mixrampdelay(mpds);
|
161 |
m_stat.songpos = mpd_status_get_song_pos(mpds);
|
154 |
m_stat.songpos = mpd_status_get_song_pos(mpds);
|
162 |
m_stat.songid = mpd_status_get_song_id(mpds);
|
155 |
m_stat.songid = mpd_status_get_song_id(mpds);
|
163 |
if (m_stat.songpos >= 0) {
|
156 |
if (m_stat.songpos >= 0) {
|
|
|
157 |
string prevuri = m_stat.currentsong["uri"];
|
164 |
updSong(m_stat.currentsong);
|
158 |
updSong(m_stat.currentsong);
|
|
|
159 |
if (m_stat.currentsong["uri"].compare(prevuri)) {
|
|
|
160 |
m_stat.trackcounter++;
|
|
|
161 |
m_stat.detailscounter = 0;
|
|
|
162 |
}
|
165 |
updSong(m_stat.nextsong, m_stat.songpos + 1);
|
163 |
updSong(m_stat.nextsong, m_stat.songpos + 1);
|
166 |
}
|
164 |
}
|
167 |
|
165 |
|
168 |
m_stat.songelapsedms = mpd_status_get_elapsed_ms(mpds);
|
166 |
m_stat.songelapsedms = mpd_status_get_elapsed_ms(mpds);
|
169 |
m_stat.songlenms = mpd_status_get_total_time(mpds) * 1000;
|
167 |
m_stat.songlenms = mpd_status_get_total_time(mpds) * 1000;
|
170 |
m_stat.kbrate = mpd_status_get_kbit_rate(mpds);
|
168 |
m_stat.kbrate = mpd_status_get_kbit_rate(mpds);
|
|
|
169 |
const struct mpd_audio_format *maf =
|
|
|
170 |
mpd_status_get_audio_format(mpds);
|
|
|
171 |
if (maf) {
|
|
|
172 |
m_stat.bitdepth = maf->bits;
|
|
|
173 |
m_stat.sample_rate = maf->sample_rate;
|
|
|
174 |
m_stat.channels = maf->channels;
|
|
|
175 |
} else {
|
|
|
176 |
m_stat.bitdepth = m_stat.channels = m_stat.sample_rate = 0;
|
|
|
177 |
}
|
171 |
|
178 |
|
172 |
const char *err = mpd_status_get_error(mpds);
|
179 |
const char *err = mpd_status_get_error(mpds);
|
173 |
if (err != 0)
|
180 |
if (err != 0)
|
174 |
m_stat.errormessage.assign(err);
|
181 |
m_stat.errormessage.assign(err);
|
175 |
|
182 |
|