Using gst-python with multiple pipelines

Gary Thomas gary at
Thu Mar 22 03:39:13 PDT 2012

On 2012-03-22 04:20, Tim-Philipp Müller wrote:
> Hi,
>> Not sure I understand the question.  I'm adapting some code I found
>> on the web which uses gst pipelines + wxPython (which was adapted from
>> the wxGTK version).
>> I create the pipeline like this
>>           self.player = gst.element_factory_make("playbin", "player")
>>           self.playing = False
>>           bus = self.player.get_bus()
>>           bus.add_signal_watch()
>>           bus.enable_sync_message_emission()
>>           bus.connect('message', self.on_message, colour)
>>           bus.connect('sync-message::element', self.on_sync_message, colour)
>> within the code that creates the pane.  Then I initiate the pipeline with
>>           self.player.set_property('uri',"file://" + path)
>>           self.player.set_state(gst.STATE_PLAYING)
>>           self.playing = True
>> I'm happy to share my actual code if that helps - it's currently just
>> a sandbox for ideas anyway.
> Yes, a small example that demonstrates the issue would definitely be
> useful.

Should I send it to this list or you directly?  Currently it's very
raw and around 200 lines.

> What I was trying to find out was if you are using (for example)
> ximagesink, or perhaps some other video sink or perhaps appsinks.

I'm just using the simple 'playbin'

> X11/Gtk doesn't do multi-threading well, so one must take care not to do
> anything X11/Gtk related from GStreamer streaming threads (like a sync
> message handler).

Here's my sync_message handler:
     def on_sync_message(self, bus, message, data):
         print "on_sync_message: " + data
         if message.structure is None:
         message_name = message.structure.get_name()
         if message_name == 'prepare-xwindow-id':
             imagesink = message.src
             imagesink.set_property('force-aspect-ratio', True)

I tried moving the GetHandle() call which is the only X11 function
I can see out of the sync handler and it didn't change the behaviour.

Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world

More information about the gstreamer-devel mailing list