QtGstreamer camerabin2 用法
QtGstreamer camerabin2 usage
我正在开发 olimex a13
开发板,只有 eglfs
,即没有窗口系统。由于这个 Qt Multimedia
东西,视频和相机无法正常工作,因为 Qt
使用 Gstreamer
,而后者又需要 X
。所以我正在使用 QtGstreamer
库,它是 here.
我关注了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。
这是我的代码:
//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
流式传输网络摄像头?提前致谢。
我意识到缺少一些插件 (multifilesink)。使用 --gst-debug-level=4
参数启动我的 Qt
应用程序,然后 gstreamer
报告缺少插件。
我正在开发 olimex a13
开发板,只有 eglfs
,即没有窗口系统。由于这个 Qt Multimedia
东西,视频和相机无法正常工作,因为 Qt
使用 Gstreamer
,而后者又需要 X
。所以我正在使用 QtGstreamer
库,它是 here.
我关注了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。
这是我的代码:
//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
流式传输网络摄像头?提前致谢。
我意识到缺少一些插件 (multifilesink)。使用 --gst-debug-level=4
参数启动我的 Qt
应用程序,然后 gstreamer
报告缺少插件。