[gst-devel] Bonobo component

Owen Fraser-Green owen at discobabe.net
Sat Mar 3 03:24:56 CET 2001


Hi,

I've been thinking a bit more about the posibility of moving gstreamer
into a component. I think, while I would offer the maximum flexibility,
it definately wouldn't offer the best (or even adequate) performance to
move each gst core object into it's own bonobo component. I think it
would be more practical to write one bonobo component (with classes
which reflect many of the core types) which the programmer instructs to
create elements, connect pads etc. Then the actual stream flows inside
this component and doesn't ever cross the CORBA boundry.

I don't think it would make sense, for instance, to implement
gst_bin_iterate as this would mean stepping throug many layers in and
out of the component upon each iteration. Rather, it seems more sensible
to instruct this gstreamer super object to do all the work for us. As I
see it, this gstreamer object would offer the means to create
pipelines/bins, connect pads etc. but not to actually create elements. I
think this functionality is better kept in the native libraries.

To use the well-worn embedded spreadsheet as an analogy, one would like
to be able to take the spreadsheet object and embed it in an application
then envoke the spreadsheet's methods on it's cells, maybe instruct it
draw a graph or two. However, if one wanted to extend the functionality
of the spreadsheet itself by enabling it to draw different kinds of
graphs then one would start fidling with the spreadsheet program
directly. I think this it is part of the concept of bonobo objects that
they are off-the-shelf components ready to use in some higher-level
application.

To help visualise what I imagine this object would do I've taken the
various helloworld examples from the documentation and rewritten them in
a VB-like syntax which I hope should be self-explanitory. As you can
see, each example begins with the creation of a "gst" object and
sub-classes within that object are used to build the bins. Then, the
final bin structure's "play" method is invoked which would run the
while... gst_bin_iterate loop. The mechanism for terminating this loop I
havn't quite decided. Also note that since methods are inherited by the
subclasses, methods such as "add" are invoked directly rather than bin's
"add" operating on a casted object.

What do you think? If you all agree this would be a suitable way of
implementing it I'd like to go ahead with doing so.

Examples:

1) helloworld:

gst = new Gst
bin = gst.bin.new("bin")

disksrc = gst.elementFactory.make("disksrc", "disk_source")
parse = gst.elementFactory.make("mp3parse", "parse")
decoder = gst.elementFactory.make("mpg123", "decoder")
audiosink = gst.elementFactory.make("audiosink", "play_audio")

bin.add(disksrc)
bin.add(parse)
bin.add(decoder)
bin.add(audiosink)

gst.padConnect(disksrc.getPad("src"), parse.getPad("sink"))
gst.padConnect(parse.getPad("src"), decoder.getPad("sink"))
gst.padConnect(decoder.getPad("src"), audiosink.getPad("sink"))

bin.play

---
2) Autoplugging helloworld:

gst = new Gst
pipeline = gst.pipeline.new("pipeline")

disksrc = gst.elementFactory.make("disksrc", "disk_source")
audiosink = gst.elementFactory.make("audiosink", "play_audio")

pipeline.addSrc(disksrc)
pipeline.addSink(audiosink)

if (!pipeline.autoplug) 
   print "Unable to handle stream"
   exit
endif

pipeline.play

---
3) helloworld-threads:

gst = new Gst
thread = gst.thread.new("thread")
pipeline = gst.pipeline.new("pipeline")

disksrc = gst.elementFactory.make("disksrc", "disk_source")
audiosink = gst.elementFactory.make("audiosink", "play_audio")

pipeline.add(disksrc)
pipeline.add(audiosink)

pipeline.autoplug(pipeline)

pipeline.remove(discksrc)

thread.add(disksrc)
thread.add(pipeline)

thread.play

---
4) helloworld-queues:

gst = new Gst
thread = gst.thread.new("thread")
bin = gst.bin.new("bin")

disksrc = gst.elementFactory.make("disksrc", "disk_source")
queue = gst.elementFactory.make("queue", "queue")

audiosink = gst.elementFactory.make("audiosink", "play_audio")

parse = gst.elementFactory.make("mp3parse", "parse")
decode = gst.elementFactory.make("mpg123", "decode")

bin.add(disksrc)
bin.add(queue)

thread.add(parse)
thread.add(decode)
thread.add(audiosink)

gst.padConnect(disksrc.getPad("src"), queue.getPad("sink"))
gst.padConnect(queue.getPad("src"), parse.getPad("sink")
gst.padConnect(parse.getPad("src"), decoder.getPad("sink"))
gst.padConnect(decoder.getPad("src"), audiosink.getPad("sink"))

bin.add(thread)

bin.setReady
bin.play

Regards,
Owen

---------------------------------------------------------------------------
Owen  Fraser-Green             "Hard work never killed anyone,
owen at discobabe.net              but why give it a chance?"
---------------------------------------------------------------------------





More information about the gstreamer-devel mailing list