開發平台(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):