Function gifski::c_api::gifski_add_frame_png_file

source ·
#[no_mangle]
pub unsafe extern "C" fn gifski_add_frame_png_file(
    handle: *const GifskiHandle,
    frame_number: u32,
    file_path: *const c_char,
    presentation_timestamp: f64
) -> GifskiError
Expand description

Adds a frame to the animation. This function is asynchronous.

File path must be valid UTF-8.

frame_number orders frames (consecutive numbers starting from 0). You can add frames in any order, and they will be sorted by their frame_number.

Presentation timestamp (PTS) is time in seconds, since start of the file, when this frame is to be displayed. For a 20fps video it could be frame_number/20.0. Frames with duplicate or out-of-order PTS will be skipped.

The first frame should have PTS=0. If the first frame has PTS > 0, it’ll be used as a delay after the last frame.

This function may block and wait until the frame is processed. Make sure to call gifski_set_write_callback or gifski_set_file_output first to avoid a deadlock.

Returns 0 (GIFSKI_OK) on success, and non-0 GIFSKI_* constant on error.