Crate chd_capi

Source
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§

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

Constants§

CHD_OPEN_READ
Open a CHD for reading.
CHD_OPEN_READWRITE
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.
PRECACHE_CHUNK_SIZEchd_precache
The chunk size to read when pre-caching the underlying file stream into memory.

Functions§

chd_close
Close a CHD file.
chd_codec_config
Set codec internal parameters.
chd_core_filechd_core_file
Returns the associated core_file*.
chd_error_string
Returns an error string for the corresponding CHD error.
chd_get_codec_name
Get the name of a particular codec.
chd_get_header
Returns a pointer to the extracted CHD header data.
chd_get_metadata
Get indexed metadata of the given search tag and index.
chd_open
Opens a CHD file by file name, with a layout-undefined backing file pointer owned by the library.
chd_open_core_filechd_virtio
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.
chd_precache_progresschd_precache
Precache the underlying file into memory with an optional callback to report progress.
chd_read
Read a single hunk from the CHD file.
chd_read_header
Read CHD header data from the file into the pointed struct.

Type Aliases§

chd_file
An opaque type for an opened CHD file.