使用QtGstreamer在connect()上编译错误

时间:2011-11-22 13:12:35

标签: c++ qt gstreamer glib qtgstreamer

我正在尝试观看消息,这些消息正在通过QtGstreamer 管道

以下是相关代码:

//pipeline is of type: QGst::PipelinePtr
pipeline->bus()->enableSyncMessageEmission(); 

QGlib::connect(pipeline->bus(), "sync-message", this, &MyClass::_msg_handler);

但QtCreator抱怨connect()

/usr/include/QtGStreamer/QGlib/connectimpl.h:-1: In function 
‘bool QGlib::connect(void*, const char*, T*, R (T::*)(A0), QGlib::ConnectFlags) 
[with T = MyClass, R = void, A0 = const QGlib::RefPointer<QGst::Message>&, 
QGlib::ConnectFlags = QFlags<QGlib::ConnectFlag>]’:

/usr/include/QtGStreamer/QGlib/connectimpl.h:330: error: invalid initialization
of reference of type ‘const QGlib::Private::DestroyNotifierIfacePtr&’ from 
expression of type ‘QGlib::Private::GetDestroyNotifier<MyClass, void>’

/usr/include/QtGStreamer/QGlib/connect.h:259: error: in passing argument 5 of 
‘ulong QGlib::Private::connect(void*, const char*, QGlib::Quark, void*, const
QGlib::Private::DestroyNotifierIfacePtr&, uint, QGlib::Private::ClosureDataBase*, 
QGlib::ConnectFlags)’

可能是什么原因?

1 个答案:

答案 0 :(得分:0)

<强>解决

就我而言,connect()中指定的回调是我写的一个类的方法,所以问题是MyClass需要继承QObject

class MasterSink : public QObject
{
   // ...
}