-
December 7th, 2011, 11:02 AM
#1
Configure Video Parameters
Hi!
I am doing a ATL Project to control the video parameters of a camera: brightness, hue, saturation, ... I dont want to use the ISpecifyPropertyPages, because I just want to allow the final user to control some settings, so I'm using IAMVideoProcAmp (http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx), but it's not working.
I added a method to the class called start just to test this feature:
Code:
STDMETHODIMP CTest::start(void)
{
IBaseFilter * sourceFilter;
HRESULT hr;
ICreateDevEnum *pCreateDevEnum=0;
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
IID_ICreateDevEnum, (void**)&pCreateDevEnum);
if(hr != NOERROR)
{
MessageBox(NULL, L"Error Creating Device Enumerator", NULL, NULL);
}
IEnumMoniker *pEm=0;
hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEm, 0);
if(hr != NOERROR)
{
MessageBox(NULL, L"Sorry, you have no video capture hardware.\r\n\r\nVideo capture will not function properly.", NULL, NULL);
}
pEm->Reset();
ULONG cFetched;
IMoniker *pM;
while(hr = pEm->Next(1, &pM, &cFetched), hr==S_OK)
{
IPropertyBag *pBag=0;
hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag);
if(SUCCEEDED(hr))
{
VARIANT var;
var.vt = VT_BSTR;
hr = pBag->Read(L"FriendlyName", &var, NULL);
if(hr == NOERROR)
{
SysFreeString(var.bstrVal);
}
pBag->Release();
}
hr = pM->BindToObject(0, 0, IID_IBaseFilter, (void**)&sourceFilter);
if(FAILED(hr)) {
MessageBox(NULL, L"Unable to bind...", NULL, NULL);
} else {
IAMVideoProcAmp * cenas;
hr = sourceFilter->QueryInterface(IID_IAMVideoProcAmp, (void**)&cenas);
if(FAILED(hr)) {
MessageBox(NULL, L"Couldn't get interface", NULL, NULL);
} else {
LONG min, max, ste, def, fla;
hr = cenas->GetRange(VideoProcAmp_Brightness, &min, &max, &ste, &def, &fla);
if(FAILED(hr)) {
MessageBox(NULL, L"The device does not support this property", NULL, NULL);
}
}
}
pM->Release();
}
pEm->Release();
return S_OK;
}
Using this code I always get the message box telling me "The device does not support this property". I also tried other properties, but I get always that message box.
When I use GraphEditPlus, I'm able to see the properties page and change the values.
What Am I doing wrong?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|