mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
examples: Make xoverlay installation thread safe using the GDK lock.
We can't call into the GDK functions in our sync-message handler without taking the GDK lock, so do so. Partially fixes #581737
This commit is contained in:
parent
873d51b345
commit
7743f1ad1e
4 changed files with 13 additions and 0 deletions
|
@ -8,12 +8,14 @@ pygtk.require('2.0')
|
|||
import sys
|
||||
|
||||
import gobject
|
||||
gobject.threads_init()
|
||||
|
||||
import pygst
|
||||
pygst.require('0.10')
|
||||
import gst
|
||||
import gst.interfaces
|
||||
import gtk
|
||||
gtk.gdk.threads_init()
|
||||
|
||||
class GstPlayer:
|
||||
def __init__(self, videowidget):
|
||||
|
@ -33,9 +35,11 @@ class GstPlayer:
|
|||
return
|
||||
if message.structure.get_name() == 'prepare-xwindow-id':
|
||||
# Sync with the X server before giving the X-id to the sink
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.gdk.display_get_default().sync()
|
||||
self.videowidget.set_sink(message.src)
|
||||
message.src.set_property('force-aspect-ratio', True)
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
def on_message(self, bus, message):
|
||||
t = message.type
|
||||
|
|
|
@ -15,6 +15,7 @@ pygst.require('0.10')
|
|||
import gst
|
||||
import gst.interfaces
|
||||
import gtk
|
||||
gtk.gdk.threads_init()
|
||||
|
||||
class GstPlayer:
|
||||
def __init__(self, videowidget):
|
||||
|
@ -33,9 +34,11 @@ class GstPlayer:
|
|||
return
|
||||
if message.structure.get_name() == 'prepare-xwindow-id':
|
||||
# Sync with the X server before giving the X-id to the sink
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.gdk.display_get_default().sync()
|
||||
self.videowidget.set_sink(message.src)
|
||||
message.src.set_property('force-aspect-ratio', True)
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
def on_message(self, bus, message):
|
||||
t = message.type
|
||||
|
|
|
@ -15,6 +15,7 @@ pygst.require('0.10')
|
|||
import gst
|
||||
import gst.interfaces
|
||||
import gtk
|
||||
gtk.gdk.threads_init()
|
||||
|
||||
class SwitchTest:
|
||||
def __init__(self, videowidget):
|
||||
|
@ -36,9 +37,11 @@ class SwitchTest:
|
|||
return
|
||||
if message.structure.get_name() == 'prepare-xwindow-id':
|
||||
# Sync with the X server before giving the X-id to the sink
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.gdk.display_get_default().sync()
|
||||
self.videowidget.set_sink(message.src)
|
||||
message.src.set_property('force-aspect-ratio', True)
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
def on_message(self, bus, message):
|
||||
t = message.type
|
||||
|
|
|
@ -15,6 +15,7 @@ pygst.require('0.10')
|
|||
import gst
|
||||
import gst.interfaces
|
||||
import gtk
|
||||
gtk.gdk.threads_init()
|
||||
|
||||
class GstPlayer:
|
||||
def __init__(self, videowidget):
|
||||
|
@ -33,9 +34,11 @@ class GstPlayer:
|
|||
return
|
||||
if message.structure.get_name() == 'prepare-xwindow-id':
|
||||
# Sync with the X server before giving the X-id to the sink
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.gdk.display_get_default().sync()
|
||||
self.videowidget.set_sink(message.src)
|
||||
message.src.set_property('force-aspect-ratio', True)
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
def on_message(self, bus, message):
|
||||
t = message.type
|
||||
|
|
Loading…
Reference in a new issue