How to switch "KSPROPERTY_CAMERACONTROL_EXTENDED_FACEAUTH_MODE" property into other v

Hi,

I want to develop an application for testing Windows Hello (IR Camera) driver.
I’ve tried to follow the “Windows Hello camera driver bring up guide” to switch the Face Authentication mode into?KSCAMERA_EXTENDEDPROP_FACEAUTH_MODE_ALTERNATIVE_FRAME_ILLUMINATION.

But I failed to invoke any KSPROPERTYSETID_ExtendedCameraControl via IKsControl::KsProperty. I always got the error code: 0x80070057 (Invalid argument).

Does Microsoft allow applications to issue?KSPROPERTYSETID_ExtendedCameraControl?

Or,?KSPROPERTY_CAMERACONTROL_EXTENDED_FACEAUTH_MODE must be set by Windows Biometric Framework or WinRT MediaCapture?
I couldn’t find the sample code or API in these two frameworks to switch the face authentication mode…

Could anyone help me? Any hints are very welcome!

Thank you,
Joe

xxxxx@msn.com wrote:

I want to develop an application for testing Windows Hello (IR Camera) driver.
I’ve tried to follow the “Windows Hello camera driver bring up guide” to switch the Face Authentication mode into?KSCAMERA_EXTENDEDPROP_FACEAUTH_MODE_ALTERNATIVE_FRAME_ILLUMINATION.

But I failed to invoke any KSPROPERTYSETID_ExtendedCameraControl via IKsControl::KsProperty. I always got the error code: 0x80070057 (Invalid argument).

Have you tried IKsPropertySet:QuerySupported, or
KSPROPERTY_TYPE_SETSUPPORT, or KSPROPERTY_TYPE_BASICSUPPORT to see if
the camera actually advertises these properties?

Did you notice that this is a pin property, not a filter property?

Does Microsoft allow applications to issue?KSPROPERTYSETID_ExtendedCameraControl?

The biometric framework and WinRT MediaCapture interface are both
user-mode interfaces.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi Tim,

Thanks for your reply.

IKsPropertySet looks like a DirectShow Interface, but I’m using Media Foundation to develop application.
Is there any code example to query IKsPropertySet interface from IMFMediaSource?
I failed to query it and got an error (hresult = 0x80070032).
Is any difference between IKsPropertySet and IKscontrol::KsProperty?

I didn’t notice it’s a pin property. Thank you for the reminder.

However, I’m a beginner in Media Foundation.
How does IKscontrol::KsProperty set a pin property?
Is it a different way for application to set a pin property? (c.f. filter property)
Could you hint me more information?

Thank you so much.
Joe

On Jul 4, 2017, at 4:17 AM, xxxxx@msn.com wrote:

IKsPropertySet looks like a DirectShow Interface, but I’m using Media Foundation to develop application.

Well, so is IKsControl, for that matter. Both are provided by their respective proxies, ksproxy.ax in the DirectShow case, devproxy.dll in the Media Foundation case.

Is there any code example to query IKsPropertySet interface from IMFMediaSource?

Querying one interface for another interface is not specific to any single API. The mechanism is universal to COM. Assuming you are using the ATL wrappers:

CComQIPtr paps( m_MediaSource );

> I failed to query it and got an error (hresult = 0x80070032).

Hmm, ERROR_NOT_SUPPORTED.

> However, I’m a beginner in Media Foundation.
> How does IKscontrol::KsProperty set a pin property?
> Is it a different way for application to set a pin property? (c.f. filter property)
> Could you hint me more information?

Why don’t you show us your current code? I know how to do it in DirectShow, but Media Foundation has not been relevant to my clients. In DirectDhow, you have a filter object, and each filter object exposes a number of pin objects. You have to get the IKsControl interface from the proper pin object.

Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi Tim,

I tired it again with CComQIPtr, and I still couldn’t query IKsPropertySet.
In addition, I also tried CComPtr, and I got the error code 0x80004002 (E_NOINTERFACE, No such interface supported) when invoking QueryInterface.

Here is the code snippet that queries IKsPropertySet by CComPtr:

IMFMediaSource *mediaSource = NULL;
CComPtr ksProperty;
hr = pSource->GetCaptureDeviceSource(MF_CAPTURE_ENGINE_DEVICE_TYPE_VIDEO, &mediaSource);
if (SUCCEEDED(hr)) {
if (mediaSource == NULL)
printf(“Fail to get IMFMediaSource\n”);
else
printf(“OK to get IMFMediaSource\n”);

/* Try to query IKsPropertySet /
hr = mediaSource->QueryInterface(__uuidof(IKsPropertySet), (void
*)&ksProperty);
if (SUCCEEDED(hr))
printf(“OK to Query ksProperty\n”);
else
printf(“failed to Query ksProperty %x\n”, hr); // Failed and got 0x80004002 here
}


Besides, here is the code snippet that I used IKsControl::KsProperty to set KSPROPERTY_CAMERACONTROL_EXTENDED_FACEAUTH_MODE:

IKsControl *ksControl = NULL;
IMFMediaSource *mediaSource = NULL;
hr = pSource->GetCaptureDeviceSource(MF_CAPTURE_ENGINE_DEVICE_TYPE_VIDEO, &mediaSource);
if (SUCCEEDED(hr)) {
hr = mediaSource->QueryInterface(IID_PPV_ARGS(&ksControl));
}

if (SUCCEEDED(hr))
{
KSCAMERA_EXTENDEDPROP_HEADER myheader = { 0 };
KSPROPERTY myProperty = {
KSPROPERTYSETID_ExtendedCameraControl,
KSPROPERTY_CAMERACONTROL_EXTENDED_FACEAUTH_MODE,
KSPROPERTY_TYPE_SET
};
myheader.Version = 1;
myheader.PinId = 0;
myheader.Size = sizeof(KSCAMERA_EXTENDEDPROP_HEADER) + sizeof(KSCAMERA_EXTENDEDPROP_VIDEOPROCSETTING);
myheader.Flags = KSCAMERA_EXTENDEDPROP_FACEAUTH_MODE_ALTERNATIVE_FRAME_ILLUMINATION;

DWORD bytesReturned = 0;
hr = ksControl->KsProperty((PKSPROPERTY)&myProperty, sizeof(myProperty), &myheader, sizeof(myheader), &bytesReturned);
if (FAILED(hr)) {
printf(“Fail to set KsProperty with error code: %x\n”, hr); // Failed and got 0x80070057
}
}

Many thanks!
Joe

xxxxx@msn.com wrote:

I tired it again with CComQIPtr, and I still couldn’t query IKsPropertySet.
In addition, I also tried CComPtr, and I got the error code 0x80004002 (E_NOINTERFACE, No such interface supported) when invoking QueryInterface.

Media Foundation tries to hide the concept of pins, but they’re still
there. I don’t know the mapping. Maybe you have to have to use the
IMFTopology and fetch a particular node, but I’m just making that up. I
was never clear why Microsoft invented Media Foundation in the first
place. As far as I can tell, it has fewer capabilities and more
restrictions than DirectShow.

By the way, you might look into converting everything to CComPtr and
CComQIPtr, just to alleviate the reference counting burden, if nothing
else. The QueryInterface call becomes literally nothing more than one
statement:

CComQIPtr ksProperty( mediaSource );
CComQIPtr ksControl( mediaSource );


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.