whipe out GTK dependency, now Glib only
This commit is contained in:
parent
f5738cef5f
commit
5336f23335
@ -7,8 +7,7 @@
|
|||||||
from core import debug
|
from core import debug
|
||||||
import gi
|
import gi
|
||||||
import time, threading
|
import time, threading
|
||||||
gi.require_version('Gtk', '3.0')
|
from gi.repository import GLib
|
||||||
from gi.repository import GLib, Gtk
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
gi.require_version('Gst', '1.0')
|
gi.require_version('Gst', '1.0')
|
||||||
@ -49,14 +48,15 @@ class driver:
|
|||||||
self._source.link(self._sink)
|
self._source.link(self._sink)
|
||||||
|
|
||||||
self._initialized = True
|
self._initialized = True
|
||||||
self.thread = threading.Thread(target=self.main)
|
self.mainloop = GLib.MainLoop()
|
||||||
|
self.thread = threading.Thread(target=self.mainloop.run)
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
global _gstreamerAvailable
|
global _gstreamerAvailable
|
||||||
if not _gstreamerAvailable:
|
if not _gstreamerAvailable:
|
||||||
return
|
return
|
||||||
self.cancel()
|
self.cancel()
|
||||||
Gtk.main_quit()
|
self.mainloop.quit()
|
||||||
self._initialized = False
|
self._initialized = False
|
||||||
_gstreamerAvailable = False
|
_gstreamerAvailable = False
|
||||||
|
|
||||||
@ -94,8 +94,7 @@ class driver:
|
|||||||
self._pipeline.set_state(Gst.State.PLAYING)
|
self._pipeline.set_state(Gst.State.PLAYING)
|
||||||
duration = int(1000 * tone.duration)
|
duration = int(1000 * tone.duration)
|
||||||
GLib.timeout_add(duration, self._onTimeout, self._pipeline)
|
GLib.timeout_add(duration, self._onTimeout, self._pipeline)
|
||||||
def main(self):
|
|
||||||
Gtk.main()
|
|
||||||
def cancel(self, element=None):
|
def cancel(self, element=None):
|
||||||
global _gstreamerAvailable
|
global _gstreamerAvailable
|
||||||
if not _gstreamerAvailable:
|
if not _gstreamerAvailable:
|
||||||
|
Loading…
Reference in New Issue
Block a user