Skip to main content

openjp2/
lib.rs

1#![allow(deprecated)] // the C ABI shim legitimately drives the low-level Codec API
2//! C ABI for the Rust OpenJPEG port.
3//!
4//! This crate holds the `#[no_mangle]`/`#[repr(C)]` surface that produces the
5//! drop-in `libopenjp2.a`/`libopenjp2.so`. The safe Rust API lives in the
6//! `openjp2` core crate.
7
8// The C ABI mirror must keep the libopenjp2 identifier spellings.
9#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
10// Every public fn here is a thin C-ABI shim; the Safety story is per-call-site.
11#![allow(clippy::missing_safety_doc)]
12#![allow(clippy::not_unsafe_ptr_arg_deref)]
13
14// The C-ABI mirror types come straight from openjp2-ctypes; the core no
15// longer re-exports C types at its root (0.7 breaking change).
16pub use openjp2_ctypes::*;
17// Re-export the core's safe surface for Rust users of this crate.
18pub use openjp2_core::{
19  ColorSpace, DecodeArea, DecodeLimits, DecodeParameters, DumpImage,
20  EncodeParameters, Error, Image, ProgressionOrder, Result,
21  CoreImage, CoreImageComp,
22  CIE_LAB_BYTE_SIZE, ICCProfile, ICCProfileMut, ICCProfileRef,
23  CodestreamIndex, CodestreamTileIndex, CstrCompInfoV2, CstrInfoV2,
24  CstrTccpInfoV2, EncoderParameters, Stream, TileInfo,
25  J2KFormat, detect_format, detect_format_from_extension,
26  detect_format_from_extension_os_str, detect_format_from_file,
27  has_thread_support, JP2_RFC3745_MAGIC,
28};
29
30/// The C stream handle type (the core's `Stream`).
31pub type opj_stream_private_t = openjp2_core::Stream;
32
33/// The merged `opj_codec_t*` handle (the core split its `Codec` into
34/// `Decoder`/`Encoder`; this crate keeps the single-pointer contract).
35pub mod codec;
36pub use codec::Codec;
37
38pub mod image;
39pub mod params;
40pub mod cstr_info;
41pub mod openjpeg;