git: eb2f6b420890 - main - multimedia/wl-screenrec: unbreak build with ffmpeg 6.1

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Sun, 12 Nov 2023 09:40:01 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=eb2f6b420890803eab616d09add7bd91ad1f0565

commit eb2f6b420890803eab616d09add7bd91ad1f0565
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-11-12 09:18:48 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-11-12 09:39:15 +0000

    multimedia/wl-screenrec: unbreak build with ffmpeg 6.1
    
    error[E0004]: non-exhaustive patterns: `sys::AVPixelFormat::AV_PIX_FMT_P212BE`, `sys::AVPixelFormat::AV_PIX_FMT_P212LE`, `sys::AVPixelFormat::AV_PIX_FMT_P412BE` and 3 more not covered
        --> cargo-crates/ffmpeg-next-6.0.0/src/util/format/pixel.rs:467:15
         |
    467  |         match value {
         |               ^^^^^ patterns `sys::AVPixelFormat::AV_PIX_FMT_P212BE`, `sys::AVPixelFormat::AV_PIX_FMT_P212LE`, `sys::AVPixelFormat::AV_PIX_FMT_P412BE` and 3 more not covered
         |
    note: `sys::AVPixelFormat` defined here
        --> /wrkdirs/usr/ports/multimedia/wl-screenrec/work/target/x86_64-unknown-freebsd/release/build/ffmpeg-sys-next-8e1bcbc25d8d3e7a/out/bindings.rs:4814:1
         |
    4814 | 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
         |
    797  ~             AV_PIX_FMT_RGBAF32LE => Pixel::RGBAF32LE,
    798  ~             _ => todo!(),
         |
    
    error[E0004]: non-exhaustive patterns: `sys::AVFrameSideDataType::AV_FRAME_DATA_VIDEO_HINT` not covered
        --> cargo-crates/ffmpeg-next-6.0.0/src/util/frame/side_data.rs:78:15
         |
    78   |         match value {
         |               ^^^^^ pattern `sys::AVFrameSideDataType::AV_FRAME_DATA_VIDEO_HINT` not covered
         |
    note: `sys::AVFrameSideDataType` defined here
        --> /wrkdirs/usr/ports/multimedia/wl-screenrec/work/target/x86_64-unknown-freebsd/release/build/ffmpeg-sys-next-8e1bcbc25d8d3e7a/out/bindings.rs:6198:5
         |
    6142 | pub enum AVFrameSideDataType {
         | ----------------------------
    ...
    6198 |     AV_FRAME_DATA_VIDEO_HINT = 27,
         |     ^^^^^^^^^^^^^^^^^^^^^^^^ not covered
         = note: the matched value is of type `sys::AVFrameSideDataType`
    help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
         |
    128  ~             AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT => Type::AMBIENT_VIEWING_ENVIRONMENT,
    129  ~             sys::AVFrameSideDataType::AV_FRAME_DATA_VIDEO_HINT => todo!(),
         |
    
    error[E0004]: non-exhaustive patterns: `sys::AVCodecID::AV_CODEC_ID_PDV`, `sys::AVCodecID::AV_CODEC_ID_EVC`, `sys::AVCodecID::AV_CODEC_ID_RTV1` and 4 more not covered
        --> cargo-crates/ffmpeg-next-6.0.0/src/codec/id.rs:664:15
         |
    664  |         match value {
         |               ^^^^^ patterns `sys::AVCodecID::AV_CODEC_ID_PDV`, `sys::AVCodecID::AV_CODEC_ID_EVC`, `sys::AVCodecID::AV_CODEC_ID_RTV1` and 4 more not covered
         |
    note: `sys::AVCodecID` defined here
        --> /wrkdirs/usr/ports/multimedia/wl-screenrec/work/target/x86_64-unknown-freebsd/release/build/ffmpeg-sys-next-8e1bcbc25d8d3e7a/out/bindings.rs:7632:1
         |
    7632 | 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
         |
    1297 ~             AV_CODEC_ID_ANULL => Id::ANULL,
    1298 ~             _ => todo!(),
         |
    
    For more information about this error, try `rustc --explain E0004`.
    error: could not compile `ffmpeg-next` (lib) due to 3 previous errors
    
    PR:             274439
---
 multimedia/wl-screenrec/files/patch-ffmpeg-6.1 | 223 +++++++++++++++++++++++++
 1 file changed, 223 insertions(+)

diff --git a/multimedia/wl-screenrec/files/patch-ffmpeg-6.1 b/multimedia/wl-screenrec/files/patch-ffmpeg-6.1
new file mode 100644
index 000000000000..5754d0cef72d
--- /dev/null
+++ b/multimedia/wl-screenrec/files/patch-ffmpeg-6.1
@@ -0,0 +1,223 @@
+https://github.com/zmwangx/rust-ffmpeg/pull/165
+
+--- cargo-crates/ffmpeg-next-6.0.0/src/codec/id.rs.orig	2006-07-24 01:21:28 UTC
++++ cargo-crates/ffmpeg-next-6.0.0/src/codec/id.rs
+@@ -644,6 +644,21 @@ pub enum Id {
+     VNULL,
+     #[cfg(feature = "ffmpeg_6_0")]
+     ANULL,
++
++    #[cfg(feature = "ffmpeg_6_1")]
++    PDV,
++    #[cfg(feature = "ffmpeg_6_1")]
++    EVC,
++    #[cfg(feature = "ffmpeg_6_1")]
++    RTV1,
++    #[cfg(feature = "ffmpeg_6_1")]
++    VMIX,
++    #[cfg(feature = "ffmpeg_6_1")]
++    AC4,
++    #[cfg(feature = "ffmpeg_6_1")]
++    SMPTE_2038,
++    #[cfg(feature = "ffmpeg_6_1")]
++    OSQ,
+ }
+ 
+ impl Id {
+@@ -1295,6 +1310,21 @@ impl From<AVCodecID> for Id {
+             AV_CODEC_ID_VNULL => Id::VNULL,
+             #[cfg(feature = "ffmpeg_6_0")]
+             AV_CODEC_ID_ANULL => Id::ANULL,
++
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_CODEC_ID_PDV => Id::PDV,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_CODEC_ID_EVC => Id::EVC,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_CODEC_ID_RTV1 => Id::RTV1,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_CODEC_ID_VMIX => Id::VMIX,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_CODEC_ID_AC4 => Id::AC4,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_CODEC_ID_SMPTE_2038 => Id::SMPTE_2038,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_CODEC_ID_OSQ => Id::OSQ,
+         }
+     }
+ }
+@@ -1938,6 +1968,21 @@ impl From<Id> for AVCodecID {
+             Id::VNULL => AV_CODEC_ID_VNULL,
+             #[cfg(feature = "ffmpeg_6_0")]
+             Id::ANULL => AV_CODEC_ID_ANULL,
++
++            #[cfg(feature = "ffmpeg_6_1")]
++            Id::PDV => AV_CODEC_ID_PDV,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Id::EVC => AV_CODEC_ID_EVC,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Id::RTV1 => AV_CODEC_ID_RTV1,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Id::VMIX => AV_CODEC_ID_VMIX,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Id::AC4 => AV_CODEC_ID_AC4,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Id::SMPTE_2038 => AV_CODEC_ID_SMPTE_2038,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Id::OSQ => AV_CODEC_ID_OSQ,
+         }
+     }
+ }
+--- cargo-crates/ffmpeg-next-6.0.0/src/util/channel_layout.rs.orig	2006-07-24 01:21:28 UTC
++++ cargo-crates/ffmpeg-next-6.0.0/src/util/channel_layout.rs
+@@ -58,6 +58,17 @@ bitflags! {
+         const OCTAGONAL          = AV_CH_LAYOUT_OCTAGONAL;
+         const HEXADECAGONAL      = AV_CH_LAYOUT_HEXADECAGONAL;
+         const STEREO_DOWNMIX     = AV_CH_LAYOUT_STEREO_DOWNMIX;
++
++        #[cfg(feature = "ffmpeg_6_1")]
++        const _3POINT1POINT2      = AV_CH_LAYOUT_3POINT1POINT2;
++        #[cfg(feature = "ffmpeg_6_1")]
++        const _5POINT1POINT2_BACK = AV_CH_LAYOUT_5POINT1POINT2_BACK;
++        #[cfg(feature = "ffmpeg_6_1")]
++        const _5POINT1POINT4_BACK = AV_CH_LAYOUT_5POINT1POINT4_BACK;
++        #[cfg(feature = "ffmpeg_6_1")]
++        const _7POINT1POINT2      = AV_CH_LAYOUT_7POINT1POINT2;
++        #[cfg(feature = "ffmpeg_6_1")]
++        const _7POINT1POINT4_BACK = AV_CH_LAYOUT_7POINT1POINT4_BACK;
+     }
+ }
+ 
+--- cargo-crates/ffmpeg-next-6.0.0/src/util/format/pixel.rs.orig	2006-07-24 01:21:28 UTC
++++ cargo-crates/ffmpeg-next-6.0.0/src/util/format/pixel.rs
+@@ -401,6 +401,19 @@ pub enum Pixel {
+     #[cfg(feature = "ffmpeg_6_0")]
+     RGBAF32LE,
+ 
++    #[cfg(feature = "ffmpeg_6_1")]
++    P212BE,
++    #[cfg(feature = "ffmpeg_6_1")]
++    P212LE,
++    #[cfg(feature = "ffmpeg_6_1")]
++    P412BE,
++    #[cfg(feature = "ffmpeg_6_1")]
++    P412LE,
++    #[cfg(feature = "ffmpeg_6_1")]
++    GBRAP14BE,
++    #[cfg(feature = "ffmpeg_6_1")]
++    GBRAP14LE,
++
+     #[cfg(feature = "rpi")]
+     RPI,
+     #[cfg(feature = "rpi")]
+@@ -796,6 +809,19 @@ impl From<AVPixelFormat> for Pixel {
+             #[cfg(feature = "ffmpeg_6_0")]
+             AV_PIX_FMT_RGBAF32LE => Pixel::RGBAF32LE,
+ 
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_PIX_FMT_P212BE => Pixel::P212BE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_PIX_FMT_P212LE => Pixel::P212LE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_PIX_FMT_P412BE => Pixel::P412BE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_PIX_FMT_P412LE => Pixel::P412LE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_PIX_FMT_GBRAP14BE => Pixel::GBRAP14BE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_PIX_FMT_GBRAP14LE => Pixel::GBRAP14LE,
++
+             #[cfg(feature = "rpi")]
+             AV_PIX_FMT_RPI => Pixel::RPI,
+             #[cfg(feature = "rpi")]
+@@ -1208,6 +1234,19 @@ impl From<Pixel> for AVPixelFormat {
+             Pixel::RGBAF32BE => AV_PIX_FMT_RGBAF32BE,
+             #[cfg(feature = "ffmpeg_6_0")]
+             Pixel::RGBAF32LE => AV_PIX_FMT_RGBAF32LE,
++
++            #[cfg(feature = "ffmpeg_6_1")]
++            Pixel::P212BE => AV_PIX_FMT_P212BE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Pixel::P212LE => AV_PIX_FMT_P212LE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Pixel::P412BE => AV_PIX_FMT_P412BE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Pixel::P412LE => AV_PIX_FMT_P412LE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Pixel::GBRAP14BE => AV_PIX_FMT_GBRAP14BE,
++            #[cfg(feature = "ffmpeg_6_1")]
++            Pixel::GBRAP14LE => AV_PIX_FMT_GBRAP14LE,
+ 
+             #[cfg(feature = "rpi")]
+             Pixel::RPI => AV_PIX_FMT_RPI,
+--- cargo-crates/ffmpeg-next-6.0.0/src/util/frame/side_data.rs.orig	2006-07-24 01:21:28 UTC
++++ cargo-crates/ffmpeg-next-6.0.0/src/util/frame/side_data.rs
+@@ -61,6 +61,9 @@ pub enum Type {
+ 
+     #[cfg(feature = "ffmpeg_6_0")]
+     AMBIENT_VIEWING_ENVIRONMENT,
++
++    #[cfg(feature = "ffmpeg_6_1")]
++    VIDEO_HINT,
+ }
+ 
+ impl Type {
+@@ -126,6 +129,9 @@ impl From<AVFrameSideDataType> for Type {
+ 
+             #[cfg(feature = "ffmpeg_6_0")]
+             AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT => Type::AMBIENT_VIEWING_ENVIRONMENT,
++
++            #[cfg(feature = "ffmpeg_6_1")]
++            AV_FRAME_DATA_VIDEO_HINT => Type::VIDEO_HINT,
+         }
+     }
+ }
+@@ -184,6 +190,9 @@ impl From<Type> for AVFrameSideDataType {
+ 
+             #[cfg(feature = "ffmpeg_6_0")]
+             Type::AMBIENT_VIEWING_ENVIRONMENT => AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT,
++
++            #[cfg(feature = "ffmpeg_6_1")]
++            Type::VIDEO_HINT => AV_FRAME_DATA_VIDEO_HINT,
+         }
+     }
+ }
+--- cargo-crates/ffmpeg-sys-next-6.0.1/build.rs.orig	2006-07-24 01:21:28 UTC
++++ cargo-crates/ffmpeg-sys-next-6.0.1/build.rs
+@@ -588,6 +588,7 @@ fn check_features(
+         ("ffmpeg_5_0", 59, 18),
+         ("ffmpeg_5_1", 59, 37),
+         ("ffmpeg_6_0", 60, 3),
++        ("ffmpeg_6_1", 60, 31),
+     ];
+     for &(ffmpeg_version_flag, lavc_version_major, lavc_version_minor) in
+         ffmpeg_lavc_versions.iter()
+--- cargo-crates/ffmpeg-sys-next-6.0.1/channel_layout_fixed.h.orig	2006-07-24 01:21:28 UTC
++++ cargo-crates/ffmpeg-sys-next-6.0.1/channel_layout_fixed.h
+@@ -114,6 +114,11 @@ const unsigned long long AV_CH_BOTTOM_FRONT_RIGHT =
+ #undef AV_CH_LAYOUT_HEXADECAGONAL
+ #undef AV_CH_LAYOUT_STEREO_DOWNMIX
+ #undef AV_CH_LAYOUT_22POINT2
++#undef AV_CH_LAYOUT_3POINT1POINT2
++#undef AV_CH_LAYOUT_5POINT1POINT2_BACK
++#undef AV_CH_LAYOUT_5POINT1POINT4_BACK
++#undef AV_CH_LAYOUT_7POINT1POINT2
++#undef AV_CH_LAYOUT_7POINT1POINT4_BACK
+ 
+ const unsigned long long AV_CH_LAYOUT_MONO = (AV_CH_FRONT_CENTER);
+ const unsigned long long AV_CH_LAYOUT_STEREO =
+@@ -185,4 +190,14 @@ const unsigned long long AV_CH_LAYOUT_22POINT2 =
+      AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT | AV_CH_TOP_SIDE_LEFT |
+      AV_CH_TOP_SIDE_RIGHT | AV_CH_TOP_BACK_CENTER | AV_CH_BOTTOM_FRONT_CENTER |
+      AV_CH_BOTTOM_FRONT_LEFT | AV_CH_BOTTOM_FRONT_RIGHT);
++const unsigned long long AV_CH_LAYOUT_3POINT1POINT2 =
++    (AV_CH_LAYOUT_3POINT1 | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT);
++const unsigned long long AV_CH_LAYOUT_5POINT1POINT2_BACK =
++    (AV_CH_LAYOUT_5POINT1_BACK | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT);
++const unsigned long long AV_CH_LAYOUT_5POINT1POINT4_BACK =
++    (AV_CH_LAYOUT_5POINT1POINT2_BACK | AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT);
++const unsigned long long AV_CH_LAYOUT_7POINT1POINT2 =
++    (AV_CH_LAYOUT_7POINT1 | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT);
++const unsigned long long AV_CH_LAYOUT_7POINT1POINT4_BACK =
++    (AV_CH_LAYOUT_7POINT1POINT2 | AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT);
+ #endif