Skip to main content

Module media_kinds

Module media_kinds 

Source
Expand description

Central registry of supported media extensions, MIME types, and asset kinds.

All file-extension lookups in the upload, watch, and library-view paths resolve through this module so the three previously hand-maintained tables cannot drift apart.

Enums§

AssetKind
Discriminant representing whether a media file is an image or a video.

Statics§

MIME_BY_EXT 🔒
Compile-time mapping from lowercased file extensions to standard MIME types.
RAW_EXTENSIONS
Camera RAW extensions – subset of SUPPORTED that needs RAW-specific decoding (libraw) instead of pixbuf or image-rs.
SUPPORTED
Static set of all supported file extensions for quick membership lookups. Mirrors Immich’s server-accepted formats; MPO is intentionally excluded.

Functions§

asset_kind
Determine the media kind based on the prefix of the MIME type.
extension_lower 🔒
Extract the extension from a path and return it lowercased.
is_raw_ext
Whether the extension is a camera RAW format.
is_raw_path
Whether the path’s extension is a camera RAW format.
is_supported_ext
Check if a lowercased extension is present in the supported set.
is_supported_path
Lowercase the path’s extension and return whether it is an accepted media file.
is_video_path
Whether the path’s extension maps to a video MIME type.
mime_for
MIME type for a known extension (already lowercased).
mime_for_path
MIME type for any path; falls back to application/octet-stream for unknowns.