我有一个回调,它由 GStreamer-Python 绑定提供,它接受固定数量的参数。这是 API:add_probe 我从一个类函数内部调用这个函数。下面是伪代码:
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(...)
访问self.idsrcpad
,给出一个错误,说它 idsrcpad
不是 self 的成员。
以下问题解决了类似的问题,但是问题中的回调函数没有固定数量的参数。就我而言,回调函数的参数是固定的。这是对add_probe函数的更详细描述。
谁能建议我在这里做错了什么。