This article具有下面的代碼和它的工作原理是魅力!
HRESULT CMFVideoCaptureDlg::SetupCamera(IMFMediaSource* pCameraSource) {
CComQIPtr spCameraControl(pCameraSource);
HRESULT hr = S_OK;
if(spCameraControl) {
long min, max, step, def, control;
hr = spCameraControl->GetRange(CameraControl_Exposure, &min, &max, &step, &def, &control);
if(SUCCEEDED(hr))
hr = spCameraControl->Set(CameraControl_Exposure, 1, CameraControl_Flags_Manual);
}
CComQIPtr spVideo(pCameraSource);
if(spVideo)
hr = spVideo->Set(VideoProcAmp_WhiteBalance, 0, VideoProcAmp_Flags_Auto);
return hr;
}
我來到這裏(在我的MF程序控制攝像頭)完全相同的問題,如OP和你的回答基本上是「你應該使用的DirectShow」。我無法接受如此-1我從 – YePhIcK 2017-03-04 04:36:35
@YePhIcK:「你應該使用DirectShow」,如果你想留下記錄的功能 - 是的答案仍然是良好的立場截至目前。 – 2017-03-04 07:56:01
我不打算爭論,因爲我使用下面發佈的答案中的代碼,它按預期工作。無需擺弄圖形或過濾器(這一切都在引擎蓋下)。我的代碼看起來就像一個普通的MF代碼,沒有DirectShow會引起混亂。 – YePhIcK 2017-03-04 08:05:28