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
Go to the documentation of this file.
1/*
2 * Copyright 2026 OpenUAS
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/**
19 * @file exifite.h
20 * @brief Bounded C11 EXIF metadata and JPEG streaming interfaces.
21 * @details EXIFite covers Sensoraia's metadata without a general-purpose TIFF
22 * object graph. Callers own the storage so memory use stays predictable on MORA.
23 * Readers borrow bytes; writers collect little-endian values before producing
24 * one JPEG APP1 payload. No function decodes or recompresses image pixels.
25 * @see exifite.c
26 */
27
28#ifndef USHER_EXIFITE_H
29#define USHER_EXIFITE_H
30
31#include <stdbool.h>
32#include <stddef.h>
33#include <stdint.h>
34#include <stdio.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/**
41 * @defgroup exifite EXIFite Metadata
42 * @brief Small, caller-owned EXIF documents and borrowed metadata views.
43 * @details Use separate storage for concurrent operations. The core has no
44 * mutable global state; sharing a document or stream still needs caller-side
45 * synchronization. File publication and path ownership belong to image_exif.c.
46 * @{
47 */
48
49/** @brief APP1 payload ceiling: the JPEG length includes its own two bytes.
50 * @details This includes the six-byte EXIF signature, not the JPEG marker. */
51#define EXIF_MAX_PAYLOAD 65533U
52/** @brief Writer entry budget, including the standard initialization tags.
53 * @details A small fixed table keeps sorting and lookup bounded without a heap. */
54#define EXIF_MAX_ENTRIES 48U
55
56/** @brief Directory identities, not on-disk tag numbers or offsets.
57 * @details TIFF calls a directory an IFD (Image File Directory). Tag numbers
58 * are meaningful within their directory, so always keep the pair together. */
60
61/** @brief TIFF field-type numbers used by Sensoraia's metadata.
62 * @details These are wire-format identifiers; do not renumber them. RATIONAL
63 * and SRATIONAL each store a numerator and denominator, not a floating value. */
74
75/** @brief Standard tag identifiers used by the current applications.
76 * @details GPS identifiers deliberately reuse small numbers: the directory
77 * argument distinguishes GPS tags from primary and camera tags. */
115
116/** @brief Borrowed bytes plus enough type information for safe interpretation.
117 * @details This does not own or convert the value. Prefer the typed accessors
118 * over casting the bytes; camera files may be unaligned or use another byte order. */
120 const unsigned char *data; /**< Borrowed field bytes, including any text terminator. */
121 size_t size; /**< Accessible byte count, distinct from the component count. */
122 uint32_t count; /**< Number of TIFF components; one rational occupies eight bytes. */
123 uint16_t format; /**< TIFF field type; check it before interpreting text or numbers. */
124 bool little_endian; /**< Byte order of multi-byte components in @ref exif_value::data. */
125};
126
127/** @brief Borrowed view of a validated APP1 payload.
128 * @details Keep the source bytes alive and unchanged while using this view.
129 * Offsets are relative to the TIFF header, not the JPEG or EXIF signature;
130 * keeping that origin explicit prevents a common six-byte addressing mistake. */
131struct exif_view {
132 const unsigned char *tiff; /**< TIFF header immediately after the EXIF signature. */
133 size_t size; /**< Accessible TIFF bytes; excludes the six-byte EXIF signature. */
134 uint32_t directories[EXIF_DIRECTORY_COUNT]; /**< TIFF-relative offsets; zero means absent. */
135 bool little_endian; /**< Byte order declared by the TIFF header. */
136};
137
138/** @brief Writer bookkeeping for one field inside the document's value storage.
139 * @details Offsets, rather than pointers, let removal compact the storage and
140 * serialization reorder entries without building an allocated object graph.
141 * @warning Treat these fields as implementation bookkeeping, not an editing API. */
142struct exif_item {
143 uint32_t offset; /**< Starting byte within the document's packed value storage. */
144 uint32_t size; /**< Value byte length used when checking and reclaiming storage. */
145 uint32_t count; /**< Number of TIFF components, not bytes. */
146 uint16_t tag; /**< Tag number interpreted within the stored directory. */
147 uint16_t format; /**< TIFF representation determining each component's width. */
148 unsigned char directory; /**< One of the exif_directory identities. */
149};
150
151/** @brief Caller-owned bounded writer with no heap allocation.
152 * @details Initialize before use. Large documents are usually best kept in a
153 * caller workspace rather than a deeply nested stack frame. All stored numeric
154 * values are little-endian, giving serialization a single predictable path.
155 * @warning Any mutation may invalidate previously borrowed field pointers. */
158 [EXIF_MAX_ENTRIES]; /**< Active fields occupy the first @ref exif_document::count slots. */
159 size_t count; /**< Number of active entries in the fixed entry table. */
160 size_t used; /**< Occupied packed-value bytes, excluding directory overhead. */
161 unsigned char
162 data[EXIF_MAX_PAYLOAD]; /**< Packed values; serialized directory overhead is separate. */
163};
164
165/** @brief Validate an EXIF APP1 payload and create a borrowed view.
166 * @param[out] view Destination view; cleared on failure when non-NULL.
167 * @param[in] payload Complete APP1 payload starting with the six-byte EXIF signature.
168 * @param[in] size Accessible payload bytes, at most EXIF_MAX_PAYLOAD.
169 * @return Zero on success, otherwise -1 with errno set to EINVAL.
170 * @details Validation happens before exposing a usable view. This rejects
171 * invalid offsets, duplicate tags, overlapping directory tables, malformed
172 * ASCII and zero rational denominators. Thumbnail and vendor pointers are not
173 * followed: they add complexity without serving Sensoraia's metadata needs.
174 * @pre The destination view must not overlap the source payload.
175 * @note Structural validity does not establish the physical meaning of a tag.
176 * @see exif_get
177 */
178int exif_parse(struct exif_view *view, const unsigned char *payload, size_t size);
179/** @brief Look up a directory-local tag without copying its bytes.
180 * @param[in] view View returned by exif_parse(), with unchanged backing storage.
181 * @param[in] directory Directory in which to look for the tag.
182 * @param[in] tag Standard tag identifier within that directory.
183 * @param[out] value Borrowed field descriptor; use it only when true is returned.
184 * @return True when a valid value is available, otherwise false.
185 * @details Lookup accepts unsorted input directories because external camera
186 * metadata need not share our writer's ordering. Missing tags are normal.
187 */
188bool exif_get(const struct exif_view *view, enum exif_directory directory, uint16_t tag,
189 struct exif_value *value);
190/** @brief Decode one BYTE, SHORT or LONG component without an unaligned load.
191 * @param[in] value Borrowed field descriptor from a lookup.
192 * @param[in] index Zero-based component index, not a byte offset.
193 * @param[out] result Decoded unsigned value; unchanged on failure.
194 * @return True for a supported, in-bounds component, otherwise false.
195 */
196bool exif_value_unsigned(const struct exif_value *value, size_t index, uint32_t *result);
197/** @brief Decode one unsigned or signed rational component as a double.
198 * @param[in] value RATIONAL or SRATIONAL field descriptor.
199 * @param[in] index Zero-based rational index; each rational occupies eight bytes.
200 * @param[out] result Numerator divided by denominator; unchanged on failure.
201 * @return True for a valid component with a nonzero denominator, otherwise false.
202 * @details Signed conversion handles the full 32-bit range without relying on
203 * implementation-defined unsigned-to-signed integer casts.
204 */
205bool exif_value_rational(const struct exif_value *value, size_t index, double *result);
206/** @brief Count text bytes after trimming trailing NUL padding only.
207 * @param[in] value ASCII or UNDEFINED field descriptor.
208 * @return Trimmed byte length, or zero for absent/unsupported values.
209 * @details Embedded NULs and the UserComment encoding prefix are retained.
210 * This is a byte-length helper, not a character decoder or strlen replacement.
211 */
212size_t exif_text_length(const struct exif_value *value);
213
214/** @brief Start a fresh upright sRGB/Y-Cb-Cr document with EXIF 2.32 defaults.
215 * @param[out] document Caller-owned writer storage; NULL is ignored.
216 * @details Standard housekeeping tags help ordinary EXIF readers interpret the
217 * result. Initialization deliberately invents no camera pose, capture time or
218 * image dimensions. Set actual dimensions and component configuration from the
219 * JPEG header before publication; grayscale needs a one-component configuration.
220 * @warning Reinitialization discards previous tags and invalidates borrowed values.
221 */
222void exif_document_init(struct exif_document *document);
223/** @brief Borrow a field from the current writable document.
224 * @param[in] document Initialized document that remains unchanged during the read.
225 * @param[in] directory Directory containing the desired tag.
226 * @param[in] tag Directory-local tag identifier.
227 * @param[out] value Borrowed little-endian field descriptor.
228 * @return True when the field is available, otherwise false.
229 * @warning Copy needed source bytes elsewhere before any document mutation.
230 */
231bool exif_document_get(const struct exif_document *document, enum exif_directory directory,
232 uint16_t tag, struct exif_value *value);
233/** @brief Rebuild a writable document from supported Sensoraia fields.
234 * @param[out] document Caller-owned destination; previous contents are replaced.
235 * @param[in] view Validated borrowed view with nonoverlapping backing storage.
236 * @return Zero on success, otherwise -1 with errno set to EINVAL.
237 * @details Import starts from standard defaults, copies only the supported tag
238 * set and normalizes numeric byte order. It intentionally drops thumbnails,
239 * MakerNotes and unknown fields instead of promising unsafe vendor preservation.
240 * @note Invalid arguments leave the document untouched. If copying has begun
241 * and fails, the document is reset to defaults, not left partially imported.
242 */
243int exif_document_import(struct exif_document *document, const struct exif_view *view);
244/** @brief Caller policy for additional, directory-local fields to import.
245 * @details Called only for fields outside the standard import set. The callback
246 * must not mutate the view or destination; context is borrowed for the call. */
247typedef bool (*exif_tag_selector)(void *context, enum exif_directory directory, uint16_t tag);
248/** @brief Import standard fields plus additional tags selected by the caller.
249 * @param document Destination with the same ownership/rollback rules as exif_document_import.
250 * @param view Validated source with nonoverlapping backing storage.
251 * @param select Optional selector for additional fields; NULL uses standard policy only.
252 * @param context Borrowed selector state, or NULL.
253 * @return Zero on success, otherwise -1; an interrupted import resets to defaults.
254 * @details Numeric values are normalized to little-endian; opaque bytes are
255 * unchanged. The caller owns custom tag meaning and relocation safety. Do not
256 * select vendor pointer structures or MakerNotes containing hidden TIFF offsets.
257 * There is no registration, global policy or retained callback state. */
258int exif_document_import_custom(struct exif_document *document, const struct exif_view *view,
259 exif_tag_selector select, void *context);
260/** @brief Remove a tag and reclaim its packed value storage.
261 * @param[in,out] document Initialized writable document.
262 * @param[in] directory Directory containing the tag.
263 * @param[in] tag Directory-local identifier to remove.
264 * @return Zero on removal or an absent tag, otherwise -1 with errno set to EINVAL.
265 * @details Compaction avoids storage growth when applications repeatedly replace
266 * provenance records. Treat earlier borrowed pointers as invalid afterwards.
267 */
269 uint16_t tag);
270/** @brief Create or replace a field with zeroed, bounded value storage.
271 * @param[in,out] document Initialized writable document.
272 * @param[in] directory Destination directory.
273 * @param[in] tag Directory-local tag; structural directory pointers are reserved.
274 * @param[in] format TIFF representation for the value.
275 * @param[in] count Positive component count, not a byte length.
276 * @return Writable value bytes, or NULL with errno set to EINVAL or ENOSPC.
277 * @details Capacity is checked before removing the old field, so an ordinary
278 * capacity failure retains it. Fill numeric components in little-endian order,
279 * terminate ASCII and supply nonzero rational denominators before serialization.
280 * @warning Reservation can move existing values. Do not use old borrowed bytes
281 * as a source afterwards. The returned pointer is borrowed until the next mutation.
282 * @see exif_encode_short
283 * @see exif_encode_long
284 */
285unsigned char *exif_document_reserve(struct exif_document *document, enum exif_directory directory,
286 uint16_t tag, enum exif_format format, uint32_t count);
287/** @brief Replace an ASCII field, including its terminating NUL byte.
288 * @param[in,out] document Initialized writable document.
289 * @param[in] directory Destination directory.
290 * @param[in] tag Directory-local ASCII tag identifier.
291 * @param[in] text Accessible NUL-terminated text outside the document storage.
292 * @return Zero on success, otherwise -1 with errno set to EINVAL or ENOSPC.
293 * @details Scanning and copying are bounded by the APP1 limit. This stores bytes;
294 * callers are responsible for supplying text appropriate to an ASCII EXIF tag.
295 */
296int exif_document_ascii(struct exif_document *document, enum exif_directory directory, uint16_t tag,
297 const char *text);
298/** @brief Store an unsigned measurement as an exact numerator/denominator pair.
299 * @param[in,out] document Initialized writable document.
300 * @param[in] directory Destination directory.
301 * @param[in] tag Directory-local RATIONAL tag identifier.
302 * @param[in] numerator Unsigned numerator in the tag's chosen units.
303 * @param[in] denominator Nonzero scale, such as 1000 for millimeter precision.
304 * @return Zero on success, otherwise -1 with errno set to EINVAL or ENOSPC.
305 * @details Keeping the integer pair avoids an unnecessary floating-point round
306 * trip. Use reservation plus integer encoders for signed rational fields.
307 */
309 uint16_t tag, uint32_t numerator, uint32_t denominator);
310/** @brief Encode a 16-bit value in the writer's little-endian representation.
311 * @param[out] data At least two writable bytes, normally reserved field storage.
312 * @param[in] value Unsigned value to encode.
313 * @pre The caller has already checked the pointer and available capacity.
314 * @details Byte stores work on unaligned addresses and on either host byte order.
315 */
316void exif_encode_short(unsigned char *data, uint16_t value);
317/** @brief Encode a 32-bit value in the writer's little-endian representation.
318 * @param[out] data At least four writable bytes, normally reserved field storage.
319 * @param[in] value Unsigned value or the bit representation of a signed component.
320 * @pre The caller has already checked the pointer and available capacity.
321 * @details Signed rational callers may convert int32_t to uint32_t before encoding;
322 * that conversion preserves the required modulo-2^32 representation.
323 */
324void exif_encode_long(unsigned char *data, uint32_t value);
325/** @brief Serialize a document into one complete EXIF APP1 payload.
326 * @param[in] document Initialized, fully populated writable document.
327 * @param[out] payload Writable storage outside the document, starting at the EXIF signature.
328 * @param[in] capacity Available bytes in @p payload.
329 * @param[out] size Published payload length; zero on failure with valid, distinct storage.
330 * @return Zero on success, otherwise -1 with errno set to EINVAL or ENOSPC.
331 * @details Validation and sizing finish before output bytes are written. Directory
332 * overhead and alignment must fit APP1 too, not just the document's value storage.
333 * Input entries are not reordered; a bounded index table controls wire ordering.
334 * @pre The size output must not overlap the document or payload. Invalid alias
335 * arguments are rejected without clearing that output, to avoid corrupting input.
336 */
337int exif_serialize(const struct exif_document *document, unsigned char *payload, size_t capacity,
338 size_t *size);
339/** @brief Read the single EXIF APP1 segment before the first JPEG scan.
340 * @param[in] filename NUL-terminated path to a readable JPEG.
341 * @param[out] payload Caller-owned writable payload buffer.
342 * @param[in] capacity Available bytes in the payload buffer.
343 * @param[out] size Payload length on success, otherwise zero when non-NULL.
344 * @return Zero on success, otherwise -1 with errno describing the failure.
345 * @details Metadata lookup stops before compressed image data to keep reads
346 * cheap. Duplicate EXIF is rejected rather than guessing which record is authoritative.
347 * Header work is bounded by marker and segment-byte limits.
348 * @pre The size output must not overlap the payload buffer.
349 * @note ENODATA means no EXIF; ENOSPC means insufficient output space. Structural
350 * errors use EINVAL and excessive segment bytes use EFBIG. File errors are also possible.
351 * @warning This extracts bytes, not a validated TIFF view or a fully validated JPEG.
352 * Call exif_parse() before interpreting the payload; ignore its contents on failure.
353 */
354int exif_read_jpeg(const char *filename, unsigned char *payload, size_t capacity, size_t *size);
355
356/** @brief Read capture EXIF from an already-open JPEG without reopening its path.
357 * @param input Borrowed readable stream positioned at SOI; position changes.
358 * @param payload Caller-owned bounded output, nonoverlapping with size.
359 * @param capacity Available payload bytes.
360 * @param size Payload length on success; zero on failure when writable.
361 * @return Zero on success; -1 with errno, including ENODATA for absent EXIF.
362 * @details The caller owns rewind, file-identity checks and closing. */
363int exif_read_stream(FILE *input, unsigned char *payload, size_t capacity, size_t *size);
364/** @brief Inspect the frame header without allocating or decoding image pixels.
365 * @param[in,out] input Readable stream positioned at the JPEG start-of-image marker.
366 * @param[out] width Actual frame width in pixels, zero on failure with valid arguments.
367 * @param[out] height Actual frame height in pixels, zero on failure with valid arguments.
368 * @param[out] components Actual frame component count, from one through four.
369 * @return Zero on success, otherwise -1 with errno set to EINVAL or EFBIG.
370 * @details Frame dimensions, not old EXIF tags, describe the compressed image.
371 * Buffered reads may advance past the inspected header; rewind before reuse.
372 * @pre Use distinct output variables; all must be valid writable pointers.
373 * @note No scan data is decoded. Delayed-height frames are outside this interface.
374 */
375int exif_jpeg_dimensions(FILE *input, uint32_t *width, uint32_t *height, unsigned *components);
376/** @brief Stream a JPEG with one new EXIF segment instead of its old EXIF records.
377 * @param[in,out] input Readable stream positioned at JPEG start-of-image.
378 * @param[in,out] output Distinct writable stream for the replacement JPEG.
379 * @param[in] payload Complete, valid EXIF APP1 payload outside both stream buffers.
380 * @param[in] size Accessible payload byte count, at most EXIF_MAX_PAYLOAD.
381 * @return Zero on successful streaming, otherwise -1 with errno set to EINVAL or EIO.
382 * @details Unrelated segments, marker fill bytes and compressed bytes are retained.
383 * Framing is checked through end-of-image without a full-image buffer, so entropy
384 * decoding, pixel validity and camera-specific metadata are intentionally separate.
385 * @pre Input and output must refer to different underlying files as well as different streams.
386 * @warning Failure can leave partial output: discard it, never publish it. Success
387 * does not flush, sync, close or rename the destination; publication belongs to the caller.
388 * @see image_exif_write_complete
389 */
390int exif_rewrite_jpeg(FILE *input, FILE *output, const unsigned char *payload, size_t size);
391
392/** @brief Replace EXIF in a regular JPEG file without a temporary file.
393 * @param[in,out] file Read/write binary stream positioned at byte zero.
394 * @param[in] payload Complete valid EXIF APP1 payload outside the stream buffers.
395 * @param[in] size Accessible payload byte count, at most EXIF_MAX_PAYLOAD.
396 * @return Zero on success, otherwise -1 with errno set.
397 * @details The entire framing is validated before mutation. Bounded block moves
398 * retain compressed bytes, unrelated markers and trailing data. Equal-size spans
399 * are not rewritten. No JPEG-sized memory or disk copy is created.
400 * @pre The caller exclusively owns the file and any hard-linked aliases.
401 * @warning Not atomic: write failures or interruption after mutation starts can
402 * leave a damaged JPEG. Success flushes but does not sync or close the file.
403 */
404int exif_update_jpeg(FILE *file, const unsigned char *payload, size_t size);
405
406/** @} */
407
408#ifdef __cplusplus
409}
410#endif
411#endif
static unsigned capacity[COVERAGE_CAMERAS]
size_t size
Definition chdk_pipe.c:143
int exif_document_import(struct exif_document *document, const struct exif_view *view)
Rebuild a writable document from supported Sensoraia fields.
Definition exifite.c:690
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.
Definition exifite.c:736
void exif_document_init(struct exif_document *document)
Start a fresh upright sRGB/Y-Cb-Cr document with EXIF 2.32 defaults.
Definition exifite.c:412
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.
Definition exifite.c:339
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.
Definition exifite.c:508
void exif_encode_long(unsigned char *data, uint32_t value)
Encode a 32-bit value in the writer's little-endian representation.
Definition exifite.c:106
int exif_parse(struct exif_view *view, const unsigned char *payload, size_t size)
Validate an EXIF APP1 payload and create a borrowed view.
Definition exifite.c:257
exif_format
TIFF field-type numbers used by Sensoraia's metadata.
Definition exifite.h:64
int exif_document_remove(struct exif_document *document, enum exif_directory directory, uint16_t tag)
Remove a tag and reclaim its packed value storage.
Definition exifite.c:473
exif_directory
Directory identities, not on-disk tag numbers or offsets.
Definition exifite.h:59
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.
Definition exifite.c:310
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.
Definition exifite.c:1022
exif_tag
Standard tag identifiers used by the current applications.
Definition exifite.h:78
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.
Definition exifite.c:572
bool(* exif_tag_selector)(void *context, enum exif_directory directory, uint16_t tag)
Caller policy for additional, directory-local fields to import.
Definition exifite.h:247
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.
Definition exifite.c:447
#define EXIF_MAX_PAYLOAD
APP1 payload ceiling: the JPEG length includes its own two bytes.
Definition exifite.h:51
int exif_jpeg_dimensions(FILE *input, uint32_t *width, uint32_t *height, unsigned *components)
Inspect the frame header without allocating or decoding image pixels.
Definition exifite.c:1309
#define EXIF_MAX_ENTRIES
Writer entry budget, including the standard initialization tags.
Definition exifite.h:54
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.
Definition exifite.c:1013
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.
Definition exifite.c:543
bool exif_value_rational(const struct exif_value *value, size_t index, double *result)
Decode one unsigned or signed rational component as a double.
Definition exifite.c:383
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.
Definition exifite.c:671
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.
Definition exifite.c:1518
size_t exif_text_length(const struct exif_value *value)
Count text bytes after trimming trailing NUL padding only.
Definition exifite.c:399
void exif_encode_short(unsigned char *data, uint16_t value)
Encode a 16-bit value in the writer's little-endian representation.
Definition exifite.c:99
int exif_update_jpeg(FILE *file, const unsigned char *payload, size_t size)
Replace EXIF in a regular JPEG file without a temporary file.
Definition exifite.c:1649
@ EXIF_ASCII
Definition exifite.h:66
@ EXIF_SLONG
Definition exifite.h:71
@ EXIF_BYTE
Definition exifite.h:65
@ EXIF_SHORT
Definition exifite.h:67
@ EXIF_SRATIONAL
Definition exifite.h:72
@ EXIF_LONG
Definition exifite.h:68
@ EXIF_UNDEFINED
Definition exifite.h:70
@ EXIF_RATIONAL
Definition exifite.h:69
@ EXIF_CAMERA
Definition exifite.h:59
@ EXIF_DIRECTORY_COUNT
Definition exifite.h:59
@ EXIF_PRIMARY
Definition exifite.h:59
@ EXIF_GPS
Definition exifite.h:59
@ EXIF_EXPOSURE_BIAS
Definition exifite.h:91
@ EXIF_GPS_TRACK
Definition exifite.h:111
@ EXIF_GPS_SPEED_REF
Definition exifite.h:108
@ EXIF_GPS_VERSION
Definition exifite.h:101
@ EXIF_FOCAL_LENGTH
Definition exifite.h:92
@ EXIF_Y_RESOLUTION
Definition exifite.h:83
@ EXIF_COMPONENTS_CONFIGURATION
Definition exifite.h:90
@ EXIF_GPS_ALTITUDE_REF
Definition exifite.h:106
@ EXIF_GPS_DIRECTION_REF
Definition exifite.h:112
@ EXIF_GPS_LATITUDE
Definition exifite.h:103
@ EXIF_BODY_SERIAL_NUMBER
Definition exifite.h:98
@ EXIF_VERSION
Definition exifite.h:89
@ EXIF_DOCUMENT_NAME
Definition exifite.h:79
@ EXIF_GPS_LATITUDE_REF
Definition exifite.h:102
@ EXIF_FLASHPIX_VERSION
Definition exifite.h:94
@ EXIF_GPS_SPEED
Definition exifite.h:109
@ EXIF_EXPOSURE_TIME
Definition exifite.h:86
@ EXIF_PIXEL_Y_DIMENSION
Definition exifite.h:97
@ EXIF_GPS_LONGITUDE
Definition exifite.h:105
@ EXIF_LENS_MODEL
Definition exifite.h:99
@ EXIF_GPS_ALTITUDE
Definition exifite.h:107
@ EXIF_X_RESOLUTION
Definition exifite.h:82
@ EXIF_PIXEL_X_DIMENSION
Definition exifite.h:96
@ EXIF_GPS_TRACK_REF
Definition exifite.h:110
@ EXIF_IMAGE_DESCRIPTION
Definition exifite.h:80
@ EXIF_SOFTWARE
Definition exifite.h:85
@ EXIF_USER_COMMENT
Definition exifite.h:93
@ EXIF_ORIENTATION
Definition exifite.h:81
@ EXIF_ISO_SPEED
Definition exifite.h:88
@ EXIF_RESOLUTION_UNIT
Definition exifite.h:84
@ EXIF_COLOR_SPACE
Definition exifite.h:95
@ EXIF_GPS_LONGITUDE_REF
Definition exifite.h:104
@ EXIF_FNUMBER
Definition exifite.h:87
@ EXIF_GPS_DIRECTION
Definition exifite.h:113
static size_t count
Definition pose_log.c:79
static FILE * output
Definition pose_log.c:77
Caller-owned bounded writer with no heap allocation.
Definition exifite.h:156
size_t count
Definition exifite.h:159
unsigned char data[EXIF_MAX_PAYLOAD]
Definition exifite.h:162
struct exif_item entries[EXIF_MAX_ENTRIES]
Definition exifite.h:157
size_t used
Definition exifite.h:160
Writer bookkeeping for one field inside the document's value storage.
Definition exifite.h:142
uint32_t size
Definition exifite.h:144
uint32_t offset
Definition exifite.h:143
uint16_t format
Definition exifite.h:147
unsigned char directory
Definition exifite.h:148
uint16_t tag
Definition exifite.h:146
uint32_t count
Definition exifite.h:145
Borrowed bytes plus enough type information for safe interpretation.
Definition exifite.h:119
bool little_endian
Definition exifite.h:124
const unsigned char * data
Definition exifite.h:120
size_t size
Definition exifite.h:121
uint32_t count
Definition exifite.h:122
uint16_t format
Definition exifite.h:123
Borrowed view of a validated APP1 payload.
Definition exifite.h:131
bool little_endian
Definition exifite.h:135
uint32_t directories[EXIF_DIRECTORY_COUNT]
Definition exifite.h:134
const unsigned char * tiff
Definition exifite.h:132
size_t size
Definition exifite.h:133
struct usher_control_result result
Definition usher.c:377