meh / rust-ffmpeg

Safe FFmpeg wrapper.
Do What The F*ck You Want To Public License
462 stars 96 forks source link

Compile even if not all cases are handled #97

Closed kornelski closed 5 years ago

kornelski commented 7 years ago

These enums are likely to get out of sync with ffmpeg_sys, so some flexibility may be useful.

meh commented 7 years ago

I don't know how I feel about this, I'd rather fix the missing cases when ffmpeg-sys upgrades, are any failing currently?

retrry commented 7 years ago

Maybe changing ffmpeg-sys dependency from ffmpeg-sys="3.3" to ffmpeg-sys="~3.3" would be enough? Then it wouldn't pull newer versions of ffmpeg-sys than 3.3.X. With current requirement it can pull every version <4.0.0

kornelski commented 7 years ago

Admittedly that's a bit lazy solution, but the Rust wrapper currently does fail to compile because ffmpeg-sys has expanded these enums.

I'm unable to find any version of ffmpeg-sys that compiles with the current master. I guess ffmpeg-sys is using bindgen, and in that case it's not possible go guarantee 1:1 match in these enums (if you add missing items to the enums, they will fail to compile with FFI from an older version of C headers).

Related #90

kornelski commented 7 years ago

Can you merge it, and perhaps remove the cases later if you find a solution to lock sys to a specific ffmpeg version?

ghost commented 7 years ago

Any progress on this?

retrry commented 6 years ago

Bindgen authors in 0.3 version changed how enums are generated (https://github.com/rust-lang-nursery/rust-bindgen/issues/758). By default instead of enums bindgen now generated constants. rust-ffmpeg-sys overrides this here: https://github.com/meh/rust-ffmpeg-sys/blob/master/build.rs#L918 Maybe we should drop this and rewrite rust-ffmpeg to use constants, but that would loose compiler check for exhaustiveness.