KMediaPlayer/Engine segv

Thomas Kliethermes thamus at kc.rr.com
Tue Apr 1 06:00:36 BST 2003


Hi all,

  I've googled around with this for a while now but I can't seem to find out what I'm 
doing wrong.  I'm on Suse 8.1 updated with KDE 3.1 and gcc 3.2.

The following code:

   KMediaPlayer::Player * part;
...
   KTrader::OfferList offers = KTrader::self()->query( "KMediaPlayer/Player" );
   const KService::Ptr service = *offers.begin();
   KLibFactory *factory = KLibLoader::self()->factory( service->library() );
   part = static_cast<KMediaPlayer::Player *>( factory->create( this, 0, "KMediaPlayer/Player" ) );
...
   ((KMediaPlayer::PlayerDCOPObject *)part)->openURL( p_url );
   part->play();

works fine, but it's not quite what I want (I don't want a GUI).  So I change the factory->create 
line to:

   part = static_cast<KMediaPlayer::Player *>( factory->create( this, 0, "KMediaPlayer/Engine" ) );

I do seem to get a valid KMediaPlayer::Player part, but then I get a sigsegv on the openURL() .  

I've traced it back through the kaboodle source and I think it's because the openURL() 
implementation tries to access stopAction, playAction, and pauseAction which aren't initialized 
because we called the alternate non-gui constructor.  play(), pause(), stop(), etc access these 
also.

So, my question is: am I using it incorrectly, are my expectations of the service incorrect, 
is the non-gui Player broken, or some other option I haven't thought of?

I've looked around for an example of using KMediaPlayer/Engine, but no dice there either.
Any pointers?

Sorry if my error is blindingly obvious to all but me...

Thanks in advance,
-Tom



More information about the kde-multimedia mailing list