[][src]Crate minimp3_ex_sys

This crate provides raw FFI bindings to the minimp3_ex library for reading MP3 audio files.

Following the *-sys package conventions, the minimp3_ex-sys crate does not define higher-level abstractions over the native minimp3_ex library functions.

The minimp3 project (https://github.com/lieff/minimp3) provides two header-only libraries:

  • minimp3.h contains only the two functions mp3dec_init() and mp3dec_decode_frame() (and the necessary type definitions).
  • minimp3_ex.h (which includes minimp3.h) is a bit less "mini" and contains many more functions, including for opening files, seeking, using buffers, using callback functions, ...

This crate provides bindings for all functions from both header files.

If you only need the minimp3.h functionality, you can also use the minimp3-sys crate.

There are also some higher-level crates based on minimp3.h:

And of course https://crates.io/ provides a multitude of further MP3-related libraries for Rust.

Usage

Add this to your Cargo.toml:

[dependencies]
minimp3_ex-sys = "0.1"

Features

The feature float-output changes the output data type (mp3d_sample_t) from i16 to f32.

WARNING: This feature doesn't behave like typical Cargo features because it is not additive. If multiple instances of minimp3_ex-sys appear in the dependency tree and at least one of them has the float-output feature enabled, it will be enabled for all instances (probably leading to compiler errors). Hopefully, this doesn't happen in practice.

The function mp3dec_f32_to_s16() is only available if the float-output feature is enabled.

The functions ending in _w are only available on Windows.

Building the minimp3_ex library

When building this crate, the minimp3_ex library is automatically built as well, using the cc crate.

Auto-generating the Rust bindings

The Rust bindings have already been auto-generated with bindgen (using the bindgen/run-bindgen.sh script) and are part of this crate (see src/bindings.rs).

Contributing

If you want to report a problem or suggest an improvement, please go to https://github.com/mgeier/minimp3_ex-sys. Contributions are always welcome!

Structs

mp3dec_ex_t
mp3dec_file_info_t
mp3dec_frame_info_t
mp3dec_frame_t
mp3dec_index_t
mp3dec_io_t
mp3dec_map_info_t
mp3dec_t

Constants

MINIMP3_BUF_SIZE
MINIMP3_IO_SIZE
MINIMP3_MAX_SAMPLES_PER_FRAME
MP3D_DO_NOT_SCAN
MP3D_E_DECODE
MP3D_E_IOERROR
MP3D_E_MEMORY
MP3D_E_PARAM
MP3D_E_USER
MP3D_SEEK_TO_BYTE
MP3D_SEEK_TO_SAMPLE

Functions

mp3dec_decode_frame
mp3dec_detect
mp3dec_detect_buf
mp3dec_detect_cb
mp3dec_detect_w
mp3dec_ex_close
mp3dec_ex_open
mp3dec_ex_open_buf
mp3dec_ex_open_cb
mp3dec_ex_open_w
mp3dec_ex_read
mp3dec_ex_read_frame
mp3dec_ex_seek
mp3dec_f32_to_s16
mp3dec_init
mp3dec_iterate
mp3dec_iterate_buf
mp3dec_iterate_cb
mp3dec_iterate_w
mp3dec_load
mp3dec_load_buf
mp3dec_load_cb
mp3dec_load_w

Type Definitions

MP3D_ITERATE_CB
MP3D_PROGRESS_CB
MP3D_READ_CB
MP3D_SEEK_CB
mp3d_sample_t

Type for decoded samples.

wchar_t