Prblm: creating Kaffeine's KMediaPart from own application.

Ola Theander ola.theander at otsystem.com
Tue Nov 15 02:09:51 GMT 2005


Dear subscribers

I'm working on an application where I need video playback and I've been
looking at both KMPlayer and Kaffeine. The application will fetch video data
(digital video, DV) directly from the Firewire port (IEEE 1394) and for that
purpose I will use GStreamer, so I would prefer if the video player
application can handle the GStreamer backend.

I've managed to instantiate KMPlayer's KPart named KMediaPlayer without any
particular problems. The reason why I also looked at Kaffeine is that
KMPlayer's widgets for controlling the playback (e.g. play, pause, etc.) is
too tiny for my use. My application will be controlled by a touch screen and
these widgets are far too small. The advantage with Kaffeine's KPart, named
KMediaPart is that it doesn't include any controller widgets, it's just a
video playback "area" and no other stuff. Exactly what I want, i.e. I want
to use my own widgets to control the playback.

Unfortunately I have some problems with the Kaffeine KPart. I can
instantiate it using the following few lines of code:

QVBox * vbox = new QVBox ( this );
KService::Ptr service = KService::serviceByDesktopName("gstreamer_part");
KLibFactory *factory = KLibLoader::self()->factory( service->library() );
part = static_cast<KMediaPart *>( factory->create( vbox, 0, "KMediaPart" )
); 

The part variable seems to be OK, i.e. it contains a value and I can call
some of it's methods, e.g. part->isPlaying(). The problem is that when I try
to set an URL, using part->openURL(), for it to play I get a segmentation
fault. I haven't managed to solve this problem so far and I hope that maybe
I can get some help with this, maybe even provide me with some sample code
on how to instantiate, load a move and play it using the Kaffeine KPart. 

The complete code block is provided below, followed by the output of a test
run:

Any help on this matter would be greatly appreciated.

Kind regards, Ola Theander

---------------------
QVBox * vbox = new QVBox ( this );

KMediaPart *part;

KService::Ptr service = KService::serviceByDesktopName("gstreamer_part");

kdDebug() << "Service name: " << service->name() << endl;
kdDebug() << "Service type: " << service->type() << endl;
kdDebug() << "Service library: " << service->library() << endl;
kdDebug() << "Service comment: " << service->comment() << endl;
kdDebug() << "Service types: " << service->serviceTypes() << endl;

KLibFactory *factory = KLibLoader::self()->factory( service->library() );
part = static_cast<KMediaPart *>( factory->create( vbox, 0, "KMediaPart" )
);

kdDebug() << "part: " << part << endl;

KURL kurl;
kurl.setPath("/root/dvgrab-001.avi");

kdDebug() << "isPlaying(): " << part->isPlaying() << endl;
part->openURL(kurl);	<--- Here is where the seg. fault occurs.
part->play();
	
setCentralWidget( vbox );
------------------

Test run output:

p3: Service name: GStreamerPart
p3: Service type: Service
p3: Service library: libgstreamerpart
p3: Service comment: A player part based on GStreamer.
p3: Service types:
(KParts/ReadOnlyPart,KMediaPart,application/x-ogg,audio/x-mp3,audio/x-mpeg,a
udio/x-ogg,audio/x-wav,audio/x-flac,video/x-matroska,audio/x-matroska,video/
mpeg,video/x-avi,application/x-kaffeine)
p3: part: 0x820af68
p3: isPlaying(): false
Segmentation fault

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<




More information about the kde-multimedia mailing list