Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
exifite.h File Reference

Bounded C11 EXIF metadata and JPEG streaming interfaces. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
Include dependency graph for exifite.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  exif_value
 Borrowed bytes plus enough type information for safe interpretation. More...
struct  exif_view
 Borrowed view of a validated APP1 payload. More...
struct  exif_item
 Writer bookkeeping for one field inside the document's value storage. More...
struct  exif_document
 Caller-owned bounded writer with no heap allocation. More...

Macros

#define EXIF_MAX_PAYLOAD   65533U
 APP1 payload ceiling: the JPEG length includes its own two bytes.
#define EXIF_MAX_ENTRIES   48U
 Writer entry budget, including the standard initialization tags.

Typedefs

typedef bool(* exif_tag_selector) (void *context, enum exif_directory directory, uint16_t tag)
 Caller policy for additional, directory-local fields to import.

Enumerations

enum  exif_directory { EXIF_PRIMARY , EXIF_CAMERA , EXIF_GPS , EXIF_DIRECTORY_COUNT }
 Directory identities, not on-disk tag numbers or offsets. More...
enum  exif_format {
  EXIF_BYTE = 1 , EXIF_ASCII = 2 , EXIF_SHORT = 3 , EXIF_LONG = 4 ,
  EXIF_RATIONAL = 5 , EXIF_UNDEFINED = 7 , EXIF_SLONG = 9 , EXIF_SRATIONAL = 10
}
 TIFF field-type numbers used by Sensoraia's metadata. More...
enum  exif_tag {
  EXIF_DOCUMENT_NAME = 0x010d , EXIF_IMAGE_DESCRIPTION = 0x010e , EXIF_ORIENTATION = 0x0112 , EXIF_X_RESOLUTION = 0x011a ,
  EXIF_Y_RESOLUTION = 0x011b , EXIF_RESOLUTION_UNIT = 0x0128 , EXIF_SOFTWARE = 0x0131 , EXIF_EXPOSURE_TIME = 0x829a ,
  EXIF_FNUMBER = 0x829d , EXIF_ISO_SPEED = 0x8827 , EXIF_VERSION = 0x9000 , EXIF_COMPONENTS_CONFIGURATION = 0x9101 ,
  EXIF_EXPOSURE_BIAS = 0x9204 , EXIF_FOCAL_LENGTH = 0x920a , EXIF_USER_COMMENT = 0x9286 , EXIF_FLASHPIX_VERSION = 0xa000 ,
  EXIF_COLOR_SPACE = 0xa001 , EXIF_PIXEL_X_DIMENSION = 0xa002 , EXIF_PIXEL_Y_DIMENSION = 0xa003 , EXIF_BODY_SERIAL_NUMBER = 0xa431 ,
  EXIF_LENS_MODEL = 0xa434 , EXIF_GPS_VERSION = 0 , EXIF_GPS_LATITUDE_REF = 1 , EXIF_GPS_LATITUDE = 2 ,
  EXIF_GPS_LONGITUDE_REF = 3 , EXIF_GPS_LONGITUDE = 4 , EXIF_GPS_ALTITUDE_REF = 5 , EXIF_GPS_ALTITUDE = 6 ,
  EXIF_GPS_SPEED_REF = 12 , EXIF_GPS_SPEED = 13 , EXIF_GPS_TRACK_REF = 14 , EXIF_GPS_TRACK = 15 ,
  EXIF_GPS_DIRECTION_REF = 16 , EXIF_GPS_DIRECTION = 17
}
 Standard tag identifiers used by the current applications. More...

Functions

int exif_parse (struct exif_view *view, const unsigned char *payload, size_t size)
 Validate an EXIF APP1 payload and create a borrowed view.
bool exif_get (const struct exif_view *view, enum exif_directory directory, uint16_t tag, struct exif_value *value)
 Look up a directory-local tag without copying its bytes.
bool exif_value_unsigned (const struct exif_value *value, size_t index, uint32_t *result)
 Decode one BYTE, SHORT or LONG component without an unaligned load.
bool exif_value_rational (const struct exif_value *value, size_t index, double *result)
 Decode one unsigned or signed rational component as a double.
size_t exif_text_length (const struct exif_value *value)
 Count text bytes after trimming trailing NUL padding only.
void exif_document_init (struct exif_document *document)
 Start a fresh upright sRGB/Y-Cb-Cr document with EXIF 2.32 defaults.
bool exif_document_get (const struct exif_document *document, enum exif_directory directory, uint16_t tag, struct exif_value *value)
 Borrow a field from the current writable document.
int exif_document_import (struct exif_document *document, const struct exif_view *view)
 Rebuild a writable document from supported Sensoraia fields.
int exif_document_import_custom (struct exif_document *document, const struct exif_view *view, exif_tag_selector select, void *context)
 Import standard fields plus additional tags selected by the caller.
int exif_document_remove (struct exif_document *document, enum exif_directory directory, uint16_t tag)
 Remove a tag and reclaim its packed value storage.
unsigned char * exif_document_reserve (struct exif_document *document, enum exif_directory directory, uint16_t tag, enum exif_format format, uint32_t count)
 Create or replace a field with zeroed, bounded value storage.
int exif_document_ascii (struct exif_document *document, enum exif_directory directory, uint16_t tag, const char *text)
 Replace an ASCII field, including its terminating NUL byte.
int exif_document_rational (struct exif_document *document, enum exif_directory directory, uint16_t tag, uint32_t numerator, uint32_t denominator)
 Store an unsigned measurement as an exact numerator/denominator pair.
void exif_encode_short (unsigned char *data, uint16_t value)
 Encode a 16-bit value in the writer's little-endian representation.
void exif_encode_long (unsigned char *data, uint32_t value)
 Encode a 32-bit value in the writer's little-endian representation.
int exif_serialize (const struct exif_document *document, unsigned char *payload, size_t capacity, size_t *size)
 Serialize a document into one complete EXIF APP1 payload.
int exif_read_jpeg (const char *filename, unsigned char *payload, size_t capacity, size_t *size)
 Read the single EXIF APP1 segment before the first JPEG scan.
int exif_read_stream (FILE *input, unsigned char *payload, size_t capacity, size_t *size)
 Read capture EXIF from an already-open JPEG without reopening its path.
int exif_jpeg_dimensions (FILE *input, uint32_t *width, uint32_t *height, unsigned *components)
 Inspect the frame header without allocating or decoding image pixels.
int exif_rewrite_jpeg (FILE *input, FILE *output, const unsigned char *payload, size_t size)
 Stream a JPEG with one new EXIF segment instead of its old EXIF records.
int exif_update_jpeg (FILE *file, const unsigned char *payload, size_t size)
 Replace EXIF in a regular JPEG file without a temporary file.

Detailed Description

Bounded C11 EXIF metadata and JPEG streaming interfaces.

EXIFite covers Sensoraia's metadata without a general-purpose TIFF object graph. Callers own the storage so memory use stays predictable on MORA. Readers borrow bytes; writers collect little-endian values before producing one JPEG APP1 payload. No function decodes or recompresses image pixels.

See also
exifite.c

Definition in file exifite.h.