about MediaSource::Empty
Matthias Kretz
kretz at kde.org
Sun Nov 8 13:25:27 CET 2009
Hi all,
sorry for not looking at this earlier.
Anyway as you figured out already MediaSource::Empty is required to allow
applications to tell Phonon more about the state of things. I.e. if a
MediaObject has a file/URL set it is required to react as fast as possible on
a call to play(). Therefore this is not the best state to leave an inactive
MediaObject in, and that's where Empty got introduced. It allows to unset the
file/URL.
Now when that happens - the unsetting - MediaObject should go into the same
state as it is in when you construct it and have not called any other
functions on it. Which should be LoadingState. Any backend that does something
else has to be fixed to go to LoadingState (and it seems even xine does that
wrong): http://api.kde.org/kdesupport-api/kdesupport-
apidocs/phonon/html/namespacePhonon.html#a506d3735ede59def9354fedfc4026db7
says StoppedState == "The Player has a valid media file loaded and is ready
for playing." (which is even more valid for PausedState).
IIUC you fixed the issue by allowing stop to be called with Empty and call
stop from the knotify4 code, right?
Instead all backends should be fixed to understand MediaSource::Empty to clean
up and go into the initial LoadingState.
Regards,
Matthias
On Monday 12 October 2009 01:25:29 Luc Menut wrote:
> Hello everyone,
>
> Currently, I'm trying to fix some bugs we have in Mandriva with
> phonon-gstreamer.
> bug 49814 involves knotify/NotifyBySound and phonon.
> https://qa.mandriva.com/show_bug.cgi?id=49814#c32 & c37
> so I have some questions about MediaSource::Empty.
>
> The type MediaSource::Empty was added last year in phonon with
> http://websvn.kde.org/?view=revision&revision=889769
> http://websvn.kde.org/?view=revision&revision=889770
> after some discussions on this list
> http://mail.kde.org/pipermail/phonon-backends/2008-November/000240.html
>
> Sadly, it seems to me that various backends don't do the same thing with
> MediaSource::Empty.
> After a quick look at the code (but I can have misread or misunderstood
> some parts).
> xine -> stop the mediaobject & unload the xine stream
> gstreamer -> pause the mediaobject
> qt7 -> pause the mediaobject
> ds9 -> ? fails ?
> MediaSource::Empty seems used mainly by phonon-xine to unload the xine
> stream.
>
> I found some information on MediaSource::Empty here
> http://api.kde.org/kdesupport-api/kdesupport-apidocs/phonon/html/classPhono
> n_1_1MediaSource.html but is there some documentation or api that says more
> precisely what the backend should do with MediaSource::Empty?
>
> In the qt4's api http://doc.trolltech.com/4.5/phonon-mediaobject.html, I
> found
> "When playback is finishing, i.e., when a media source has been played
> to the end and the queue is empty, several signals are emitted. First,
> the media object will emit aboutToFinish() - shortly before the playback
> has finished - and then finished(). The stateChanged() signal will also
> be emitted with PausedState, which is the state the media object takes
> when the playback is finished. If you wish to enter another state, you
> can connect a slot to finished() and set a new state there."
> The new state is often StoppedState.
> but with r889769, applications can't stop the mediaobject if it has an
> empty mediasource.
> 93 static inline bool isPlayable(const MediaSource::Type t)
> 94 {
> 95 return t != MediaSource::Invalid && t != MediaSource::Empty;
> 96 }
> <...>
> 114 void MediaObject::stop()
> 115 {
> 116 K_D(MediaObject);
> 117 if (d->backendObject() && isPlayable(d->mediaSource.type())) {
> 118 INTERFACE_CALL(stop());
> 119 }
> 120 }
> It seems to me that it is a regression.
> Couldn't we remove this restriction for MediaObject::stop(), allowing to
> stop mediaobject with any valid source including empty source?
>
> regards,
>
> Luc
>
Regards,
Matthias
--
________________________________________________________
Matthias Kretz (Germany) <><
http://Vir.homelinux.org/
More information about the Phonon-backends
mailing list