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
@ -8,12 +8,14 @@ pygtk.require('2.0')
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import gobject
|
import gobject
|
||||||
|
gobject.threads_init()
|
||||||
|
|
||||||
import pygst
|
import pygst
|
||||||
pygst.require('0.10')
|
pygst.require('0.10')
|
||||||
import gst
|
import gst
|
||||||
import gst.interfaces
|
import gst.interfaces
|
||||||
import gtk
|
import gtk
|
||||||
|
gtk.gdk.threads_init()
|
||||||
|
|
||||||
class GstPlayer:
|
class GstPlayer:
|
||||||
def __init__(self, videowidget):
|
def __init__(self, videowidget):
|
||||||
@ -33,9 +35,11 @@ class GstPlayer:
|
|||||||
return
|
return
|
||||||
if message.structure.get_name() == 'prepare-xwindow-id':
|
if message.structure.get_name() == 'prepare-xwindow-id':
|
||||||
# Sync with the X server before giving the X-id to the sink
|
# Sync with the X server before giving the X-id to the sink
|
||||||
|
gtk.gdk.threads_enter()
|
||||||
gtk.gdk.display_get_default().sync()
|
gtk.gdk.display_get_default().sync()
|
||||||
self.videowidget.set_sink(message.src)
|
self.videowidget.set_sink(message.src)
|
||||||
message.src.set_property('force-aspect-ratio', True)
|
message.src.set_property('force-aspect-ratio', True)
|
||||||
|
gtk.gdk.threads_leave()
|
||||||
|
|
||||||
def on_message(self, bus, message):
|
def on_message(self, bus, message):
|
||||||
t = message.type
|
t = message.type
|
||||||
|
@ -15,6 +15,7 @@ pygst.require('0.10')
|
|||||||
import gst
|
import gst
|
||||||
import gst.interfaces
|
import gst.interfaces
|
||||||
import gtk
|
import gtk
|
||||||
|
gtk.gdk.threads_init()
|
||||||
|
|
||||||
class GstPlayer:
|
class GstPlayer:
|
||||||
def __init__(self, videowidget):
|
def __init__(self, videowidget):
|
||||||
@ -33,9 +34,11 @@ class GstPlayer:
|
|||||||
return
|
return
|
||||||
if message.structure.get_name() == 'prepare-xwindow-id':
|
if message.structure.get_name() == 'prepare-xwindow-id':
|
||||||
# Sync with the X server before giving the X-id to the sink
|
# Sync with the X server before giving the X-id to the sink
|
||||||
|
gtk.gdk.threads_enter()
|
||||||
gtk.gdk.display_get_default().sync()
|
gtk.gdk.display_get_default().sync()
|
||||||
self.videowidget.set_sink(message.src)
|
self.videowidget.set_sink(message.src)
|
||||||
message.src.set_property('force-aspect-ratio', True)
|
message.src.set_property('force-aspect-ratio', True)
|
||||||
|
gtk.gdk.threads_leave()
|
||||||
|
|
||||||
def on_message(self, bus, message):
|
def on_message(self, bus, message):
|
||||||
t = message.type
|
t = message.type
|
||||||
|
@ -15,6 +15,7 @@ pygst.require('0.10')
|
|||||||
import gst
|
import gst
|
||||||
import gst.interfaces
|
import gst.interfaces
|
||||||
import gtk
|
import gtk
|
||||||
|
gtk.gdk.threads_init()
|
||||||
|
|
||||||
class SwitchTest:
|
class SwitchTest:
|
||||||
def __init__(self, videowidget):
|
def __init__(self, videowidget):
|
||||||
@ -36,9 +37,11 @@ class SwitchTest:
|
|||||||
return
|
return
|
||||||
if message.structure.get_name() == 'prepare-xwindow-id':
|
if message.structure.get_name() == 'prepare-xwindow-id':
|
||||||
# Sync with the X server before giving the X-id to the sink
|
# Sync with the X server before giving the X-id to the sink
|
||||||
|
gtk.gdk.threads_enter()
|
||||||
gtk.gdk.display_get_default().sync()
|
gtk.gdk.display_get_default().sync()
|
||||||
self.videowidget.set_sink(message.src)
|
self.videowidget.set_sink(message.src)
|
||||||
message.src.set_property('force-aspect-ratio', True)
|
message.src.set_property('force-aspect-ratio', True)
|
||||||
|
gtk.gdk.threads_leave()
|
||||||
|
|
||||||
def on_message(self, bus, message):
|
def on_message(self, bus, message):
|
||||||
t = message.type
|
t = message.type
|
||||||
|
@ -15,6 +15,7 @@ pygst.require('0.10')
|
|||||||
import gst
|
import gst
|
||||||
import gst.interfaces
|
import gst.interfaces
|
||||||
import gtk
|
import gtk
|
||||||
|
gtk.gdk.threads_init()
|
||||||
|
|
||||||
class GstPlayer:
|
class GstPlayer:
|
||||||
def __init__(self, videowidget):
|
def __init__(self, videowidget):
|
||||||
@ -33,9 +34,11 @@ class GstPlayer:
|
|||||||
return
|
return
|
||||||
if message.structure.get_name() == 'prepare-xwindow-id':
|
if message.structure.get_name() == 'prepare-xwindow-id':
|
||||||
# Sync with the X server before giving the X-id to the sink
|
# Sync with the X server before giving the X-id to the sink
|
||||||
|
gtk.gdk.threads_enter()
|
||||||
gtk.gdk.display_get_default().sync()
|
gtk.gdk.display_get_default().sync()
|
||||||
self.videowidget.set_sink(message.src)
|
self.videowidget.set_sink(message.src)
|
||||||
message.src.set_property('force-aspect-ratio', True)
|
message.src.set_property('force-aspect-ratio', True)
|
||||||
|
gtk.gdk.threads_leave()
|
||||||
|
|
||||||
def on_message(self, bus, message):
|
def on_message(self, bus, message):
|
||||||
t = message.type
|
t = message.type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user