// !!! What if this interface isnt supported?
// we use this interface to set the frame rate and get the capture size
if (hr != NOERROR)
{
hr = m_pCapBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video, m_pVCapFilter,
IID_IAMStreamConfig, (void **)&m_pVStreamConfig);
if (hr != NOERROR)
{
// this means we cant set frame
rate (non-DV only)
ErrMsg("Error %x: Cannot find VCapture:IAMStreamConfig", hr);
return hr;
}
}
AM_MEDIA_TYPE *pmt;
// default capture format
if (m_pVStreamConfig && m_pVStreamConfig->GetFormat(&pmt) == S_OK)
{
// DV capture does not use a VIDEOINFOHEADER
if (pmt->formattype == FORMAT_VideoInfo)
{
VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER *)pmt->pbFormat;
if(pmt->subtype == MEDIASUBTYPE_RGB24)
{
pmt->lSampleSize = (LONG)(_DEFAULT_CAP_WIDTH * _DEFAULT_CAP_HEIGHT * 3); // sample size calc
pvi->bmiHeader.biSizeImage = pmt->lSampleSize;
}
/// 프레임 조절
pvi->AvgTimePerFrame = (LONGLONG)(10000000 / m_fFramerate); // frames
pvi->bmiHeader.biWidth = _DEFAULT_CAP_WIDTH; // frame width
pvi->bmiHeader.biHeight = _DEFAULT_CAP_HEIGHT; // frame height
// resize our window to the default capture size
// ResizeWindow(HEADER(pmt->pbFormat)->biWidth,
// ABS(HEADER(pmt->pbFormat)->biHeight));
m_pVStreamConfig->SetFormat(pmt);
}
DeleteMediaType(pmt);
}
// we use this interface to set the frame rate and get the capture size
if (hr != NOERROR)
{
hr = m_pCapBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video, m_pVCapFilter,
IID_IAMStreamConfig, (void **)&m_pVStreamConfig);
if (hr != NOERROR)
{
// this means we cant set frame
rate (non-DV only)
ErrMsg("Error %x: Cannot find VCapture:IAMStreamConfig", hr);
return hr;
}
}
AM_MEDIA_TYPE *pmt;
// default capture format
if (m_pVStreamConfig && m_pVStreamConfig->GetFormat(&pmt) == S_OK)
{
// DV capture does not use a VIDEOINFOHEADER
if (pmt->formattype == FORMAT_VideoInfo)
{
VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER *)pmt->pbFormat;
if(pmt->subtype == MEDIASUBTYPE_RGB24)
{
pmt->lSampleSize = (LONG)(_DEFAULT_CAP_WIDTH * _DEFAULT_CAP_HEIGHT * 3); // sample size calc
pvi->bmiHeader.biSizeImage = pmt->lSampleSize;
}
/// 프레임 조절
pvi->AvgTimePerFrame = (LONGLONG)(10000000 / m_fFramerate); // frames
pvi->bmiHeader.biWidth = _DEFAULT_CAP_WIDTH; // frame width
pvi->bmiHeader.biHeight = _DEFAULT_CAP_HEIGHT; // frame height
// resize our window to the default capture size
// ResizeWindow(HEADER(pmt->pbFormat)->biWidth,
// ABS(HEADER(pmt->pbFormat)->biHeight));
m_pVStreamConfig->SetFormat(pmt);
}
DeleteMediaType(pmt);
}