Crate mp4parse_capi [] [src]

C API for mp4parse module.

Parses ISO Base Media Format aka video/mp4 streams.

Examples

extern crate mp4parse_capi;
use std::io::Read;

extern fn buf_read(buf: *mut u8, size: usize, userdata: *mut std::os::raw::c_void) -> isize {
   let mut input: &mut std::fs::File = unsafe { &mut *(userdata as *mut _) };
   let mut buf = unsafe { std::slice::from_raw_parts_mut(buf, size) };
   match input.read(&mut buf) {
       Ok(n) => n as isize,
       Err(_) => -1,
   }
}

let mut file = std::fs::File::open("../mp4parse/tests/minimal.mp4").unwrap();
let io = mp4parse_capi::mp4parse_io {
    read: buf_read,
    userdata: &mut file as *mut _ as *mut std::os::raw::c_void
};
unsafe {
    let parser = mp4parse_capi::mp4parse_new(&io);
    let rv = mp4parse_capi::mp4parse_read(parser);
    assert_eq!(rv, mp4parse_capi::mp4parse_error::MP4PARSE_OK);
    mp4parse_capi::mp4parse_free(parser);
}

Structs

mp4parse_codec_specific_config
mp4parse_io
mp4parse_parser
mp4parse_track_audio_info
mp4parse_track_info
mp4parse_track_video_info

Enums

mp4parse_codec
mp4parse_error
mp4parse_track_type

Functions

mp4parse_free

Free an mp4parse_parser* allocated by mp4parse_new().

mp4parse_get_track_audio_info

Fill the supplied mp4parse_track_audio_info with metadata for track.

mp4parse_get_track_count

Return the number of tracks parsed by previous mp4parse_read() call.

mp4parse_get_track_info

Fill the supplied mp4parse_track_info with metadata for track.

mp4parse_get_track_video_info

Fill the supplied mp4parse_track_video_info with metadata for track.

mp4parse_is_fragmented
mp4parse_new

Allocate an mp4parse_parser* to read from the supplied mp4parse_io.

mp4parse_read

Run the mp4parse_parser* allocated by mp4parse_new() until EOF or error.