修改部分1.
//在Capture的构造函数中和SetupGraph函数中
// 增加亮度传入参数int iBrightness
private void SetupGraph(DsDevice dev, int iWidth, int iHeight, short iBPP, Control hControl,int iBrightness)
{
...
}
修改部分2.
//在SetupGraph函数的如下位置增加对iBrightness的判断
if (iHeight + iWidth + iBPP > 0)
{
SetConfigParms(pRaw, iWidth, iHeight, iBPP);
}
if (iBrightness > 0)
{
SetBrightness(capFilter, iBrightness);
}
修改部分3.
//函数实现
private void SetBrightness(IBaseFilter capFilter, int iBrightness)
{
IAMVideoProcAmp videoProcAmp = capFilter as IAMVideoProcAmp;
int Val;
DirectShowLib.VideoProcAmpFlags Flags = VideoProcAmpFlags.Auto;
videoProcAmp.Get(VideoProcAmpProperty.Brightness, out Val, out Flags);
if (m_brightness != 0)
{
videoProcAmp.Set(VideoProcAmpProperty.Brightness, m_brightness, Flags);
}
else
{
...
}
//在Capture的构造函数中和SetupGraph函数中
// 增加亮度传入参数int iBrightness
private void SetupGraph(DsDevice dev, int iWidth, int iHeight, short iBPP, Control hControl,int iBrightness)
{
...
}
修改部分2.
//在SetupGraph函数的如下位置增加对iBrightness的判断
if (iHeight + iWidth + iBPP > 0)
{
SetConfigParms(pRaw, iWidth, iHeight, iBPP);
}
if (iBrightness > 0)
{
SetBrightness(capFilter, iBrightness);
}
修改部分3.
//函数实现
private void SetBrightness(IBaseFilter capFilter, int iBrightness)
{
IAMVideoProcAmp videoProcAmp = capFilter as IAMVideoProcAmp;
int Val;
DirectShowLib.VideoProcAmpFlags Flags = VideoProcAmpFlags.Auto;
videoProcAmp.Get(VideoProcAmpProperty.Brightness, out Val, out Flags);
if (m_brightness != 0)
{
videoProcAmp.Set(VideoProcAmpProperty.Brightness, m_brightness, Flags);
}
else
{
...
}
}
以上仅做简单实现