Prise en charge de L’appareil MFT (Profil caméra V2)
Dans les scénarios où les IHV/OEM doivent publier des profils d’appareil photo en fonction des informations d’exécution (par exemple, un ensemble de pilotes utilisés pour plusieurs références SKU qui utilisent différents capteurs), les pilotes de caméra doivent implémenter un MFT d’appareil pour publier les profils d’appareil photo.
Pendant l’appel InitializeTransform de Device MFT, le DMFT peut publier des profils d’appareil photo en fournissant l’interface IMFSensorProfileCollection via l’attribut suivant :
// MF_DEVICEMFT_SENSORPROFILE_COLLECTION
// Data type: IUnknown
// IMFSensorProfileCollection interface that SGT Factory can provide to indicate new
// profiles available to the SG generation.
cpp_quote("EXTERN_GUID(MF_DEVICEMFT_SENSORPROFILE_COLLECTION, 0x36EBDC44, 0xB12C, 0x441B, 0x89, 0xF4, 0x08, 0xB2, 0xF4, 0x1A, 0x9C, 0xFC );")
Cet attribut doit être défini sur le magasin d’attributs de l’imfTransform fourni au DMFT via l’attribut MF_DEVICEMFT_CONNECTED_FILTER_KSCONTROL.
Le morceau de code suivant illustre comment le DMFT pendant la méthode InitializeTransform peut fournir un nouveau profil d’appareil photo.
Pour cet exemple, nous allons faire quelques hypothèses :
Il s’agit d’une caméra à 4 broches.
Épingler 0 – Capture, Épingler 1 – Aperçu, Épingler 2 – Photo et Épingler 3 – flux IR.
IFACEMETHODIMP
SampleDMFT::InitializeTransform(
_In_ IMFAttributes *pAttributes
)
{
ComPtr<IMFTransform> spTransform;
ComPtr<IMFAttributes> spAttributes;
ComPtr<IMFSensorProfileCollection> spProfileCollection;
ComPtr<IMFSensorProfile> spProfile;
if (nullptr == pAttributes)
{
return E_INVALIDARG;
}
RETURN_IF_FAILED (pAttributes->GetUnknown(MF_DEVICEMFT_CONNECTED_FILTER_KSCONTROL,
IID_PPV_ARGS(&spTransform)));
RETURN_IF_FAILED (spTransform->GetAttributes(&spAttributes));
// Create an empty collection...
RETURN_IF_FAILED (MFCreateSensorProfileCollection(&spProfileCollection));
// Create various profiles we want to publish.
// For the legacy profile, we don't want to expose the IR stream since
// legacy apps will not be able to consume it.
RETURN_IF_FAILED (MFCreateSensorProfile(KSCAMERAPROFILE_Legacy, 0, nullptr, &spProfile));
RETURN_IF_FAILED (spProfile->AddProfileFilter(0, L"((RES==;FRT<=30,1;SUT==))"));
RETURN_IF_FAILED (spProfile->AddProfileFilter(1, L"((RES==;FRT<=30,1;SUT==))"));
RETURN_IF_FAILED (spProfile->AddProfileFilter(2, L"((RES==;FRT<=30,1;SUT==))"));
RETURN_IF_FAILED (spProfile->AddProfileFilter(3, L"(!)"));
RETURN_IF_FAILED (spProfileCollection->AddProfile(spProfile));
spProfile = nullptr;
// For the High Frame Rate recording profile, we only support 60fps or
// higher on the record pin and any on the preview (since preview only
// exposes 30fps).
RETURN_IF_FAILED (MFCreateSensorProfile(KSCAMERAPROFILE_HighFrameRate, 0, nullptr, &spProfile));
RETURN_IF_FAILED (spProfile->AddProfileFilter(0, L"((RES==;FRT>=60,1;SUT==))"));
RETURN_IF_FAILED (spProfile->AddProfileFilter(1, L"((RES==;FRT==;SUT==))"));
RETURN_IF_FAILED (spProfile->AddProfileFilter(2, L"(!)"));
RETURN_IF_FAILED (spProfile->AddProfileFilter(3, L"(!)"));
RETURN_IF_FAILED (spProfileCollection->AddProfile(spProfile));
spProfile = nullptr;
// For the Face Auth, we can handle any media type on the preview but we
// want to remove the photo and record pins and allow the IR pin to only
// expose one media type: VGA@60fps with L8.
RETURN_IF_FAILED (MFCreateSensorProfile(KSCAMERAPROFILE_FaceAuth_Mode, 0, nullptr, &spProfile));
RETURN_IF_FAILED (spProfile->AddProfileFilter(0, L"(!)"));
RETURN_IF_FAILED (spProfile->AddProfileFilter(1, L"((RES==;FRT==;SUT==))"));
RETURN_IF_FAILED (spProfile->AddProfileFilter(2, L"(!)"));
RETURN_IF_FAILED (spProfile->AddProfileFilter(3, L"((RES==640,480;FRT==60,1;SUT==L8))"));
RETURN_IF_FAILED (spProfileCollection->AddProfile(spProfile));
spProfile = nullptr;
// Set the profile collection to the attribute store of the IMFTransform.
RETURN_IF_FAILED (spAttributes->SetUnknown(MF_DEVICEMFT_SENSORPROFILE_COLLECTION,
spProfileCollection));
// ... Reset of the InitializeTransform logic...
}
Le MF_DEVICEMFT_SENSORPROFILE_COLLECTION doit être publié dans le magasin d’attributs de l’IMFTransform connecté avant que la méthode InitializeTransform() ne retourne.
DMFT chaîné
Dans le scénario où plusieurs DMFT sont chaînés au sein de la source de l’appareil, le DMFT responsable de la publication du profil caméra doit être configuré par l’IHV/OEM en tant que première transformation de la chaîne suivant DevProxy ou Platform DMFT si la plateforme DMFT est activée.
Par exemple, la publication de profils d’appareil photo à partir d’IHV/OEM DMFT1 dans les topologies suivantes est prise en charge :
Dans la topologie 1 et 2, seul DMFT1 peut publier des profils d’appareil photo. Tout profil d’appareil photo publié par DMFT2 sera ignoré.
M-in, N-out Appareil MFT
L’une des fonctionnalités prises en charge par les appareils MFT est la possibilité d’accepter un nombre arbitraire de flux d’entrée et d’exposer un nombre différent de flux de sortie.
Étant donné que la logique de profil nécessite un ID de broche pour identifier les informations de filtre de profil, le mappage de broches doit être cohérent.
La collection IMFSensorProfileCollection publiée par l’appareil MFT doit utiliser la numérotation d’épingle basée sur la broche de sortie du DMFT. Dans ce cas, l’ID de code pin doit correspondre à l’attribut MF_DEVICESTREAM_STREAM_ID présenté dans le magasin d’attributs de la broche de sortie.
Pour éviter une collision possible avec l’ID de broche, le DMFT doit supprimer le MF_DEVICESTREAM_TRANSFORM_STREAM_ID. Le MF_DEVICESTREAM_TRANSFORM_STREAM_ID est présenté uniquement par le DevProxy et n’est significatif que dans le contexte du DevProxy. Pour un DMFT M-in, N-out, le MF_DEVICESTREAM_TRANSFORM_STREAM_ID n’est pas défini.