1
/* This file is part of the KDE project.
3
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
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.
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.
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/>.
18
#ifndef Phonon_QT7_MEDIAOBJECT_H
19
#define Phonon_QT7_MEDIAOBJECT_H
21
#include <QtCore/QStringList>
22
#include <QtCore/QTime>
23
#include <phonon/mediaobjectinterface.h>
24
#include <phonon/addoninterface.h>
26
#include "medianode.h"
34
class QuickTimeVideoPlayer;
35
class QuickTimeAudioPlayer;
36
class QuickTimeMetaData;
38
class MediaObjectAudioNode;
40
class MediaObject : public MediaNode,
41
public Phonon::MediaObjectInterface, public Phonon::AddonInterface
44
Q_INTERFACES(Phonon::MediaObjectInterface Phonon::AddonInterface)
47
MediaObject(QObject *parent);
50
QStringList availableAudioStreams() const;
51
QStringList availableVideoStreams() const;
52
QStringList availableSubtitleStreams() const;
53
QString currentAudioStream(const QObject *audioPath) const;
54
QString currentVideoStream(const QObject *videoPath) const;
55
QString currentSubtitleStream(const QObject *videoPath) const;
57
void setCurrentAudioStream(const QString &streamName,const QObject *audioPath);
58
void setCurrentVideoStream(const QString &streamName,const QObject *videoPath);
59
void setCurrentSubtitleStream(const QString &streamName,const QObject *videoPath);
64
void seek(qint64 milliseconds);
66
qint32 tickInterval() const;
67
void setTickInterval(qint32 interval);
68
bool hasVideo() const;
69
bool isSeekable() const;
70
qint64 currentTime() const;
71
Phonon::State state() const;
73
QString errorString() const;
74
Phonon::ErrorType errorType() const;
76
qint64 totalTime() const;
77
MediaSource source() const;
78
void setSource(const MediaSource &);
79
void setNextSource(const MediaSource &source);
80
qint32 prefinishMark() const;
81
void setPrefinishMark(qint32);
82
qint32 transitionTime() const;
83
void setTransitionTime(qint32);
84
bool hasInterface(Interface interface) const;
85
QVariant interfaceCall(Interface interface, int command, const QList<QVariant> &arguments = QList<QVariant>());
87
QuickTimeVideoPlayer* videoPlayer() const;
88
QuickTimeAudioPlayer* audioPlayer() const;
90
void setVolumeOnMovie(float volume);
91
bool setAudioDeviceOnMovie(int id);
93
int videoOutputCount();
96
void stateChanged(Phonon::State,Phonon::State);
98
void seekableChanged(bool);
99
void hasVideoChanged(bool);
100
void bufferStatus(int);
102
void aboutToFinish();
103
void prefinishMarkReached(qint32);
104
void totalTimeChanged(qint64);
105
void metaDataChanged(QMultiMap<QString,QString>);
106
void currentSourceChanged(const MediaSource &newSource);
109
void mediaNodeEvent(const MediaNodeEvent *event);
110
bool event(QEvent *event);
113
enum AudioSystem {AS_Unset, AS_Video, AS_Graph, AS_Silent} m_audioSystem;
114
Phonon::State m_state;
116
QuickTimeVideoPlayer *m_videoPlayer;
117
QuickTimeAudioPlayer *m_audioPlayer;
118
QuickTimeVideoPlayer *m_nextVideoPlayer;
119
QuickTimeAudioPlayer *m_nextAudioPlayer;
120
MediaObjectAudioNode *m_mediaObjectAudioNode;
121
QuickTimeMetaData *m_metaData;
123
qint32 m_tickInterval;
124
qint32 m_transitionTime;
125
quint32 m_prefinishMark;
126
quint32 m_currentTime;
127
float m_percentageLoaded;
137
void synchAudioVideo();
138
void updateCurrentTime();
139
void swapCurrentWithNext(qint32 transitionTime);
140
bool setState(Phonon::State state);
141
void pause_internal();
142
void play_internal();
143
void setupAudioSystem();
144
void updateTimer(int &timer, int interval);
145
void bufferAudioVideo();
146
void updateRapidly();
147
void updateCrossFade();
148
void updateAudioBuffers();
149
void updateLipSynch(int allowedOffset);
150
void updateVideoFrames();
151
void updateBufferStatus();
152
void setMute(bool mute);
153
void inspectAudioGraphRecursive(AudioConnection *connection, int &effectCount, int &outputCount);
154
void inspectVideoGraphRecursive(MediaNode *node, int &effectCount, int &outputCount);
156
bool isCrossFading();
158
QString m_errorString;
159
Phonon::ErrorType m_errorType;
160
bool checkForError();
162
int m_audioEffectCount;
163
int m_audioOutputCount;
164
int m_videoEffectCount;
165
int m_videoOutputCount;
168
}} //namespace Phonon::QT7
171
#endif // Phonon_QT7_MEDIAOBJECT_H