Using gst-python with multiple pipelines

Gary Thomas gary at mlbassoc.com
Wed Mar 21 16:51:23 PDT 2012


On 2012-03-21 17:00, Tim-Philipp Müller wrote:
> On Wed, 2012-03-21 at 16:39 -0600, Gary Thomas wrote:
>
>> I'm trying to build a Python (GUI) application which will need
>> multiple gstreamer pipelines active simultaneously.  I'm using
>> wxPython as the basis for my GUI.  Currently, I have a window
>> which has multiple (4) sub-panes.  If I try to create a pipeline
>> for each of those panes, sometimes it works, more often it fails,
>> typically with glib or free() errors which tells me this is a
>> multi-thread-safe problem.
>>
>> Is this the right place to get help for my issue?
>> Is there something special, wrt threads, that I need to do to
>> make my application safe?
>
> So you're displaying 4 videos from 4 pipelines in that window, one per
> pane?

Let's make sure we agree on terminology
   window = Top level X window (the kind of thing that can be minimized, etc)
   pane = a writeable subsurface within the window (which has a unique ID)

If we agree, then yes, that's what I want to do.  I've found that if I start
the videos separately, i.e. in "human" time by selecting and clicking, then
everything works well.  It only fails if I try to create the pipelines all
at once whilst creating the basic window+panes.

> What do you use as video sink(s)?

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.

Thanks for your help

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


More information about the gstreamer-devel mailing list