Switch to unified view

a/src/avtransport.cxx b/src/avtransport.cxx
...
...
30
30
31
#include "mpdcli.hxx"                   // for MpdStatus, MPDCli, etc
31
#include "mpdcli.hxx"                   // for MpdStatus, MPDCli, etc
32
#include "ohplaylist.hxx"               // for OHPlaylist
32
#include "ohplaylist.hxx"               // for OHPlaylist
33
#include "upmpd.hxx"                    // for UpMpd, etc
33
#include "upmpd.hxx"                    // for UpMpd, etc
34
#include "upmpdutils.hxx"               // for didlmake, mapget
34
#include "upmpdutils.hxx"               // for didlmake, mapget
35
36
// For testing upplay with a dumb renderer.
37
// #define NO_SETNEXT
35
38
36
using namespace std;
39
using namespace std;
37
using namespace std::placeholders;
40
using namespace std::placeholders;
38
41
39
static const string sIdTransport("urn:upnp-org:serviceId:AVTransport");
42
static const string sIdTransport("urn:upnp-org:serviceId:AVTransport");
...
...
84
    m_dev->addActionMapping(this, "Previous", 
87
    m_dev->addActionMapping(this, "Previous", 
85
                            bind(&UpMpdAVTransport::seqcontrol, 
88
                            bind(&UpMpdAVTransport::seqcontrol, 
86
                                 this, _1, _2, 1));
89
                                 this, _1, _2, 1));
87
90
88
//    dev->m_mpdcli->consume(true);
91
//    dev->m_mpdcli->consume(true);
92
#ifdef NO_SETNEXT
93
    // If no setnext, fake stopping at each track
94
    m_dev->m_mpdcli->single(true);
95
#endif
89
}
96
}
90
97
91
// Translate MPD mode flags to UPnP Play mode
98
// Translate MPD mode flags to UPnP Play mode
92
static string mpdsToPlaymode(const MpdStatus& mpds)
99
static string mpdsToPlaymode(const MpdStatus& mpds)
93
{
100
{
...
...
217
    status["RelativeTimePosition"] = is_song?
224
    status["RelativeTimePosition"] = is_song?
218
        upnpduration(mpds.songelapsedms):"0:00:00";
225
        upnpduration(mpds.songelapsedms):"0:00:00";
219
    status["AbsoluteTimePosition"] = is_song?
226
    status["AbsoluteTimePosition"] = is_song?
220
        upnpduration(mpds.songelapsedms) : "0:00:00";
227
        upnpduration(mpds.songelapsedms) : "0:00:00";
221
228
229
#ifdef NO_SETNEXT
230
    status["NextAVTransportURI"] = "NOT_IMPLEMENTED";
231
    status["NextAVTransportURIMetaData"] = "NOT_IMPLEMENTED";
232
#else
222
    status["NextAVTransportURI"] = mpds.nextsong.uri;
233
    status["NextAVTransportURI"] = mpds.nextsong.uri;
223
    if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
234
    if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
224
        status["NextAVTransportURIMetaData"] = is_song ? m_nextMetadata : "";
235
        status["NextAVTransportURIMetaData"] = is_song ? m_nextMetadata : "";
225
    } else {
236
    } else {
226
        status["NextAVTransportURIMetaData"] = is_song ?
237
        status["NextAVTransportURIMetaData"] = is_song ?
227
            didlmake(mpds.nextsong) : "";
238
            didlmake(mpds.nextsong) : "";
228
    }
239
    }
240
#endif
229
241
230
    status["PlaybackStorageMedium"] = playmedium;
242
    status["PlaybackStorageMedium"] = playmedium;
231
    status["PossiblePlaybackStorageMedia"] = "HDD,NETWORK";
243
    status["PossiblePlaybackStorageMedia"] = "HDD,NETWORK";
232
    status["RecordStorageMedium"] = "NOT_IMPLEMENTED";
244
    status["RecordStorageMedium"] = "NOT_IMPLEMENTED";
233
    status["RelativeCounterPosition"] = "0";
245
    status["RelativeCounterPosition"] = "0";
...
...
292
// http://192.168.4.4:8200/MediaItems/246.mp3
304
// http://192.168.4.4:8200/MediaItems/246.mp3
293
int UpMpdAVTransport::setAVTransportURI(const SoapIncoming& sc, SoapOutgoing& data, 
305
int UpMpdAVTransport::setAVTransportURI(const SoapIncoming& sc, SoapOutgoing& data, 
294
                                        bool setnext)
306
                                        bool setnext)
295
{
307
{
296
    // pretend not to support setnext:
308
    // pretend not to support setnext:
309
#ifdef NO_SETNEXT
310
    if (setnext) {
311
        LOGERR("SetNextAVTransportURI: faking error\n");
297
    //if (setnext) return UPNP_E_INVALID_PARAM;
312
        return UPNP_E_INVALID_PARAM;
313
    }
314
#endif
315
298
    string uri;
316
    string uri;
299
    bool found = setnext? sc.get("NextURI", &uri) : sc.get("CurrentURI", &uri);
317
    bool found = setnext? sc.get("NextURI", &uri) : sc.get("CurrentURI", &uri);
300
    if (!found) {
318
    if (!found) {
301
        return UPNP_E_INVALID_PARAM;
319
        return UPNP_E_INVALID_PARAM;
302
    }
320
    }
...
...
601
{
619
{
602
    string playmode;
620
    string playmode;
603
    if (!sc.get("NewPlayMode", &playmode)) {
621
    if (!sc.get("NewPlayMode", &playmode)) {
604
        return UPNP_E_INVALID_PARAM;
622
        return UPNP_E_INVALID_PARAM;
605
    }
623
    }
624
    LOGDEB("UpMpdAVTransport::setPlayMode: " << playmode << endl);
606
625
607
    bool ok;
626
    bool ok;
608
    if (!playmode.compare("NORMAL")) {
627
    if (!playmode.compare("NORMAL")) {
609
        ok = m_dev->m_mpdcli->repeat(false) && m_dev->m_mpdcli->random(false) &&
628
        ok = m_dev->m_mpdcli->repeat(false) && m_dev->m_mpdcli->random(false) &&
610
            m_dev->m_mpdcli->single(false);
629
            m_dev->m_mpdcli->single(false);