Phonon: how to know
Tanguy Krotoff
tkrotoff at gmail.com
Thu Apr 10 19:23:06 BST 2008
I just found it :p
class Backend {
bool connectNodes(QObject * source, QObject * sink);
bool disconnectNodes(QObject * source, QObject * sink);
}
There are some stuffs that I still don't understand about Phonon :/
I checked Xine backend source code about connection between MediaNode,
I don't get it, the code seems to be very generic.
For the moment I do this:
bool Backend::connectNodes(QObject * source, QObject * sink) {
qDebug() << __FUNCTION__ << source->metaObject()->className() << ""
<< sink->metaObject()->className();
//Example:
//source = Phonon::VLC_MPlayer::MediaObject (inherits Phonon::MediaNode)
//sink = Phonon::VLC_MPlayer::VideoWidget (inherits Phonon::MediaNode)
VideoWidget * videoWidget = qobject_cast<VideoWidget *>(sink);
if (videoWidget) {
//We have a VideoWidget
MediaObject * mediaObject = qobject_cast<MediaObject *>(source);
if (mediaObject) {
//Connects the VideoWidget to a MediaObject
videoWidget->connectToMediaObject(mediaObject);
return true;
}
}
//Example:
//source = Phonon::VLC_MPlayer::MediaObject (inherits Phonon::MediaNode)
//sink = Phonon::VLC_MPlayer::AudioOutput (inherits Phonon::MediaNode)
AudioOutput * audioOutput = qobject_cast<AudioOutput *>(sink);
else if (audioOutput) {
//We have a AudioOutput
MediaObject * mediaObject = qobject_cast<MediaObject *>(source);
if (mediaObject) {
//Connects the AudioOutput to a MediaObject
audioOutput->connectToMediaObject(mediaObject);
return true;
}
}
qWarning() << __FUNCTION__ << "Connection not supported";
return false;
}
I guess it is not the right way to do it, I will improve it and make
it more generic as I understand better how works Phonon.
Where can I find some tests examples (i.e some unit test that uses
QTest or something)?
For now I've coded my own GUI examples:
http://code.google.com/p/phonon-vlc-mplayer/source/browse/trunk/tests/
These tests examples only depend on Qt-4.4 as I want my Phonon
backends to be able to work with simple Qt apps + I want to test my
code under Windows and it is easier to test it without depending on
KDE.
On Thu, Apr 10, 2008 at 6:51 PM, Ian Monroe <ian at monroe.nu> wrote:
>
> On 4/10/08, Tanguy Krotoff <tkrotoff at gmail.com> wrote:
> > Hi everybody
> >
> > Still coding on VLC & MPlayer backends...
> >
> > Here is a question:
> > A MediaObject can be linked with a VideoWidget via Path.
> > Inside my backend implementation, I would like to retrieve the
> > VideoWidget associated with the MediaObject, how can I do that?
> >
> > Explanation:
> > I want to access the right VideoWidget from MediaObject since I need
> > VideoWidget Window ID inside MediaObject::play() (as VLC & MPlayer
> > need it to render the video).
> >
> > Currently I'm relying on a simple static variable containing the
> > Window ID of the last VideoWidget created and this approach leads to
> > some bugs.
> >
> > Thx
>
> I've only done a tiny bit of backend stuff, so I'm no expert. But
> initutively this sounds like something the backend needs to keep track
> of.
>
> Ian
> _______________________________________________
> kde-multimedia mailing list
> kde-multimedia at kde.org
> https://mail.kde.org/mailman/listinfo/kde-multimedia
>
--
Tanguy Krotoff <tkrotoff at gmail.com>
+33 6 68 42 70 24
More information about the kde-multimedia
mailing list