2012-02-22 17 views
2

ウェブカメラの再生にWebRTCを使用しています(ビデオコールする前に私のアプリケーションでウェブカメラをテストするためです)。私はこれらの次のいくつかのWebRTC機能を実行します。WebRTC Qtでウェブカメラを再生

//////////////////////// 

//initialization 
{ 
webrtc::VoiceEngine* voe = VoiceEngine::Create(); 
webrtc::VoEBase* voeBase = VoEBase::GetInterface(voe); 
voeBase->Init(); 
webrtc::VideoEngine* vie = VideoEngine::Create(); 
webrtc::ViEBase* vieBase = ViEBase::GetInterface(vie); 
vieBase->Init(); 
webrtc::ViECapture* vieCapture = ViECapture::GetInterface(vie); 
} 

//////////////////////// 

// start webcam playing 
void MainWindow::StartWebcamTest() 
{ 
     // creating window for playing webcam video 
    videoWidget = new Phonon::VideoWidget(); 
    videoWidget->setFixedSize(640, 480); 
    videoWidget->setWindowTitle("Test Webcam"); 

    char captDevName[1024], captGuidName[1024]; 
    VoEEngineSingleton::Instance()->GetViECapture()->GetCaptureDevice(0, captDevName, 1024, captGuidName, 1024); 
    VoEEngineSingleton::Instance()->GetViECapture()->AllocateCaptureDevice(captGuidName, 1024, captureID); 

    testVideoChannel = VoEEngineSingleton::Instance()->GetViEBase()->CreateChannel(testVideoChannel); 
    if(testVideoChannel == -1) 
     LOGERR << "Creating video channel error: " << VoEEngineSingleton::Instance()->GetViEBase()->LastError() << endl; 
    else LOGDEBUG << "Video channel created, ID = " << testVideoChannel << endl; 

    testAudioChannel = VoEEngineSingleton::Instance()->GetVoEBase()->CreateChannel(); 
    if(testAudioChannel == -1) 
     LOGERR << "Creating audio channel error: " << VoEEngineSingleton::Instance()->GetVoEBase()->LastError() << endl; 
    else LOGDEBUG << "Audio channel created, ID = " << testAudioChannel << endl; 

    if(VoEEngineSingleton::Instance()->GetViEBase()->ConnectAudioChannel(testVideoChannel, testAudioChannel) != 0) 
     LOGERR << "ConnectAudioChannel() error: " << VoEEngineSingleton::Instance()->GetViEBase()->LastError() << endl; 
    else LOGINFO << "Audio channel connected successful " << endl; 

    if(VoEEngineSingleton::Instance()->GetViECapture()->ConnectCaptureDevice(captureID, testVideoChannel) != 0) 
     LOGERR << "ConnectCaptureDevice() error: " << VoEEngineSingleton::Instance()->GetViEBase()->LastError() << endl; 
    else LOGINFO << "Capture device connected successful " << endl; 

    if(VoEEngineSingleton::Instance()->GetViERender()->StartRender(testVideoChannel) != 0) 
     LOGERR << "StartRender() error: " << VoEEngineSingleton::Instance()->GetViEBase()->LastError() << endl; 
    else LOGINFO "StartRender() successed " << endl; 

    if(VoEEngineSingleton::Instance()->GetViECapture()->StartCapture(captureID) != 0) 
     LOGERR << "StartCapture() error: " << VoEEngineSingleton::Instance()->GetViEBase()->LastError() << endl; 
    else LOGINFO << "StartCapture() successed " << endl; 

    videoWidget->show(); 
} 

私はビデオを再生するためのボタンをクリックすると - ウェブカメラは、再生を開始しますが、videoWidgetウィンドウは空の黒です。

私は何をしていませんか?それにほかのQtウィジェットを使用する必要がありますか?

答えて

0

Qtでビデオレンダラを実装する必要があります。 webrtc :: ExternalRendererのサブクラスを作成し、フレームを描画します

関連する問題