directshow issue  
Author Message
vishuonline





PostPosted: Smart Devices Native C++ Development, directshow issue Top

Hi,

I am using directshow graphs in my application for accessing the embedded camera(PPC and SPs).

I am not using a graphmanager; I contrust the graph manually, by adding the required filters.

An overview of my Graph: To the VideoCapture filter, I connect the SmartTee. The Render Output pin of the SmartTee is connected to the VideoRenderer; The Capture Output Pin of the SmartTee is connected to the input pin of my custom NULLRenderer filter. In this filter, I register a custom app callback function in which I perform my image processing operations on the frames received.

Ok. Now the problem I am facing is changing the camera / viewfinder properties. In varying lighting conditions, I need to be able to adjust the properties like Brightness, contrast, etc. I tried using the IAMProcControl interface, but they did NOT seem to work.

{ The images I am receiving in this pipeline is YUV12. My image processing routine is functioning good for this image format; So I am not interested in considering a change in this section}

I am hopeful that there is a way to change these properties. Can anyone throw some light on this

Best Regards,




Smart Device Development18  
 
 
Alex Feinman





PostPosted: Smart Devices Native C++ Development, directshow issue Top

I have not tried this, but check if your capture filter supports IAMVideoProcAmp interface. This is unless you meant that interface when you said "IAMProcControl" - I am not aware of such interface.

 
 
vishuonline





PostPosted: Smart Devices Native C++ Development, directshow issue Top

Yes; sorry for the typo.I had meant the IAMVideoProcAmp interface.

My device's capture filter does support this interface. For verification I get the VideoProcAmp flags on the camera properties like Brightness, Contrast, gamma, etc to be VideoProcAmp_Flags_Manual.

By this I am assuming that the driver supports manipulation of these properties programmatically; eventhough the msdn documentation seems to be misleading in this instance; http://msdn.microsoft.com/library/default.asp url=/library/en-us/directshow/htm/videoprocamppropertyenumeration.asp

But when the graph is running and I alter the stream properties using this interface through Get and Set functions on VideoProcAmp_Brightness, VideoProcAmp_Contrast and VideoProcAmp_Gamma, I dont see any difference in the images in the viewfinder / renderer. I tried changing the properties one at a time, and changing the value not in increments / decrements by 1 unit, but by 5 units; but of no avail.

Please throw some light on this.

Best Regards



 
 
Alex Feinman





PostPosted: Smart Devices Native C++ Development, directshow issue Top

I've done some tests using CameraCapture sample from WM5 SDK and my iMate JAMin. It looks like not only controlling the values via filtergraph does not work but even trying to change them using the camera application produces no visible result.

I assume that you are

a) Checking the HRESULT returned by IAMVideoProcAmp->SetValue()

b) Use increments that are multiples of delta returned by GetRange call



 
 
vishuonline





PostPosted: Smart Devices Native C++ Development, directshow issue Top

Yes. I am checking the returned HRESULT from the seting operation. It is a SUCCESS.

I am assuming that by SetValue on IAMVideoProcAmp interface, you meant Set() function right. Because I did not find any setValue function in that interface. Also I did increment and decrement by the deltas returned by the GetRange; still NO perceptible difference in the images. DO you know of any sample project anywhere which does somthing like this, for reference



 
 
Alex Feinman





PostPosted: Smart Devices Native C++ Development, directshow issue Top

Right, I meant Set.

I don't know of any device project that does it, but I remember writing a brightness/contrast adjust tool for Media Center 2004 where I would connect to a capture graph (capturing from a TV tuner) and get IAMVideoProcAmp to do this



 
 
englund





PostPosted: Smart Devices Native C++ Development, directshow issue Top

Check out the free videoInput library:
http://muonics.net/school/spring05/videoInput/
I recently contributed support for getting and setting video and camera properties.

Example of the code:

// Set a video signal setting using IAMVideoProcAmp
bool videoInput:Tongue TiedetVideoSetting(int deviceID, long Property, long lValue, long Flags, bool useDefaultValue)
{
IAMVideoProcAmp *pAMVideoProcAmp;
if(isDeviceSetup(deviceID))
{
if (verbose) printf("Setting video setting %ld.\n", Property);
HRESULT hr = VDList[deviceID]->pVideoInputFilter->QueryInterface(IID_IAMVideoProcAmp, (void**)&pAMVideoProcAmp);
if (FAILED(hr)) {
printf("Error\n");
return false;
}
else
{
long CurrVal, Min, Max, SteppingDelta, Default, CapsFlags, AvailableCapsFlags;
pAMVideoProcAmp->GetRange(Property, &Min, &Max, &SteppingDelta, &Default, &AvailableCapsFlags);
if (verbose) printf("Range for video setting %ld: Min:%ld Max:%ld SteppingDelta:%ld Default:%ld Flags:%ld\n", Property, Min, Max, SteppingDelta, Default, AvailableCapsFlags);
pAMVideoProcAmp->Get(Property, &CurrVal, &CapsFlags);
if (verbose) printf("Current value: %ld Flags %ld (%s)\n", CurrVal, CapsFlags, (CapsFlags == 1 "Auto" : (CapsFlags == 2 "Manual" : "Unknown")));
if (useDefaultValue) {
pAMVideoProcAmp->Set(Property, Default, VideoProcAmp_Flags_Auto);
}
else
{
// Perhaps add a check that lValue and Flags are within the range aquired from GetRange above
pAMVideoProcAmp->Set(Property, lValue, Flags);
}
pAMVideoProcAmp->Release();
return true;
}
}
return false;
}


/Lars