oddity-ai / video-rs

Video readers, writers, muxers, encoders and decoders for Rust based on ffmpeg libraries.
Apache License 2.0
234 stars 28 forks source link

specify log line datatype as `std::ffi::c_char` instead of `i8` for ARM platforms #19

Closed Rikharthu closed 1 year ago

Rikharthu commented 1 year ago

Not specifying log line data type as i8 to make project compile on platforms, where c_char is not represented with i8 types. Having it typed as i8 leads to the following error on ARM64 NVIDIA Jetson machine:

error[E0308]: mismatched types
   --> video-rs/src/ffi.rs:507:56
    |
507 |             if let Ok(line) = std::ffi::CStr::from_ptr(line.as_mut_ptr()).to_str() {
    |                               ------------------------ ^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
    |                               |
    |                               arguments to this function are incorrect
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*mut i8`

Similarly av_opt_flag_is_set expects flags to be provided as c_char pointers, but in ffi.rs these are provided as i8 pointers; hence casting av_opt_flag_is_set arguments as c_char pointer rather than i8 pointer.

penso commented 1 year ago

Would be nice to release a 0.5 including this, just had the issue.

gerwin3 commented 1 year ago

released 0.4.1 :tada: