Search code examples
c#c++windowsms-media-foundationdecoder

Decoding mp3 in windows 8.1 (universal App)


I'm new to C++/CX so the scenario is next:

I have a universal app windows 8.1 with c#, so I'd like to decode an mp3 from c#. Well I know that I can Use SharpDx, but I just not what to use it, my idea is really simple: using c++/cx and media foundation to decode mp3, and return a stream to c# so for example

from c#

Stream stream = GetMp3Stream("some.mp3"); //a custom method in c#
var audioEng = new AudioEng();   //c++/cx class
var streamOut = audioEng.DecodeMp3(stream);

so my problems are:

  1. I dunno how using stream in c++/cx
  2. I dunno how decode mp3 in c++/cx

I have found some example in cpp using ComPtr but I'd like to use cx


Solution

  • I think you need to use Media Foundation for this. The Playback-Samples should be a good starting point.