11#include "../AddonBase.h"
12#include "../c-api/addon-instance/image_decoder.h"
215 !kodiVersion.empty() ? kodiVersion
218 if (CAddonBase::m_interface->globalSingleInstance !=
nullptr)
219 throw std::logic_error(
"kodi::addon::CInstanceImageDecoder: Creation of multiple together "
220 "with single instance way is not allowed!");
222 SetAddonStruct(instance);
241 unsigned int bufSize,
243 unsigned int& height) = 0;
257 virtual bool Decode(
unsigned char* pixels,
273 inline std::string
MimeType() {
return m_instanceData->props->mimetype; }
277 void SetAddonStruct(KODI_HANDLE instance)
279 if (instance ==
nullptr)
280 throw std::logic_error(
"kodi::addon::CInstanceImageDecoder: Creation with empty addon "
281 "structure not allowed, table must be given from Kodi!");
284 m_instanceData->toAddon->addonInstance =
this;
285 m_instanceData->toAddon->load_image_from_memory = ADDON_LoadImageFromMemory;
286 m_instanceData->toAddon->decode = ADDON_Decode;
290 unsigned char* buffer,
291 unsigned int bufSize,
293 unsigned int* height)
295 return static_cast<CInstanceImageDecoder*
>(instance->toAddon->addonInstance)
296 ->LoadImageFromMemory(buffer, bufSize, *width, *height);
300 unsigned char* pixels,
306 return static_cast<CInstanceImageDecoder*
>(instance->toAddon->addonInstance)
307 ->Decode(pixels, width, height, pitch, format);
Definition: ImageDecoder.h:199
Definition: AddonBase.h:186
@ ADDON_INSTANCE_IMAGEDECODER
Image Decoder instance, see kodi::addon::CInstanceImageDecoder.
Definition: versions.h:243
ImageFormat
Image format types Used to define wanted target format where image decoder should give to Kodi.
Definition: image_decoder.h:26
virtual bool Decode(unsigned char *pixels, unsigned int width, unsigned int height, unsigned int pitch, ImageFormat format)=0
Decode previously loaded image.
CInstanceImageDecoder(KODI_HANDLE instance, const std::string &kodiVersion="")
Class constructor.
Definition: ImageDecoder.h:213
virtual bool LoadImageFromMemory(unsigned char *buffer, unsigned int bufSize, unsigned int &width, unsigned int &height)=0
Initialize an encoder.
std::string MimeType()
Callback to Kodi Function Get the wanted mime type from Kodi.
Definition: ImageDecoder.h:273
std::string ATTRIBUTE_HIDDEN GetKodiTypeVersion(int type)
To get used version inside Kodi itself about asked type.
Definition: AddonBase.h:630
Definition: image_decoder.h:71