Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2012
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. IBaseFilter* cam = 0;
  2. hr = mon->BindToObject(0,0,IID_IBaseFilter, (void**)&cam);
  3. IAMStreamConfig* pConf = NULL;
  4. HRESULT hr1 = pBuild->FindInterface(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video,cam,IID_IAMStreamConfig,(void **)&pConf);
  5.  
  6. hr1 = pConf->GetNumberOfCapabilities(&iCount, &iSize);
  7. for(int iFormat = 0; iFormat < iCount; iFormat++)
  8. {
  9. VIDEO_STREAM_CONFIG_CAPS scc;
  10. AM_MEDIA_TYPE *pmtConfig;
  11.  
  12. hr1 = pConf->GetStreamCaps(iFormat, &pmtConfig, (BYTE*)&scc);
  13.  
  14. if(SUCCEEDED(hr1))
  15. {
  16. if (pmtConfig->formattype == FORMAT_VideoInfo)
  17. {
  18. if (pmtConfig->cbFormat >= sizeof(VIDEOINFOHEADER) && (pmtConfig->majortype == MEDIATYPE_Video))
  19. {
  20. if((pmtConfig->subtype == MEDIASUBTYPE_RGB24)||(pmtConfig->subtype == MEDIASUBTYPE_YUY2) || (pmtConfig->subtype == MEDIASUBTYPE_RGB32))
  21. {
  22. VIDEOINFOHEADER *pVih = reinterpret_cast<VIDEOINFOHEADER*>(pmtConfig->pbFormat);
  23. //SET THE biHeight and biWidth params here.
  24. hr1 = pConf->SetFormat(pmtConfig);
  25. if(S_OK != hr1)
  26. {
  27. PrintLog(โ€œError is %X\nโ€,hr1);
  28. }
  29. break;
  30. }
  31. }
  32. }
  33. }
  34. }
  35.  
  36. //Now Do Add Filter and RenderStream.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement