[問題] directshow GetFormat SetFormat
開發平台(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):
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.134.117.70
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1424609840.A.4AA.html
推
02/24 20:31, , 1F
02/24 20:31, 1F
→
02/25 21:26, , 2F
02/25 21:26, 2F
推
02/25 22:17, , 3F
02/25 22:17, 3F
推
02/26 00:23, , 4F
02/26 00:23, 4F
→
02/26 00:24, , 5F
02/26 00:24, 5F
→
02/27 18:25, , 6F
02/27 18:25, 6F
→
02/27 18:27, , 7F
02/27 18:27, 7F
推
02/28 22:10, , 8F
02/28 22:10, 8F