我正在olimex a13
船上工作,eglfs
即没有窗口系统。由于这些Qt Multimedia
东西,视频和相机不能用作反过来需要的Qt
用途。所以我正在使用这里的库。Gstreamer
X
QtGstreamer
我已经按照这些示例创建了一个按预期工作的媒体播放器。现在,我想做一个相机,并使用camerabin2
来自坏插件的相机。
这是我的代码:
//init QGst
QGst::init(&argc, &argv);
//create video surface
QGst::Quick::VideoSurface* videoSurface = new QGst::Quick::VideoSurface(&engine);
CameraPlayer player;
player.setVideoSink(videoSurface->videoSink());
//cameraplayer.cpp
void open()
{
if (!m_pipeline) {
m_pipeline = QGst::ElementFactory::make("camerabin").dynamicCast<QGst::Pipeline>();
if (m_pipeline) {
m_pipeline->setProperty("video-sink", m_videoSink);
//watch the bus for messages
QGst::BusPtr bus = m_pipeline->bus();
bus->addSignalWatch();
QGlib::connect(bus, "message", this, &CameraPlayer::onBusMessage);
//QGlib::connect(bus, "image-done", this, &CameraPlayer::onImageDone);
} else {
qCritical() << "Failed to create the pipeline";
}
}
}
//-----------------------------------
void CameraPlayer::setVideoSink(const QGst::ElementPtr & sink)
{
m_videoSink = sink;
}
//-----------------------------------
void CameraPlayer::start()
{
m_pipeline->setState(QGst::StateReady);
m_pipeline->setState(QGst::StatePlaying);
}
然后我打电话给cameraPlayer.start()
它不起作用,即没有视频。我在这里错过了什么吗?有人用过QtGstreamer
网络摄像头吗?提前致谢。