2016-04-05 64 views
2

我正在olimex a13板上工作,只有eglfs即沒有窗口系統。由於這Qt Multimedia東西視頻和相機不工作Qt使用Gstreamer而這又需要X。所以我使用QtGstreamer庫,它是hereQtGstreamer 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來串流攝像頭?提前致謝。

+0

您是否設法解決此問題?我有同樣的問題,即我的videosink上沒有視頻顯示。 – Luca

+0

@Luca,請檢查我的答案。謝謝 – ramtheconqueror

回答

1

我意識到一些插件(multifilesink)丟失。開始我的Qt申請與--gst-debug-level=4參數和gstreamer然後報告關於缺少插件。

+0

感謝您的提示!今晚我會試試看看它是否能解決我的問題! – Luca