Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
A version of this page is also available for
4/8/2010
Video capture devices can support various properties that control the quality of the output, such as brightness, contrast, saturation, and so forth. To set these properties, do the following:
- Query the capture filter for the
IAMVideoProcAmp
interface.
- For each property that you want to control, call the
IAMVideoProcAmp::GetRangemethod. This method returns the range
of values that the device supports for that property, the default
value, and the minimum increments for the settings. The
IAMVideoProcAmp::Getmethod returns the current value of the
property. The
VideoProcAmpPropertyenumeration defines flags for each of the
properties.
- To set a property, call the
IAMVideoProcAmp::Setmethod. To restore a property to its
default value, use
IAMVideoProcAmp::GetRangeto find the default and pass that
value to the
IAMVideoProcAmp::Setmethod. You do not have to stop the filter
graph when you set the properties.
The following code configures a trackbar control so that it can be used to set the brightness. The range of the trackbar corresponds to the brightness range that the device supports, and position of the trackbar corresponds to the device's initial brightness setting.
Copy Code | |
---|---|
HWND hTrackbar; // Handle to the trackbar control. // Initialize hTrackbar (not shown). // Query the capture filter for the IAMVideoProcAmp interface. IAMVideoProcAmp *pProcAmp = 0; hr = pCap->QueryInterface(IID_IAMVideoProcAmp, (void**)&pProcAmp); if (FAILED(hr)) { // The device does not support IAMVideoProcAmp, so disable // the control. EnableWindow(hTrackbar, FALSE); } else { long Min, Max, Step, Default, Flags, Val; // Get the range and default value. hr = m_pProcAmp->GetRange(VideoProcAmp_Brightness, &Min, &Max, &Step, &Default, &Flags); if (SUCCEEDED(hr)) { // Get the current value. hr = m_pProcAmp->Get(VideoProcAmp_Brightness, &Val, &Flags); } if (SUCCEEDED(hr)) { // Set the trackbar range and position. SendMessage(hTrackbar, TBM_SETRANGE, TRUE, MAKELONG(Min, Max)); SendMessage(hTrackbar, TBM_SETPOS, TRUE, Val); EnableWindow(hTrackbar, TRUE); } else { // This property is not supported, so disable the control. EnableWindow(hTrackbar, FALSE); } } |