I have a callback, that is provided by GStreamer-Python bindings which accepts fixed number of arguments. Here is the API : add_probe I call this function from inside a class function. Below is the pesudo code:
class Example:
def __init__(self):
thread = threading.Thread(target=self.run)
thread.start()
def run(self):
#if external event
self.idsrcpad = identity.get_static_pad("src") #get source pad
self.idsrcpad.add_probe(Gst.PadProbeType.IDLE,self.modify_pipeline)
def modify_pipeline(pad,info,self):
#access self.idsrcpad
self.idsrcpad.unlink(...)
Accessing self.idsrcpad
, gives an error saying that idsrcpad
is not a member of self.
The following question addresses, a similar issue, but then the callback function in the question does not have fixed number of arguments. In my case, the arguments are fixed for the callback function. Here is a more elaborate description of the add_probe function.
Can anyone suggest me what I am doing wrong here.
The correct syntax for the callback is :
def modify_pipeline(self,pad,info):
With this new definition, self
can be used inside the function.