summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@noraisin.net>2009-05-06 23:38:08 +0100
committerEdward Hervey <bilboed@bilboed.com>2009-05-07 14:48:25 +0200
commit7743f1ad1e309fc1d073f777712c98bd0392eff0 (patch)
tree5dac250a61e8ec7912cf03be223afde1568dd8fa
parent873d51b34572e24651ef527690b6657df4b77a0d (diff)
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
-rw-r--r--examples/play.py4
-rw-r--r--examples/remuxer.py3
-rwxr-xr-xexamples/switch.py3
-rwxr-xr-xexamples/synchronizer.py3
4 files changed, 13 insertions, 0 deletions
diff --git a/examples/play.py b/examples/play.py
index a7522b4..4045dff 100644
--- a/examples/play.py
+++ b/examples/play.py
@@ -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
diff --git a/examples/remuxer.py b/examples/remuxer.py
index 039e38c..fa32134 100644
--- a/examples/remuxer.py
+++ b/examples/remuxer.py
@@ -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
diff --git a/examples/switch.py b/examples/switch.py
index 7117843..3428571 100755
--- a/examples/switch.py
+++ b/examples/switch.py
@@ -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
diff --git a/examples/synchronizer.py b/examples/synchronizer.py
index f5eff50..656e332 100755
--- a/examples/synchronizer.py
+++ b/examples/synchronizer.py
@@ -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