PDA

View Full Version : VCD properties, getRangeMin() problem



tsyba.y.a
August 1, 2017, 06:36:57
Hello!

I'am using DMK33GP2000e camera, the following code:

----------------------------------------------------------------------------------------------------------------------------------------------
bool SetBrightnessAbsolute(DShowLib::Grabber *pGrabber, double dBrigtness)
{
bool bOK = false;
DShowLib::tIVCDAbsoluteValuePropertyPtr pBrigtnessRange;
DShowLib::tIVCDSwitchPropertyPtr pBrigtnessAuto;

pBrigtnessRange = NULL;
pBrigtnessAuto = NULL;

if (pGrabber->isDevValid())
{
DShowLib::tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
if (pItems != 0)
{
// Try to find the exposure item.
DShowLib::tIVCDPropertyItemPtr pBrigtnessItem = pItems->findItem(DShowLib::VCDID_Brightness);
if (pBrigtnessItem != 0)
{
// Try to find the value and auto elements
DShowLib::tIVCDPropertyElementPtr pBrigtnessValueElement = pBrigtnessItem->findElement(DShowLib::VCDElement_Value);
DShowLib::tIVCDPropertyElementPtr pBrigtnessAutoElement = pBrigtnessItem->findElement(DShowLib::VCDElement_Auto);

// If an auto element exists, try to acquire a switch interface
if (pBrigtnessAutoElement != 0)
{
pBrigtnessAutoElement->getInterfacePtr(pBrigtnessAuto);
pBrigtnessAuto->setSwitch(false); // Disable auto, otherwise we can not set exposure.
}


// If a value element exists, try to acquire a range interface
if (pBrigtnessValueElement != 0)
{
pBrigtnessValueElement->getInterfacePtr(pBrigtnessRange);

double min = pBrigtnessRange->getRangeMin();
double max = pBrigtnessRange->getRangeMax();

if (dBrigtness < min)
{
dBrigtness = min;
}
else if (dBrigtness > max)
{
dBrigtness = max;
}

// Here we set the the exposure value.
pBrigtnessRange->setValue(dBrigtness);
bOK = true;
}
}
}
}
return bOK;
}
----------------------------------------------------------------------------------------------------------------------------------------------

And I have exception Thrown in IVCDPropertyInterfaces_inl.h

inline double IVCDAbsoluteValueProperty::getRangeMin() const
{
double rval;
----> HRESULT hr = get_RangeMin( &rval ); x
if( FAILED( hr ) ) throw hr;
return rval;
}



What is the problem?

I use similar code with Exposure, and it works properly.

Thank you in advance

Stefan Geissler
August 1, 2017, 09:31:18
Hello

DShowLib::tIVCDAbsoluteValuePropertyPtr pBrigtnessRange; does not exist. But the normal range interface for long values exists.