|
a/src/avtransport.cxx |
|
b/src/avtransport.cxx |
|
... |
|
... |
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
*/
|
16 |
*/
|
17 |
|
17 |
|
18 |
#include "avtransport.hxx"
|
18 |
#include "avtransport.hxx"
|
19 |
|
19 |
|
20 |
#include <upnp/upnp.h> // for UPNP_E_SUCCESS, etc
|
20 |
#include <upnp/upnp.h>
|
21 |
|
21 |
|
22 |
#include <functional> // for _Bind, bind, _1, _2
|
22 |
#include <functional>
|
23 |
#include <iostream> // for operator<<, etc
|
23 |
#include <iostream>
|
24 |
#include <map> // for map, map<>::const_iterator
|
24 |
#include <map>
|
25 |
#include <utility> // for pair
|
25 |
#include <utility>
|
26 |
|
26 |
|
27 |
#include "libupnpp/log.hxx" // for LOGDEB, LOGDEB1, LOGERR
|
27 |
#include "libupnpp/log.hxx"
|
28 |
#include "libupnpp/soaphelp.hxx" // for SoapOutgoing, SoapIncoming, etc
|
28 |
#include "libupnpp/soaphelp.hxx"
|
29 |
#include "libupnpp/upnpavutils.hxx" // for upnpduration, etc
|
29 |
#include "libupnpp/upnpavutils.hxx"
|
|
|
30 |
#include "libupnpp/control/cdircontent.hxx"
|
30 |
|
31 |
|
31 |
#include "mpdcli.hxx" // for MpdStatus, MPDCli, etc
|
32 |
#include "mpdcli.hxx"
|
32 |
#include "ohplaylist.hxx" // for OHPlaylist
|
33 |
#include "ohplaylist.hxx"
|
33 |
#include "upmpd.hxx" // for UpMpd, etc
|
34 |
#include "upmpd.hxx"
|
34 |
#include "upmpdutils.hxx" // for didlmake, mapget
|
35 |
#include "upmpdutils.hxx"
|
|
|
36 |
#include "smallut.h"
|
35 |
|
37 |
|
36 |
// For testing upplay with a dumb renderer.
|
38 |
// For testing upplay with a dumb renderer.
|
37 |
// #define NO_SETNEXT
|
39 |
// #define NO_SETNEXT
|
38 |
|
40 |
|
39 |
using namespace std;
|
41 |
using namespace std;
|
|
... |
|
... |
325 |
" metadata[" << metadata << "]" << endl);
|
327 |
" metadata[" << metadata << "]" << endl);
|
326 |
|
328 |
|
327 |
const MpdStatus &mpds = m_dev->getMpdStatus();
|
329 |
const MpdStatus &mpds = m_dev->getMpdStatus();
|
328 |
const MpdStatus::State st = mpds.state;
|
330 |
const MpdStatus::State st = mpds.state;
|
329 |
|
331 |
|
|
|
332 |
// Check that we support the audio format for the input uri.
|
|
|
333 |
UpSong metaformpd;
|
|
|
334 |
if (!m_dev->checkContentFormat(uri, metadata, &metaformpd)) {
|
|
|
335 |
LOGERR("set(Next)AVTRansportURI: unsupported format: uri " << uri <<
|
|
|
336 |
" metadata " << metadata);
|
|
|
337 |
return UPNP_E_INVALID_PARAM;
|
|
|
338 |
}
|
|
|
339 |
|
330 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue) && !setnext) {
|
340 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue) && !setnext) {
|
331 |
// If we own the queue, just clear it before setting the
|
341 |
// If we own the queue, just clear it before setting the
|
332 |
// track. Else it's difficult to impossible to prevent it
|
342 |
// track. Else it's difficult to impossible to prevent it
|
333 |
// from growing if upmpdcli restarts. If the option is not set, the
|
343 |
// from growing if upmpdcli restarts. If the option is not set, the
|
334 |
// user prefers to live with the issue.
|
344 |
// user prefers to live with the issue.
|
|
... |
|
... |
363 |
}
|
373 |
}
|
364 |
if (posend > curpos+1)
|
374 |
if (posend > curpos+1)
|
365 |
m_dev->m_mpdcli->deletePosRange(curpos + 1, posend);
|
375 |
m_dev->m_mpdcli->deletePosRange(curpos + 1, posend);
|
366 |
}
|
376 |
}
|
367 |
}
|
377 |
}
|
368 |
|
|
|
369 |
UpSong metaformpd;
|
|
|
370 |
uMetaToUpSong(metadata, &metaformpd);
|
|
|
371 |
|
378 |
|
372 |
int songid = m_dev->m_mpdcli->insert(uri, setnext ? curpos + 1 : curpos,
|
379 |
int songid = m_dev->m_mpdcli->insert(uri, setnext ? curpos + 1 : curpos,
|
373 |
metaformpd);
|
380 |
metaformpd);
|
374 |
if (songid < 0) {
|
381 |
if (songid < 0) {
|
375 |
return UPNP_E_INTERNAL_ERROR;
|
382 |
return UPNP_E_INTERNAL_ERROR;
|