33
class MediaProducerInterface
34
* \short Backend interface for media source classes.
36
* Backend classes providing MediaObject, MediaQueue, ByteStream, AvCapture,
37
* etc. need to implement this interface.
39
* The backend implementation has to provide two signals, that are not defined
42
* <li>\anchor phonon_MediaProducerInterface_stateChanged
43
* <b>void stateChanged(\ref Phonon::State newstate, \ref Phonon::State oldstate)</b>
45
* Emitted when the state of the MediaObject has changed.
46
* In case you're not interested in the old state you can also
47
* connect to a slot that only has one State argument.
49
* \param newstate The state the Player is in now.
50
* \param oldstate The state the Player was in before.
52
* <li>\anchor phonon_MediaProducerInterface_tick
53
* <b>void tick(qint64 time)</b>
55
* This signal gets emitted every tickInterval milliseconds.
57
* \param time The position of the media file in milliseconds.
59
* \see setTickInterval()
64
* \author Matthias Kretz <kretz@kde.org>
65
* \see AbstractMediaProducer
67
class PHONONCORE_EXPORT MediaProducerInterface
36
virtual ~MediaProducerInterface() {}
38
virtual bool addAudioPath(QObject*) = 0;
39
virtual bool addVideoPath(QObject*) = 0;
40
virtual void removeAudioPath(QObject*) = 0;
41
virtual void removeVideoPath(QObject*) = 0;
43
virtual QStringList availableAudioStreams() const = 0;
44
virtual QStringList availableVideoStreams() const = 0;
45
virtual QStringList availableSubtitleStreams() const = 0;
47
virtual QString selectedAudioStream(const QObject*) const = 0;
48
virtual QString selectedVideoStream(const QObject*) const = 0;
49
virtual QString selectedSubtitleStream(const QObject*) const = 0;
51
virtual void selectAudioStream(const QString&,const QObject*) = 0;
52
virtual void selectVideoStream(const QString&,const QObject*) = 0;
53
virtual void selectSubtitleStream(const QString&,const QObject*) = 0;
55
virtual void play() = 0;
56
virtual void pause() = 0;
57
virtual void stop() = 0;
58
virtual void seek(qint64) = 0;
60
virtual qint32 tickInterval() const = 0;
61
virtual void setTickInterval(qint32) = 0;
63
virtual bool hasVideo() const = 0;
64
virtual bool isSeekable() const = 0;
65
virtual qint64 currentTime() const = 0;
66
virtual Phonon::State state() const = 0;
70
virtual ~MediaProducerInterface() {}
73
* Adds an AudioPath object to tell where to send the audio data.
75
* The frontend class ensures that the \p audioPath is unique,
76
* meaning the AudioPath object has not been added to this object.
78
virtual bool addAudioPath(QObject *audioPath) = 0;
80
* Adds a VideoPath object to tell where to send the video data (and
81
* render the subtitle if one is selected).
83
* The frontend class ensures that the \p videoPath is unique,
84
* meaning the VideoPath object has not been added to this object.
86
virtual bool addVideoPath(QObject *videoPath) = 0;
88
* Removes the AudioPath object from the flow graph. This function will
89
* only be called with a valid \p audioPath, meaning that the path has been
90
* added to this object before.
92
virtual void removeAudioPath(QObject *audioPath) = 0;
94
* Removes the VideoPath object from the flow graph. This function will
95
* only be called with a valid \p videoPath, meaning that the path has been
96
* added to this object before.
98
virtual void removeVideoPath(QObject *videoPath) = 0;
101
* Lists the available audio streams the media provides. The strings are
102
* what is shown to the user and often just consist of the stream name
103
* encoded into the media file.
105
* Be prepared to change the audio stream when \ref
106
* phonon_AbstractMediaProducer_selectAudioStream is called with one of the
107
* strings of this list. If the media has multiple audio streams but the
108
* backend cannot switch then the list of available audio streams should be
111
* \returns A list of names for the available audio streams.
113
virtual QStringList availableAudioStreams() const = 0;
115
* Lists the available video streams the media provides. The strings are
116
* what is shown to the user and often just consist of the stream name
117
* encoded into the media file.
119
* Be prepared to change the video stream when \ref
120
* phonon_AbstractMediaProducer_selectVideoStream is called with one of the
121
* strings of this list. If the media has multiple video streams but the
122
* backend cannot switch then the list of available video streams should be
125
* \returns A list of names for the available video streams.
127
virtual QStringList availableVideoStreams() const = 0;
129
* Lists the available subtitle streams the media provides. The strings are
130
* what is shown to the user and often just consist of the stream name
131
* encoded into the media file.
133
* Be prepared to change the subtitle stream when \ref
134
* phonon_AbstractMediaProducer_selectSubtitleStream is called with one of the
135
* strings of this list. If the media has multiple subtitle streams but the
136
* backend cannot switch then the list of available subtitle streams should be
139
* \returns A list of names for the available subtitle streams.
141
virtual QStringList availableSubtitleStreams() const = 0;
144
* Returns the selected audio stream for the given AudioPath object.
146
virtual QString selectedAudioStream(const QObject *audioPath) const = 0;
148
* Returns the selected video stream for the given VideoPath object.
150
virtual QString selectedVideoStream(const QObject *videoPath) const = 0;
152
* Returns the selected subtitle stream for the given VideoPath object.
154
virtual QString selectedSubtitleStream(const QObject *videoPath) const = 0;
157
* Selects one audio stream for the selected AudioPath object.
159
* \param audioPath If \p 0 the audio stream should be used for all
160
* connected AudioPath objects. Else the audio stream selection should only
161
* be made for the one specified AudioPath. This way the user can request
162
* different audio streams for different audio paths/outputs.
164
virtual void selectAudioStream(const QString &streamName,const QObject *audioPath) = 0;
166
* Selects one video stream for the selected VideoPath object.
168
* \param videoPath If \p 0 the video stream should be used for all
169
* connected VideoPath objects. Else the video stream selection should only
170
* be made for the one specified VideoPath. This way the user can request
171
* different video streams for different video paths/outputs.
173
virtual void selectVideoStream(const QString &streamName,const QObject *videoPath) = 0;
175
* Selects one subtitle stream for the selected VideoPath object. By
176
* default normally no subtitle is selected, but depending on the media
177
* this may be different.
179
* \param videoPath If \p 0 the video stream should be used for all
180
* connected VideoPath objects. Else the video stream selection should only
181
* be made for the one specified VideoPath. This way the user can request
182
* different video streams for different video paths/outputs.
184
virtual void selectSubtitleStream(const QString &streamName,const QObject *videoPath) = 0;
187
* Requests the playback to start.
189
* This method is only called if the state transition to \ref PlayingState is possible.
191
* The backend should react immediately
192
* by either going into \ref PlayingState or \ref BufferingState if the
193
* former is not possible.
195
virtual void play() = 0;
198
* Requests the playback to pause.
200
* This method is only called if the state transition to \ref PausedState is possible.
202
* The backend should react as fast as possible. Go to \ref PausedState
203
* as soon as playback is paused.
205
virtual void pause() = 0;
208
* Requests the playback to be stopped.
210
* This method is only called if the state transition to \ref StoppedState is possible.
212
* The backend should react as fast as possible. Go to \ref StoppedState
213
* as soon as playback is stopped.
215
* A subsequent call to play() will start playback at the beginning of
218
virtual void stop() = 0;
221
* Requests the playback to be seeked to the given time.
223
* The backend does not have to finish seeking while in this function
224
* (i.e. the backend does not need to block the thread until the seek is
225
* finished; even worse it might lead to deadlocks when using a
226
* ByteStream which gets its data from the thread this function would
229
* As soon as the seek is done the currentTime() function and
230
* the tick() signal will report it.
232
* \param milliseconds The time where playback should seek to in
235
virtual void seek(qint64 milliseconds) = 0;
238
* Return the time interval in milliseconds between two ticks.
240
* \returns Returns the tick interval that it was set to (might not
241
* be the same as you asked for).
243
virtual qint32 tickInterval() const = 0;
245
* Change the interval the tick signal is emitted. If you set \p
246
* interval to 0 the signal gets disabled.
248
* \param interval tick interval in milliseconds
250
* \returns Returns the tick interval that it was set to (might not
251
* be the same as you asked for).
253
virtual void setTickInterval(qint32 interval) = 0;
256
* Check whether the media data includes a video stream.
258
* \return returns \p true if the media contains video data
260
virtual bool hasVideo() const = 0;
262
* If the current media may be seeked returns true.
264
* \returns whether the current media may be seeked.
266
virtual bool isSeekable() const = 0;
268
* Get the current time (in milliseconds) of the file currently being played.
270
virtual qint64 currentTime() const = 0;
272
* Get the current state.
274
virtual Phonon::State state() const = 0;
277
* A translated string describing the error.
279
virtual QString errorString() const = 0;
282
* Tells your program what to do about the error.
284
* \see Phonon::ErrorType
286
virtual Phonon::ErrorType errorType() const = 0;
69
289
} // namespace Phonon
71
Q_DECLARE_INTERFACE( Phonon::MediaProducerInterface, "org.kde.Phonon.MediaProducerInterface/0.1" )
291
Q_DECLARE_INTERFACE( Phonon::MediaProducerInterface, "org.kde.Phonon.MediaProducerInterface/0.2" )
73
293
#endif // PHONON_MEDIAPRODUCERINTERFACE_H
74
// vim: sw=4 ts=4 noet tw=80
294
// vim: sw=4 ts=4 tw=80