AIMP Forum

AIMP for Windows => Дополнения / Addons => Плагины / Plugins => Topic started by: zbych on March 31, 2018, 16:43:57

Title: Need help with audiodecoder plugin devlopment
Post by: zbych on March 31, 2018, 16:43:57
Hi,
I dont know if this is right place to ask if not then please to move it to right section.
I am developing plugin to play SID files, and it looks like it works ok but after installation of my plugin I cant play other file types.
I am doing it like this:
In plugin initialization I am registering class implementing IAIMPExtensionFileFormat
   res = Core->RegisterExtension(IID_IAIMPServiceFileFormats, static_cast<IAIMPExtensionFileFormat*>(m_fileFormats));
next registering class implementing IAIMPServiceFileStreaming
   res = Core->RegisterExtension(IID_IAIMPServiceFileStreaming, static_cast<IAIMPServiceFileStreaming*>(m_sidFileStreaming));
and finally I am registering class implementing IAIMPExtensionAudioDecoder
   res = Core->RegisterExtension(IID_IAIMPServiceAudioDecoders, static_cast<IAIMPExtensionAudioDecoder*>(m_decoderFactory));

And everyting works fine except other formats - when AIMP wants to start to play other file type it is calling CreateDecoder for my decoder and because I am recoginzing that given stream is not my type I am returning S_FALSE but it gives error in AIMP.

What I am doing wrong? I thought the CreateDecoder will be called onyl for file types registere by my plugin. Maybe I should return different value.
Pleaase help anyone?

Full source code is available at github https://github.com/zbych-r/aimp_sidplay (https://github.com/zbych-r/aimp_sidplay)
Title: Re: Need help with audiodecoder plugin devlopment
Post by: zbych on March 31, 2018, 17:58:54
I don't know if it is right way but I found solution by myself:
the IAIMPExtensionAudioDecoder::CreateDecoder method returns E_FAIL
and other objects like IAIMPExtensionFileInfoProvider check given FileURI and returns E_FAIL too.
Title: Re: Need help with audiodecoder plugin devlopment
Post by: Artem on March 31, 2018, 20:11:52
IAIMPExtensionFileFormat just informs the player that some new file types are supported. Player ask all decoders because file extension may not be same to file type. If you have checked that stream is not yours - just return E_FAIL but dont change the IAIMPErrorInfo .