locked
MFSourceReader - sample allocator is not set

    Question

  • Hi!

    Preamble - i need to read samples from file, process samples with DirectX and next write it to sink. For that i'd like to receive samples with DXGI buffers, to convert it to textures, do my stuffs and convert back to samples.

    I have source reader, configured to decode samples with MFVideoFormat_NV12 sub type , during initialization i passing IMFDXGIDeviceManager pointer using

    hr = spAttributes->SetUnknown(MF_SOURCE_READER_D3D_MANAGER, pDXGIManafer);
    

    i'm turned on HW support by calling 

    hr = spAttributes->SetUINT32(MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING, TRUE);
    

    all calls return S_OK.

    i tried to pass my DXGI device to video decoder

    hr = spVideoDecoder->ProcessMessage(MFT_MESSAGE_SET_D3D_MANAGER, manager);

    no luck, every time i'm calling ReadSample i'm receiving result = Samples allocator is not set.

    So my question is - how to set samples allocator on source reader?

    Monday, September 29, 2014 1:10 PM

Answers

  • Hello Dmitry,

    I don't believe that you can set the sample allocator directly. It is the responsibility of the decoder to create the sample allocator and manage samples via the IMFTrackedSample. If you provide a 3D3 manager then the decoder will query the manager for the device. My initial guess is that the device is not associated with the manager so the decoder can't allocate any samples. Try calling IMFDXGIDeviceManager.OpenDeviceHandle to verify that you have a device properly associated with the manager. Remember that you need to call IMFDXGIDeviceManager::ResetDevice to properly associate the device with the manager.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, September 29, 2014 11:47 PM
    Moderator

All replies

  • I'll ask our Media/DirectX expert to check this.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, September 29, 2014 8:42 PM
    Moderator
  • Hello Dmitry,

    I don't believe that you can set the sample allocator directly. It is the responsibility of the decoder to create the sample allocator and manage samples via the IMFTrackedSample. If you provide a 3D3 manager then the decoder will query the manager for the device. My initial guess is that the device is not associated with the manager so the decoder can't allocate any samples. Try calling IMFDXGIDeviceManager.OpenDeviceHandle to verify that you have a device properly associated with the manager. Remember that you need to call IMFDXGIDeviceManager::ResetDevice to properly associate the device with the manager.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, September 29, 2014 11:47 PM
    Moderator
  • Hi James,

    yes you were right, i did all the stuffs with initialization except OpenDeviceHandle ... 


    Wednesday, October 1, 2014 9:59 AM