GStreamer wrappers for KDE/Qt

Tim Jansen ml at tjansen.de
Sat Aug 17 17:46:24 BST 2002


Hi..

At the last KDE multimedia/arts meeting, the (few) participating people agreed 
to split the next-generation multimedia system into three parts: 
1. a sound server
2. a multimedia framework
3. something for music creation/synthesis
Here is my contender for number 2. 

I have written wrappers for GStreamer (http://gstreamer.net). Most classes and 
functions have been translated 1:1 to C++/Qt. This should be almost 
everything that you need to write GStreamer applications with a Qt'ish 
feeling. You can find the code in KDE CVS, kdenonbeta/gst 
(http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdenonbeta/gst). To get a first 
impression of the API, see the short example at the end of the mail. You can 
find more complete examples, including a gui-based video player, in the 
repository.

What's still missing?
- support for dynamic parameters
- testing, most wrapper functions have not been tested yet (I don't expect 
many bugs though, most implementations have 1-2 lines)
- please note that GStreamer itself is not mature yet

What's next?
- backend-independent KPlayObject and KVideoWidget-equivalents to allow easy 
porting of existing apps and to allow developers to use audio/video without  
GStreamer knowledge
- KIO-based source and sink elements for a better integration with KDE-apps


- snip! ----- Example --------------------------------------------------------
/* Play mp3, function blocks until finished, all error handling removed */
void playMp3(const QString &file) { 
	Pipeline *bin;
	Element *filesrc, *decoder, *osssink;
	
	/* create a pipeline to hold the elements */
	bin = new Pipeline();
	
	/* create a disk reader */
	filesrc = ElementFactory::make("filesrc");
	filesrc->setString("location", file);
	
	/* get the mp3 decoder */
	decoder = ElementFactory::make("mad");

	/* and an audio sink (OSS based) */
	osssink = ElementFactory::make("osssink");
	
	/* add objects to the pipeline */
	bin->add(filesrc, decoder, osssink);
	
	/* connect the elements in the pipeline*/
	filesrc->connect(decoder)
	decoder->(osssink);
	
	/* start playing */
	bin->setState(Element::STATE_PLAYING);
	while (bin->iterate());
	
	/* stop the bin and delete it */
	bin->setState(Element::STATE_NULL);
	delete bin;
}


bye...



More information about the kde-multimedia mailing list