mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
Use expose instead of after_realize_cb+idle_add
Original commit message from CVS: Use expose instead of after_realize_cb+idle_add
This commit is contained in:
parent
7020315e74
commit
65e693c8a9
1 changed files with 5 additions and 7 deletions
|
@ -88,7 +88,7 @@ class PlayerWidget(gtk.DrawingArea):
|
|||
self.parentw = parent
|
||||
gtk.DrawingArea.__init__(self)
|
||||
self.connect('destroy', self.destroy_cb)
|
||||
self.connect_after('realize', self.after_realize_cb)
|
||||
self.connect('expose-event', self.expose_cb)
|
||||
self.set_size_request(400, 400)
|
||||
self.player = gst.play.Play()
|
||||
self.player.connect('eos', lambda p: gst.main_quit())
|
||||
|
@ -97,17 +97,15 @@ class PlayerWidget(gtk.DrawingArea):
|
|||
|
||||
# Setup source and sinks
|
||||
self.player.set_data_src(gst.element_factory_make('filesrc'))
|
||||
self.player.set_audio_sink(gst.element_factory_make('osssink'))
|
||||
audio_sink = gst.element_factory_make('alsasink')
|
||||
audio_sink.set_property('device', 'hw:0')
|
||||
self.player.set_audio_sink(audio_sink)
|
||||
self.player.set_video_sink(self.imagesink)
|
||||
|
||||
def destroy_cb(self, da):
|
||||
self.imagesink.set_xwindow_id(0L)
|
||||
|
||||
def after_realize_cb(self, window):
|
||||
# Sort of a hack, but it works for now.
|
||||
gtk.idle_add(self.idler)
|
||||
|
||||
def idler(self):
|
||||
def expose_cb(self, window, event):
|
||||
self.imagesink.set_xwindow_id(self.window.xid)
|
||||
|
||||
def stop(self):
|
||||
|
|
Loading…
Reference in a new issue