author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 02 Feb 2010 00:43:10 +0200 | |
changeset 3 | 41300fa6a67c |
parent 0 | 1918ee327afb |
child 4 | 3b1da2848fc7 |
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 |
||
22 |
#include <Phonon/MediaSource> |
|
23 |
#include <Phonon/MediaObjectInterface> |
|
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; |
|
41 |
class VideoOutput; |
|
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 |
||
78 |
/** |
|
79 |
* This class owns the AbstractPlayer, and will delete it upon |
|
80 |
* destruction. |
|
81 |
*/ |
|
82 |
AbstractPlayer *abstractPlayer() const; |
|
83 |
||
84 |
void setVideoOutput(VideoOutput* videoOutput); |
|
85 |
||
86 |
virtual bool activateOnMediaObject(MediaObject *); |
|
87 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
public Q_SLOTS: |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
void volumeChanged(qreal volume); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
|
0 | 91 |
Q_SIGNALS: |
92 |
void totalTimeChanged(qint64 length); |
|
93 |
void hasVideoChanged(bool hasVideo); |
|
94 |
void seekableChanged(bool seekable); |
|
95 |
// TODO: emit bufferStatus from MediaObject |
|
96 |
void bufferStatus(int); |
|
97 |
// TODO: emit aboutToFinish from MediaObject |
|
98 |
void aboutToFinish(); |
|
99 |
// TODO: emit prefinishMarkReached from MediaObject |
|
100 |
void prefinishMarkReached(qint32); |
|
101 |
// TODO: emit metaDataChanged from MediaObject |
|
102 |
void metaDataChanged(const QMultiMap<QString, QString>& metaData); |
|
103 |
void currentSourceChanged(const MediaSource& source); |
|
104 |
void stateChanged(Phonon::State oldState, |
|
105 |
Phonon::State newState); |
|
106 |
void finished(); |
|
107 |
void tick(qint64 time); |
|
108 |
||
109 |
private: |
|
110 |
void createPlayer(const MediaSource &source); |
|
111 |
bool openRecognizer(); |
|
112 |
||
113 |
// Audio / video media type recognition |
|
114 |
MediaType fileMediaType(const QString& fileName); |
|
115 |
// TODO: urlMediaType function |
|
116 |
||
117 |
static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); |
|
118 |
||
119 |
private: |
|
120 |
||
121 |
// Audio / video media type recognition |
|
122 |
bool m_recognizerOpened; |
|
123 |
RApaLsSession m_recognizer; |
|
124 |
RFs m_fileServer; |
|
125 |
||
126 |
// Storing the file handle here to work around KErrInUse error |
|
127 |
// from MMF player utility OpenFileL functions |
|
128 |
RFile m_file; |
|
129 |
||
130 |
QScopedPointer<AbstractPlayer> m_player; |
|
131 |
||
132 |
}; |
|
133 |
} |
|
134 |
} |
|
135 |
||
136 |
QT_END_NAMESPACE |
|
137 |
||
138 |
#endif |