From 1276275eca7168144e456b9ac2856f8a9f40291d Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Fri, 5 Nov 2010 16:23:06 +0000 Subject: fixed a crash bug in dcc video and added the ability to switch input git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5132 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/dcc/video.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/modules/dcc/video.cpp') diff --git a/src/modules/dcc/video.cpp b/src/modules/dcc/video.cpp index eae11d33f..461a092a3 100644 --- a/src/modules/dcc/video.cpp +++ b/src/modules/dcc/video.cpp @@ -301,6 +301,24 @@ bool KviDccVideoThread::handleIncomingData(KviDccThreadIncomingData * data,bool return true; } +void KviDccVideoThread::restartRecording(int iDevice, int iInput, int) +{ +#ifndef COMPILE_DISABLE_DCC_VIDEO + m_bRecording=false; + if(!g_pVideoDevicePool) + g_pVideoDevicePool = Kopete::AV::VideoDevicePool::self(); + + g_pVideoDevicePool->stopCapturing(); + g_pVideoDevicePool->open(iDevice); + g_pVideoDevicePool->setSize(320, 240); + if(iInput >= 0) + g_pVideoDevicePool->selectInput(iInput); + g_pVideoDevicePool->startCapturing(); + + m_bRecording=true; +#endif +} + void KviDccVideoThread::startRecording() { #ifndef COMPILE_DISABLE_DCC_VIDEO @@ -483,6 +501,10 @@ KviDccVideo::KviDccVideo(KviFrame *pFrm,KviDccDescriptor * dcc,const char * name connect(m_pMarshal,SIGNAL(connected()),this,SLOT(connected())); connect(m_pMarshal,SIGNAL(inProgress()),this,SLOT(connectionInProgress())); + connect(m_pCDevices, SIGNAL(currentIndexChanged(int)), this, SLOT(videoInputChanged(int))); + connect(m_pCInputs, SIGNAL(currentIndexChanged(int)), this, SLOT(videoInputChanged(int))); + connect(m_pCStandards, SIGNAL(currentIndexChanged(int)), this, SLOT(videoInputChanged(int))); + startConnection(); } @@ -997,6 +1019,12 @@ void KviDccVideo::deviceUnregistered(const QString & ) #endif } +void KviDccVideo::videoInputChanged(int ) +{ + if(m_pSlaveThread) + m_pSlaveThread->restartRecording(m_pCDevices->currentIndex(), m_pCInputs->currentIndex(), m_pCStandards->currentIndex()); +} + #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "m_video.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES -- cgit v1.3.1-10-gc9f91