PDA

View Full Version : Issue with understanding the getAvailableInputChannels()



sulabh
March 30, 2017, 08:52:40
Hi,

I am using frame grabber for my project. Here is the code snippet of what i have done so far, I want to get a list of available input channels and later set it. I know i must select a device first in order to get input channels. However I really do not understand how to select device and than show available input channels.

//From library

DShowLib::InitLibrary();
atexit(ExitLibrary);
m_pGrabber = new Grabber();
Grabber::tVidCapDevListPtr pVidCapDevList = m_pGrabber->getAvailableVideoCaptureDevices();
if( pVidCapDevList == 0 || pVidCapDevList->empty() )
{
qDebug() << "No device available";
}
// Fill the qDebug with available capture device module
for ( Grabber::tVidCapDevList::iterator it =
pVidCapDevList->begin();
it != pVidCapDevList->end();
++it )
{
qDebug() << "Available device name : ";
qDebug() << it->c_str();

}
// Select the currently valid device
if( m_pGrabber->isDevValid() )
{
qDebug() << "Device available";
m_pGrabber->getDev().c_str();
qDebug() << "Device set properly";
}
qDebug() << "Device not valid";
Grabber::tInChnListPtr pInpChnList = m_pGrabber->getAvailableInputChannels();
//Check if input channel exists or not
if( pInpChnList == 0 || pInpChnList->empty() )
{
qDebug() << "No input channel exists";
qDebug() << m_pGrabber->isFrameRateListAvailable();
qDebug() << m_pGrabber->isInputChannelAvailableWithCurDev();
}
// Fill the qDebug with available channels
for ( Grabber::tInChnList::iterator it =
pInpChnList->begin();
it != pInpChnList->end();
++it )
{
qDebug() << "Available channels : ";
qDebug() << it->c_str();
}


//End

I see the following output :

Available device name :
DFG/SV1/PCIe
No input channel exists
The program has unexpectedly finished.

Stefan Geissler
March 30, 2017, 09:37:55
Hello Sulab

You did not open the device. The debug output "qDebug() << "Device set properly";" is not executed. You should call

m_pGrabber->openDev("DFG/SV!/PCIe");
before
if( m_pGrabber->isDevValid() )


https://www.theimagingsource.com/support/documentation/ic-imaging-control-cpp/meth_descGrabber_openDev.htm

sulabh
March 30, 2017, 09:43:29
Hello Sulab

You did not open the device. The debug output "qDebug() << "Device set properly";" is not executed. You should call

m_pGrabber->openDev("DFG/SV!/PCIe");
before
if( m_pGrabber->isDevValid() )


https://www.theimagingsource.com/support/documentation/ic-imaging-control-cpp/meth_descGrabber_openDev.htm

Thanks it works perfectly now :)