MF_SA_D3D_ALLOCATE_DISPLAYABLE_RESOURCES 특성

MFT의 SA(샘플 할당자)가 D3D11_RESOURCE_MISC_SHARED_DISPLAYABLE 플래그를 사용하여 기본 Direct3D 텍스처를 할당해야 하는지를 지정합니다.

데이터 형식

UINT32

설명

이 특성은 Windows 10 빌드 20348을 사용하여 응시할 수 있습니다.

참고

D3D11_RESOURCE_MISC_FLAG 열거형의 D3D11_RESOURCE_MISC_SHARED_DISPLAYABLE 멤버 필드는 향후 SDK 릴리스에서 사용할 수 있습니다.

Media Foundation 플랫폼 계층은 비디오를 렌더링할 때 MF_SA_D3D11_ALLOCATE_DISPLAYABLE_RESOURCES 특성을 설정합니다. 앱은 자체 비디오 렌더러를 구현하고 D3D11 표시 가능한 리소스를 사용하려는 경우 이 특성을 설정하도록 선택할 수도 있습니다.

예제

다음 코드 예제에서는 MF_SA_D3D11_ALLOCATE_DISPLAYABLE_RESOURCES 특성의 사용을 보여 줍니다.

class DecoderMFT : public IMFAttributes, public IMFTransform 
{ 
    //  
    ... Other implementation details omitted 
    // 

public: 
    // Implementation of IMFAttributes::GetAttributes which is invoked by the MF Topology Loader 
    STDMETHODIMP GetAttribtues(IMFAttributes** attributes) 
    { 
        m_attributes.copyTo(attributes); 
        return S_OK; 
    } 

 

private: 
    // Private method to be called before DecoderMFT initializes its sample pool. 
    // A good place for this to happen is in the method which processes the  
    // 'MFT_MESSAGE_NOTIFY_BEGIN_STREAMING' event. 
    // At a minimum, this processing would be in DecoderMFT's implementation of IMFTransform::ProcessMessage.  

    HRESULT ConfigureTextureFlags() 
    { 
        UINT32 allocateDisplayables = MFGetAttributeUINT32(m_attributes.get(), 
            MF_SA_D3D11_ALLOCATE_DISPLAYABLE_RESOURCES, 0); 

        // If no MF_SA_* attributes which correspond to D3D misc flags are set then it is valid for 
        // miscFlags to be set to 0. 
        m_textureDesc.miscFlags = 0; 
        UINT32 sharedResources = 0; 

        if (allocateDisplayables != 0) 
        { 
            m_textureDesc.miscFlags |= D3D11_RESOURCE_MISC_DISPLAYABLE; 
            // The following flag is required for the decoders output to 
            // use D3D11_RESOURCE_MISC_DISPLAYABLE. 
            m_textureDesc.miscFlags |= D3D11_RESOURCE_MISC_EXCLUSIVE_WRITER; 

            // The following flags are required for the presentation API 
            // to consume and present these resources (also known as direct presentation). 
            m_textureDesc.miscFlags |= D3D11_RESOURCE_MISC_SHARED; 
            m_textureDesc.miscFlags |= D3D11_RESOURCE_MISC_SHARED_NTHANDLE; 

            sharedResources = 1; 
        } 
        else  
        { 
            // This handles the case when MF_SA_D3D11_ALLOCATE_DISPLAYABLE_RESOURCES was 0 or missing. 
            sharedResources = MFGetAttributeUINT32(m_attributes.get(), MF_SA_D3D11_SHARED_WITHOUT_MUTEX, 0); 

            if (sharedResources != 0) 
            { 
                m_textureDesc.miscFlags |= D3D11_RESOURCE_MISC_SHARED; 
            } 
            else 
            { 
                UINT32 sharedKeyMutex = MFGetAttributeUINT32(m_attributes.get(), MF_SA_D3D11_SHARED, 0); 

                if (sharedKeyMutex != 0) 
                { 
                    m_textureDesc.micsFlags |= D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX; 
                } 
            } 
        } 

        // Processing for other MF_SA_* attributes which imply D3D11_RESOURCE_MISC flag 
        // omitted from this sample. 

        return S_OK; 

    } 

    // Private method showing how DecoderMFT can create a texture with the flags required 
    // to satisfy "MF_SA_D3D11_ALLOCATE_DISPLAYBLE_RESOURCES".  
    // Because this is a private function we know the passed in pointer is always valid. 
    // This would be invoked by another private DecoderMFT function when allocating an MFSample 
    // for its sample pool. 

    HRESULT AllocateTextureForSample(ID3D11Texture2D** texture2D) 
    { 
        return m_d3dDevice->CreateTexture2D(&m_textureDesc, nullptr, texture2D); 
    } 

    // ... other members omitted 
    wil::com_ptr_nothrow<IMFAttributes> m_attributes; 
    wil::com_ptr_nothrow<ID3D11Device> m_d3dDevice; 

    // This a texture description for D3D11 resources. 
    D3D11_TEXTURE_2D_DESC m_textureDesc = {}; 

}; 

요구 사항

요구 사항
지원되는 최소 클라이언트
Windows 10 빌드 20348
헤더
Mftransform.h

추가 정보

미디어 파운데이션 특성의 사전순 목록

IMFAttributes::GetUINT32

IMFAttributes::SetUINT32

Media Foundation 특성