if message_name == 'prepare-xwindow-id':
    pythonapi.PyCObject_AsVoidPtr.restype = c_void_p
pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object]
hWnd = pythonapi.PyCObject_AsVoidPtr(self.videoWidget.winId())
self.videoSink.set_xwindow_id(hWnd)
Python + QT + Gstreamer