|
a/upadapt/avtadapt.h |
|
b/upadapt/avtadapt.h |
1 |
/* Copyright (C) 2014 J.F.Dockes
|
1 |
/* Copyright (C) 2014-2018 J.F.Dockes
|
2 |
* This program is free software; you can redistribute it and/or modify
|
2 |
* This program is free software; you can redistribute it and/or modify
|
3 |
* it under the terms of the GNU General Public License as published by
|
3 |
* it under the terms of the GNU General Public License as published by
|
4 |
* the Free Software Foundation; either version 2 of the License, or
|
4 |
* the Free Software Foundation; either version 2 of the License, or
|
5 |
* (at your option) any later version.
|
5 |
* (at your option) any later version.
|
6 |
*
|
6 |
*
|
7 |
* This program is distributed in the hope that it will be useful,
|
7 |
* This program is distributed in the hope that it will be useful,
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10 |
* GNU General Public License for more details.
|
10 |
* GNU General Public License for more details.
|
11 |
*
|
11 |
*
|
12 |
* You should have received a copy of the GNU General Public License
|
12 |
* You should have received a copy of the GNU General Public License
|
13 |
* along with this program; if not, write to the
|
13 |
* along with this program; if not, write to the
|
14 |
* Free Software Foundation, Inc.,
|
14 |
* Free Software Foundation, Inc.,
|
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 |
#ifndef _AVTADAPT_H_INCLUDED_
|
18 |
#ifndef _AVTADAPT_H_INCLUDED_
|
19 |
#define _AVTADAPT_H_INCLUDED_
|
19 |
#define _AVTADAPT_H_INCLUDED_
|
20 |
|
20 |
|
|
... |
|
... |
28 |
#include "upqo/avtransport_qo.h"
|
28 |
#include "upqo/avtransport_qo.h"
|
29 |
#include "upadapt/upputils.h"
|
29 |
#include "upadapt/upputils.h"
|
30 |
|
30 |
|
31 |
class MetaDataAdaptor : public AVTMetadata {
|
31 |
class MetaDataAdaptor : public AVTMetadata {
|
32 |
public:
|
32 |
public:
|
33 |
MetaDataAdaptor(const MetaData &md)
|
33 |
MetaDataAdaptor(const MetaData &md) : m_md(md) {}
|
34 |
: m_md(md)
|
34 |
|
35 |
{}
|
|
|
36 |
virtual ~MetaDataAdaptor() {}
|
35 |
virtual ~MetaDataAdaptor() {}
|
37 |
|
36 |
|
38 |
virtual std::string getDidl() const
|
37 |
virtual std::string getDidl() const {
|
39 |
{
|
|
|
40 |
return qs2utf8s(m_md.didl);
|
38 |
return qs2utf8s(m_md.didl);
|
41 |
}
|
39 |
}
|
42 |
|
40 |
|
43 |
private:
|
41 |
private:
|
44 |
const MetaData& m_md;
|
42 |
const MetaData& m_md;
|
45 |
};
|
43 |
};
|
46 |
|
44 |
|
47 |
class AVTPlayer : public AVTransportQO {
|
45 |
class AVTPlayer : public AVTransportQO {
|
48 |
Q_OBJECT
|
46 |
Q_OBJECT
|
49 |
public:
|
47 |
public:
|
50 |
AVTPlayer(UPnPClient::AVTH avt, QObject *parent = 0)
|
48 |
AVTPlayer(UPnPClient::AVTH avt, QObject *parent = 0)
|
51 |
: AVTransportQO(avt, parent)
|
49 |
: AVTransportQO(avt, parent) {
|
52 |
{
|
|
|
53 |
connect(this, SIGNAL(tpStateChanged(int)),
|
50 |
connect(this, SIGNAL(tpStateChanged(int)),
|
54 |
this, SLOT(playerState(int)));
|
51 |
this, SLOT(playerState(int)));
|
55 |
connect(this, SIGNAL(currentMetadata(UPnPClient::UPnPDirObject)),
|
52 |
connect(this, SIGNAL(currentMetadata(UPnPClient::UPnPDirObject)),
|
56 |
this, SLOT(onCurrentMetadata(UPnPClient::UPnPDirObject)));
|
53 |
this, SLOT(onCurrentMetadata(UPnPClient::UPnPDirObject)));
|
57 |
}
|
54 |
}
|
58 |
|
55 |
|
59 |
public slots:
|
56 |
public slots:
|
60 |
|
57 |
|
61 |
void onCurrentMetadata(UPnPClient::UPnPDirObject ude) {
|
58 |
void onCurrentMetadata(UPnPClient::UPnPDirObject ude) {
|
62 |
MetaData md;
|
59 |
MetaData md;
|
63 |
udirentToMetadata(&ude, &md);
|
60 |
udirentToMetadata(&ude, &md);
|
64 |
emit sig_currentMetadata(md);
|
61 |
emit sig_currentMetadata(md);
|
65 |
}
|
62 |
}
|
66 |
void changeTrack(const MetaData& md, int /*pos_secs*/, bool /*playnow*/)
|
63 |
void changeTrack(const MetaData& md, int /*pos_secs*/, bool /*playnow*/) {
|
67 |
{
|
|
|
68 |
MetaDataAdaptor mad(md);
|
64 |
MetaDataAdaptor mad(md);
|
69 |
AVTransportQO::changeTrack(qs2utf8s(md.filepath), &mad);
|
65 |
AVTransportQO::changeTrack(qs2utf8s(md.filepath), &mad);
|
70 |
AVTransportQO::play();
|
66 |
AVTransportQO::play();
|
71 |
}
|
67 |
}
|
72 |
|
68 |
|
73 |
// Inform about the next track to play (for setNextAVTURI)
|
69 |
// Inform about the next track to play (for setNextAVTURI)
|
74 |
void infoNextTrack(const MetaData& md)
|
70 |
void infoNextTrack(const MetaData& md) {
|
75 |
{
|
|
|
76 |
MetaDataAdaptor mad(md);
|
71 |
MetaDataAdaptor mad(md);
|
77 |
AVTransportQO::prepareNextTrack(qs2utf8s(md.filepath), &mad);
|
72 |
AVTransportQO::prepareNextTrack(qs2utf8s(md.filepath), &mad);
|
78 |
}
|
73 |
}
|
79 |
|
74 |
|
80 |
void playerState(int tps) {
|
75 |
void playerState(int tps) {
|