Switch to unified view

a/src/avtransport.cxx b/src/avtransport.cxx
...
...
322
    found = setnext ? sc.get("NextURIMetaData", &metadata) :
322
    found = setnext ? sc.get("NextURIMetaData", &metadata) :
323
        sc.get("CurrentURIMetaData", &metadata);
323
        sc.get("CurrentURIMetaData", &metadata);
324
    LOGDEB("Set(next)AVTransportURI: next " << setnext <<  " uri " << uri <<
324
    LOGDEB("Set(next)AVTransportURI: next " << setnext <<  " uri " << uri <<
325
           " metadata[" << metadata << "]" << endl);
325
           " metadata[" << metadata << "]" << endl);
326
326
327
    const MpdStatus &mpds = m_dev->getMpdStatus();
328
    const MpdStatus::State st = mpds.state;
329
327
    if ((m_dev->m_options & UpMpd::upmpdOwnQueue) && !setnext) {
330
    if ((m_dev->m_options & UpMpd::upmpdOwnQueue) && !setnext) {
328
        // If we own the queue, just clear it before setting the
331
        // If we own the queue, just clear it before setting the
329
        // track.  Else it's difficult to impossible to prevent it
332
        // track.  Else it's difficult to impossible to prevent it
330
        // from growing if upmpdcli restarts. If the option is not set, the
333
        // from growing if upmpdcli restarts. If the option is not set, the
331
        // user prefers to live with the issue.
334
        // user prefers to live with the issue.
332
        m_dev->m_mpdcli->clearQueue();
335
        m_dev->m_mpdcli->clearQueue();
333
    }
336
    }
334
337
335
    const MpdStatus &mpds = m_dev->getMpdStatus();
338
    bool is_song = (st == MpdStatus::MPDS_PLAY) || (st == MpdStatus::MPDS_PAUSE);
336
    bool is_song = (mpds.state == MpdStatus::MPDS_PLAY) || 
337
        (mpds.state == MpdStatus::MPDS_PAUSE);
338
    int curpos = mpds.songpos;
339
    int curpos = mpds.songpos;
339
    LOGDEB1("UpMpdAVTransport::set" << (setnext?"Next":"") << 
340
    LOGDEB1("UpMpdAVTransport::set" << (setnext?"Next":"") << 
340
            "AVTransportURI: curpos: " <<
341
            "AVTransportURI: curpos: " <<
341
            curpos << " is_song " << is_song << " qlen " << mpds.qlen << endl);
342
            curpos << " is_song " << is_song << " qlen " << mpds.qlen << endl);
342
343
...
...
383
        m_nextUri.clear();
384
        m_nextUri.clear();
384
        m_nextMetadata.clear();
385
        m_nextMetadata.clear();
385
    }
386
    }
386
387
387
    if (!setnext) {
388
    if (!setnext) {
388
        MpdStatus::State st = mpds.state;
389
        // Have to tell mpd which track to play, else it will keep on
389
        // Have to tell mpd which track to play, else it will keep on
390
        // the previous despite the insertion. The UPnP docs say
390
        // the previous despite the insertion. The UPnP docs say
391
        // that setAVTransportURI should not change the transport
391
        // that setAVTransportURI should not change the transport
392
        // state (pause/stop stay pause/stop) but it seems that some clients
392
        // state (pause/stop stay pause/stop) but it seems that some clients
393
        // expect that the track will start playing.
393
        // expect that the track will start playing.
394
        // Needs to be revisited after seeing more clients. For now try to 
394
        // Needs to be revisited after seeing more clients. For now try to 
395
        // preserve state as per standard.
395
        // preserve state as per standard.
396
        // Audionet: issues a Play
396
        // Audionet: issues a Play
397
        // BubbleUpnp: issues a Play
397
        // BubbleUpnp: issues a Play
398
        // MediaHouse: no setnext, Play
398
        // MediaHouse: no setnext, Play
399
        m_dev->m_mpdcli->play(curpos);
400
#if 1 || defined(upmpd_do_restore_play_state_after_add)
399
#if 1 || defined(upmpd_do_restore_play_state_after_add)
401
        switch (st) {
400
        switch (st) {
401
        case MpdStatus::MPDS_PLAY: m_dev->m_mpdcli->play(curpos); break;
402
        case MpdStatus::MPDS_PAUSE: m_dev->m_mpdcli->togglePause(); break;
402
        case MpdStatus::MPDS_PAUSE: m_dev->m_mpdcli->pause(true); break;
403
        case MpdStatus::MPDS_STOP: m_dev->m_mpdcli->stop(); break;
403
        case MpdStatus::MPDS_STOP: m_dev->m_mpdcli->stop(); break;
404
        default: break;
404
        default: break;
405
        }
405
        }
406
#endif
406
#endif
407
        // Clean up old song ids
407
        // Clean up old song ids