[英]QtGstreamer camerabin2 usage
I'm working on olimex a13
board with just eglfs
ie, no windowing system.我正在使用只有
eglfs
olimex a13
板,即没有窗口系统。 Because of this Qt Multimedia
stuff video and camera aren't working as Qt
uses Gstreamer
which in turn needs X
.由于这个
Qt Multimedia
东西视频和相机不能工作,因为Qt
使用Gstreamer
而Gstreamer
又需要X
。 So I'm using QtGstreamer
library which is here .所以我正在使用这里的
QtGstreamer
库。
I've followed the examples and created a media player which is working as expected.我已经按照示例创建了一个按预期工作的媒体播放器。 Now, I want to do a camera and using
camerabin2
which is from bad plugins .现在,我想做一个相机并使用来自 bad plugins 的
camerabin2
。
This is my code:这是我的代码:
//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 //摄像头.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);
}
I then call cameraPlayer.start()
which isn't working ie, no video.然后我调用
cameraPlayer.start()
,它不起作用,即没有视频。 Am I missing something here?我在这里错过了什么吗? Has anyone used
QtGstreamer
to stream webcam?有没有人使用
QtGstreamer
流式传输网络摄像头? Thanks in advance.提前致谢。
I realised some plugins (multifilesink) were missing.我意识到缺少一些插件(multifilesink)。 Started my
Qt
application with --gst-debug-level=4
argument and gstreamer
then reported about missing plugins.使用
--gst-debug-level=4
参数启动我的Qt
应用程序,然后gstreamer
报告缺少插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.