locked
WavSource doesn't work? RRS feed

  • Question

  • Hi all,

    I am trying to make the MF WavSource sample to work.

    I can compile it with not problem and I am sure it is registred correctly.

    However, when I try to load a wav file (with .xyz extension) using BasicPlayback or TopoEdit, I get the error "failed to create source node. The byte stream type of the given URL is unsupported."

    I enabled the error reports to debug and I got :

    Source Resolver Context(0x7d83d70) Trying Byte Scheme Handler CLSID("WAVE Source ByteStreamHandler")
    Source Resolver Context(0x7d83d70) Byte stream Handler Result 0x80040111       ????
    Source Resolver Context(0x7d83d70) SchemeHandler Result 0xC00D36C4      (which is MF_E_UNSUPPORTED_BYTESTREAM_TYPE)

    I got this error either in pure C++ or in the MediaFoundation.net sample and I am on Windows 10 x64.

    Any idea?

    Tuesday, July 5, 2016 4:41 PM

Answers

  • Found my mistake using MFTrace.exe

    6416,3B3C 10:31:03.45433 
    COle32ExportDetours::CoCreateInstance @ Failed to create {CFF2D529-0D61-463A-9049-BD9611004E02} 
    WAVE Source ByteStreamHandler (C:\Users\<username>\Source\mediafoundation\wavsource\Release\WavSource.dll) 
    hr=0x80040111 CLASS_E_CLASSNOTAVAILABLE

    It look like I didn't changed the GUID everywhere in the project :( First time I create a COM object.

    WavSource works now :)

    And it was a similar problem with my custom media source in .NET.

    8744,2C78 11:45:07.42117
    COle32ExportDetours::CoCreateInstance @ Failed to create {B2C8B1AF-A0CC-4A47-9F4C-9764CF1CBF6E} 
    WavSourceFilter.CWavByteStreamHandler (mscoree.dll) 
    hr=0x80070002 ERROR_FILE_NOT_FOUND
    

    Here I used a tool called FUSLOGVW.exe to see that CoCreateInstance try to load the assembly not where it was registered but in the Global Assembly Cache (GAC), or in the caller directory. So I copied my assembly in the topoedit folder, run regasm and it work :)

    Thank you all,

    • Marked as answer by DBriard Wednesday, July 6, 2016 1:05 PM
    Wednesday, July 6, 2016 1:05 PM

All replies

  • Hi

    Have you modified the WaveSource sample, or are you just compiling it and then calling DllRegisterServer ?

    It should be obvious that the unmodified source handles only files with .wav extension. I dont know much about xyz container, but even if it is some kind of an uncompressed pcm wave container, the source will only work with .wav files.

    If you want to support files with .xyz extension you have to modify the source. If the xyz container is nearly or exactly the same as a wav container then the modifications needed are small to nothing.

    I googled 2 seconds and the first thing that popped up was the Windows 7 SDK ( on github ), and thats where the WaveSource sample is originated. click on the link and then scroll down and read :

    - > WaveSource ( click me ) <-

    There it is already mentioned that the WaveSource sample will only be registered for .xyz extension when WRP is protecting the Windows built-in wave handler in Windows 7. I dont know how it behaves in later Windows versions, but i think you can easily register the source for .xyz extension.

    The doc there also states that you can simply rename .xyz files to .wav files and they can be handled by the source. Reading that my assumption is that .xyz must be compatible or equal to .wav containers. It should be fairly simpe to mod the WaveSource and register it for the .xyz file extension.

    Regards,

    Francis



    Tuesday, July 5, 2016 6:23 PM
  • Hi Francis and thank you for your long reply.

    I haven't modified the sample except changing the GUID. The sample is already based on the xyz extension as you can see in the code below:

    #if NTDDI_VERSION < 0x06010000
    #define SZ_FILE_EXT L".wav"
    #else
    #define SZ_FILE_EXT L".xyz"
    #endif
    

    I registred the dll using RegSvr32, the keys are correctly added to the registry and I know that the WavByteStreamHandle is found as I can see "WAVE Source ByteStreamHandler" in the Windows event reports.

    However, I get an error when I try to open a wav file renamed with .xyz and I don't know how to debug more.

    I try to put a Logs into each of the four methods of CWavByteStreamHandler (BeginCreateObject, GetMaxNumberOfBytesRequiredForResolution etc...) but I don't see my trace in the log file.

    I the first place, I wanted to create a custom media source for Still Images and I got the same error, then I discovered that I have the exact same error with the original sample too. I tried with the wav files from the Windows/Media folder (Alarm01.wav).

    In the following trace, I don't know what the result 0x80040111 is, can't find the corresponding HRESULT.

    Source Resolver Context(0x7d83d70) Byte stream Handler Result 0x80040111

    About the extensions, I think it is only used to lookup the ByteStreamHandler.

    Any other idea?

    Best regards,

    Wednesday, July 6, 2016 5:52 AM
  • Here is my compiled (with VC2013) DLL: https://we.tl/BtDjVCeOYv

    I registered it directly in the Release folder.
    Wednesday, July 6, 2016 5:58 AM
  • Found my mistake using MFTrace.exe

    6416,3B3C 10:31:03.45433 
    COle32ExportDetours::CoCreateInstance @ Failed to create {CFF2D529-0D61-463A-9049-BD9611004E02} 
    WAVE Source ByteStreamHandler (C:\Users\<username>\Source\mediafoundation\wavsource\Release\WavSource.dll) 
    hr=0x80040111 CLASS_E_CLASSNOTAVAILABLE

    It look like I didn't changed the GUID everywhere in the project :( First time I create a COM object.

    WavSource works now :)

    And it was a similar problem with my custom media source in .NET.

    8744,2C78 11:45:07.42117
    COle32ExportDetours::CoCreateInstance @ Failed to create {B2C8B1AF-A0CC-4A47-9F4C-9764CF1CBF6E} 
    WavSourceFilter.CWavByteStreamHandler (mscoree.dll) 
    hr=0x80070002 ERROR_FILE_NOT_FOUND
    

    Here I used a tool called FUSLOGVW.exe to see that CoCreateInstance try to load the assembly not where it was registered but in the Global Assembly Cache (GAC), or in the caller directory. So I copied my assembly in the topoedit folder, run regasm and it work :)

    Thank you all,

    • Marked as answer by DBriard Wednesday, July 6, 2016 1:05 PM
    Wednesday, July 6, 2016 1:05 PM