For audio decoders as binary add-ons. This class implements a way to handle special types of audio files.
The add-on handles loading of the source file and outputting the audio stream for consumption by the player.
The addon.xml defines the capabilities of this add-on.
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="audiodecoder.myspecialnamefor"
version="1.0.0"
name="My special audio decoder addon"
provider-name="Your Name">
<requires>@ADDON_DEPENDS@</requires>
<extension
point="kodi.audiodecoder"
name="2sf"
extension=".2sf|.mini2sf"
tags="true"
library_@PLATFORM@="@LIBRARY_FILENAME@"/>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">My audio decoder addon addon</summary>
<description lang="en_GB">My audio decoder addon description</description>
<platform>@PLATFORM@</platform>
</extension>
</addon>
#include <kodi/addon-instance/AudioDecoder.h>
{
public:
CMyAudioDecoder(KODI_HANDLE instance, const std::string& version);
bool Init(const std::string& filename, unsigned int filecache,
int& channels, int& samplerate,
int& bitspersample, int64_t& totaltime,
std::vector<AudioEngineChannel>& channellist) override;
int ReadPCM(uint8_t* buffer, int size, int& actualsize) override;
};
CMyAudioDecoder::CMyAudioDecoder(KODI_HANDLE instance, const std::string& version)
: kodi::addon::CInstanceAudioDecoder(instance, version)
{
...
}
bool CMyAudioDecoder::Init(const std::string& filename, unsigned int filecache,
int& channels, int& samplerate,
int& bitspersample, int64_t& totaltime,
std::vector<AudioEngineChannel>& channellist)
{
...
return true;
}
int CMyAudioDecoder::ReadPCM(uint8_t* buffer, int size, int& actualsize)
{
...
return 0;
}
{
public:
CMyAddon() { }
const std::string& instanceID,
KODI_HANDLE instance,
const std::string& version,
KODI_HANDLE& addonInstance) override;
};
const std::string& instanceID,
KODI_HANDLE instance,
const std::string& version,
KODI_HANDLE& addonInstance)
{
{
addonInstance = new CMyAudioDecoder(instance, version);
}
else if (...)
{
...
}
}
ADDONCREATOR(CMyAddon)
Definition: AddonBase.h:322
Definition: AudioDecoder.h:382
@ ADDON_LOG_INFO
1 : To include information messages in the log file.
Definition: addon_base.h:177
ADDON_STATUS
Definition: addon_base.h:128
@ ADDON_STATUS_OK
For everything OK and no error.
Definition: addon_base.h:130
@ ADDON_STATUS_UNKNOWN
Unknown and incomprehensible error.
Definition: addon_base.h:142
@ ADDON_INSTANCE_AUDIODECODER
Audio decoder instance, see kodi::addon::CInstanceAudioDecoder.
Definition: versions.h:217
virtual ADDON_STATUS CreateInstance(int instanceType, const std::string &instanceID, KODI_HANDLE instance, const std::string &version, KODI_HANDLE &addonInstance)
Instance created.
Definition: AddonBase.h:481
void ATTRIBUTE_HIDDEN Log(const AddonLog loglevel, const char *format,...)
Add a message to Kodi's log.
Definition: AddonBase.h:749