LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Typedefs | Functions
Compression registry

Register, enumerate, and install compression implementations. More...

Collaboration diagram for Compression registry:

Typedefs

typedef int(* TIFFInitMethod) (TIFF *tif, int scheme)
 Install compression methods and private state on a handle.
 

Functions

const TIFFCodec * TIFFFindCODEC (uint16_t scheme)
 Find the highest-priority descriptor for a compression scheme.
 
TIFFCodec * TIFFRegisterCODEC (uint16_t scheme, const char *name, TIFFInitMethod init)
 Register a codec descriptor ahead of built-in and older entries.
 
void TIFFUnRegisterCODEC (TIFFCodec *c)
 Remove and free an exact registered codec descriptor.
 
int TIFFIsCODECConfigured (uint16_t scheme)
 Check whether the selected descriptor has a configured initialiser.
 
TIFFCodec * TIFFGetConfiguredCODECs (void)
 Allocate a terminated snapshot of registered and configured codec descriptors.
 

Detailed Description

Register, enumerate, and install compression implementations.

Typedef Documentation

◆ TIFFInitMethod

typedef int(* TIFFInitMethod) (TIFF *tif, int scheme)

Install compression methods and private state on a handle.

Invoked synchronously after default methods have been installed. The initialiser may allocate handle-owned state and chain tag methods; keep code live for the lifetime of all installed callbacks. Cleanup must release that state and restore method chains. Failure can leave partial state for the handle lifecycle; no caller-buffer ownership transfers. Do not close or recursively reconfigure the active handle.

Parameters
[in,out]tifNon-NULL live handle whose codec state can be changed; caller serialises handle and registry access.
[in]schemeRequested compression identifier; related schemes can share an initialiser.
Returns
Normally one for accepted installation and zero on failure; a disabled/unknown scheme can be accepted with nonworking methods.

Definition at line 697 of file tiffio.h.

Function Documentation

◆ TIFFFindCODEC()

const TIFFCodec * TIFFFindCODEC ( uint16_t  scheme)
extern

Find the highest-priority descriptor for a compression scheme.

Searches registered entries newest first, then built-ins; a descriptor can represent a codec disabled at build time. No allocation, I/O or diagnostics. Returned registered storage is invalidated by unregister; built-in storage remains live while the library is loaded. Do not modify/free it. The process-global registry is unsynchronised; serialise queries and modifications externally. No registry operation manages active codec state or unloads callback code.

Parameters
[in]schemeCompression identifier to look up.
Returns
Borrowed descriptor, or NULL if no matching scheme is known.

Definition at line 306 of file tif_compress.c.

References _TIFFBuiltinCODECS, _codec::info, TIFFCodec::name, _codec::next, registeredCODECS, and TIFFCodec::scheme.

Referenced by _notConfigured(), TIFFIsCODECConfigured(), TIFFNoDecode(), TIFFNoEncode(), TIFFPrintDirectory(), and TIFFSetCompressionScheme().

Here is the caller graph for this function:

◆ TIFFGetConfiguredCODECs()

TIFFCodec * TIFFGetConfiguredCODECs ( void  )
extern

Allocate a terminated snapshot of registered and configured codec descriptors.

Lists registrations newest first followed by built-in records whose scheme currently resolves as configured. Duplicates/shadowed entries can remain, and registered entries are copied even if their callback is NULL. The sentinel record has all fields zero. Caller frees the array with _TIFFfree(); names and callback pointers are shallow borrowed copies. Registration removal invalidates names in earlier snapshots. Reallocation failure frees partial output and returns NULL; no explicit diagnostic is emitted here. The process-global registry is unsynchronised; serialise queries and modifications externally. No registry operation manages active codec state or unloads callback code.

Returns
Owned array terminated by a name-NULL record, or NULL on allocation failure.

Definition at line 371 of file tif_compress.c.

References _TIFFBuiltinCODECS, _TIFFfreeExt(), _TIFFmemcpy(), _TIFFmemset(), _TIFFreallocExt(), _codec::info, TIFFCodec::name, _codec::next, registeredCODECS, TIFFCodec::scheme, and TIFFIsCODECConfigured().

Here is the call graph for this function:

◆ TIFFIsCODECConfigured()

int TIFFIsCODECConfigured ( uint16_t  scheme)
extern

Check whether the selected descriptor has a configured initialiser.

Tests lookup, non-NULL init and inequality with the build-disabled stub. Does not call init, validate a custom callback, test format support, allocate, do I/O, or diagnose. The process-global registry is unsynchronised; serialise queries and modifications externally. No registry operation manages active codec state or unloads callback code.

Parameters
[in]schemeCompression identifier.
Returns
One for a descriptor with a non-stub non-NULL initialiser, zero otherwise; not a runtime success guarantee.

Definition at line 171 of file tif_codec.c.

References TIFFCodec::init, NotConfigured(), and TIFFFindCODEC().

Referenced by _TIFFCheckFieldIsValidForCodec(), and TIFFGetConfiguredCODECs().

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

◆ TIFFRegisterCODEC()

TIFFCodec * TIFFRegisterCODEC ( uint16_t  scheme,
const char *  name,
TIFFInitMethod  init 
)
extern

Register a codec descriptor ahead of built-in and older entries.

Copies name into a combined allocation and stores the init pointer without invoking it. Registration can shadow existing schemes and need not supply both encoding and decoding. Keep callback code/context live while registered and while any installed handles still use it. Release this registration only with TIFFUnRegisterCODEC(); do not free the returned descriptor or its name separately. Allocation failure uses global diagnostics. The process-global registry is unsynchronised; serialise queries and modifications externally. No registry operation manages active codec state or unloads callback code.

Parameters
[in]schemeCompression identifier to register.
[in]nameNon-NULL borrowed terminated name, copied synchronously; combined allocation size must be representable.
[in]initInitialiser callback; a usable registration requires a callable non-NULL function.
Returns
Registration-owned descriptor token, or NULL on allocation failure.

Definition at line 320 of file tif_compress.c.

References _TIFFmallocExt(), _TIFFmemcpy(), _codec::info, TIFFCodec::init, TIFFCodec::name, _codec::next, registeredCODECS, TIFFCodec::scheme, and TIFFErrorExt().

Here is the call graph for this function:

◆ TIFFUnRegisterCODEC()

void TIFFUnRegisterCODEC ( TIFFCodec *  c)
extern

Remove and free an exact registered codec descriptor.

Requires a live descriptor token from TIFFRegisterCODEC(). Removes only that pointer, exposing any older match. Frees the combined allocation and invalidates its descriptor/name plus borrowed copies of that name. Does not clean up installed handles; callback code must still outlive them. An unmatched live descriptor is diagnosed through global handlers; dangling/NULL input is not safe. The process-global registry is unsynchronised; serialise queries and modifications externally. No registry operation manages active codec state or unloads callback code.

Parameters
[in]cLive registration token, consumed on successful removal; not a configured-list copy or built-in descriptor.

Definition at line 348 of file tif_compress.c.

References _TIFFfreeExt(), _codec::info, TIFFCodec::name, _codec::next, registeredCODECS, and TIFFErrorExt().

Here is the call graph for this function: