rust-av / ffms2-rs

ffms2 bindings
MIT License
10 stars 5 forks source link

Can't build new project with ffms2-rs as the only dependency #3

Closed askoufis closed 3 years ago

askoufis commented 3 years ago

Disclaimer: I'm pretty new to Rust, so forgive me if I'm forgetting to do something obvious.

I can't seem to get this package to build. I've installed the ffms2 library (version 2.23.1), created a new package with cargo new and then added ffms2-rs as a dependency:

[dependencies]
ffms2 = { git = "https://github.com/rust-av/ffms2-rs" }

Running cargo build gives me a bunch of errors. Primarily they're about unknown fields on structs and types:

error[E0609]: no field `Flip` on type `ffms2_sys::FFMS_VideoProperties`
   --> /home/askoufis/.cargo/git/checkouts/ffms2-rs-deffbde628fee48c/bc7da53/src/video.rs:262:41
    |
262 |         (cfg(feature = "ffms2-2-31-0"), Flip, usize, Flip as i32)
    |                                         ^^^^ unknown field
    |
    = note: available fields are: `FPSDenominator`, `FPSNumerator`, `RFFDenominator`, `RFFNumerator`, `NumFrames` ... and 11 others

This seems like it has something to do with features, though if I build with --verbose I can see all features being included.

I also get a few errors inside macros about missing variants, as well as this one:

error[E0425]: cannot find function, tuple struct or tuple variant `FFMS_Deinit` in this scope
    --> /home/askoufis/.cargo/git/checkouts/ffms2-rs-deffbde628fee48c/bc7da53/src/lib.rs:178:13
     |
178  |             FFMS_Deinit();
     |             ^^^^^^^^^^^ help: a function with a similar name exists: `FFMS_Init`
     | 
    ::: /home/askoufis/code/rust/scratch/target/debug/build/ffms2-sys-32545be65579f47e/out/ffms2.rs:1436:5
     |
1436 |     pub fn FFMS_Init(arg1: ::std::os::raw::c_int, arg2: ::std::os::raw::c_int);
     |     --------------------------------------------------------------------------- similarly named function `FFMS_Init` defined here

This one seems to suggest it can't find ffms2-sys, which is odd because that package successfully builds right before it cargo tries to build ffms2-rs.

Finally there is a single mismatched type error:

error[E0308]: mismatched types
   --> /home/askoufis/.cargo/git/checkouts/ffms2-rs-deffbde628fee48c/bc7da53/src/frame.rs:330:13
    |
330 |             data[0].as_ptr(),
    |             ^^^^^^^^^^^^^^^^ types differ in mutability
    |
    = note: expected raw pointer `*mut u8`
               found raw pointer `*const u8`

I really hope there's something obvious that I'm missing that will fix this. Any help would be much appreciated.

Thanks.

Luni-4 commented 3 years ago

Hi @askoufis! Thanks for your report! :)

You're perfectly right, my crate misses some APIs of the ffms2 library (version 2.23.1) from the GitHub Release. That is because I've used the master branch of that time, and it had more commits than the 2.31.0 version.

I will fix this problem, in the meantime, you could use version 2.40: it should work perfectly.

Luni-4 commented 3 years ago

@askoufis

Since maintaining the old versions of ffms2 will be a burden for me, I've decided to support only the master branch and the last released version. I hope it won't be a problem for you :)

askoufis commented 3 years ago

Thanks for your quick reply!

I'm perfectly happy to use the latest version of the library. The only reason I was using an older one was because the version on the arch repo isn't up to date. Thanks for your help :)

Luni-4 commented 3 years ago

Thanks for your quick reply!

I'm perfectly happy to use the latest version of the library. The only reason I was using an older one was because the version on the arch repo isn't up to date. Thanks for your help :)

Oh, I see! Thanks to you for your report and feel free to open new issues if you encounter some other problems! :)