I’ve developed an application in Python/Gtk4 for our vacation pictures and movies. The built-in video for Gtk4 is too limited, so I’m using gstreamer. This is on Manjaro Linux test branch so all Gtk and Gst packages are very recent.
I’ve done a very simple pipeline, basically connecting playbin3 straight to gtk4paintablesink embedded in a Gtk Picture… This is all working well. I was just wondering if this is an appropriate way to use things, letting the sink and Gtk take care of scaling etc.
Should i be putting things like videoconvert or other components into the pipeline to handle things?
Here’s the class where I set up the pipeline.
class GtkSink(Gtk.Picture):
def __init__(self):
super().__init__()
# noinspection PyArgumentList,PyTypeChecker
self.player = Gst.ElementFactory.make("playbin3", None)
player_factory = self.player.get_factory()
# noinspection SpellCheckingInspection
video_sink: Gst.ChildProxy = player_factory.make('gtk4paintablesink', 'videosink')
self.player.set_property("video-sink", video_sink)
audio_sink: Gst.ChildProxy = player_factory.make('pulsesink', 'audiosink')
# noinspection PyArgumentList
role = Gst.Structure.new_from_string('props,media.role=video')
audio_sink.set_property('stream-properties', role)
role.free()
self.player.set_property("audio-sink", audio_sink)
paintable = video_sink.get_property('paintable')
self.set_paintable(paintable)
Cheers,
Pat