我正在olimex a13
板上工作,只有eglfs
即沒有窗口系統。由於這Qt Multimedia
東西視頻和相機不工作Qt
使用Gstreamer
而這又需要X
。所以我使用QtGstreamer
庫,它是here。QtGstreamer camerabin2用法
我跟着examples創建了一個按預期工作的媒體播放器。現在,我想做一個相機,並使用camerabin2
這是從不好的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
來串流攝像頭?提前致謝。
您是否設法解決此問題?我有同樣的問題,即我的videosink上沒有視頻顯示。 – Luca
@Luca,請檢查我的答案。謝謝 – ramtheconqueror