Crate mp4parse_capi[−][src]
Expand description
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 capi_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let mut file = std::fs::File::open(capi_dir + "/../mp4parse/tests/minimal.mp4").unwrap();
let io = mp4parse_capi::Mp4parseIo {
read: Some(buf_read),
userdata: &mut file as *mut _ as *mut std::os::raw::c_void
};
let mut parser = std::ptr::null_mut();
unsafe {
let rv = mp4parse_capi::mp4parse_new(&io, &mut parser);
assert_eq!(rv, mp4parse_capi::Mp4parseStatus::Ok);
assert!(!parser.is_null());
mp4parse_capi::mp4parse_free(parser);
}
Structs
Enums
The return value to the C API
Any detail that needs to be communicated to the caller must be encoded here
since the Error
type’s associated data is part of the FFI.
Functions
Free an Mp4parseAvifParser*
allocated by mp4parse_avif_new()
.
Return a pointer to the primary item parsed by previous mp4parse_avif_new()
call.
Allocate an Mp4parseAvifParser*
to read from the supplied Mp4parseIo
.
Free an Mp4parseParser*
allocated by mp4parse_new()
.
Fill the supplied Mp4parseFragmentInfo
with metadata from fragmented file.
Fill the supplied Mp4parseByteData
with index information from track
.
Get ‘pssh’ system id and ‘pssh’ box content for eme playback.
Fill the supplied Mp4parseTrackAudioInfo
with metadata for track
.
Return the number of tracks parsed by previous mp4parse_read()
call.
Fill the supplied Mp4parseTrackInfo
with metadata for track
.
Fill the supplied Mp4parseTrackVideoInfo
with metadata for track
.
Determine if an mp4 file is fragmented. A fragmented file needs mvex table and contains no data in stts, stsc, and stco boxes.
Allocate an Mp4parseParser*
to read from the supplied Mp4parseIo
and
parse the content from the Mp4parseIo
argument until EOF or error.