vdaanen
July 25, 2007, 16:47:12
Hi,
I want to initalize my grabber by specifying the video format and the image size.
The only way I found is
- first create a MemBufferCollection
- create FrameHandlerSink using the MemBufferCollection created above.
But when I call grabber->startLive, it fails because "the sink could not be connected !"
Here is my initalization code. Does someone see the error ?
// ---------------------------
if (l_Format == CVideoFrame::eFRAME_FORMAT_PAL)
{
if (!m_pGrabber->setVideoNorm("PAL_B"))
{
LOGERR("CVideoGrabberImplImagingSource : Can not initalize Grabber with video signal : PAL_B ");
return false;
}
}
else // (l_Format == CVideoFrame::eFRAME_FORMAT_PAL)
{
if (!m_pGrabber->setVideoNorm("NTSC_M"))
{
LOGERR("CVideoGrabberImplImagingSource : Can not initalize Grabber with video signal : NTSC_M");
return false;
}
}
// use normal video input (no S-VIDEO)
m_pGrabber->setInputChannel(l_VideoOutputNumber);
// --------------
BYTE *l_pBuffer[1]={m_Frame.GetBuffer()}; // the buffer is valid !
tColorformatEnum l_colorFormat = (l_Color == CVideoFrame::eFRAME_RGB_8) ? eRGB24 : eY800;
m_pBuffer = MemBufferCollection::create(l_colorFormat, m_Frame.GetSize(), 1, l_pBuffer);
if (m_pBuffer==0)
{
LOGERR("Can not create the buffer for the grabber");
return false;
}
m_pSink = FrameHandlerSink::create(m_pBuffer);
if (m_pSink==0)
{
LOGERR("Can not create the FrameHandler for the grabber");
return false;
}
m_pGrabber->setSinkType( m_pSink );
// declare the listener
if (!m_pListener)
{
m_pListener = new CListener(this);
if (!m_pListener)
{
LOGERR("Unable to initialize the Listener");
return false;
}
}
m_pGrabber->addListener(m_pListener);
// Start the background grabbing
if (!m_pGrabber->startLive(false)) <---- it's failing here
{
LOGERR("Unable to start background grabbing");
return false;
}
// Pause
m_pSink->setSinkMode(GrabberSinkType::ePAUSE);
V
I want to initalize my grabber by specifying the video format and the image size.
The only way I found is
- first create a MemBufferCollection
- create FrameHandlerSink using the MemBufferCollection created above.
But when I call grabber->startLive, it fails because "the sink could not be connected !"
Here is my initalization code. Does someone see the error ?
// ---------------------------
if (l_Format == CVideoFrame::eFRAME_FORMAT_PAL)
{
if (!m_pGrabber->setVideoNorm("PAL_B"))
{
LOGERR("CVideoGrabberImplImagingSource : Can not initalize Grabber with video signal : PAL_B ");
return false;
}
}
else // (l_Format == CVideoFrame::eFRAME_FORMAT_PAL)
{
if (!m_pGrabber->setVideoNorm("NTSC_M"))
{
LOGERR("CVideoGrabberImplImagingSource : Can not initalize Grabber with video signal : NTSC_M");
return false;
}
}
// use normal video input (no S-VIDEO)
m_pGrabber->setInputChannel(l_VideoOutputNumber);
// --------------
BYTE *l_pBuffer[1]={m_Frame.GetBuffer()}; // the buffer is valid !
tColorformatEnum l_colorFormat = (l_Color == CVideoFrame::eFRAME_RGB_8) ? eRGB24 : eY800;
m_pBuffer = MemBufferCollection::create(l_colorFormat, m_Frame.GetSize(), 1, l_pBuffer);
if (m_pBuffer==0)
{
LOGERR("Can not create the buffer for the grabber");
return false;
}
m_pSink = FrameHandlerSink::create(m_pBuffer);
if (m_pSink==0)
{
LOGERR("Can not create the FrameHandler for the grabber");
return false;
}
m_pGrabber->setSinkType( m_pSink );
// declare the listener
if (!m_pListener)
{
m_pListener = new CListener(this);
if (!m_pListener)
{
LOGERR("Unable to initialize the Listener");
return false;
}
}
m_pGrabber->addListener(m_pListener);
// Start the background grabbing
if (!m_pGrabber->startLive(false)) <---- it's failing here
{
LOGERR("Unable to start background grabbing");
return false;
}
// Pause
m_pSink->setSinkMode(GrabberSinkType::ePAUSE);
V