adaptivedemux2 uses default main context
adaptivedemux2
needs the default main context in order to work. It shouldn't, as it's not always available.
The following script never starts playing. However, if you replace the if True:
with if False:
, it will use a main loop and playback should work.
import gi
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
gi.require_version("Gst", "1.0")
from gi.repository import Gst, GLib
Gst.init([])
pipeline = Gst.parse_launch(
"""
playbin3 uri=https://mcdn.daserste.de/daserste/de/master.m3u8
"""
)
bus = pipeline.get_bus()
pipeline.set_state(Gst.State.PLAYING)
if True:
while True:
msg = bus.timed_pop(Gst.CLOCK_TIME_NONE)
print(f"Message {msg.type} from {msg.src}")
if msg.type in (Gst.MessageType.EOS, Gst.MessageType.ERROR):
break
else:
loop = GLib.MainLoop.new(None, False)
def on_message(bus, msg):
print(f"Message {msg.type} from {msg.src}")
if msg.type in (Gst.MessageType.EOS, Gst.MessageType.ERROR):
loop.quit()
return GLib.SOURCE_CONTINUE
bus.add_watch(GLib.PRIORITY_DEFAULT, on_message)
loop.run()
pipeline.set_state(Gst.State.NULL)