共用方式為


裝置 MFT 支援 (Camera Profile V2)

例如,在 IHV/OEM 需要根據運行時間資訊發佈相機配置檔 (例如,一組驅動程式用於使用不同感測器的多個 SKU) ,相機驅動程式必須實作裝置 MFT 來發布相機配置檔。

在裝置 MFT 的 InitializeTransform 呼叫期間,DMFT 可以透過下列屬性提供 IMFSensorProfileCollection 介面來發佈相機配置檔:

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

此屬性必須透過 MF_DEVICEMFT_CONNECTED_FILTER_KSCONTROL 屬性,在提供給 DMFT 之 IMFTransform 的屬性存放區上設定。

下列程式代碼片段說明 InitializeTransform 方法期間 DMFT 如何提供新的相機配置檔。

在此範例中,讓我們進行一些假設:

  1. 這是 4 針腳相機。

  2. 釘選 0 – 擷取、釘選 1 – 預覽、釘選 2 – 相片和釘選 3 – 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...
 }

MF_DEVICEMFT_SENSORPROFILE_COLLECTION必須在 InitializeTransform () 方法傳回之前,發佈至連接的 IMFTransform 屬性存放區。

鏈結 DMFT

在裝置來源內鏈結多個 DMFT 的案例中,如果已啟用 Platform DMFT,則負責發佈相機配置檔的 DMFT 必須由 IHV/OEM 設定為下列 DevProxy 或 Platform DMFT 鏈結中的第一個轉換。

例如,支援在下列拓撲中從 IHV/OEM DMFT1 發佈相機配置檔:

鏈結的 D M F T。

在拓撲 1 和 2 中,只有 DMFT1 可以發佈相機配置檔。 DMFT2 所發行的任何相機配置檔都會被忽略。

M-in、N-out 裝置 MFT

Device MFT 支援的其中一項功能是能夠接受任意數目的輸入數據流,並公開不同的輸出數據流數目。

由於配置文件邏輯需要針腳標識碼來識別配置文件篩選資訊,因此針腳對應必須一致。

裝置 MFT 所發佈的 IMFSensorProfileCollection 必須根據 DMFT 的輸出針腳使用 Pin 編號。 在此情況下,釘選標識元必須符合輸出釘選屬性存放區上呈現的 MF_DEVICESTREAM_STREAM_ID 屬性。

若要避免可能的針腳標識符衝突,DMFT 必須移除MF_DEVICESTREAM_TRANSFORM_STREAM_ID。 MF_DEVICESTREAM_TRANSFORM_STREAM_ID只會由 DevProxy 呈現,而且只有在 DevProxy 的內容中才有意義。 若為 M-in、N-out DMFT,則MF_DEVICESTREAM_TRANSFORM_STREAM_ID未定義。

數位相機配置檔 V2 開發人員規格