
Untitled
By: a guest on
Mar 23rd, 2012 | syntax:
None | size: 1.15 KB | hits: 43 | expires: Never
IBaseFilter* cam = 0;
hr = mon->BindToObject(0,0,IID_IBaseFilter, (void**)&cam);
IAMStreamConfig* pConf = NULL;
HRESULT hr1 = pBuild->FindInterface(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video,cam,IID_IAMStreamConfig,(void **)&pConf);
hr1 = pConf->GetNumberOfCapabilities(&iCount, &iSize);
for(int iFormat = 0; iFormat < iCount; iFormat++)
{
VIDEO_STREAM_CONFIG_CAPS scc;
AM_MEDIA_TYPE *pmtConfig;
hr1 = pConf->GetStreamCaps(iFormat, &pmtConfig, (BYTE*)&scc);
if(SUCCEEDED(hr1))
{
if (pmtConfig->formattype == FORMAT_VideoInfo)
{
if (pmtConfig->cbFormat >= sizeof(VIDEOINFOHEADER) && (pmtConfig->majortype == MEDIATYPE_Video))
{
if((pmtConfig->subtype == MEDIASUBTYPE_RGB24)||(pmtConfig->subtype == MEDIASUBTYPE_YUY2) || (pmtConfig->subtype == MEDIASUBTYPE_RGB32))
{
VIDEOINFOHEADER *pVih = reinterpret_cast<VIDEOINFOHEADER*>(pmtConfig->pbFormat);
//SET THE biHeight and biWidth params here.
hr1 = pConf->SetFormat(pmtConfig);
if(S_OK != hr1)
{
PrintLog(“Error is %X\n”,hr1);
}
break;
}
}
}
}
}
//Now Do Add Filter and RenderStream.