HRESULT: 0xC00D5212 when trying to play an mp2 encoded wav file with NAudio library

0

I am writing a simple audio player with ASIO and MIDI control support that is going to be used by a local radio station. I am using the NAudio library. The station uses some weird ancient software that uses mp2 encoded wav files. The file itself plays fine on all windows versions in WMP or VLC Players it also plays fine with my player on Windows 10, but many computers there are still running Windows 7 and when I try to play the file on windows 7, the program throws an exception:

System.Runtime.InteropServices.COMException (0xC00D5212): Výjimka na základě hodnoty HRESULT: 0xC00D5212
   v NAudio.MediaFoundation.IMFSourceReader.SetCurrentMediaType(Int32 dwStreamIndex, IntPtr pdwReserved, IMFMediaType pMediaType)
   v NAudio.Wave.MediaFoundationReader.CreateReader(MediaFoundationReaderSettings settings)
   v NAudio.Wave.MediaFoundationReader.Init(MediaFoundationReaderSettings initialSettings)
   v NAudio.Wave.MediaFoundationReader..ctor(String file)

which I believe is "Missing codec", do any of you have any idea how to get around this? I am using the MediaFoundationReader() in the NAudio library.

vb.net
audio
naudio
asked on Stack Overflow Apr 7, 2020 by anonyfous

1 Answer

0

It seems that it is hard to get a MF enabled MP2 codec for Widows 7. I ended up using the NLayer library and edited the AudioFileReader type in NAudio library si that it can understand the MP2 WAV file.

answered on Stack Overflow Apr 8, 2020 by anonyfous

User contributions licensed under CC BY-SA 3.0