Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement