어떻게 DirectShow의 SamleGrabber의 현재 해상도를 얻으려면? directshow에서 실시간 해상도를 얻는 방법은 무엇입니까?
나는 그것이 작동하지 않습니다, 아래의 코드를 시도했다. 소스의 해상도가 1920 × 1080에서 화면 1680x1050로 변경하면서 당신이 얻는 가치는 항상 1920 × 1080이다.void GetCurrentResolution(ISampleGrabber* pGrabber, int* pWidth, int* pHeight)
{
AM_MEDIA_TYPE pmt = {0};
hr = pGrabber->GetConnectedMediaType(&pmt);
if (SUCCEEDED(hr))
{
if(pmt.formattype == FORMAT_VideoInfo)
{
VIDEOINFOHEADER *pVih = (VIDEOINFOHEADER*)pmt.pbFormat;
*pWidth = pVih->bmiHeader.biWidth;
*pHeight = pVih->bmiHeader.biHeight;
}
FreeMediaType(pmt);
}
}
당신은 "작동하지 않습니다"더 구체적으로시겠습니까? – Rachel
해상도가 1920x1080에서 1680x1050으로 변경된 경우 얻을 수있는 값은 1920x1080입니다. – senggen