Skip to content
Snippets Groups Projects
Commit 95973085 authored by Patrick Godwin's avatar Patrick Godwin Committed by ChiWai Chan
Browse files

stream.py: replace GObject.MainLoop() -> GLib.MainLoop(), remove...

stream.py: replace GObject.MainLoop() -> GLib.MainLoop(), remove GObject.threads_init() to address deprecation warnings
parent 6af8ba15
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,8 @@ import pluggy
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstAudio', '1.0')
from gi.repository import GObject, Gst, GstAudio
gi.require_version('GLib', '2.0')
from gi.repository import Gst, GstAudio, GLib
from lal import LIGOTimeGPS
......@@ -73,7 +74,7 @@ MessageType = Gst.MessageType
class Stream:
"""Class for building a GStreamer-based pipeline.
"""
_thread_init = False
_gst_init = False
_has_elements = False
_caps_buffer_map = None
......@@ -86,11 +87,10 @@ class Stream:
source=None,
head=None,
):
# initialize threads if not set
if not self._thread_init:
GObject.threads_init()
# initialize GStreamer if needed
if not self._gst_init:
Gst.init(None)
self._thread_init = True
self._gst_init = True
# register elements to stream if needed
if not self._has_elements:
......@@ -103,7 +103,7 @@ class Stream:
# set up gstreamer pipeline
self.name = name if name else str(uuid.uuid1())
self.mainloop = mainloop if mainloop else GObject.MainLoop()
self.mainloop = mainloop if mainloop else GLib.MainLoop()
self.pipeline = pipeline if pipeline else Gst.Pipeline(self.name)
self.handler = handler if handler else StreamHandler(self.mainloop, self.pipeline)
self.head = head if head is not None else {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment