author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 22 | 79de32ba3296 |
permissions | -rw-r--r-- |
0 | 1 |
/* This file is part of the KDE project. |
2 |
||
3 |
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
||
5 |
This library is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Lesser General Public License as published by |
|
7 |
the Free Software Foundation, either version 2.1 or 3 of the License. |
|
8 |
||
9 |
This library is distributed in the hope that it will be useful, |
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
GNU Lesser General Public License for more details. |
|
13 |
||
14 |
You should have received a copy of the GNU Lesser General Public License |
|
15 |
along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
||
17 |
*/ |
|
18 |
||
19 |
#ifndef PHONON_MMF_MEDIAOBJECT_H |
|
20 |
#define PHONON_MMF_MEDIAOBJECT_H |
|
21 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
22 |
#include <phonon/mediasource.h> |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
23 |
#include <phonon/mediaobjectinterface.h> |
0 | 24 |
#include <QScopedPointer> |
25 |
#include <QTimer> |
|
26 |
||
27 |
// For recognizer |
|
28 |
#include <apgcli.h> |
|
29 |
||
30 |
#include "abstractplayer.h" |
|
31 |
#include "mmf_medianode.h" |
|
32 |
#include "defs.h" |
|
33 |
||
34 |
QT_BEGIN_NAMESPACE |
|
35 |
||
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
36 |
class QResource; |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
37 |
|
0 | 38 |
namespace Phonon |
39 |
{ |
|
40 |
namespace MMF |
|
41 |
{ |
|
42 |
class AbstractPlayer; |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
43 |
class AbstractVideoOutput; |
0 | 44 |
|
45 |
/** |
|
46 |
* @short Facade class which wraps MMF client utility instance |
|
47 |
*/ |
|
48 |
class MediaObject : public MediaNode |
|
49 |
, public MediaObjectInterface |
|
50 |
{ |
|
51 |
Q_OBJECT |
|
52 |
Q_INTERFACES(Phonon::MediaObjectInterface) |
|
53 |
||
54 |
public: |
|
55 |
MediaObject(QObject *parent); |
|
56 |
virtual ~MediaObject(); |
|
57 |
||
58 |
// MediaObjectInterface |
|
59 |
virtual void play(); |
|
60 |
virtual void pause(); |
|
61 |
virtual void stop(); |
|
62 |
virtual void seek(qint64 milliseconds); |
|
63 |
virtual qint32 tickInterval() const; |
|
64 |
virtual void setTickInterval(qint32 interval); |
|
65 |
virtual bool hasVideo() const; |
|
66 |
virtual bool isSeekable() const; |
|
67 |
virtual qint64 currentTime() const; |
|
68 |
virtual Phonon::State state() const; |
|
69 |
virtual QString errorString() const; |
|
70 |
virtual Phonon::ErrorType errorType() const; |
|
71 |
virtual qint64 totalTime() const; |
|
72 |
virtual MediaSource source() const; |
|
73 |
virtual void setSource(const MediaSource &); |
|
74 |
virtual void setNextSource(const MediaSource &source); |
|
75 |
virtual qint32 prefinishMark() const; |
|
76 |
virtual void setPrefinishMark(qint32); |
|
77 |
virtual qint32 transitionTime() const; |
|
78 |
virtual void setTransitionTime(qint32); |
|
79 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
80 |
// MediaNode |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
81 |
void connectMediaObject(MediaObject *mediaObject); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
82 |
void disconnectMediaObject(MediaObject *mediaObject); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
83 |
|
0 | 84 |
/** |
85 |
* This class owns the AbstractPlayer, and will delete it upon |
|
86 |
* destruction. |
|
87 |
*/ |
|
88 |
AbstractPlayer *abstractPlayer() const; |
|
89 |
||
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
90 |
void setVideoOutput(AbstractVideoOutput* videoOutput); |
0 | 91 |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
92 |
RFile* file() const; |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
93 |
QResource* resource() const; |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
94 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
95 |
public Q_SLOTS: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
void volumeChanged(qreal volume); |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
97 |
void switchToNextSource(); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
|
0 | 99 |
Q_SIGNALS: |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
100 |
void abstractPlayerChanged(AbstractPlayer *player); |
0 | 101 |
void totalTimeChanged(qint64 length); |
102 |
void hasVideoChanged(bool hasVideo); |
|
103 |
void seekableChanged(bool seekable); |
|
104 |
void bufferStatus(int); |
|
105 |
void aboutToFinish(); |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
106 |
void prefinishMarkReached(qint32 remaining); |
0 | 107 |
// TODO: emit metaDataChanged from MediaObject |
108 |
void metaDataChanged(const QMultiMap<QString, QString>& metaData); |
|
109 |
void currentSourceChanged(const MediaSource& source); |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
110 |
void stateChanged(Phonon::State newState, |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
111 |
Phonon::State oldState); |
0 | 112 |
void finished(); |
113 |
void tick(qint64 time); |
|
114 |
||
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
115 |
private Q_SLOTS: |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
116 |
void handlePrefinishMarkReached(qint32); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
117 |
|
0 | 118 |
private: |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
119 |
void switchToSource(const MediaSource &source); |
0 | 120 |
void createPlayer(const MediaSource &source); |
121 |
bool openRecognizer(); |
|
122 |
||
123 |
// Audio / video media type recognition |
|
124 |
MediaType fileMediaType(const QString& fileName); |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
125 |
MediaType bufferMediaType(const uchar *data, qint64 size); |
0 | 126 |
// TODO: urlMediaType function |
127 |
||
128 |
static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); |
|
129 |
||
130 |
private: |
|
131 |
||
132 |
// Audio / video media type recognition |
|
133 |
bool m_recognizerOpened; |
|
134 |
RApaLsSession m_recognizer; |
|
135 |
RFs m_fileServer; |
|
136 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
137 |
MediaSource m_source; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
138 |
MediaSource m_nextSource; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
139 |
bool m_nextSourceSet; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
140 |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
141 |
RFile* m_file; |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
142 |
QResource* m_resource; |
0 | 143 |
|
144 |
QScopedPointer<AbstractPlayer> m_player; |
|
145 |
||
146 |
}; |
|
147 |
} |
|
148 |
} |
|
149 |
||
150 |
QT_END_NAMESPACE |
|
151 |
||
152 |
#endif |