To start with, I KNOW the standard answer to this in non-gstreamer python. The trouble is that that leads to an infinite recursion.
I am using the gi repository to write a python-gstreamer element which is a child of Gst.Bin. gi hides the virtual methods of parent classes, but lets you automagically override them by defining a do_... method. So I can override GstBin's handle_message method by defining a do_handle_message method in the child. However if that child method calls the parent's do_handle_message, it calls back into the child, and you get an infinite recursion. ie, this doesn't work:
class MyBin(Gst.Bin):
"New Gst.Bin based Element"
def __init__(self):
Gst.Bin.__init__(self) # works
...
def do_handle_message(self, message):
if message.type != Gst.MessageType.ERROR:
Gst.Bin.do_handle_error(self, message) # infinite recursion
super().do_handle_error(self, message) # same thing
else:
...
I only want to change the Gst.Bin's behaviour for ERRORs, and leave the other processing intact. Any suggestions?