/usr/include/spatialite/gaiaexif.h is in libspatialite-dev 4.1.1-5ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | /*
gaiaexif.h -- Gaia common EXIF Metadata reading functions
version 4.1, 2013 May 8
Author: Sandro Furieri a.furieri@lqt.it
------------------------------------------------------------------------------
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is the SpatiaLite library
The Initial Developer of the Original Code is Alessandro Furieri
Portions created by the Initial Developer are Copyright (C) 2008-2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
*/
/**
\file gaiaexif.h
EXIF/image: supporting functions and constants
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#ifdef DLL_EXPORT
#define GAIAEXIF_DECLARE __declspec(dllexport)
#else
#define GAIAEXIF_DECLARE extern
#endif
#endif
#ifndef _GAIAEXIF_H
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define _GAIAEXIF_H
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* constants used for BLOB value types */
/** generic hexadecimal BLOB */
#define GAIA_HEX_BLOB 0
/** this BLOB does actually contain a GIF image */
#define GAIA_GIF_BLOB 1
/** this BLOB does actually containt a PNG image */
#define GAIA_PNG_BLOB 2
/** this BLOB does actually contain a generic JPEG image */
#define GAIA_JPEG_BLOB 3
/** this BLOB does actually contain a JPEG-EXIF image */
#define GAIA_EXIF_BLOB 4
/** this BLOB does actually contain a JPEG-EXIF image including GPS data */
#define GAIA_EXIF_GPS_BLOB 5
/** this BLOB does actually contain a ZIP compressed file */
#define GAIA_ZIP_BLOB 6
/** this BLOB does actually contain a PDF document */
#define GAIA_PDF_BLOB 7
/** this BLOB does actually contain a SpatiaLite Geometry */
#define GAIA_GEOMETRY_BLOB 8
/** this BLOB does actually contain a TIFF image */
#define GAIA_TIFF_BLOB 9
/** this BLOB does actually contain a WebP image */
#define GAIA_WEBP_BLOB 10
/** this BLOB does actually contain a SpatiaLite XmlBLOB */
#define GAIA_XML_BLOB 11
/* constants used for EXIF value types */
/** unrecognized EXIF value */
#define GAIA_EXIF_NONE 0
/** EXIF value of the BYTE type */
#define GAIA_EXIF_BYTE 1
/** EXIF value of the SHORT type */
#define GAIA_EXIF_SHORT 2
/** EXIF value of the STRING type */
#define GAIA_EXIF_STRING 3
/** EXIF value of the LONG type */
#define GAIA_EXIF_LONG 4
/** EXIF value of the RATIONAL type */
#define GAIA_EXIF_RATIONAL 5
/** EXIF value of the SLONG type */
#define GAIA_EXIF_SLONG 9
/** EXIF value of the SRATIONAL type */
#define GAIA_EXIF_SRATIONAL 10
/**
Container for an EXIF tag
*/
typedef struct gaiaExifTagStruct
{
/* an EXIF TAG */
/** GPS data included (0/1) */
char Gps;
/** EXIF tag ID */
unsigned short TagId;
/** EXIF value type */
unsigned short Type;
/** number of values */
unsigned short Count;
/** tag offset [big- little-endian encoded] */
unsigned char TagOffset[4];
/** array of BYTE values */
unsigned char *ByteValue;
/** array of STRING values */
char *StringValue;
/** array of SHORT values */
unsigned short *ShortValues;
/** array of LONG values ] */
unsigned int *LongValues;
/** array of RATIONAL values [numerators] */
unsigned int *LongRationals1;
/** array of RATIONAL values [denominators] */
unsigned int *LongRationals2;
/** array of Signed SHORT values */
short *SignedShortValues;
/** array of Signed LONG values */
int *SignedLongValues;
/** array of Signed RATIONAL values [numerators] */
int *SignedLongRationals1;
/** array of Signed RATIONAL values [denominators] */
int *SignedLongRationals2;
/** array of FLOAT values */
float *FloatValues;
/** array of DOUBLE values */
double *DoubleValues;
/** pointer to next item into the linked list */
struct gaiaExifTagStruct *Next;
} gaiaExifTag;
/**
Typedef for EXIF tag structure.
\sa gaiaExifTagStruct
*/
typedef gaiaExifTag *gaiaExifTagPtr;
/**
Container for a list of EXIF tags
*/
typedef struct gaiaExifTagListStruct
{
/* an EXIF TAG LIST */
/** pointer to first item into the linked list */
gaiaExifTagPtr First;
/** pointer to the last item into the linked list */
gaiaExifTagPtr Last;
/** number of items */
int NumTags;
/** an array of pointers to items */
gaiaExifTagPtr *TagsArray;
} gaiaExifTagList;
/**
Typedef for EXIF tag structure
\sa gaiaExifTagListStruct
*/
typedef gaiaExifTagList *gaiaExifTagListPtr;
/* function prototipes */
/**
Creates a list of EXIF tags by parsing a BLOB of the JPEG-EXIF type
\param blob the BLOB to be parsed
\param size the BLOB size (in bytes)
\return a list of EXIF tags: or NULL if any error is encountered
\sa gaiaExifTagsFree
\note you must explicitly destroy the list when it's any longer used.
*/
GAIAEXIF_DECLARE gaiaExifTagListPtr gaiaGetExifTags (const unsigned char
*blob, int size);
/**
Destroy a list of EXIF tags
\param tag_list the list to be destroied
\sa gaiaGetExifTags
\note the pointer passed to this function must be one returned by a
previous call to gaiaGetExifTags
*/
GAIAEXIF_DECLARE void gaiaExifTagsFree (gaiaExifTagListPtr tag_list);
/**
Return the total number of EXIF tags into the list
\param tag_list pointer to an EXIF tag list.
\return the EXIF tag count.
\sa gaiaGetExifTags, gaiaExifTagsFree
*/
GAIAEXIF_DECLARE int gaiaGetExifTagsCount (gaiaExifTagListPtr tag_list);
/**
Retrieves an EXIF tag by its relative position into the list
\param tag_list pointer to an EXIF tag list.
\param pos relative item position [first item is 0]
\return a pointer to the corresponding EXIF tag: NULL if not found
\sa gaiaGetExifTags, gaiaExifTagsFree, gaiaExifTagsCount
*/
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByPos (gaiaExifTagListPtr
tag_list,
const int pos);
/**
Return the total number of EXIF tags into the list
\param tag_list pointer to an EXIF tag list.
\return the EXIF tag count.
\sa gaiaGetExifTags, gaiaExifTagsFree
*/
GAIAEXIF_DECLARE int gaiaGetExifTagsCount (gaiaExifTagListPtr tag_list);
/**
Retrieves an EXIF tag by its Tag ID
\param tag_list pointer to an EXIF tag list.
\param tag_id the Tag ID to be found
\return a pointer to the corresponding EXIF tag: NULL if not found
\sa gaiaGetExifTags, gaiaExifTagsFree
*/
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagById (const gaiaExifTagListPtr
tag_list,
const unsigned short
tag_id);
/**
Retrieves an EXIF-GPS tag by its Tag ID
\param tag_list pointer to an EXIF tag list.
\param tag_id the GPS Tag ID to be found
\return a pointer to the corresponding EXIF tag: NULL if not found
\sa gaiaGetExifTags, gaiaExifTagsFree
*/
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifGpsTagById (const
gaiaExifTagListPtr
tag_list,
const unsigned short
tag_id);
/**
Retrieves an EXIF tag by its name
\param tag_list pointer to an EXIF tag list.
\param tag_name the Tag Name to be found
\return a pointer to the corresponding EXIF tag: NULL if not found
\sa gaiaGetExifTags, gaiaExifTagsFree
*/
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByName (const
gaiaExifTagListPtr
tag_list,
const char *tag_name);
/**
Return the Tag ID from an EXIF tag
\param tag pointer to an EXIF tag
\return the Tag ID
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
*/
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetId (const gaiaExifTagPtr tag);
/**
Return the Tag Name from an EXIF tag
\param tag pointer to an EXIF tag
\param tag_name receiving buffer: the Tag Name will be copied here
\param len length of the receiving buffer
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
*/
GAIAEXIF_DECLARE void gaiaExifTagGetName (const gaiaExifTagPtr tag,
char *tag_name, int len);
/**
Checks if an EXIF tag actually is an EXIF-GPS tag
\param tag pointer to an EXIF tag
\return 0 if false: any other value if true
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
*/
GAIAEXIF_DECLARE int gaiaIsExifGpsTag (const gaiaExifTagPtr tag);
/**
Return the value type for an EXIF tag
\param tag pointer to an EXIF tag
\return the value type: one of GAIA_EXIF_NONE, GAIA_EXIF_BYTE,
GAIA_EXIF_SHORT, GAIA_EXIF_STRING, GAIA_EXIF_LONG, GAIA_EXIF_RATIONAL,
GAIA_EXIF_SLONG, GAIA_EXIF_SRATIONAL
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
*/
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetValueType (const
gaiaExifTagPtr
tag);
/**
Return the total count of values from an EXIF tag
\param tag pointer to an EXIF tag
\return the number of available values
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
*/
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetNumValues (const
gaiaExifTagPtr
tag);
/**
Return a BYTE value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the BYTE value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE unsigned char gaiaExifTagGetByteValue (const gaiaExifTagPtr
tag, const int ind,
int *ok);
/**
Return a STRING value from an EXIF tag
\param tag pointer to an EXIF tag.
\param str receiving buffer: the STRING value will be copied here.
\param len length of the receiving buffer
\param ok on completion will contain 0 on failure: any other value on success.
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE void gaiaExifTagGetStringValue (const gaiaExifTagPtr tag,
char *str, int len,
int *ok);
/**
Return a SHORT value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the SHORT value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetShortValue (const
gaiaExifTagPtr
tag,
const int ind,
int *ok);
/**
Return a LONG value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the LONG value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetLongValue (const gaiaExifTagPtr
tag, const int ind,
int *ok);
/**
Return a RATIONAL [numerator] value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the RATIONAL [numerator] value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational1Value (const
gaiaExifTagPtr
tag,
const int ind,
int *ok);
/**
Return a RATIONAL [denominator] value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the RATIONAL [denominator] value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational2Value (const
gaiaExifTagPtr
tag,
const int ind,
int *ok);
/**
Return a RATIONAL value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the RATIONAL value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE double gaiaExifTagGetRationalValue (const gaiaExifTagPtr
tag, const int ind,
int *ok);
/**
Return a Signed SHORT value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the Signed SHORT value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE short gaiaExifTagGetSignedShortValue (const gaiaExifTagPtr
tag, const int ind,
int *ok);
/**
Return a Signed LONG value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the Signed LONG value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE int gaiaExifTagGetSignedLongValue (const gaiaExifTagPtr
tag, const int ind,
int *ok);
/**
Return a SRATIONAL [numerator] value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the SRATIONAL [numerator] value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational1Value (const
gaiaExifTagPtr tag,
const int ind,
int *ok);
/**
Return a SRATIONAL [denominator] value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the SRATIONAL [denominator] value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational2Value (const
gaiaExifTagPtr tag,
const int ind,
int *ok);
/**
Return a Signed RATIONAL value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the Signed RATIONAL value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE double gaiaExifTagGetSignedRationalValue (const
gaiaExifTagPtr
tag,
const int ind,
int *ok);
/**
Return a FLOAT value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the FLOAT value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE float gaiaExifTagGetFloatValue (const gaiaExifTagPtr tag,
const int ind, int *ok);
/**
Return a DOUBLE value from an EXIF tag
\param tag pointer to an EXIF tag.
\param ind value index [first value has index 0].
\param ok on completion will contain 0 on failure: any other value on success.
\return the DOUBLE value
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaExifTagGetValueType, gaiaExifTagGetNumValues
*/
GAIAEXIF_DECLARE double gaiaExifTagGetDoubleValue (const gaiaExifTagPtr tag,
const int ind, int *ok);
/**
Return a human readable description from an EXIF tag
\param tag pointer to an EXIF tag.
\param str receiving buffer: the STRING value will be copied here.
\param len length of the receiving buffer
\param ok on completion will contain 0 on failure: any other value on success.
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
*/
GAIAEXIF_DECLARE void gaiaExifTagGetHumanReadable (const gaiaExifTagPtr tag,
char *str, int len,
int *ok);
/**
Attempts to guess the actual content-type of some BLOB
\param blob the BLOB to be parsed
\param size length of the BLOB (in bytes)
\return the BLOB type: one of GAIA_HEX_BLOB, GAIA_GIF_BLOB, GAIA_PNG_BLOB,
GAIA_JPEG_BLOB, GAIA_EXIF_BLOB, GAIA_EXIF_GPS_BLOB, GAIA_ZIP_BLOB,
GAIA_PDF_BLOB, GAIA_GEOMETRY_BLOB, GAIA_TIFF_BLOB
*/
GAIAEXIF_DECLARE int gaiaGuessBlobType (const unsigned char *blob,
int size);
/**
Return longitude and latitude from an EXIF-GPS tag
\param blob the BLOB to be parsed
\param size length of the BLOB (in bytes)
\param longitude on success will contain the longitude coordinate
\param latitude on success will contain the latitude coordinate
\return 0 on failure: any other value on success
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaIsExifGpsTag
*/
GAIAEXIF_DECLARE int gaiaGetGpsCoords (const unsigned char *blob, int size,
double *longitude, double *latitude);
/**
Return a text string representing DMS coordinates from an EXIF-GPS tag
\param blob the BLOB to be parsed
\param size length of the BLOB (in bytes)
\param latlong receiving buffer: the text string will be copied here.
\param ll_size length of the receiving buffer
\return 0 on failure: any other value on success
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName,
gaiaIsExifGpsTag
*/
GAIAEXIF_DECLARE int gaiaGetGpsLatLong (const unsigned char *blob, int size,
char *latlong, int ll_size);
#ifdef __cplusplus
}
#endif
#endif /* _GAIAEXIF_H */
|