You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
692 B
30 lines
692 B
#!/usr/bin/env python3
|
|
|
|
import gi
|
|
gi.require_version('Gst', '1.0')
|
|
from gi.repository import Gst, GObject, GLib
|
|
|
|
pipeline = None
|
|
bus = None
|
|
message = None
|
|
|
|
# initialize GStreamer
|
|
Gst.init(None)
|
|
|
|
# build the pipeline
|
|
pipeline = Gst.parse_launch(
|
|
"udpsrc multicast-group=239.255.42.42 auto-multicast=true port=5004 caps=\"video/mpegts, media=(string)video\" ! tsdemux ! decodebin ! videoconvert ! autovideosink sync=false"
|
|
)
|
|
|
|
# start playing
|
|
pipeline.set_state(Gst.State.PLAYING)
|
|
|
|
# wait until EOS or error
|
|
bus = pipeline.get_bus()
|
|
msg = bus.timed_pop_filtered(
|
|
Gst.CLOCK_TIME_NONE,
|
|
Gst.MessageType.ERROR | Gst.MessageType.EOS
|
|
)
|
|
|
|
# free resources
|
|
pipeline.set_state(Gst.State.NULL)
|
|
|