about MediaSource::Empty

Luc Menut Luc.Menut at supagro.inra.fr
Mon Oct 12 01:25:29 CEST 2009


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/classPhonon_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

-- 
Luc Menut


More information about the Phonon-backends mailing list