Open Ryu2u opened 3 months ago
vcpkg
with commit 0557210
tracks FFmpeg 6.1, which does contain AV_PIX_FMT_P010LE
. The vcpkg
crate links x64-windows-static-md
packages by default: https://docs.rs/vcpkg/latest/vcpkg/#windows, but the configuration you specified in Cargo.toml is x64-windows-static
. So I think the build failure is caused by a previously installed old(version < 6.0) FFmpeg x64-windows-static-md
package.
Therefore, you can replace x64-windows-static
with x64-windows-static-md
in your Cargo.toml, or add RUSTFLAGS=-Ctarget-feature=+crt-static
before building. Both will solve your problem(I've locally verified).
vcpkg
with commit0557210
tracks FFmpeg 6.1, which does containAV_PIX_FMT_P010LE
. Thevcpkg
crate linksx64-windows-static-md
packages by default: https://docs.rs/vcpkg/latest/vcpkg/#windows, but the configuration you specified in Cargo.toml isx64-windows-static
. So I think the build failure is caused by a previously installed old(version < 6.0) FFmpegx64-windows-static-md
package.Therefore, you can replace
x64-windows-static
withx64-windows-static-md
in your Cargo.toml, or addRUSTFLAGS=-Ctarget-feature=+crt-static
before building. Both will solve your problem(I've locally verified).
i changed the x64-windows-static
to x64-windows-static-md
and execute cargo clean & cargo vcpkg --verbose build & cargo build
. It still doesn't work
error[E0308]: mismatched types
--> C:\Users\Ryu2u\.cargo\registry\src\mirrors.ustc.edu.cn-61ef6e0cd06fb9b8\rsmpeg-0.15.1+ffmpeg.7.0\src\avcodec\parser.rs:17:38
|
17 | unsafe { ffi::av_parser_init(codec_id) }
| ------------------- ^^^^^^^^ expected `i32`, found `u32`
| |
| arguments to this function are incorrect
|
note: function defined here
--> H:\Project\rsmpeg-vcpkg-demo\./target/debug\build\rusty_ffmpeg-a9d5a95fbcb34fc0\out/binding.rs:16221:12
|
16221 | pub fn av_parser_init(codec_id: ::std::os::raw::c_int) -> *mut AVCodecParserContext;
| ^^^^^^^^^^^^^^
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
|
17 | unsafe { ffi::av_parser_init(codec_id.try_into().unwrap()) }
| ++++++++++++++++++++
For more information about this error, try `rustc --explain E0308`.
error: could not compile `rsmpeg` (lib) due to 1 previous error
That's another issue.
It's strange that AVCodecID
's binding was generated as u32
. enums should share the same layout with i32
on Windows(https://github.com/rust-lang/rust-bindgen/issues/1244). Could you create a minimal repo which can reproduce this problem?
The crate I created with such Cargo.toml compiled successfully with cargo clean & cargo vcpkg --verbose build & cargo build
:
[package]
name = "rust_test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[package.metadata.vcpkg]
dependencies = ["ffmpeg[ffmpeg,x264,avcodec,avdevice,avfilter,avformat]:x64-windows-static-md"]
git = "https://github.com/microsoft/vcpkg"
rev = "0557210"
[dependencies]
rsmpeg = { version = "0.15.0", default-features = false, features = ["ffmpeg6"] }
That's another issue.
It's strange that
AVCodecID
's binding was generated asu32
. enums should share the same layout withi32
on Windows(rust-lang/rust-bindgen#1244). Could you create a minimal repo which can reproduce this problem?The crate I created with such Cargo.toml compiled successfully with
cargo clean & cargo vcpkg --verbose build & cargo build
:[package] name = "rust_test" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [package.metadata.vcpkg] dependencies = ["ffmpeg[ffmpeg,x264,avcodec,avdevice,avfilter,avformat]:x64-windows-static-md"] git = "https://github.com/microsoft/vcpkg" rev = "0557210" [dependencies] rsmpeg = { version = "0.15.0", default-features = false, features = ["ffmpeg6"] }
i use this https://github.com/aegroto/rsmpeg-vcpkg-demo
demo and change the Cargo.toml
[package]
name = "rsmpeg-vcpkg-demo"
version = "0.1.0"
edition = "2021"
[package.metadata.vcpkg]
dependencies = ["ffmpeg[ffmpeg,x264,avcodec,avdevice,avfilter,avformat]:x64-windows-static-md"]
git = "https://github.com/microsoft/vcpkg"
rev = "0557210"
[dependencies]
rsmpeg = { version = "0.15.1", default-features = false, features = ["ffmpeg6"] }
``
@Ryu2u the example repository was created quite some time ago so I believe some things in the binding have changed. Please let me know if something could be updated to make the example more coherent with the last released versions of ffmpeg and rsmpeg.
Cargo cargo 1.80.0 (376290515 2024-07-16) vcpkg vcpkg package management program version 2024-07-10-d2dfc73769081bdd9b782d08d27794780b7a99b9 toolchain stable-x86_64-pc-windows-gnu stable-x86_64-pc-windows-msvc (default) nightly-x86_64-pc-windows-msvc
Cargo.toml
build