author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 11:15:19 +0300 | |
branch | RCL_3 |
changeset 11 | 25a739ee40f4 |
parent 7 | 3f74d0d4af4c |
child 13 | c0432d11811c |
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 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
22 |
#include <phonon/mediasource.h> |
3b1da2848fc7
Revision: 201003
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 |
||
36 |
namespace Phonon |
|
37 |
{ |
|
38 |
namespace MMF |
|
39 |
{ |
|
40 |
class AbstractPlayer; |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
41 |
class AbstractVideoOutput; |
0 | 42 |
|
43 |
/** |
|
44 |
* @short Facade class which wraps MMF client utility instance |
|
45 |
*/ |
|
46 |
class MediaObject : public MediaNode |
|
47 |
, public MediaObjectInterface |
|
48 |
{ |
|
49 |
Q_OBJECT |
|
50 |
Q_INTERFACES(Phonon::MediaObjectInterface) |
|
51 |
||
52 |
public: |
|
53 |
MediaObject(QObject *parent); |
|
54 |
virtual ~MediaObject(); |
|
55 |
||
56 |
// MediaObjectInterface |
|
57 |
virtual void play(); |
|
58 |
virtual void pause(); |
|
59 |
virtual void stop(); |
|
60 |
virtual void seek(qint64 milliseconds); |
|
61 |
virtual qint32 tickInterval() const; |
|
62 |
virtual void setTickInterval(qint32 interval); |
|
63 |
virtual bool hasVideo() const; |
|
64 |
virtual bool isSeekable() const; |
|
65 |
virtual qint64 currentTime() const; |
|
66 |
virtual Phonon::State state() const; |
|
67 |
virtual QString errorString() const; |
|
68 |
virtual Phonon::ErrorType errorType() const; |
|
69 |
virtual qint64 totalTime() const; |
|
70 |
virtual MediaSource source() const; |
|
71 |
virtual void setSource(const MediaSource &); |
|
72 |
virtual void setNextSource(const MediaSource &source); |
|
73 |
virtual qint32 prefinishMark() const; |
|
74 |
virtual void setPrefinishMark(qint32); |
|
75 |
virtual qint32 transitionTime() const; |
|
76 |
virtual void setTransitionTime(qint32); |
|
77 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
78 |
// MediaNode |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
79 |
void connectMediaObject(MediaObject *mediaObject); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
80 |
void disconnectMediaObject(MediaObject *mediaObject); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
81 |
|
0 | 82 |
/** |
83 |
* This class owns the AbstractPlayer, and will delete it upon |
|
84 |
* destruction. |
|
85 |
*/ |
|
86 |
AbstractPlayer *abstractPlayer() const; |
|
87 |
||
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
88 |
void setVideoOutput(AbstractVideoOutput* videoOutput); |
0 | 89 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
public Q_SLOTS: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
91 |
void volumeChanged(qreal volume); |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
92 |
void switchToNextSource(); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
93 |
|
0 | 94 |
Q_SIGNALS: |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
95 |
void abstractPlayerChanged(AbstractPlayer *player); |
0 | 96 |
void totalTimeChanged(qint64 length); |
97 |
void hasVideoChanged(bool hasVideo); |
|
98 |
void seekableChanged(bool seekable); |
|
99 |
void bufferStatus(int); |
|
100 |
void aboutToFinish(); |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
101 |
void prefinishMarkReached(qint32 remaining); |
0 | 102 |
// TODO: emit metaDataChanged from MediaObject |
103 |
void metaDataChanged(const QMultiMap<QString, QString>& metaData); |
|
104 |
void currentSourceChanged(const MediaSource& source); |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
105 |
void stateChanged(Phonon::State newState, |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
106 |
Phonon::State oldState); |
0 | 107 |
void finished(); |
108 |
void tick(qint64 time); |
|
109 |
||
110 |
private: |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
111 |
void switchToSource(const MediaSource &source); |
0 | 112 |
void createPlayer(const MediaSource &source); |
113 |
bool openRecognizer(); |
|
114 |
||
115 |
// Audio / video media type recognition |
|
116 |
MediaType fileMediaType(const QString& fileName); |
|
117 |
// TODO: urlMediaType function |
|
118 |
||
119 |
static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); |
|
120 |
||
121 |
private: |
|
122 |
||
123 |
// Audio / video media type recognition |
|
124 |
bool m_recognizerOpened; |
|
125 |
RApaLsSession m_recognizer; |
|
126 |
RFs m_fileServer; |
|
127 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
128 |
MediaSource m_source; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
129 |
MediaSource m_nextSource; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
130 |
bool m_nextSourceSet; |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
131 |
|
0 | 132 |
// Storing the file handle here to work around KErrInUse error |
133 |
// from MMF player utility OpenFileL functions |
|
134 |
RFile m_file; |
|
135 |
||
136 |
QScopedPointer<AbstractPlayer> m_player; |
|
137 |
||
138 |
}; |
|
139 |
} |
|
140 |
} |
|
141 |
||
142 |
QT_END_NAMESPACE |
|
143 |
||
144 |
#endif |