Hi Martel, All,
Sorry, but the more I read, the more I get confused, and more questions come up.
I did install the FFDShow filter and it works with WMP, and when in_directshow is set in winamp, also winamp takes it as the default filter.
Now if I use it in my application, it defaults always to the fraunhofer mp3 filter, and if I disable the fraunhofer (with DSFMgr.exe) then my app just can't play mp3 files at all, in code it gives an error when trying to open the file. It goes wrong already at the openfile call, again only if the fraunhofer is not installed (see attached code). Else everything works fine.
I assume that somewhere I have to set the format tag? To something comparable to the WAVE_FORMAT_MPEGLAYER3? Or am I missing the point, if not, any ideas what value this would need to be? Can't find any ref to it on the internet. If I am missing the point, any suggestions to force a filter or something?
Regards,
Eric
// creates IAMMultiMediaStream instance/directx
SCheck( CoCreateInstance( CLSID_AMMultiMediaStream, nil, CLSCTX_INPROC_SERVER,
IID_IAMMultiMediaStream, FAMMultiMediaStream ) );
SCheck( FAMMultiMediaStream.Initialize(STREAMTYPE_READ, AMMSF_NOGRAPHTHREAD, nil) );
// creates IMediaStream instance
SCheck( FAMMultiMediaStream.AddMediaStream(nil, @MSPID_PrimaryAudio, 0, FMediaStream) );
SCheck( FAMMultiMediaStream.GetMediaStream(MSPID_PrimaryAudio, FMediaStream) );
// opens the file
v := Trim(FileName);
===========================HERE IT GOES WRONG=================
SCheck( FAMMultiMediaStream.OpenFile(PWideChar(v), AMMSF_NOCLOCK));//EDH0) );
// Get IMediaControl instance
SCheck( FAMMultiMediaStream.GetFilterGraph(FGraphBuilder) );
SCheck( FGraphBuilder.QueryInterface(IID_IMediaControl, FMediaControl) );
SCheck( FGraphBuilder.QueryInterface(IID_IMediaSeeking, FMediaSeeking) );
// creates IAudioMediaStream instance
SCheck( FMediaStream.QueryInterface(IID_IAudioMediaStream, FAudioMediaStream) );
SCheck( FAudioMediaStream.GetFormat(Format) );
// creates IAudioData instance and set format to audiodata!!
SCheck( CoCreateInstance(CLSID_AMAudioData, nil, CLSCTX_INPROC_SERVER,
IID_IAudioData, FAudioData) );
SCheck( FAudioData.SetFormat(Format) );
// creates IAudioStreamSample instance
SCheck( FAudioMediaStream.CreateSample(FAudioData, 0, FAudioStreamSample) );
//SCheck( FAMMultiMediaStream.GetInformation(FInformation) );
SCheck( FAMMultiMediaStream.GetDuration(FLenght) );
SCheck( FAMMultiMediaStream.SetState( STREAMSTATE_RUN ) );
FLenght := FLenght div MUNITS_PER_MSEC; //Must be before
FDuration := (FLenght * Format.Format.nAvgBytesPerSec) div 1000;
FFileName := FileName;
FSelLength := 0;
FPosition := 0;