11#include "../AddonBase.h"
12#include "../c-api/addon-instance/imagedecoder.h"
138 m_exposure_program = exposure_program;
195 m_focal_length_in_35mm_format = focal_length_in_35mm_format;
222 if (!latitude || !longitude)
225 m_gps_info_present = gps_info_present;
226 if (gps_info_present)
228 m_latitude_ref = latitude_ref;
229 m_longitude_ref = longitude_ref;
230 for (
int i = 0; i < 3; i++)
232 m_latitude[i] = latitude[i];
233 m_longitude[i] = longitude[i];
235 m_altitude_ref = altitude_ref;
236 m_altitude = altitude;
240 m_latitude_ref = 0.0f;
241 m_longitude_ref = 0.0f;
242 for (
int i = 0; i < 3; i++)
243 latitude[i] = longitude[i] = 0.0f;
258 if (!latitude || !longitude)
261 gps_info_present = m_gps_info_present;
262 if (m_gps_info_present)
264 latitude_ref = m_latitude_ref;
265 longitude_ref = m_longitude_ref;
266 for (
int i = 0; i < 3; i++)
268 latitude[i] = m_latitude[i];
269 longitude[i] = m_longitude[i];
271 altitude_ref = m_altitude_ref;
272 altitude = m_altitude;
278 for (
int i = 0; i < 3; i++)
279 latitude[i] = longitude[i] = 0.0f;
288 m_camera_manufacturer = camera_manufacturer;
295 void SetCameraModel(
const std::string& camera_model) { m_camera_model = camera_model; }
301 void SetAuthor(
const std::string& author) { m_author = author; }
304 const std::string&
GetAuthor()
const {
return m_author; }
307 void SetDescription(
const std::string& description) { m_description = description; }
313 void SetCopyright(
const std::string& copyright) { m_copyright = copyright; }
327 float m_exposure_time{};
328 float m_exposure_bias{};
331 time_t m_time_created{};
332 float m_aperture_f_number{};
335 int m_focal_length{};
336 int m_focal_length_in_35mm_format{};
337 float m_digital_zoom_ratio{};
340 bool m_gps_info_present{
false};
341 char m_latitude_ref{
' '};
342 float m_latitude[3]{};
343 char m_longitude_ref{
' '};
344 float m_longitude[3]{};
345 int m_altitude_ref{};
348 std::string m_camera_manufacturer;
349 std::string m_camera_model;
350 std::string m_author;
351 std::string m_description;
352 std::string m_copyright;
549 if (CPrivateBase::m_interface->globalSingleInstance !=
nullptr)
550 throw std::logic_error(
"kodi::addon::CInstanceImageDecoder: Creation of multiple together "
551 "with single instance way is not allowed!");
553 SetAddonStruct(instance);
568 virtual bool SupportsFile(
const std::string& filename) {
return true; }
603 const uint8_t* buffer,
606 unsigned int& height) = 0;
630 instance->hdl =
this;
631 instance->imagedecoder->toAddon->supports_file = ADDON_supports_file;
632 instance->imagedecoder->toAddon->read_tag = ADDON_read_tag;
633 instance->imagedecoder->toAddon->load_image_from_memory = ADDON_load_image_from_memory;
634 instance->imagedecoder->toAddon->decode = ADDON_decode;
637 inline static bool ADDON_supports_file(
const KODI_ADDON_IMAGEDECODER_HDL hdl,
const char* file)
642 inline static bool ADDON_read_tag(
const KODI_ADDON_IMAGEDECODER_HDL hdl,
648#pragma warning(disable : 4996)
651 bool ret =
static_cast<CInstanceImageDecoder*
>(hdl)->ReadTag(file, cppTag);
672 cppTag.
GetGPSInfo(tag->gps_info_present, tag->latitude_ref, tag->latitude, tag->longitude_ref,
673 tag->longitude, tag->altitude_ref, tag->altitude);
676 tag->author = strdup(cppTag.
GetAuthor().c_str());
686 inline static bool ADDON_load_image_from_memory(
const KODI_ADDON_IMAGEDECODER_HDL hdl,
687 const char* mimetype,
688 const uint8_t* buffer,
691 unsigned int* height)
693 return static_cast<CInstanceImageDecoder*
>(hdl)->LoadImageFromMemory(mimetype, buffer, bufSize,
697 inline static bool ADDON_decode(
const KODI_ADDON_IMAGEDECODER_HDL hdl,
705 return static_cast<CInstanceImageDecoder*
>(hdl)->Decode(pixels, width, height, pitch, format);
Definition ImageDecoder.h:537
Definition AddonBase.h:565
Definition AddonBase.h:498
Definition ImageDecoder.h:47
ADDON_IMG_COLOR
Definition imagedecoder.h:91
@ ADDON_IMG_COLOR_COLORED
Colored image.
Definition imagedecoder.h:93
ADDON_IMG_EXPOSURE_MODE
Definition imagedecoder.h:190
@ ADDON_IMG_EXPOSURE_MODE_AUTO
0 = Auto exposure
Definition imagedecoder.h:192
ADDON_IMG_EXPOSURE_PROGRAM
Definition imagedecoder.h:144
@ ADDON_IMG_EXPOSURE_PROGRAM_UNDEFINED
0 = Not Defined
Definition imagedecoder.h:146
ADDON_IMG_FLASH_TYPE
Definition imagedecoder.h:284
@ ADDON_IMG_FLASH_TYPE_NO_FLASH
0x0 = No Flash
Definition imagedecoder.h:286
ADDON_IMG_FMT
Definition imagedecoder.h:30
ADDON_IMG_LIGHT_SOURCE
Definition imagedecoder.h:210
ADDON_IMG_METERING_MODE
Definition imagedecoder.h:108
@ ADDON_IMG_METERING_MODE_UNKNOWN
0 = Unknown
Definition imagedecoder.h:110
ADDON_IMG_ORIENTATION
Definition imagedecoder.h:55
@ ADDON_IMG_ORIENTATION_NONE
If not available.
Definition imagedecoder.h:57
ADDON_IMG_FLASH_TYPE GetFlashUsed() const
Get info about image was created with flash.
Definition ImageDecoder.h:176
void SetFlashUsed(ADDON_IMG_FLASH_TYPE flash_used)
Set to true if image was created with flash.
Definition ImageDecoder.h:173
void SetOrientation(ADDON_IMG_ORIENTATION orientation)
Set the orientation.
Definition ImageDecoder.h:155
const std::string & GetDescription() const
Get description.
Definition ImageDecoder.h:310
void SetHeight(int height)
Set the image height as pixels.
Definition ImageDecoder.h:94
void SetFocalLength(int focal_length)
Set focal length.
Definition ImageDecoder.h:179
void SetDistance(int distance)
Set the image distance in meters.
Definition ImageDecoder.h:100
int GetDistance() const
Get mage distance in meters.
Definition ImageDecoder.h:103
float GetExposureTime() const
Get exposure time.
Definition ImageDecoder.h:125
int GetWidth() const
Get image width as pixels.
Definition ImageDecoder.h:91
void SetExposureBias(float exposure_bias)
Set exposure bias.
Definition ImageDecoder.h:128
int GetHeight() const
Get image height as pixels.
Definition ImageDecoder.h:97
void SetDescription(const std::string &description)
Set description.
Definition ImageDecoder.h:307
ADDON_IMG_COLOR GetColor() const
Get image image color type.
Definition ImageDecoder.h:111
float GetExposureBias() const
Get exposure bias.
Definition ImageDecoder.h:131
void SetExposureTime(float exposure_time)
Set exposure time.
Definition ImageDecoder.h:122
int GetFocalLength() const
Get focal length.
Definition ImageDecoder.h:182
const std::string & GetAuthor() const
Get author.
Definition ImageDecoder.h:304
void SetFocalLengthIn35mmFormat(int focal_length_in_35mm_format)
Set focal length in 35 mm format.
Definition ImageDecoder.h:193
const std::string & GetCameraModel() const
Get camera model.
Definition ImageDecoder.h:298
void SetApertureFNumber(float aperture_f_number)
Set Aperture F number.
Definition ImageDecoder.h:167
void SetColor(ADDON_IMG_COLOR color)
Set the image color type.
Definition ImageDecoder.h:108
void GetGPSInfo(bool &gps_info_present, char &latitude_ref, float latitude[3], char &longitude_ref, float longitude[3], int &altitude_ref, float &altitude)
Get GPS position information.
Definition ImageDecoder.h:250
void SetCameraModel(const std::string &camera_model)
Set camera model.
Definition ImageDecoder.h:295
time_t GetTimeCreated() const
Get image creation time.
Definition ImageDecoder.h:164
void SetISOSpeed(float iso_speed)
Set ISO sensitivity.
Definition ImageDecoder.h:208
void SetCameraManufacturer(const std::string &camera_manufacturer)
Set the camera manufacturer as string on info tag.
Definition ImageDecoder.h:286
float GetApertureFNumber() const
Get Aperture F number.
Definition ImageDecoder.h:170
ADDON_IMG_EXPOSURE_MODE GetExposureMode() const
Get Exposure mode.
Definition ImageDecoder.h:150
ADDON_IMG_ORIENTATION GetOrientation() const
Get image orientation.
Definition ImageDecoder.h:158
float GetISOSpeed() const
Get ISO sensitivity.
Definition ImageDecoder.h:211
void SetDigitalZoomRatio(float digital_zoom_ratio)
Set digital zoom ratio.
Definition ImageDecoder.h:202
void SetTimeCreated(time_t time_created)
Set the image creation time in time_t format (number of seconds elapsed since 00:00 hours,...
Definition ImageDecoder.h:161
float GetDigitalZoomRatio() const
Get digital zoom ratio.
Definition ImageDecoder.h:205
void SetWidth(int width)
Set the camera manufacturer as string on info tag.
Definition ImageDecoder.h:88
ADDON_IMG_LIGHT_SOURCE GetLightSource() const
Get light source.
Definition ImageDecoder.h:188
const std::string & GetCameraManufacturer() const
Get camera manufacturer.
Definition ImageDecoder.h:292
void SetAuthor(const std::string &author)
Set author.
Definition ImageDecoder.h:301
ADDON_IMG_EXPOSURE_PROGRAM GetExposureProgram() const
Get Exposure program.
Definition ImageDecoder.h:142
void SetCopyright(const std::string ©right)
Set copyright.
Definition ImageDecoder.h:313
void SetExposureProgram(ADDON_IMG_EXPOSURE_PROGRAM exposure_program)
Set Exposure program.
Definition ImageDecoder.h:136
ADDON_IMG_METERING_MODE GetMeteringMode() const
Get metering mode.
Definition ImageDecoder.h:119
void SetExposureMode(ADDON_IMG_EXPOSURE_MODE exposure_mode)
Set Exposure mode.
Definition ImageDecoder.h:147
const std::string & GetCopyright() const
Get copyright.
Definition ImageDecoder.h:316
void SetMeteringMode(ADDON_IMG_METERING_MODE metering_mode)
Set metering mode.
Definition ImageDecoder.h:116
void SetGPSInfo(bool gps_info_present, char latitude_ref, float latitude[3], char longitude_ref, float longitude[3], int altitude_ref, float altitude)
Set GPS position information.
Definition ImageDecoder.h:214
void SetLightSource(ADDON_IMG_LIGHT_SOURCE light_source)
Set light source.
Definition ImageDecoder.h:185
int GetFocalLengthIn35mmFormat() const
Get focal length in 35 mm format.
Definition ImageDecoder.h:199
virtual bool ReadTag(const std::string &file, kodi::addon::ImageDecoderInfoTag &tag)
Read tag of a file.
Definition ImageDecoder.h:583
virtual bool Decode(uint8_t *pixels, unsigned int width, unsigned int height, unsigned int pitch, ADDON_IMG_FMT format)=0
Decode previously loaded image.
virtual bool SupportsFile(const std::string &filename)
Checks addon support given file path.
Definition ImageDecoder.h:568
virtual bool LoadImageFromMemory(const std::string &mimetype, const uint8_t *buffer, size_t bufSize, unsigned int &width, unsigned int &height)=0
Initialize an encoder.
CInstanceImageDecoder(const IInstanceInfo &instance)
Class constructor.
Definition ImageDecoder.h:547
Definition imagedecoder.h:370
Definition addon_base.h:268