Expand description

A (mostly) libchdr compatible C-API for chd-rs.

For Rust consumers, consider using chd-rs instead.

The best way to integrate chd-rs in your C or C++ project is to instead vendor the sources directly into your project, with a compatible implementation of libchdcorefile for your platform as required.

ABI compatibility with libchdr

chd-rs-capi makes the following ABI-compatibility guarantees compared to libchdr when compiled statically.

  • chd_error is ABI and API-compatible with chd.h
  • chd_header is ABI and API-compatible chd.h
  • chd_file * is an opaque pointer. It is not layout compatible with chd.c
  • The layout of core_file * is user-defined when the chd_core_file feature is enabled.
  • Freeing any pointer returned by chd-rs with free is undefined behaviour. The exception are chd_file * pointers which can be safely freed with chd_close.

Enums

Error types that may occur when reading a CHD file or hunk.

Constants

Open a CHD for reading.

Open a CHD for reading and writing. This mode is not supported and will always return an error when passed into a constructor function such as chd_open.

The chunk size to read when pre-caching the underlying file stream into memory.

Functions

Close a CHD file.

Set codec internal parameters.

chd_core_filechd_core_file

Returns the associated core_file*.

Returns an error string for the corresponding CHD error.

Get the name of a particular codec.

Returns a pointer to the extracted CHD header data.

Get indexed metadata of the given search tag and index.

Opens a CHD file by file name, with a layout-undefined backing file pointer owned by the library.

Open an existing CHD file from an opened core_file object.

chd_open_filechd_core_file

Open an existing CHD file from an opened core_file object.

chd_precachechd_precache

Precache the underlying file into memory.

Precache the underlying file into memory with an optional callback to report progress.

Read a single hunk from the CHD file.

Read CHD header data from the file into the pointed struct.

Type Definitions

An opaque type for an opened CHD file.