[英]QtGstreamer camerabin2 usage
我正在使用只有eglfs
olimex a13
板,即沒有窗口系統。 由於這個Qt Multimedia
東西視頻和相機不能工作,因為Qt
使用Gstreamer
而Gstreamer
又需要X
。 所以我正在使用這里的QtGstreamer
庫。
我已經按照示例創建了一個按預期工作的媒體播放器。 現在,我想做一個相機並使用來自 bad plugins 的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());
//攝像頭.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
報告缺少插件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.