Unable to create working instance of subclassed GStreamer objects
When I try to subclass the Gst.Bin class to, for example, add custom signal handling code, I can no longer create new instances of it with new
.
With the code:
import gi
gi.require_version("Gst", "1.0")
from gi.repository import Gst, GLib
Gst.init()
class SubclassBin(Gst.Bin):
pass
subclass_bin = SubclassBin.new("mybin")
main_loop = GLib.MainLoop.new(context=None, is_running=False)
main_loop.run()
I get the following exception:
TypeError: Bin constructor cannot be used to create instances of a subclass SubclassBin
The message leads me to believe that this is expected behavior, but then it isn't clear to me how to create a new instance of my SubclassBin type. I assume that just using SubclassBin()
isn't sufficient, and in my testing it doesn't appear to be.