For audio encoders as binary add-ons. This class implements a way to handle the encode of given stream to a new format.
The addon.xml defines the capabilities of this add-on.
#include <kodi/addon-instance/AudioEncoder.h>
{
public:
int Encode(
int numBytesRead,
const uint8_t* pbtStream)
override;
};
: kodi::addon::CInstanceAudioEncoder(instance)
{
...
}
{
...
return true;
}
ssize_t CMyAudioEncoder::Encode(const uint8_t* pbtStream, size_t numBytesRead)
{
uint8_t* data = nullptr;
size_t length = 0;
...
return 0;
}
bool CMyAudioEncoder::Finish()
{
...
return true;
}
{
public:
CMyAddon() = default;
KODI_ADDON_INSTANCE_HDL& hdl) override;
};
KODI_ADDON_INSTANCE_HDL& hdl)
{
{
hdl = new CMyAudioEncoder(instance);
}
else if (...)
{
...
}
}
ADDONCREATOR(CMyAddon)
Definition AudioEncoder.h:40
Definition AddonBase.h:775
Definition AudioEncoder.h:361
Definition AddonBase.h:498
@ ADDON_LOG_INFO
1 : To include information messages in the log file.
Definition addon_base.h:187
ADDON_STATUS
Definition addon_base.h:138
@ ADDON_STATUS_OK
For everything OK and no error.
Definition addon_base.h:140
@ ADDON_STATUS_UNKNOWN
Unknown and incomprehensible error.
Definition addon_base.h:152
@ ADDON_INSTANCE_AUDIOENCODER
Audio encoder instance, see kodi::addon::CInstanceAudioEncoder.
Definition versions.h:222
bool IsType(KODI_ADDON_INSTANCE_TYPE type) const
Check asked type used on this class.
Definition AddonBase.h:525
virtual ADDON_STATUS CreateInstance(const kodi::addon::IInstanceInfo &instance, KODI_ADDON_INSTANCE_HDL &hdl)
Instance created.
Definition AddonBase.h:924
virtual bool Finish()
Finalize encoding (optional)
Definition AudioEncoder.h:434
ssize_t Write(const uint8_t *data, size_t length)
Write block of data.
Definition AudioEncoder.h:447
virtual bool Start(const kodi::addon::AudioEncoderInfoTag &tag)=0
Start encoder (required)
virtual ssize_t Encode(const uint8_t *pbtStream, size_t numBytesRead)=0
Encode a chunk of audio (required)
void ATTR_DLL_LOCAL Log(const ADDON_LOG loglevel, const char *format,...)
Add a message to Kodi's log.
Definition AddonBase.h:1938