Nicholas Hu
Nicholas Hu

Reputation: 33

How to control camera capture display in MediaFoundation?

I wonder which MediaFoundation API can I use to control the brightness, contrast, hue and saturation etc? I find IMFVideoProcessor::SetProcAmpValues can modify these attributes, but these attributes are modified in graphics card; I want to modify these by capture device or by MediaFoundation interface within AVStream. thank you!

Upvotes: 3

Views: 1878

Answers (1)

Eldar
Eldar

Reputation: 164

that will be the same as in DirectShow : acquire a IMFMediaSource for your video capture device and then query the IAMVideoProcAmp interface :

 IMFMediaSource * pSource = NULL;
 ...
 IAMVideoProcAmp *pProcAmp = NULL;
 hr = pSource->QueryInterface(IID_PPV_ARGS(&pProcAmp));
 if (SUCCEEDED(hr))
 {
    long lMin, lMax, lStep, lDefault, lCaps;
    hr = pProcAmp->GetRange(
                      VideoProcAmp_Brightness, 
                      &lMin, 
                      &lMax, 
                      &lStep, 
                      &lDefault, 
                      &lCaps
    );

    if (SUCCEEDED(hr))
    {
       hr = pProcAmp->Set(
                       VideoProcAmp_Brightness, 
                       lMax, 
                       VideoProcAmp_Flags_Manual
       );
    }
 }

Upvotes: 4

Related Questions