Implement automatic FFmpeg version detection

Based on ffmpeg-sys-next 4.3.2.
This commit is contained in:
Zhiming Wang 2020-08-02 11:44:13 +08:00
parent a5a897f42f
commit b28e852eb0
No known key found for this signature in database
GPG Key ID: 5B58F95EC95965D8
11 changed files with 239 additions and 235 deletions

View File

@ -17,9 +17,14 @@ categories = ["multimedia"]
[features]
default = ["ffmpeg43", "codec", "device", "filter", "format", "software-resampling", "software-scaling"]
ffmpeg43 = ["ffmpeg42"]
ffmpeg42 = ["ffmpeg41"]
ffmpeg41 = ["ffmpeg4"]
# ffmpeg<xy> are obsolete features kept for backward compatibility purposes and
# don't do anything anymore (equivalents are automatically specified through
# compile-time detection in ffmpeg-sys-next). Deprecation plan: ffmpeg43 will be
# dropped from default features come 4.4, and all these features will be removed
# come 5.0.
ffmpeg43 = []
ffmpeg42 = []
ffmpeg41 = []
ffmpeg4 = []
static = ["ffmpeg-sys-next/static"]
@ -107,5 +112,5 @@ version = "0.12"
optional = true
[dependencies.ffmpeg-sys-next]
version = "4.3"
version = "4.3.2"
default-features = false

View File

@ -3,22 +3,14 @@
This is a fork of the abandoned [ffmpeg](https://crates.io/crates/ffmpeg) crate by [meh.](https://github.com/meh/rust-ffmpeg).
Support for different FFmpeg versions are guarded by feature flags:
Currently supported FFmpeg versions: 3.4.x through 4.3.x.
| FFmpeg version | lavc version | corresponding feature |
| -------------- | ------------ | ---------------------------- |
| 4.3.x | 58.91.100 | `ffmpeg43` (current default) |
| 4.2.x | 58.54.100 | `ffmpeg42` |
| 4.1.x | 58.35.100 | `ffmpeg41` |
| 4.0.x | 58.18.100 | `ffmpeg4` |
| 3.4.x | 57.107.100 | none |
Build instructions can be found on the [wiki](https://github.com/zmwangx/rust-ffmpeg/wiki/Notes-on-building).
See my [`metadata` project](https://github.com/zmwangx/metadata) for an example of targeting multiple versions of FFmpeg.
*Note on upgrading to v4.3.4 or later: v4.3.4 introduced automatic FFmpeg version detection, obseleting feature flags `ffmpeg4`, `ffmpeg41`, `ffmpeg42` and `ffmpeg43`. If you manually specify any of these features, now is the time to remove them; if you use `ffmpeg43` through the `default` feature, it's still on for backward-compatibility but it has turned into a no-op, and you don't need to do anything. Deprecation plan: `ffmpeg43` will be dropped from default features come 4.4, and all these features will be removed come 5.0.*
A word on versioning: major and minor versions of this crate track major and minor versions of FFmpeg, e.g. 4.2.x of this crate has been updated to support the 4.2.x series of FFmpeg. Patch level is reserved for bug fixes of this crate and does not track FFmpeg patch versions.
If you have problem building this crate, please have a look at the [wiki](https://github.com/zmwangx/rust-ffmpeg/wiki/Notes-on-building).
**Please realize that this crate is in maintenance-only mode for the most part.** Which means I'll try my best to ensure the crate compiles against all release branches of FFmpeg 3.4 and later (only the latest patch release of each release branch is officially supported) and fix reported bugs, but if a new FFmpeg version brings new APIs that require significant effort to port to Rust, you might have to send me a PR (and just to be clear, I can't really guarantee I'll have the time to review). Any PR to improve existing API is unlikely to be merged, unfortunately.
🤝 **If you have significant, demonstrable experience in Rust and multimedia-related programming, please let me know, I'll be more than happy to invite you as a collaborator.** 🤝

View File

@ -8,7 +8,7 @@ bitflags! {
const TRUNCATED = AV_CODEC_CAP_TRUNCATED;
const DELAY = AV_CODEC_CAP_DELAY;
const SMALL_LAST_FRAME = AV_CODEC_CAP_SMALL_LAST_FRAME;
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
const HWACCEL_VDPAU = AV_CODEC_CAP_HWACCEL_VDPAU;
const SUBFRAMES = AV_CODEC_CAP_SUBFRAMES;
const EXPERIMENTAL = AV_CODEC_CAP_EXPERIMENTAL;

View File

@ -8,19 +8,19 @@ bitflags! {
const BITSTREAM = FF_DEBUG_BITSTREAM;
const MB_TYPE = FF_DEBUG_MB_TYPE;
const QP = FF_DEBUG_QP;
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
const MV = FF_DEBUG_MV;
const DCT_COEFF = FF_DEBUG_DCT_COEFF;
const SKIP = FF_DEBUG_SKIP;
const STARTCODE = FF_DEBUG_STARTCODE;
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
const PTS = FF_DEBUG_PTS;
const ER = FF_DEBUG_ER;
const MMCO = FF_DEBUG_MMCO;
const BUGS = FF_DEBUG_BUGS;
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
const VIS_QP = FF_DEBUG_VIS_QP;
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
const VIS_MB_TYPE = FF_DEBUG_VIS_MB_TYPE;
const BUFFERS = FF_DEBUG_BUFFERS;
const THREADS = FF_DEBUG_THREADS;

View File

@ -397,7 +397,7 @@ pub enum Id {
ON2AVC,
DSS_SP,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
CODEC2,
FFWAVESYNTH,
SONIC,
@ -483,88 +483,88 @@ pub enum Id {
GREMLIN_DPCM,
DOLBY_E,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
APTX,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
APTX_HD,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
SBC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AVS2,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
IMM4,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
PROSUMER,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
MWSC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
WCMV,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
RASC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
PCM_VIDC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
ATRAC9,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
TTML,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
HYMT,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
ARBC,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AGM,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
LSCR,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
VP4,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
ADPCM_AGM,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
HCOM,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
ARIB_CAPTION,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
IMM5,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
MVDV,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
MVHA,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
CDTOONS,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
MV30,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
NOTCHLC,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
PFM,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
ADPCM_ARGO,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
ADPCM_IMA_SSI,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
ADPCM_ZORK,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
ADPCM_IMA_APM,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
ADPCM_IMA_ALP,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
ADPCM_IMA_MTF,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
ADPCM_IMA_CUNNING,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
DERF_DPCM,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
ACELP_KELVIN,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
MPEGH_3D_AUDIO,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
SIREN,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
HCA,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
EPG,
}
@ -971,7 +971,7 @@ impl From<AVCodecID> for Id {
AV_CODEC_ID_ON2AVC => Id::ON2AVC,
AV_CODEC_ID_DSS_SP => Id::DSS_SP,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
AV_CODEC_ID_CODEC2 => Id::CODEC2,
AV_CODEC_ID_FFWAVESYNTH => Id::FFWAVESYNTH,
AV_CODEC_ID_SONIC => Id::SONIC,
@ -1056,88 +1056,88 @@ impl From<AVCodecID> for Id {
AV_CODEC_ID_GREMLIN_DPCM => Id::GREMLIN_DPCM,
AV_CODEC_ID_DOLBY_E => Id::DOLBY_E,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
AV_CODEC_ID_APTX => Id::APTX,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
AV_CODEC_ID_APTX_HD => Id::APTX_HD,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
AV_CODEC_ID_SBC => Id::SBC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_CODEC_ID_AVS2 => Id::AVS2,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_CODEC_ID_IMM4 => Id::IMM4,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_CODEC_ID_PROSUMER => Id::PROSUMER,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_CODEC_ID_MWSC => Id::MWSC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_CODEC_ID_WCMV => Id::WCMV,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_CODEC_ID_RASC => Id::RASC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_CODEC_ID_PCM_VIDC => Id::PCM_VIDC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_CODEC_ID_ATRAC9 => Id::ATRAC9,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_CODEC_ID_TTML => Id::TTML,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_CODEC_ID_HYMT => Id::HYMT,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_CODEC_ID_ARBC => Id::ARBC,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_CODEC_ID_AGM => Id::AGM,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_CODEC_ID_LSCR => Id::LSCR,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_CODEC_ID_VP4 => Id::VP4,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_CODEC_ID_ADPCM_AGM => Id::ADPCM_AGM,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_CODEC_ID_HCOM => Id::HCOM,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_CODEC_ID_ARIB_CAPTION => Id::ARIB_CAPTION,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_IMM5 => Id::IMM5,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_MVDV => Id::MVDV,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_MVHA => Id::MVHA,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_CDTOONS => Id::CDTOONS,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_MV30 => Id::MV30,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_NOTCHLC => Id::NOTCHLC,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_PFM => Id::PFM,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_ADPCM_ARGO => Id::ADPCM_ARGO,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_ADPCM_IMA_SSI => Id::ADPCM_IMA_SSI,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_ADPCM_ZORK => Id::ADPCM_ZORK,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_ADPCM_IMA_APM => Id::ADPCM_IMA_APM,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_ADPCM_IMA_ALP => Id::ADPCM_IMA_ALP,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_ADPCM_IMA_MTF => Id::ADPCM_IMA_MTF,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_ADPCM_IMA_CUNNING => Id::ADPCM_IMA_CUNNING,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_DERF_DPCM => Id::DERF_DPCM,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_ACELP_KELVIN => Id::ACELP_KELVIN,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_MPEGH_3D_AUDIO => Id::MPEGH_3D_AUDIO,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_SIREN => Id::SIREN,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_HCA => Id::HCA,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_CODEC_ID_EPG => Id::EPG,
}
}
@ -1535,7 +1535,7 @@ impl Into<AVCodecID> for Id {
Id::ON2AVC => AV_CODEC_ID_ON2AVC,
Id::DSS_SP => AV_CODEC_ID_DSS_SP,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
Id::CODEC2 => AV_CODEC_ID_CODEC2,
Id::FFWAVESYNTH => AV_CODEC_ID_FFWAVESYNTH,
Id::SONIC => AV_CODEC_ID_SONIC,
@ -1621,88 +1621,88 @@ impl Into<AVCodecID> for Id {
Id::GREMLIN_DPCM => AV_CODEC_ID_GREMLIN_DPCM,
Id::DOLBY_E => AV_CODEC_ID_DOLBY_E,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
Id::APTX => AV_CODEC_ID_APTX,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
Id::APTX_HD => AV_CODEC_ID_APTX_HD,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
Id::SBC => AV_CODEC_ID_SBC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Id::AVS2 => AV_CODEC_ID_AVS2,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Id::IMM4 => AV_CODEC_ID_IMM4,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Id::PROSUMER => AV_CODEC_ID_PROSUMER,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Id::MWSC => AV_CODEC_ID_MWSC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Id::WCMV => AV_CODEC_ID_WCMV,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Id::RASC => AV_CODEC_ID_RASC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Id::PCM_VIDC => AV_CODEC_ID_PCM_VIDC,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Id::ATRAC9 => AV_CODEC_ID_ATRAC9,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Id::TTML => AV_CODEC_ID_TTML,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Id::HYMT => AV_CODEC_ID_HYMT,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Id::ARBC => AV_CODEC_ID_ARBC,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Id::AGM => AV_CODEC_ID_AGM,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Id::LSCR => AV_CODEC_ID_LSCR,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Id::VP4 => AV_CODEC_ID_VP4,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Id::ADPCM_AGM => AV_CODEC_ID_ADPCM_AGM,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Id::HCOM => AV_CODEC_ID_HCOM,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Id::ARIB_CAPTION => AV_CODEC_ID_ARIB_CAPTION,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::IMM5 => AV_CODEC_ID_IMM5,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::MVDV => AV_CODEC_ID_MVDV,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::MVHA => AV_CODEC_ID_MVHA,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::CDTOONS => AV_CODEC_ID_CDTOONS,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::MV30 => AV_CODEC_ID_MV30,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::NOTCHLC => AV_CODEC_ID_NOTCHLC,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::PFM => AV_CODEC_ID_PFM,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::ADPCM_ARGO => AV_CODEC_ID_ADPCM_ARGO,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::ADPCM_IMA_SSI => AV_CODEC_ID_ADPCM_IMA_SSI,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::ADPCM_ZORK => AV_CODEC_ID_ADPCM_ZORK,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::ADPCM_IMA_APM => AV_CODEC_ID_ADPCM_IMA_APM,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::ADPCM_IMA_ALP => AV_CODEC_ID_ADPCM_IMA_ALP,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::ADPCM_IMA_MTF => AV_CODEC_ID_ADPCM_IMA_MTF,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::ADPCM_IMA_CUNNING => AV_CODEC_ID_ADPCM_IMA_CUNNING,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::DERF_DPCM => AV_CODEC_ID_DERF_DPCM,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::ACELP_KELVIN => AV_CODEC_ID_ACELP_KELVIN,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::MPEGH_3D_AUDIO => AV_CODEC_ID_MPEGH_3D_AUDIO,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::SIREN => AV_CODEC_ID_SIREN,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::HCA => AV_CODEC_ID_HCA,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Id::EPG => AV_CODEC_ID_EPG,
}
}

View File

@ -34,19 +34,19 @@ pub enum Type {
ContentLightLevel,
A53CC,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
EncryptionInitInfo,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
EncryptionInfo,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AFD,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
PRFT,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
ICC_PROFILE,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
DOVI_CONF,
}
@ -80,19 +80,19 @@ impl From<AVPacketSideDataType> for Type {
AV_PKT_DATA_CONTENT_LIGHT_LEVEL => Type::ContentLightLevel,
AV_PKT_DATA_A53_CC => Type::A53CC,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
AV_PKT_DATA_ENCRYPTION_INIT_INFO => Type::EncryptionInitInfo,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
AV_PKT_DATA_ENCRYPTION_INFO => Type::EncryptionInfo,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_PKT_DATA_AFD => Type::AFD,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_PKT_DATA_PRFT => Type::PRFT,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_PKT_DATA_ICC_PROFILE => Type::ICC_PROFILE,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_PKT_DATA_DOVI_CONF => Type::DOVI_CONF,
}
}
@ -128,19 +128,19 @@ impl Into<AVPacketSideDataType> for Type {
Type::ContentLightLevel => AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
Type::A53CC => AV_PKT_DATA_A53_CC,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
Type::EncryptionInitInfo => AV_PKT_DATA_ENCRYPTION_INIT_INFO,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
Type::EncryptionInfo => AV_PKT_DATA_ENCRYPTION_INFO,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Type::AFD => AV_PKT_DATA_AFD,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Type::PRFT => AV_PKT_DATA_PRFT,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Type::ICC_PROFILE => AV_PKT_DATA_ICC_PROFILE,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Type::DOVI_CONF => AV_PKT_DATA_DOVI_CONF,
}
}

View File

@ -6,7 +6,7 @@ bitflags! {
const NO_FILE = AVFMT_NOFILE;
const NEED_NUMBER = AVFMT_NEEDNUMBER;
const SHOW_IDS = AVFMT_SHOW_IDS;
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
const RAW_PICTURE = AVFMT_RAWPICTURE;
const GLOBAL_HEADER = AVFMT_GLOBALHEADER;
const NO_TIMESTAMPS = AVFMT_NOTIMESTAMPS;

View File

@ -98,6 +98,13 @@ fn init_filter() {
#[cfg(not(feature = "filter"))]
fn init_filter() {}
#[cfg_attr(
any(feature = "ffmpeg4", feature = "ffmpeg41", feature = "ffmpeg42"),
deprecated(
note = "features ffmpeg4/ffmpeg41/ffmpeg42/ffmpeg43 are now auto-detected \
and will be removed in a future version"
)
)]
pub fn init() -> Result<(), Error> {
init_error();
init_format();

View File

@ -21,14 +21,14 @@ pub enum Primaries {
SMPTE428,
SMPTE431,
SMPTE432,
#[cfg(not(feature = "ffmpeg43"))]
#[cfg(not(feature = "ffmpeg_4_3"))]
JEDEC_P22,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
EBU3213,
}
impl Primaries {
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
pub const JEDEC_P22: Primaries = Primaries::EBU3213;
pub fn name(&self) -> Option<&'static str> {
@ -62,9 +62,9 @@ impl From<AVColorPrimaries> for Primaries {
AVCOL_PRI_SMPTE428 => Primaries::SMPTE428,
AVCOL_PRI_SMPTE431 => Primaries::SMPTE431,
AVCOL_PRI_SMPTE432 => Primaries::SMPTE432,
#[cfg(not(feature = "ffmpeg43"))]
#[cfg(not(feature = "ffmpeg_4_3"))]
AVCOL_PRI_JEDEC_P22 => Primaries::JEDEC_P22,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AVCOL_PRI_EBU3213 => Primaries::EBU3213,
}
}
@ -88,9 +88,9 @@ impl Into<AVColorPrimaries> for Primaries {
Primaries::SMPTE428 => AVCOL_PRI_SMPTE428,
Primaries::SMPTE431 => AVCOL_PRI_SMPTE431,
Primaries::SMPTE432 => AVCOL_PRI_SMPTE432,
#[cfg(not(feature = "ffmpeg43"))]
#[cfg(not(feature = "ffmpeg_4_3"))]
Primaries::JEDEC_P22 => AVCOL_PRI_JEDEC_P22,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Primaries::EBU3213 => AVCOL_PRI_EBU3213,
}
}

View File

@ -113,7 +113,7 @@ pub enum Pixel {
YUV444P10LE,
YUV422P9BE,
YUV422P9LE,
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
VDA_VLD,
GBRP,
@ -158,7 +158,7 @@ pub enum Pixel {
YVYU422,
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
VDA,
YA16BE,
@ -310,36 +310,36 @@ pub enum Pixel {
GBRAPF32LE,
DRM_PRIME,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
OPENCL,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
GRAY14BE,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
GRAY14LE,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
GRAYF32BE,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
GRAYF32LE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
YUVA422P12BE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
YUVA422P12LE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
YUVA444P12BE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
YUVA444P12LE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
NV24,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
NV42,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
VULKAN,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Y210BE,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Y210LE,
#[cfg(feature = "rpi")]
RPI,
@ -510,7 +510,7 @@ impl From<AVPixelFormat> for Pixel {
AV_PIX_FMT_YUV444P10LE => Pixel::YUV444P10LE,
AV_PIX_FMT_YUV422P9BE => Pixel::YUV422P9BE,
AV_PIX_FMT_YUV422P9LE => Pixel::YUV422P9LE,
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
AV_PIX_FMT_VDA_VLD => Pixel::VDA_VLD,
AV_PIX_FMT_GBRP => Pixel::GBRP,
@ -555,7 +555,7 @@ impl From<AVPixelFormat> for Pixel {
AV_PIX_FMT_YVYU422 => Pixel::YVYU422,
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
AV_PIX_FMT_VDA => Pixel::VDA,
AV_PIX_FMT_YA16BE => Pixel::YA16BE,
@ -643,36 +643,36 @@ impl From<AVPixelFormat> for Pixel {
AV_PIX_FMT_GBRAPF32LE => Pixel::GBRAPF32LE,
AV_PIX_FMT_DRM_PRIME => Pixel::DRM_PRIME,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
AV_PIX_FMT_OPENCL => Pixel::OPENCL,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_PIX_FMT_GRAY14BE => Pixel::GRAY14BE,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_PIX_FMT_GRAY14LE => Pixel::GRAY14LE,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_PIX_FMT_GRAYF32BE => Pixel::GRAYF32BE,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_PIX_FMT_GRAYF32LE => Pixel::GRAYF32LE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_PIX_FMT_YUVA422P12BE => Pixel::YUVA422P12BE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_PIX_FMT_YUVA422P12LE => Pixel::YUVA422P12LE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_PIX_FMT_YUVA444P12BE => Pixel::YUVA444P12BE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_PIX_FMT_YUVA444P12LE => Pixel::YUVA444P12LE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_PIX_FMT_NV24 => Pixel::NV24,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_PIX_FMT_NV42 => Pixel::NV42,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_PIX_FMT_VULKAN => Pixel::VULKAN,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_PIX_FMT_Y210BE => Pixel::Y210BE,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_PIX_FMT_Y210LE => Pixel::Y210LE,
#[cfg(feature = "rpi")]
@ -800,7 +800,7 @@ impl Into<AVPixelFormat> for Pixel {
Pixel::YUV444P10LE => AV_PIX_FMT_YUV444P10LE,
Pixel::YUV422P9BE => AV_PIX_FMT_YUV422P9BE,
Pixel::YUV422P9LE => AV_PIX_FMT_YUV422P9LE,
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
Pixel::VDA_VLD => AV_PIX_FMT_VDA_VLD,
Pixel::GBRP => AV_PIX_FMT_GBRP,
@ -845,7 +845,7 @@ impl Into<AVPixelFormat> for Pixel {
Pixel::YVYU422 => AV_PIX_FMT_YVYU422,
#[cfg(not(feature = "ffmpeg4"))]
#[cfg(not(feature = "ffmpeg_4_0"))]
Pixel::VDA => AV_PIX_FMT_VDA,
Pixel::YA16BE => AV_PIX_FMT_YA16BE,
@ -997,36 +997,36 @@ impl Into<AVPixelFormat> for Pixel {
Pixel::GBRAPF32LE => AV_PIX_FMT_GBRAPF32LE,
Pixel::DRM_PRIME => AV_PIX_FMT_DRM_PRIME,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
Pixel::OPENCL => AV_PIX_FMT_OPENCL,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Pixel::GRAY14BE => AV_PIX_FMT_GRAY14BE,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Pixel::GRAY14LE => AV_PIX_FMT_GRAY14LE,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Pixel::GRAYF32BE => AV_PIX_FMT_GRAYF32BE,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Pixel::GRAYF32LE => AV_PIX_FMT_GRAYF32LE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Pixel::YUVA422P12BE => AV_PIX_FMT_YUVA422P12BE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Pixel::YUVA422P12LE => AV_PIX_FMT_YUVA422P12LE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Pixel::YUVA444P12BE => AV_PIX_FMT_YUVA444P12BE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Pixel::YUVA444P12LE => AV_PIX_FMT_YUVA444P12LE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Pixel::NV24 => AV_PIX_FMT_NV24,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Pixel::NV42 => AV_PIX_FMT_NV42,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Pixel::VULKAN => AV_PIX_FMT_VULKAN,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Pixel::Y210BE => AV_PIX_FMT_Y210BE,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Pixel::Y210LE => AV_PIX_FMT_Y210LE,
#[cfg(feature = "rpi")]

View File

@ -28,20 +28,20 @@ pub enum Type {
ContentLightLevel,
IccProfile,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
QPTableProperties,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
QPTableData,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
S12M_TIMECODE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
DYNAMIC_HDR_PLUS,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
REGIONS_OF_INTEREST,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
VIDEO_ENC_PARAMS,
}
@ -76,20 +76,20 @@ impl From<AVFrameSideDataType> for Type {
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL => Type::ContentLightLevel,
AV_FRAME_DATA_ICC_PROFILE => Type::IccProfile,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
AV_FRAME_DATA_QP_TABLE_PROPERTIES => Type::QPTableProperties,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
AV_FRAME_DATA_QP_TABLE_DATA => Type::QPTableData,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
AV_FRAME_DATA_S12M_TIMECODE => Type::S12M_TIMECODE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_FRAME_DATA_DYNAMIC_HDR_PLUS => Type::DYNAMIC_HDR_PLUS,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
AV_FRAME_DATA_REGIONS_OF_INTEREST => Type::REGIONS_OF_INTEREST,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
AV_FRAME_DATA_VIDEO_ENC_PARAMS => Type::VIDEO_ENC_PARAMS,
}
}
@ -117,20 +117,20 @@ impl Into<AVFrameSideDataType> for Type {
Type::ContentLightLevel => AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
Type::IccProfile => AV_FRAME_DATA_ICC_PROFILE,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
Type::QPTableProperties => AV_FRAME_DATA_QP_TABLE_PROPERTIES,
#[cfg(feature = "ffmpeg4")]
#[cfg(feature = "ffmpeg_4_0")]
Type::QPTableData => AV_FRAME_DATA_QP_TABLE_DATA,
#[cfg(feature = "ffmpeg41")]
#[cfg(feature = "ffmpeg_4_1")]
Type::S12M_TIMECODE => AV_FRAME_DATA_S12M_TIMECODE,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Type::DYNAMIC_HDR_PLUS => AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
#[cfg(feature = "ffmpeg42")]
#[cfg(feature = "ffmpeg_4_2")]
Type::REGIONS_OF_INTEREST => AV_FRAME_DATA_REGIONS_OF_INTEREST,
#[cfg(feature = "ffmpeg43")]
#[cfg(feature = "ffmpeg_4_3")]
Type::VIDEO_ENC_PARAMS => AV_FRAME_DATA_VIDEO_ENC_PARAMS,
}
}