Switch to unified view

a/src/ohplaylist.cxx b/src/ohplaylist.cxx
...
...
34
34
35
#include "ohmetacache.hxx"              // for dmcacheSave
35
#include "ohmetacache.hxx"              // for dmcacheSave
36
#include "mpdcli.hxx"                   // for MpdStatus, UpSong, MPDCli, etc
36
#include "mpdcli.hxx"                   // for MpdStatus, UpSong, MPDCli, etc
37
#include "upmpd.hxx"                    // for UpMpd, etc
37
#include "upmpd.hxx"                    // for UpMpd, etc
38
#include "upmpdutils.hxx"               // for didlmake, diffmaps, etc
38
#include "upmpdutils.hxx"               // for didlmake, diffmaps, etc
39
#include "ohproduct.hxx"
39
40
40
using namespace std;
41
using namespace std;
41
using namespace std::placeholders;
42
using namespace std::placeholders;
42
43
43
static const string sTpProduct("urn:av-openhome-org:service:Playlist:1");
44
static const string sTpProduct("urn:av-openhome-org:service:Playlist:1");
44
static const string sIdProduct("urn:av-openhome-org:serviceId:Playlist");
45
static const string sIdProduct("urn:av-openhome-org:serviceId:Playlist");
45
46
47
// Playlist is the default oh service, so it's active when starting up
46
OHPlaylist::OHPlaylist(UpMpd *dev, unsigned int cssleep)
48
OHPlaylist::OHPlaylist(UpMpd *dev, unsigned int cssleep)
47
    : UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev),
49
    : UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev),
48
      m_cachedirty(false), m_mpdqvers(-1)
50
      m_active(true), m_cachedirty(false), m_mpdqvers(-1)
49
{
51
{
50
    dev->addActionMapping(this, "Play", 
52
    dev->addActionMapping(this, "Play", 
51
                          bind(&OHPlaylist::play, this, _1, _2));
53
                          bind(&OHPlaylist::play, this, _1, _2));
52
    dev->addActionMapping(this, "Pause", 
54
    dev->addActionMapping(this, "Pause", 
53
                          bind(&OHPlaylist::pause, this, _1, _2));
55
                          bind(&OHPlaylist::pause, this, _1, _2));
...
...
257
bool OHPlaylist::getEventData(bool all, std::vector<std::string>& names, 
259
bool OHPlaylist::getEventData(bool all, std::vector<std::string>& names, 
258
                              std::vector<std::string>& values)
260
                              std::vector<std::string>& values)
259
{
261
{
260
    //LOGDEB("OHPlaylist::getEventData" << endl);
262
    //LOGDEB("OHPlaylist::getEventData" << endl);
261
263
264
    if (!m_active)
265
        return true;
266
262
    unordered_map<string, string> state;
267
    unordered_map<string, string> state;
263
268
264
    makestate(state);
269
    makestate(state);
265
270
266
    unordered_map<string, string> changed;
271
    unordered_map<string, string> changed;
...
...
286
}
291
}
287
292
288
int OHPlaylist::play(const SoapIncoming& sc, SoapOutgoing& data)
293
int OHPlaylist::play(const SoapIncoming& sc, SoapOutgoing& data)
289
{
294
{
290
    LOGDEB("OHPlaylist::play" << endl);
295
    LOGDEB("OHPlaylist::play" << endl);
296
    if (!m_active && m_dev->m_ohpr) {
297
        m_dev->m_ohpr->iSetSourceIndexByName("Playlist");
298
    }
291
    m_dev->m_mpdcli->consume(false);
299
    m_dev->m_mpdcli->consume(false);
292
    m_dev->m_mpdcli->single(false);
300
    m_dev->m_mpdcli->single(false);
293
    bool ok = m_dev->m_mpdcli->play();
301
    bool ok = m_dev->m_mpdcli->play();
294
    maybeWakeUp(ok);
302
    maybeWakeUp(ok);
295
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
303
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;