LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Typedefs | Functions
Field definitions and extension

Query registered descriptors and extend image-directory schemas. More...

Collaboration diagram for Field definitions and extension:

Typedefs

typedef void(* TIFFExtendProc) (TIFF *tif)
 Extend the image-directory field table during default initialisation.
 

Functions

int TIFFGetTagListCount (TIFF *tif)
 Count values stored in the current custom-tag list.
 
uint32_t TIFFGetTagListEntry (TIFF *tif, int tag_index)
 Look up a tag number by its custom-value list index.
 
const TIFFField * TIFFFindField (TIFF *tif, uint32_t tag, TIFFDataType dt)
 Find a registered field by tag number and file data type.
 
const TIFFField * TIFFFieldWithTag (TIFF *tif, uint32_t tag)
 Find a registered field by tag number.
 
const TIFFField * TIFFFieldWithName (TIFF *tif, const char *field_name)
 Find a registered field by name.
 
uint32_t TIFFFieldTag (const TIFFField *fip)
 Read a field descriptor's tag number.
 
const char * TIFFFieldName (const TIFFField *fip)
 Read a field descriptor's name.
 
TIFFDataType TIFFFieldDataType (const TIFFField *fip)
 Read a field descriptor's on-disk data type.
 
int TIFFFieldPassCount (const TIFFField *fip)
 Test whether a field passes an explicit count argument.
 
int TIFFFieldReadCount (const TIFFField *fip)
 Read a field descriptor's getter count rule.
 
int TIFFFieldWriteCount (const TIFFField *fip)
 Read a field descriptor's setter count rule.
 
int TIFFFieldSetGetSize (const TIFFField *fip)
 Report the internal element storage width of a field.
 
int TIFFFieldSetGetCountSize (const TIFFField *fip)
 Report the count width encoded by a field's set/get representation.
 
int TIFFFieldIsAnonymous (const TIFFField *fip)
 Test whether a field was registered as an unknown tag.
 
TIFFTagMethods * TIFFAccessTagMethods (TIFF *tif)
 Expose a handle's mutable tag-method table.
 
TIFFExtendProc TIFFSetTagExtender (TIFFExtendProc extender)
 Replace the process-wide image-directory extension callback.
 
int TIFFDataWidth (TIFFDataType type)
 Report the on-disk byte width of a TIFF data type.
 
int TIFFMergeFieldInfo (TIFF *tif, const TIFFFieldInfo info[], uint32_t n)
 Register legacy application field definitions on a handle.
 

Detailed Description

Query registered descriptors and extend image-directory schemas.

Typedef Documentation

◆ TIFFExtendProc

typedef void(* TIFFExtendProc) (TIFF *tif)

Extend the image-directory field table during default initialisation.

Called synchronously by TIFFDefaultDirectory(), including repeated directory setup on an existing handle. Register application fields and optionally chain the previously installed extender. It has no status channel; registration errors must be checked/reported within the callback. Custom/EXIF/GPS setup subsequently replaces the field table, so this hook does not extend their schemas. Keep callback code and borrowed field names live for their use, and synchronise global registration externally.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.

Definition at line 1026 of file tiffio.h.

Function Documentation

◆ TIFFAccessTagMethods()

TIFFTagMethods * TIFFAccessTagMethods ( TIFF *  tif)
extern

Expose a handle's mutable tag-method table.

Returns inline borrowed storage valid until handle cleanup. Changes take effect immediately and may be overwritten by codec/directory setup. Save and delegate to the previous methods for unhandled tags. Keep installed callback code live until removed and all calls finish. No allocation, validation, or locking occurs; do not free the table.

Parameters
[in]tifNon-NULL live TIFF handle; not modified here, but the returned pointer gives write access to its method table. Accessed without internal locking.
Returns
Non-NULL pointer to the embedded method table.

Definition at line 63 of file tif_extension.c.

References tiff::tif_tagmethods.

◆ TIFFDataWidth()

int TIFFDataWidth ( TIFFDataType  type)
extern

Report the on-disk byte width of a TIFF data type.

RATIONAL and SRATIONAL occupy eight bytes even when represented internally by float. TIFF_NOTYPE (zero) returns one for historical compatibility. No diagnostic or allocation occurs.

Parameters
[in]typeFile data type; no state is accessed.
Returns
Width of one file element (1, 2, 4, or 8), or zero for an unknown type.

Definition at line 793 of file tif_dirinfo.c.

References TIFF_ASCII, TIFF_BYTE, TIFF_DOUBLE, TIFF_FLOAT, TIFF_IFD, TIFF_IFD8, TIFF_LONG, TIFF_LONG8, TIFF_RATIONAL, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SRATIONAL, TIFF_SSHORT, and TIFF_UNDEFINED.

Referenced by _TIFFRewriteField(), EstimateStripByteCounts(), EvaluateIFDdatasizeReading(), and TIFFReadDirEntryArrayWithLimit().

Here is the caller graph for this function:

◆ TIFFFieldDataType()

TIFFDataType TIFFFieldDataType ( const TIFFField *  fip)
extern

Read a field descriptor's on-disk data type.

Reads descriptor metadata without changing it or transferring ownership. No allocation or diagnostic occurs.

Parameters
[in]fipNon-NULL live borrowed field descriptor.
Returns
TIFFDataType value; not the complete variadic argument representation.

Definition at line 1079 of file tif_dirinfo.c.

References _TIFFField::field_type.

◆ TIFFFieldIsAnonymous()

int TIFFFieldIsAnonymous ( const TIFFField *  fip)
extern

Test whether a field was registered as an unknown tag.

Reads descriptor metadata without changing it or transferring ownership. No allocation or diagnostic occurs.

Parameters
[in]fipNon-NULL live borrowed field descriptor.
Returns
Nonzero for an anonymous descriptor, zero for a named definition; no diagnostic is emitted.

Definition at line 1087 of file tif_dirinfo.c.

References _TIFFField::field_anonymous.

Referenced by _TIFFPrettyPrintField(), _TIFFPrintField(), _TIFFSetupFields(), TIFFCleanup(), and TIFFReadCustomDirectory().

Here is the caller graph for this function:

◆ TIFFFieldName()

const char * TIFFFieldName ( const TIFFField *  fip)
extern

Read a field descriptor's name.

Reads descriptor metadata without changing it or transferring ownership. No allocation or diagnostic occurs.

Parameters
[in]fipNon-NULL live borrowed field descriptor.
Returns
Borrowed name string; valid only while its descriptor/name storage remains live. Do not free or modify it.

Definition at line 1077 of file tif_dirinfo.c.

References _TIFFField::field_name.

◆ TIFFFieldPassCount()

int TIFFFieldPassCount ( const TIFFField *  fip)
extern

Test whether a field passes an explicit count argument.

Reads descriptor metadata without changing it or transferring ownership. No allocation or diagnostic occurs.

Parameters
[in]fipNon-NULL live borrowed field descriptor.
Returns
Nonzero for an explicit count, zero otherwise; see Tag arguments for argument promotions and exceptions.

Definition at line 1081 of file tif_dirinfo.c.

References _TIFFField::field_passcount.

◆ TIFFFieldReadCount()

int TIFFFieldReadCount ( const TIFFField *  fip)
extern

Read a field descriptor's getter count rule.

Reads descriptor metadata without changing it or transferring ownership. No allocation or diagnostic occurs.

Parameters
[in]fipNon-NULL live borrowed field descriptor.
Returns
Fixed element count, or TIFF_VARIABLE, TIFF_VARIABLE2, or TIFF_SPP; see Tag arguments. No diagnostic is emitted.

Definition at line 1083 of file tif_dirinfo.c.

References _TIFFField::field_readcount.

◆ TIFFFieldSetGetCountSize()

int TIFFFieldSetGetCountSize ( const TIFFField *  fip)
extern

Report the count width encoded by a field's set/get representation.

Inspects the C16/C32 representation; it does not validate special built- in calling conventions or the consistency of legacy metadata. No allocation or diagnostic occurs.

Parameters
[in]fipBorrowed descriptor, or NULL.
Returns
Two for C16, four for C32, or zero for all other representations or NULL.

Definition at line 913 of file tif_dirinfo.c.

References _TIFFField::set_get_field_type, TIFF_SETGET_ASCII, TIFF_SETGET_C0_ASCII, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_C0_IFD8, TIFF_SETGET_C0_SINT16, TIFF_SETGET_C0_SINT32, TIFF_SETGET_C0_SINT64, TIFF_SETGET_C0_SINT8, TIFF_SETGET_C0_UINT16, TIFF_SETGET_C0_UINT32, TIFF_SETGET_C0_UINT64, TIFF_SETGET_C0_UINT8, TIFF_SETGET_C16_ASCII, TIFF_SETGET_C16_DOUBLE, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_C16_IFD8, TIFF_SETGET_C16_SINT16, TIFF_SETGET_C16_SINT32, TIFF_SETGET_C16_SINT64, TIFF_SETGET_C16_SINT8, TIFF_SETGET_C16_UINT16, TIFF_SETGET_C16_UINT32, TIFF_SETGET_C16_UINT64, TIFF_SETGET_C16_UINT8, TIFF_SETGET_C32_ASCII, TIFF_SETGET_C32_DOUBLE, TIFF_SETGET_C32_FLOAT, TIFF_SETGET_C32_IFD8, TIFF_SETGET_C32_SINT16, TIFF_SETGET_C32_SINT32, TIFF_SETGET_C32_SINT64, TIFF_SETGET_C32_SINT8, TIFF_SETGET_C32_UINT16, TIFF_SETGET_C32_UINT32, TIFF_SETGET_C32_UINT64, TIFF_SETGET_C32_UINT8, TIFF_SETGET_DOUBLE, TIFF_SETGET_FLOAT, TIFF_SETGET_IFD8, TIFF_SETGET_INT, TIFF_SETGET_OTHER, TIFF_SETGET_SINT16, TIFF_SETGET_SINT32, TIFF_SETGET_SINT64, TIFF_SETGET_SINT8, TIFF_SETGET_UINT16, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UINT32, TIFF_SETGET_UINT64, TIFF_SETGET_UINT8, and TIFF_SETGET_UNDEFINED.

◆ TIFFFieldSetGetSize()

int TIFFFieldSetGetSize ( const TIFFField *  fip)
extern

Report the internal element storage width of a field.

Returns the width selected by the set/get representation, including float versus double rationals. UINT16_PAIR returns four. UNDEFINED, ASCII, and OTHER representations return one. This is neither the file data width nor a complete variadic signature: promotions, count arguments, and pointer indirection still apply. No allocation or diagnostic occurs.

Parameters
[in]fipBorrowed descriptor, or NULL.
Returns
Element width in bytes (1, 2, 4, or 8), or zero for NULL or an unrecognised representation.

Definition at line 829 of file tif_dirinfo.c.

References _TIFFField::set_get_field_type, TIFF_SETGET_ASCII, TIFF_SETGET_C0_ASCII, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_C0_IFD8, TIFF_SETGET_C0_SINT16, TIFF_SETGET_C0_SINT32, TIFF_SETGET_C0_SINT64, TIFF_SETGET_C0_SINT8, TIFF_SETGET_C0_UINT16, TIFF_SETGET_C0_UINT32, TIFF_SETGET_C0_UINT64, TIFF_SETGET_C0_UINT8, TIFF_SETGET_C16_ASCII, TIFF_SETGET_C16_DOUBLE, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_C16_IFD8, TIFF_SETGET_C16_SINT16, TIFF_SETGET_C16_SINT32, TIFF_SETGET_C16_SINT64, TIFF_SETGET_C16_SINT8, TIFF_SETGET_C16_UINT16, TIFF_SETGET_C16_UINT32, TIFF_SETGET_C16_UINT64, TIFF_SETGET_C16_UINT8, TIFF_SETGET_C32_ASCII, TIFF_SETGET_C32_DOUBLE, TIFF_SETGET_C32_FLOAT, TIFF_SETGET_C32_IFD8, TIFF_SETGET_C32_SINT16, TIFF_SETGET_C32_SINT32, TIFF_SETGET_C32_SINT64, TIFF_SETGET_C32_SINT8, TIFF_SETGET_C32_UINT16, TIFF_SETGET_C32_UINT32, TIFF_SETGET_C32_UINT64, TIFF_SETGET_C32_UINT8, TIFF_SETGET_DOUBLE, TIFF_SETGET_FLOAT, TIFF_SETGET_IFD8, TIFF_SETGET_INT, TIFF_SETGET_OTHER, TIFF_SETGET_SINT16, TIFF_SETGET_SINT32, TIFF_SETGET_SINT64, TIFF_SETGET_SINT8, TIFF_SETGET_UINT16, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UINT32, TIFF_SETGET_UINT64, TIFF_SETGET_UINT8, and TIFF_SETGET_UNDEFINED.

Referenced by _TIFFPrintField(), _TIFFVGetField(), _TIFFVSetField(), TIFFPrintDirectory(), and TIFFWriteDirectorySec().

Here is the caller graph for this function:

◆ TIFFFieldTag()

uint32_t TIFFFieldTag ( const TIFFField *  fip)
extern

Read a field descriptor's tag number.

Reads descriptor metadata without changing it or transferring ownership. No allocation or diagnostic occurs.

Parameters
[in]fipNon-NULL live borrowed field descriptor.
Returns
Tag identifier; no allocation or diagnostics.

Definition at line 1075 of file tif_dirinfo.c.

References _TIFFField::field_tag.

Referenced by TIFFWriteDirectorySec().

Here is the caller graph for this function:

◆ TIFFFieldWithName()

const TIFFField * TIFFFieldWithName ( TIFF *  tif,
const char *  field_name 
)
extern

Find a registered field by name.

The result is borrowed; do not free or modify it. Directory field-table replacement or handle cleanup can invalidate it, particularly for anonymous and legacy descriptors. Lookup updates the handle's field cache but does not register a missing tag. Absence dispatches a warning only when unknown-tag warnings are enabled for this handle.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]field_nameNon-NULL null-terminated, case-sensitive field name.
Returns
Borrowed descriptor, or NULL if absent.

Definition at line 1061 of file tif_dirinfo.c.

References _TIFFFindFieldByName(), tiff::tif_warn_about_unknown_tags, TIFF_ANY, and TIFFWarningExtR().

Here is the call graph for this function:

◆ TIFFFieldWithTag()

const TIFFField * TIFFFieldWithTag ( TIFF *  tif,
uint32_t  tag 
)
extern

Find a registered field by tag number.

The result is borrowed; do not free or modify it. Directory field-table replacement or handle cleanup can invalidate it, particularly for anonymous and legacy descriptors. Lookup updates the handle's field cache but does not register a missing tag. Absence dispatches a warning only when unknown-tag warnings are enabled for this handle.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagTag number in the current namespace.
Returns
Borrowed descriptor, or NULL if absent.

Definition at line 1047 of file tif_dirinfo.c.

References tiff::tif_warn_about_unknown_tags, TIFF_ANY, TIFFFindField(), and TIFFWarningExtR().

Referenced by _TIFFVSetField(), CheckDirCount(), JPEGVSetField(), OJPEGVSetField(), TIFFFetchStripThing(), TIFFPrintDirectory(), TIFFReadDirectory(), TIFFReadDirEntryPersampleShort(), and TIFFUnsetField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TIFFFieldWriteCount()

int TIFFFieldWriteCount ( const TIFFField *  fip)
extern

Read a field descriptor's setter count rule.

Reads descriptor metadata without changing it or transferring ownership. No allocation or diagnostic occurs.

Parameters
[in]fipNon-NULL live borrowed field descriptor.
Returns
Fixed element count, or TIFF_VARIABLE, TIFF_VARIABLE2, or TIFF_SPP; see Tag arguments. No diagnostic is emitted.

Definition at line 1085 of file tif_dirinfo.c.

References _TIFFField::field_writecount.

◆ TIFFFindField()

const TIFFField * TIFFFindField ( TIFF *  tif,
uint32_t  tag,
TIFFDataType  dt 
)
extern

Find a registered field by tag number and file data type.

The result is borrowed; do not free or modify it. Directory field-table replacement or handle cleanup can invalidate it, particularly for anonymous and legacy descriptors. Lookup updates the handle's field cache but does not register a missing tag. No diagnostic is emitted on absence.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagTag number in the current directory namespace.
[in]dtRequired file type, or TIFF_ANY to accept any registered type.
Returns
Borrowed matching descriptor, or NULL if none is registered.

Definition at line 979 of file tif_dirinfo.c.

References _TIFFField::field_tag, _TIFFField::field_type, tagCompare(), tiff::tif_fields, tiff::tif_foundfield, tiff::tif_nfields, TIFF_ANY, TIFF_NOTYPE, and TIFF_SETGET_UNDEFINED.

Referenced by _TIFFFindOrRegisterField(), _TIFFMergeFields(), _TIFFRewriteField(), _TIFFVGetField(), _TIFFVSetField(), OkToChangeTag(), TIFFFieldWithTag(), and TIFFVGetField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TIFFGetTagListCount()

int TIFFGetTagListCount ( TIFF *  tif)
extern

Count values stored in the current custom-tag list.

Counts FIELD_CUSTOM values, not all present baseline or codec tags. No allocation, diagnostic, or ownership change occurs.

Parameters
[in]tifNon-NULL live handle.
Returns
Number of entries, including any partially installed custom value.

Definition at line 39 of file tif_extension.c.

References TIFFDirectory::td_customValueCount, and tiff::tif_dir.

Referenced by TIFFPrintDirectory().

Here is the caller graph for this function:

◆ TIFFGetTagListEntry()

uint32_t TIFFGetTagListEntry ( TIFF *  tif,
int  tag_index 
)
extern

Look up a tag number by its custom-value list index.

The unsorted list changes after custom setters, unsetting, and directory replacement. No diagnostic is emitted for an invalid index.

Parameters
[in]tifNon-NULL live handle.
[in]tag_indexZero-based index below TIFFGetTagListCount().
Returns
Tag number, or UINT32_MAX for an invalid index.

Definition at line 47 of file tif_extension.c.

References _TIFFField::field_tag, TIFFTagValue::info, TIFFDirectory::td_customValueCount, TIFFDirectory::td_customValues, and tiff::tif_dir.

Referenced by TIFFPrintDirectory().

Here is the caller graph for this function:

◆ TIFFMergeFieldInfo()

int TIFFMergeFieldInfo ( TIFF *  tif,
const TIFFFieldInfo  info[],
uint32_t  n 
)
extern

Register legacy application field definitions on a handle.

Converts descriptors into handle-owned compatibility storage, but borrows each non-NULL field_name until field-table/handle cleanup; keep names live and unchanged. Input records may be released after the call. Existing tag definitions win; this does not replace a definition or install tag values. Count validation/allocation/merge failures dispatch diagnostics and may leave partial compatibility storage or altered field- table state; there is no rollback. Zero-length input is not a successful no-op. Call during image-directory extension before values are read. This legacy interface cannot express every private set/get representation; see Tag arguments.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]infoReadable array of n definitions, with valid count rules and long-lived names.
[in]nPositive number of records, with allocation sizes representable by tmsize_t.
Returns
Zero on success, minus one on detected failure (opposite to ordinary tag setters).

Definition at line 1380 of file tif_dirinfo.c.

References _TIFFCheckMalloc(), _TIFFCheckRealloc(), _TIFFMergeFields(), _TIFFSetGetType(), _TIFFFieldArray::allocated_size, _TIFFFieldArray::count, _TIFFField::field_anonymous, _TIFFField::field_bit, TIFFFieldInfo::field_bit, FIELD_IGNORE, _TIFFField::field_name, TIFFFieldInfo::field_name, _TIFFField::field_oktochange, TIFFFieldInfo::field_oktochange, _TIFFField::field_passcount, TIFFFieldInfo::field_passcount, _TIFFField::field_readcount, TIFFFieldInfo::field_readcount, _TIFFField::field_subfields, _TIFFField::field_tag, TIFFFieldInfo::field_tag, _TIFFField::field_type, TIFFFieldInfo::field_type, _TIFFField::field_writecount, TIFFFieldInfo::field_writecount, _TIFFFieldArray::fields, _TIFFField::set_get_field_type, tfiatOther, tiff::tif_fieldscompat, tiff::tif_nfieldscompat, TIFF_VARIABLE2, TIFFErrorExtR(), and _TIFFFieldArray::type.

Here is the call graph for this function:

◆ TIFFSetTagExtender()

TIFFExtendProc TIFFSetTagExtender ( TIFFExtendProc  extender)
extern

Replace the process-wide image-directory extension callback.

Affects future default-directory initialisations, including those on existing handles, rather than invoking the hook immediately. NULL disables it. To coexist with other extenders, save and chain the returned callback. Callback code is borrowed; no allocation, validation, diagnostic, or locking occurs. Coordinate replacement with all users and in-flight initialisations.

Parameters
[in]extenderNew callback, or NULL; must remain callable while installed/in flight.
Returns
Previous callback, possibly NULL; no ownership transfer.

Definition at line 2232 of file tif_dir.c.

References _TIFFextender.