Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg-next won't build on windows. Non exhaustive patterns. #126

Open
ThatNerdUKnow opened this issue Dec 25, 2022 · 7 comments
Open

ffmpeg-next won't build on windows. Non exhaustive patterns. #126

ThatNerdUKnow opened this issue Dec 25, 2022 · 7 comments

Comments

@ThatNerdUKnow
Copy link

OS: Windows 10
Ffmpeg version: ffmpeg-master-latest-win64-gpl-shared. 12/24/2022

I followed the installation guide from the wiki for building on windows. I have downloaded the latest ffmpeg windows build and set the FFMPEG_DIR variable accordingly.

I get the following error when building my project that depends on ffmpeg-next in windows.
This project compiles just fine in linux

cargo build
    Blocking waiting for file lock on build directory
   Compiling ffmpeg-next v5.1.1
error[E0004]: non-exhaustive patterns: `sys::AVPixelFormat::AV_PIX_FMT_VUYA`, `sys::AVPixelFormat::AV_PIX_FMT_RGBAF16BE`, `sys::AVPixelFormat::AV_PIX_FMT_RGBAF16LE` and 13 more not covered
    --> C:\Users\brand\.cargo\registry\src\github.com-1ecc6299db9ec823\ffmpeg-next-5.1.1\src\util\format\pixel.rs:434:15
     |
434  |         match value {
     |               ^^^^^ patterns `sys::AVPixelFormat::AV_PIX_FMT_VUYA`, `sys::AVPixelFormat::AV_PIX_FMT_RGBAF16BE`, `sys::AVPixelFormat::AV_PIX_FMT_RGBAF16LE` and 13 more not covered
     |
note: `sys::AVPixelFormat` defined here
    --> C:\Users\brand\repos\libvmaf-rs\target\debug\build\ffmpeg-sys-next-f6d84f95db8b1f08\out/bindings.rs:4792:1
     |
4792 | pub enum AVPixelFormat {
     | ^^^^^^^^^^^^^^^^^^^^^^
     = note: the matched value is of type `sys::AVPixelFormat`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
     |
731  ~             AV_PIX_FMT_P416LE => Pixel::P416LE,
732  ~             _ => todo!(),
     |

error[E0004]: non-exhaustive patterns: `sys::AVCodecID::AV_CODEC_ID_RADIANCE_HDR`, `sys::AVCodecID::AV_CODEC_ID_WBMP`, `sys::AVCodecID::AV_CODEC_ID_MEDIA100` and 5 more not covered
    --> C:\Users\brand\.cargo\registry\src\github.com-1ecc6299db9ec823\ffmpeg-next-5.1.1\src\codec\id.rs:633:15
     |
633  |         match value {
     |               ^^^^^ patterns `sys::AVCodecID::AV_CODEC_ID_RADIANCE_HDR`, `sys::AVCodecID::AV_CODEC_ID_WBMP`, `sys::AVCodecID::AV_CODEC_ID_MEDIA100` and 5 more not covered
     |
note: `sys::AVCodecID` defined here
    --> C:\Users\brand\repos\libvmaf-rs\target\debug\build\ffmpeg-sys-next-f6d84f95db8b1f08\out/bindings.rs:8866:1
     |
8866 | pub enum AVCodecID {
     | ^^^^^^^^^^^^^^^^^^
     = note: the matched value is of type `sys::AVCodecID`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
     |
1235 ~             AV_CODEC_ID_DFPWM => Id::DFPWM,
1236 ~             _ => todo!(),
     |

For more information about this error, try `rustc --explain E0004`.
error: could not compile `ffmpeg-next` due to 2 previous errors
@ThatNerdUKnow
Copy link
Author

ThatNerdUKnow commented Jan 22, 2023

It seems that the following enums were missing some match arms. I've cloned this repo and had my editor automatically generate the missing match arms:

This compiler error doesn't seem to affect linux builds.

impl<From<AVPixelFormat> for Pixel{
// Current match arms elided
            AV_PIX_FMT_VUYA => todo!(),
            AV_PIX_FMT_RGBAF16BE => todo!(),
            AV_PIX_FMT_RGBAF16LE => todo!(),
            AV_PIX_FMT_VUYX => todo!(),
            AV_PIX_FMT_P012LE => todo!(),
            AV_PIX_FMT_P012BE => todo!(),
            AV_PIX_FMT_Y212BE => todo!(),
            AV_PIX_FMT_Y212LE => todo!(),
            AV_PIX_FMT_XV30BE => todo!(),
            AV_PIX_FMT_XV30LE => todo!(),
            AV_PIX_FMT_XV36BE => todo!(),
            AV_PIX_FMT_XV36LE => todo!(),
            AV_PIX_FMT_RGBF32BE => todo!(),
            AV_PIX_FMT_RGBF32LE => todo!(),
            AV_PIX_FMT_RGBAF32BE => todo!(),
            AV_PIX_FMT_RGBAF32LE => todo!(),
}
impl From<AVCodecID> for Id{
// Current match arms elided
            AV_CODEC_ID_RADIANCE_HDR => todo!(),
            AV_CODEC_ID_WBMP => todo!(),
            AV_CODEC_ID_MEDIA100 => todo!(),
            AV_CODEC_ID_VQC => todo!(),
            AV_CODEC_ID_BONK => todo!(),
            AV_CODEC_ID_MISC4 => todo!(),
            AV_CODEC_ID_APAC => todo!(),
            AV_CODEC_ID_FTR => todo!(),
}

Could this be a matter of creating enum variants for Pixel and Id like so?

pub enum Pixel{
// Current variants elided
#[cfg(target_os = "windows")]
YUVA
}

and then the following match arms in the From implementations?

impl From<AVPixelFormat> for Pixel{
// Current match arms elided
#[cfg(target_os = "windows")]
 AV_PIX_FMT_VUYA => Pixel::YUVA,
}

Also if it's relevant, my installed version of ffmpeg is ffmpeg version 4.2.3

@fooeyround
Copy link

happens for me too, should I just build it on linux from now on?

@fooeyround
Copy link

I can build it outside of the other crate on windows, but that crate won't compile....

@fooeyround
Copy link

my issue seems to be with

----------------------
...
4587 |     AV_PIX_FMT_P212BE = 222,
     |     ^^^^^^^^^^^^^^^^^ not covered
4588 |     #[doc = "< interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, little-endian"]
4589 |     AV_PIX_FMT_P212LE = 223,
     |     ^^^^^^^^^^^^^^^^^ not covered
4590 |     #[doc = "< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, big-endian"]
4591 |     AV_PIX_FMT_P412BE = 224,
     |     ^^^^^^^^^^^^^^^^^ not covered
4592 |     #[doc = "< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, little-endian"]
4593 |     AV_PIX_FMT_P412LE = 225,

@fooeyround
Copy link

It seems to not like to build in its dev env, not knowing the things that are missing, but works when the branches are added and just used in another crate. Is this a quirk of how rust bindings work?

@fooeyround
Copy link

(I probably missed something when adding them (may be feature flag stuff.))

@thewh1teagle
Copy link

It's related to what version of ffmpeg library you use.
Currently ffmpeg-next supported FFmpeg versions: 3.4.x through 4.4.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants