metadata
metadata copied to clipboard
Compilation Issue, FFmpeg error
I get the following error from a cargo build
error[E0616]:` field `0` of struct `ffmpeg::ChannelLayout` is private
--> /home/karma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/metadata-0.1.9/src/stream/audio.rs:83:25
|
83 | &layout.0 as *const ffmpeg::ffi::AVChannelLayout,
| ^ private field
this is with metadata v0.1.9
This is the ffmpeg packages I am using
[[package]]
name = "ffmpeg-next"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f46a28a7161e8066ebe0d854cd9e30fcee4b64059660ef8580db7084b25b5e4"
dependencies = [
"bitflags 2.5.0",
"ffmpeg-sys-next",
"libc",
]
[[package]]
name = "ffmpeg-sys-next"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "972a460dd8e901b737ce0482bf71a837e1751e3dd7c8f8b0a4ead808e7f174a5"
dependencies = [
"bindgen",
"cc",
"libc",
"num_cpus",
"pkg-config",
"vcpkg",
]
Same here
This fork has a workaround but depending on the internals of the ffmpeg crate in this manner is clearly asking for trouble: https://github.com/cozyGalvinism/metadata/commit/690dcc182abe15731c55470f3f145383f6e198e0. Though if you need to fix your build right now... maybe...
This fork has a workaround but depending on the internals of the ffmpeg crate in this manner is clearly asking for trouble: cozyGalvinism@690dcc1. Though if you need to fix your build right now... maybe...
Oh no no, don't use my fork please. It does not work and segfaults. I instead implemented the subset of functions I needed by myself using the ffmpeg crates.
The metadata crate itself is also too much functionality for my use-case specifically, so I dropped the dependency.
EDIT: Just to be safe, I deleted my fork with faulty code, as I don't have time to properly fix the issue and since I already replaced the functionality in my use-case.
Thanks for the heads up, my fault should not have pointed there.
Looking more into this, one possible fix is to use ffmpeg 7. In particular, the ffmpeg-next crate uses two different versions of ChannelLayout
based on the ffmpeg version. With version 7, the struct has the field that the metadata crate expects and everything compiles fine. For older versions a legacy bitflags struct is used and the compilation fails.
Here is the relevant code: https://github.com/zmwangx/rust-ffmpeg/blob/master/src/util/mod.rs#L18
I'm also having this issue