Freigeben über


Geräte-MFT-Unterstützung (Kameraprofil V2)

In Szenarien, in denen IHV/OEMs Kameraprofile basierend auf Laufzeitinformationen veröffentlichen müssen (z. B. ein Satz von Treibern, die für mehrere SKUs verwendet werden, die verschiedene Sensoren verwenden), müssen Kameratreiber ein Device MFT implementieren, um die Kameraprofile zu veröffentlichen.

Während des InitializeTransform-Aufrufs von Device MFT kann das DMFT Kameraprofile veröffentlichen, indem die IMFSensorProfileCollection-Schnittstelle über das folgende Attribut bereitgestellt wird:

// 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 );")

Dieses Attribut muss im Attributspeicher der IMFTransform festgelegt werden, die dem DMFT über das attribut MF_DEVICEMFT_CONNECTED_FILTER_KSCONTROL bereitgestellt wird.

Der folgende Codeabschnitt veranschaulicht, wie das DMFT während der InitializeTransform-Methode ein neues Kameraprofil bereitstellen kann.

Für dieses Beispiel werden einige Annahmen angenommen:

  1. Dies ist eine 4-polige Kamera.

  2. Pin 0 – Aufnahme, Pin 1 – Vorschau, Pin 2 – Foto und Pin 3 – IR-Stream.

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...
 }

Die MF_DEVICEMFT_SENSORPROFILE_COLLECTION muss im attributspeicher des verbundenen IMFTransform veröffentlicht werden, bevor die InitializeTransform()-Methode zurückgibt.

Verkettete DMFT

In dem Szenario, in dem mehrere DMFTs innerhalb der Gerätequelle verkettet sind, muss das für die Veröffentlichung des Kameraprofils zuständige DMFT vom IHV/OEM als erste Transformation in der Kette nach DevProxy oder Platform DMFT konfiguriert werden, wenn Plattform-DMFT aktiviert ist.

Beispielsweise wird das Veröffentlichen von Kameraprofilen aus IHV/OEM DMFT1 in den folgenden Topologien unterstützt:

verkettete D M F T.

In Topologie 1 und 2 darf nur DMFT1 Kameraprofile veröffentlichen. Alle von DMFT2 veröffentlichten Kameraprofile werden ignoriert.

M-in, N-out Device MFT

Eines der von Geräte-MFTs unterstützten Features ist die Möglichkeit, eine beliebige Anzahl von Eingabedatenströmen aufzunehmen und eine andere Anzahl von Ausgabedatenströmen verfügbar zu machen.

Da die Profillogik die Pin-ID erfordert, um die Profilfilterinformationen zu identifizieren, muss die Pinzuordnung konsistent sein.

Die vom Gerät MFT veröffentlichte IMFSensorProfileCollection muss die Pinnummerierung basierend auf dem Ausgabepin des DMFT verwenden. Die Pin-ID muss in diesem Fall mit dem MF_DEVICESTREAM_STREAM_ID-Attribut übereinstimmen, das im Attributspeicher des Ausgabenadels angezeigt wird.

Um mögliche Pin-ID-Kollisionen zu vermeiden, MUSS der DMFT die MF_DEVICESTREAM_TRANSFORM_STREAM_ID entfernen. Die MF_DEVICESTREAM_TRANSFORM_STREAM_ID wird nur vom DevProxy präsentiert und nur im Kontext des DevProxy sinnvoll. Bei einer M-In-, N-Out-DMFT ist die MF_DEVICESTREAM_TRANSFORM_STREAM_ID undefiniert.

Kameraprofil V2-Entwicklerspezifikation