开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
vc6 windowsXP
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
Directshow
问题(Question):
设定输出usb camera分辨率正确流程?
己知先用 GetFormat 读入目前 usb camera 设定分辨率
修改过后再用SetFormat 写入设定
但是测试发现分辨率变成最小,不知问题在那里
只要求改默认输出分辨率
程式码(Code):(请善用置底文网页, 记得排版)
IAMStreamConfig *pVSC;
hr =
g_pCapture->FindInterface(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video,m_pVidDeviceFilter,IID_IAMStreamConfig,(void
**)&pVSC);
if(FAILED(hr))
{
printf("Findinterface error \n");
return -1;
}
AM_MEDIA_TYPE *aMediaType ;
pVSC->GetFormat(&aMediaType);
VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)aMediaType->pbFormat;
AM_MEDIA_TYPE *out_set = aMediaType ;
VIDEOINFOHEADER *pOut_set =(VIDEOINFOHEADER*)out_set->pbFormat;
pOut_set->bmiHeader.biWidth = 1280;
pOut_set->bmiHeader.biHeight = 720;
out_set->pbFormat = (unsigned char *)pOut_set;
pVSC->SetFormat(out_set);
补充说明(Supplement):