add feature non-exhaustive-enums

This commit is contained in:
FreezyLemon 2022-10-22 17:28:37 +02:00 committed by Josh Holmer
parent 28c356dd98
commit 92a8c6a9d8
22 changed files with 25 additions and 1 deletions

View File

@ -15,7 +15,7 @@ keywords = ["ffmpeg", "multimedia", "video", "audio"]
categories = ["multimedia"] categories = ["multimedia"]
[features] [features]
default = ["codec", "device", "filter", "format", "software-resampling", "software-scaling"] default = ["codec", "device", "filter", "format", "software-resampling", "software-scaling", "non-exhaustive-enums"]
# ffmpeg<xy> are obsolete features kept for backward compatibility purposes and # ffmpeg<xy> are obsolete features kept for backward compatibility purposes and
# don't do anything anymore (equivalents are automatically specified through # don't do anything anymore (equivalents are automatically specified through
@ -29,6 +29,9 @@ ffmpeg4 = []
static = ["ffmpeg-sys-next/static"] static = ["ffmpeg-sys-next/static"]
build = ["static", "ffmpeg-sys-next/build"] build = ["static", "ffmpeg-sys-next/build"]
# mark enums in generated bindings as #[non_exhaustive]
non-exhaustive-enums = ["ffmpeg-sys-next/non-exhaustive-enums"]
# licensing # licensing
build-license-gpl = ["ffmpeg-sys-next/build-license-gpl"] build-license-gpl = ["ffmpeg-sys-next/build-license-gpl"]
build-license-nonfree = ["ffmpeg-sys-next/build-license-nonfree"] build-license-nonfree = ["ffmpeg-sys-next/build-license-nonfree"]

View File

@ -28,6 +28,7 @@ impl From<AVAudioServiceType> for AudioService {
AV_AUDIO_SERVICE_TYPE_KARAOKE => AudioService::Karaoke, AV_AUDIO_SERVICE_TYPE_KARAOKE => AudioService::Karaoke,
AV_AUDIO_SERVICE_TYPE_NB => AudioService::Main, AV_AUDIO_SERVICE_TYPE_NB => AudioService::Main,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -23,6 +23,7 @@ impl From<AVDiscard> for Discard {
AVDISCARD_NONKEY => Discard::NonKey, AVDISCARD_NONKEY => Discard::NonKey,
AVDISCARD_ALL => Discard::All, AVDISCARD_ALL => Discard::All,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -21,6 +21,7 @@ impl From<AVFieldOrder> for FieldOrder {
AV_FIELD_TB => FieldOrder::TB, AV_FIELD_TB => FieldOrder::TB,
AV_FIELD_BT => FieldOrder::BT, AV_FIELD_BT => FieldOrder::BT,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -1234,6 +1234,7 @@ impl From<AVCodecID> for Id {
#[cfg(feature = "ffmpeg_5_1")] #[cfg(feature = "ffmpeg_5_1")]
AV_CODEC_ID_DFPWM => Id::DFPWM, AV_CODEC_ID_DFPWM => Id::DFPWM,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -107,6 +107,7 @@ impl From<AVPacketSideDataType> for Type {
#[cfg(feature = "ffmpeg_5_0")] #[cfg(feature = "ffmpeg_5_0")]
AV_PKT_DATA_DYNAMIC_HDR10_PLUS => Type::DYNAMIC_HDR10_PLUS, AV_PKT_DATA_DYNAMIC_HDR10_PLUS => Type::DYNAMIC_HDR10_PLUS,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -30,6 +30,7 @@ impl From<AVSubtitleType> for Type {
SUBTITLE_TEXT => Type::Text, SUBTITLE_TEXT => Type::Text,
SUBTITLE_ASS => Type::Ass, SUBTITLE_ASS => Type::Ass,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -35,6 +35,7 @@ impl From<SwrDitherType> for Dither {
SWR_DITHER_NS_HIGH_SHIBATA => Dither::NoiseShapingHighShibata, SWR_DITHER_NS_HIGH_SHIBATA => Dither::NoiseShapingHighShibata,
SWR_DITHER_NB => Dither::None, SWR_DITHER_NB => Dither::None,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -14,6 +14,7 @@ impl From<SwrEngine> for Engine {
SWR_ENGINE_SOXR => Engine::SoundExchange, SWR_ENGINE_SOXR => Engine::SoundExchange,
SWR_ENGINE_NB => Engine::Software, SWR_ENGINE_NB => Engine::Software,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -15,6 +15,7 @@ impl From<SwrFilterType> for Filter {
SWR_FILTER_TYPE_BLACKMAN_NUTTALL => Filter::BlackmanNuttall, SWR_FILTER_TYPE_BLACKMAN_NUTTALL => Filter::BlackmanNuttall,
SWR_FILTER_TYPE_KAISER => Filter::Kaiser, SWR_FILTER_TYPE_KAISER => Filter::Kaiser,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -24,6 +24,7 @@ impl From<AVChromaLocation> for Location {
AVCHROMA_LOC_BOTTOM => Location::Bottom, AVCHROMA_LOC_BOTTOM => Location::Bottom,
AVCHROMA_LOC_NB => Location::Unspecified, AVCHROMA_LOC_NB => Location::Unspecified,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -67,6 +67,7 @@ impl From<AVColorPrimaries> for Primaries {
#[cfg(feature = "ffmpeg_4_3")] #[cfg(feature = "ffmpeg_4_3")]
AVCOL_PRI_EBU3213 => Primaries::EBU3213, AVCOL_PRI_EBU3213 => Primaries::EBU3213,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -32,6 +32,7 @@ impl From<AVColorRange> for Range {
AVCOL_RANGE_JPEG => Range::JPEG, AVCOL_RANGE_JPEG => Range::JPEG,
AVCOL_RANGE_NB => Range::Unspecified, AVCOL_RANGE_NB => Range::Unspecified,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -60,6 +60,7 @@ impl From<AVColorSpace> for Space {
AVCOL_SPC_CHROMA_DERIVED_CL => Space::ChromaDerivedCL, AVCOL_SPC_CHROMA_DERIVED_CL => Space::ChromaDerivedCL,
AVCOL_SPC_ICTCP => Space::ICTCP, AVCOL_SPC_ICTCP => Space::ICTCP,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -64,6 +64,7 @@ impl From<AVColorTransferCharacteristic> for TransferCharacteristic {
AVCOL_TRC_SMPTE428 => TransferCharacteristic::SMPTE428, AVCOL_TRC_SMPTE428 => TransferCharacteristic::SMPTE428,
AVCOL_TRC_ARIB_STD_B67 => TransferCharacteristic::ARIB_STD_B67, AVCOL_TRC_ARIB_STD_B67 => TransferCharacteristic::ARIB_STD_B67,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -743,6 +743,7 @@ impl From<AVPixelFormat> for Pixel {
#[cfg(feature = "rpi")] #[cfg(feature = "rpi")]
AV_PIX_FMT_RPI4_10 => Pixel::RPI4_10, AV_PIX_FMT_RPI4_10 => Pixel::RPI4_10,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -87,6 +87,7 @@ impl From<AVSampleFormat> for Sample {
AV_SAMPLE_FMT_NB => Sample::None, AV_SAMPLE_FMT_NB => Sample::None,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -121,6 +121,7 @@ impl From<AVFrameSideDataType> for Type {
#[cfg(feature = "ffmpeg_5_1")] #[cfg(feature = "ffmpeg_5_1")]
AV_FRAME_DATA_DYNAMIC_HDR_VIVID => Type::DYNAMIC_HDR_VIVID, AV_FRAME_DATA_DYNAMIC_HDR_VIVID => Type::DYNAMIC_HDR_VIVID,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -22,6 +22,7 @@ impl From<AVRounding> for Rounding {
AV_ROUND_NEAR_INF => Rounding::NearInfinity, AV_ROUND_NEAR_INF => Rounding::NearInfinity,
AV_ROUND_PASS_MINMAX => Rounding::PassMinMax, AV_ROUND_PASS_MINMAX => Rounding::PassMinMax,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -23,6 +23,7 @@ impl From<AVMediaType> for Type {
AVMEDIA_TYPE_ATTACHMENT => Type::Attachment, AVMEDIA_TYPE_ATTACHMENT => Type::Attachment,
AVMEDIA_TYPE_NB => Type::Unknown, AVMEDIA_TYPE_NB => Type::Unknown,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -54,6 +54,7 @@ impl From<AVOptionType> for Type {
#[cfg(feature = "ffmpeg_5_1")] #[cfg(feature = "ffmpeg_5_1")]
AV_OPT_TYPE_CHLAYOUT => Type::ChannelLayout, AV_OPT_TYPE_CHLAYOUT => Type::ChannelLayout,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

View File

@ -26,6 +26,7 @@ impl From<AVPictureType> for Type {
AV_PICTURE_TYPE_SP => Type::SP, AV_PICTURE_TYPE_SP => Type::SP,
AV_PICTURE_TYPE_BI => Type::BI, AV_PICTURE_TYPE_BI => Type::BI,
#[cfg(feature = "non-exhaustive-enums")]
_ => unimplemented!(), _ => unimplemented!(),
} }
} }