Skip to content

Commit fd44dd3

Browse files
FreezyLemonshssoichiro
authored andcommitted
Drop support for FFmpeg < 4.2
Check https://ffmpeg.org/download.html#releases and https://trac.ffmpeg.org/wiki/Downstreams to see the FFmpeg versions that are considered supported or EOL.
1 parent e70779a commit fd44dd3

File tree

12 files changed

+24
-182
lines changed

12 files changed

+24
-182
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
matrix:
3232
ffmpeg_version:
33-
["3.4", "4.0", "4.1", "4.2", "4.3", "4.4", "5.0", "5.1", "6.0", "6.1", "7.0"]
33+
["4.2", "4.3", "4.4", "5.0", "5.1", "6.0", "6.1", "7.0"]
3434
fail-fast: false
3535

3636
steps:

ffmpeg-sys-the-third/README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,23 @@ This is a fork of the abandoned [ffmpeg-sys](https://github.com/meh/rust-ffmpeg-
55

66
This crate contains low level bindings to FFmpeg. You're probably interested in the high level bindings instead: [ffmpeg-next](https://github.com/shssoichiro/ffmpeg-the-third).
77

8-
A word on versioning: major and minor versions 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.
8+
A word on versioning: The crate version includes the **maximum supported** FFmpeg version for each release. E.g. `ffmpeg-sys-the-third@2.0.0+ffmpeg-7.0` supports *up to* FFmpeg 7.0. The minimum supported FFmpeg version at the moment is 4.2.
99

1010
## Feature flags
1111

1212
In addition to feature flags declared in `Cargo.toml`, this crate performs various compile-time version and feature detections and exposes the results in additional flags. These flags are briefly documented below; run `cargo build -vv` to view more details.
1313

14-
- `ffmpeg_<x>_<y>` flags (new in v4.3.2), e.g. `ffmpeg_4_4`, indicating the FFmpeg installation being compiled against is at least version `<x>.<y>`. Currently available:
14+
- `ffmpeg_<x>_<y>` flags, e.g. `ffmpeg_4_4`, indicating the FFmpeg installation being compiled against is at least version `<x>.<y>`. Currently available:
1515

16-
- `ffmpeg_3_0`
17-
- `ffmpeg_3_1`
18-
- `ffmpeg_3_2`
19-
- `ffmpeg_3_3`
20-
- `ffmpeg_3_1`
21-
- `ffmpeg_4_0`
22-
- `ffmpeg_4_1`
23-
- `ffmpeg_4_2`
24-
- `ffmpeg_4_3`
25-
- `ffmpeg_4_4`
16+
- "ffmpeg_4_3"
17+
- "ffmpeg_4_4"
18+
- "ffmpeg_5_0"
19+
- "ffmpeg_5_1"
20+
- "ffmpeg_6_0"
21+
- "ffmpeg_6_1"
22+
- "ffmpeg_7_0"
2623

27-
- `avcodec_version_greater_than_<x>_<y>` (new in v4.3.2), e.g., `avcodec_version_greater_than_58_90`. The name should be self-explanatory.
24+
- `avcodec_version_greater_than_<x>_<y>`, e.g., `avcodec_version_greater_than_58_90`. The name should be self-explanatory.
2825

2926
- `ff_api_<feature>`, e.g. `ff_api_vaapi`, corresponding to whether their respective uppercase deprecation guards evaluate to true.
3027

ffmpeg-sys-the-third/build.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ fn check_features(include_paths: &[PathBuf]) {
807807
}
808808
}
809809

810-
let version_check_info = [("avcodec", 56, 62, 0, 108)];
810+
let version_check_info = [("avcodec", 57, 62, 0, 101)];
811811
for &(lib, begin_version_major, end_version_major, begin_version_minor, end_version_minor) in
812812
&version_check_info
813813
{
@@ -830,14 +830,6 @@ fn check_features(include_paths: &[PathBuf]) {
830830
}
831831

832832
let ffmpeg_lavc_versions = [
833-
("ffmpeg_3_0", 57, 24),
834-
("ffmpeg_3_1", 57, 48),
835-
("ffmpeg_3_2", 57, 64),
836-
("ffmpeg_3_3", 57, 89),
837-
("ffmpeg_3_1", 57, 107),
838-
("ffmpeg_4_0", 58, 18),
839-
("ffmpeg_4_1", 58, 35),
840-
("ffmpeg_4_2", 58, 54),
841833
("ffmpeg_4_3", 58, 91),
842834
("ffmpeg_4_4", 58, 100),
843835
("ffmpeg_5_0", 59, 18),
@@ -851,6 +843,9 @@ fn check_features(include_paths: &[PathBuf]) {
851843
.get("avcodec")
852844
.expect("Unable to find the version for lib{lib}");
853845

846+
// This allows removing a lot of #[cfg] attributes.
847+
assert!(lavc_version >= (58, 54), "FFmpeg 4.2 or higher is required, but found avcodec version {lavc_version:?}");
848+
854849
for &(ffmpeg_version_flag, lavc_version_major, lavc_version_minor) in &ffmpeg_lavc_versions {
855850
// Every possible feature needs an unconditional check-cfg to prevent warnings
856851
println!(

src/codec/capabilities.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ bitflags! {
1010
const TRUNCATED = AV_CODEC_CAP_TRUNCATED;
1111
const DELAY = AV_CODEC_CAP_DELAY;
1212
const SMALL_LAST_FRAME = AV_CODEC_CAP_SMALL_LAST_FRAME;
13-
#[cfg(not(feature = "ffmpeg_4_0"))]
14-
const HWACCEL_VDPAU = AV_CODEC_CAP_HWACCEL_VDPAU;
1513
const SUBFRAMES = AV_CODEC_CAP_SUBFRAMES;
1614
const EXPERIMENTAL = AV_CODEC_CAP_EXPERIMENTAL;
1715
const CHANNEL_CONF = AV_CODEC_CAP_CHANNEL_CONF;

src/codec/debug.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,12 @@ bitflags! {
88
const BITSTREAM = FF_DEBUG_BITSTREAM;
99
const MB_TYPE = FF_DEBUG_MB_TYPE;
1010
const QP = FF_DEBUG_QP;
11-
#[cfg(not(feature = "ffmpeg_4_0"))]
12-
const MV = FF_DEBUG_MV;
1311
const DCT_COEFF = FF_DEBUG_DCT_COEFF;
1412
const SKIP = FF_DEBUG_SKIP;
1513
const STARTCODE = FF_DEBUG_STARTCODE;
16-
#[cfg(not(feature = "ffmpeg_4_0"))]
17-
const PTS = FF_DEBUG_PTS;
1814
const ER = FF_DEBUG_ER;
1915
const MMCO = FF_DEBUG_MMCO;
2016
const BUGS = FF_DEBUG_BUGS;
21-
#[cfg(not(feature = "ffmpeg_4_0"))]
22-
const VIS_QP = FF_DEBUG_VIS_QP;
23-
#[cfg(not(feature = "ffmpeg_4_0"))]
24-
const VIS_MB_TYPE = FF_DEBUG_VIS_MB_TYPE;
2517
const BUFFERS = FF_DEBUG_BUFFERS;
2618
const THREADS = FF_DEBUG_THREADS;
2719
const NOMC = FF_DEBUG_NOMC;

src/codec/id.rs

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ pub enum Id {
401401
ON2AVC,
402402
DSS_SP,
403403

404-
#[cfg(feature = "ffmpeg_4_0")]
405404
CODEC2,
406405
FFWAVESYNTH,
407406
SONIC,
@@ -487,47 +486,27 @@ pub enum Id {
487486
GREMLIN_DPCM,
488487
DOLBY_E,
489488

490-
#[cfg(feature = "ffmpeg_4_0")]
491489
APTX,
492-
#[cfg(feature = "ffmpeg_4_0")]
493490
APTX_HD,
494-
#[cfg(feature = "ffmpeg_4_0")]
495491
SBC,
496492

497-
#[cfg(feature = "ffmpeg_4_1")]
498493
AVS2,
499-
#[cfg(feature = "ffmpeg_4_1")]
500494
IMM4,
501-
#[cfg(feature = "ffmpeg_4_1")]
502495
PROSUMER,
503-
#[cfg(feature = "ffmpeg_4_1")]
504496
MWSC,
505-
#[cfg(feature = "ffmpeg_4_1")]
506497
WCMV,
507-
#[cfg(feature = "ffmpeg_4_1")]
508498
RASC,
509-
#[cfg(feature = "ffmpeg_4_1")]
510499
PCM_VIDC,
511-
#[cfg(feature = "ffmpeg_4_1")]
512500
ATRAC9,
513-
#[cfg(feature = "ffmpeg_4_1")]
514501
TTML,
515502

516-
#[cfg(feature = "ffmpeg_4_2")]
517503
HYMT,
518-
#[cfg(feature = "ffmpeg_4_2")]
519504
ARBC,
520-
#[cfg(feature = "ffmpeg_4_2")]
521505
AGM,
522-
#[cfg(feature = "ffmpeg_4_2")]
523506
LSCR,
524-
#[cfg(feature = "ffmpeg_4_2")]
525507
VP4,
526-
#[cfg(feature = "ffmpeg_4_2")]
527508
ADPCM_AGM,
528-
#[cfg(feature = "ffmpeg_4_2")]
529509
HCOM,
530-
#[cfg(feature = "ffmpeg_4_2")]
531510
ARIB_CAPTION,
532511

533512
#[cfg(feature = "ffmpeg_4_3")]
@@ -1073,7 +1052,6 @@ impl From<AVCodecID> for Id {
10731052
AV_CODEC_ID_ON2AVC => Id::ON2AVC,
10741053
AV_CODEC_ID_DSS_SP => Id::DSS_SP,
10751054

1076-
#[cfg(feature = "ffmpeg_4_0")]
10771055
AV_CODEC_ID_CODEC2 => Id::CODEC2,
10781056
AV_CODEC_ID_FFWAVESYNTH => Id::FFWAVESYNTH,
10791057
AV_CODEC_ID_SONIC => Id::SONIC,
@@ -1158,47 +1136,27 @@ impl From<AVCodecID> for Id {
11581136
AV_CODEC_ID_GREMLIN_DPCM => Id::GREMLIN_DPCM,
11591137
AV_CODEC_ID_DOLBY_E => Id::DOLBY_E,
11601138

1161-
#[cfg(feature = "ffmpeg_4_0")]
11621139
AV_CODEC_ID_APTX => Id::APTX,
1163-
#[cfg(feature = "ffmpeg_4_0")]
11641140
AV_CODEC_ID_APTX_HD => Id::APTX_HD,
1165-
#[cfg(feature = "ffmpeg_4_0")]
11661141
AV_CODEC_ID_SBC => Id::SBC,
11671142

1168-
#[cfg(feature = "ffmpeg_4_1")]
11691143
AV_CODEC_ID_AVS2 => Id::AVS2,
1170-
#[cfg(feature = "ffmpeg_4_1")]
11711144
AV_CODEC_ID_IMM4 => Id::IMM4,
1172-
#[cfg(feature = "ffmpeg_4_1")]
11731145
AV_CODEC_ID_PROSUMER => Id::PROSUMER,
1174-
#[cfg(feature = "ffmpeg_4_1")]
11751146
AV_CODEC_ID_MWSC => Id::MWSC,
1176-
#[cfg(feature = "ffmpeg_4_1")]
11771147
AV_CODEC_ID_WCMV => Id::WCMV,
1178-
#[cfg(feature = "ffmpeg_4_1")]
11791148
AV_CODEC_ID_RASC => Id::RASC,
1180-
#[cfg(feature = "ffmpeg_4_1")]
11811149
AV_CODEC_ID_PCM_VIDC => Id::PCM_VIDC,
1182-
#[cfg(feature = "ffmpeg_4_1")]
11831150
AV_CODEC_ID_ATRAC9 => Id::ATRAC9,
1184-
#[cfg(feature = "ffmpeg_4_1")]
11851151
AV_CODEC_ID_TTML => Id::TTML,
11861152

1187-
#[cfg(feature = "ffmpeg_4_2")]
11881153
AV_CODEC_ID_HYMT => Id::HYMT,
1189-
#[cfg(feature = "ffmpeg_4_2")]
11901154
AV_CODEC_ID_ARBC => Id::ARBC,
1191-
#[cfg(feature = "ffmpeg_4_2")]
11921155
AV_CODEC_ID_AGM => Id::AGM,
1193-
#[cfg(feature = "ffmpeg_4_2")]
11941156
AV_CODEC_ID_LSCR => Id::LSCR,
1195-
#[cfg(feature = "ffmpeg_4_2")]
11961157
AV_CODEC_ID_VP4 => Id::VP4,
1197-
#[cfg(feature = "ffmpeg_4_2")]
11981158
AV_CODEC_ID_ADPCM_AGM => Id::ADPCM_AGM,
1199-
#[cfg(feature = "ffmpeg_4_2")]
12001159
AV_CODEC_ID_HCOM => Id::HCOM,
1201-
#[cfg(feature = "ffmpeg_4_2")]
12021160
AV_CODEC_ID_ARIB_CAPTION => Id::ARIB_CAPTION,
12031161

12041162
#[cfg(feature = "ffmpeg_4_3")]
@@ -1738,7 +1696,6 @@ impl From<Id> for AVCodecID {
17381696
Id::ON2AVC => AV_CODEC_ID_ON2AVC,
17391697
Id::DSS_SP => AV_CODEC_ID_DSS_SP,
17401698

1741-
#[cfg(feature = "ffmpeg_4_0")]
17421699
Id::CODEC2 => AV_CODEC_ID_CODEC2,
17431700
Id::FFWAVESYNTH => AV_CODEC_ID_FFWAVESYNTH,
17441701
Id::SONIC => AV_CODEC_ID_SONIC,
@@ -1824,47 +1781,27 @@ impl From<Id> for AVCodecID {
18241781
Id::GREMLIN_DPCM => AV_CODEC_ID_GREMLIN_DPCM,
18251782
Id::DOLBY_E => AV_CODEC_ID_DOLBY_E,
18261783

1827-
#[cfg(feature = "ffmpeg_4_0")]
18281784
Id::APTX => AV_CODEC_ID_APTX,
1829-
#[cfg(feature = "ffmpeg_4_0")]
18301785
Id::APTX_HD => AV_CODEC_ID_APTX_HD,
1831-
#[cfg(feature = "ffmpeg_4_0")]
18321786
Id::SBC => AV_CODEC_ID_SBC,
18331787

1834-
#[cfg(feature = "ffmpeg_4_1")]
18351788
Id::AVS2 => AV_CODEC_ID_AVS2,
1836-
#[cfg(feature = "ffmpeg_4_1")]
18371789
Id::IMM4 => AV_CODEC_ID_IMM4,
1838-
#[cfg(feature = "ffmpeg_4_1")]
18391790
Id::PROSUMER => AV_CODEC_ID_PROSUMER,
1840-
#[cfg(feature = "ffmpeg_4_1")]
18411791
Id::MWSC => AV_CODEC_ID_MWSC,
1842-
#[cfg(feature = "ffmpeg_4_1")]
18431792
Id::WCMV => AV_CODEC_ID_WCMV,
1844-
#[cfg(feature = "ffmpeg_4_1")]
18451793
Id::RASC => AV_CODEC_ID_RASC,
1846-
#[cfg(feature = "ffmpeg_4_1")]
18471794
Id::PCM_VIDC => AV_CODEC_ID_PCM_VIDC,
1848-
#[cfg(feature = "ffmpeg_4_1")]
18491795
Id::ATRAC9 => AV_CODEC_ID_ATRAC9,
1850-
#[cfg(feature = "ffmpeg_4_1")]
18511796
Id::TTML => AV_CODEC_ID_TTML,
18521797

1853-
#[cfg(feature = "ffmpeg_4_2")]
18541798
Id::HYMT => AV_CODEC_ID_HYMT,
1855-
#[cfg(feature = "ffmpeg_4_2")]
18561799
Id::ARBC => AV_CODEC_ID_ARBC,
1857-
#[cfg(feature = "ffmpeg_4_2")]
18581800
Id::AGM => AV_CODEC_ID_AGM,
1859-
#[cfg(feature = "ffmpeg_4_2")]
18601801
Id::LSCR => AV_CODEC_ID_LSCR,
1861-
#[cfg(feature = "ffmpeg_4_2")]
18621802
Id::VP4 => AV_CODEC_ID_VP4,
1863-
#[cfg(feature = "ffmpeg_4_2")]
18641803
Id::ADPCM_AGM => AV_CODEC_ID_ADPCM_AGM,
1865-
#[cfg(feature = "ffmpeg_4_2")]
18661804
Id::HCOM => AV_CODEC_ID_HCOM,
1867-
#[cfg(feature = "ffmpeg_4_2")]
18681805
Id::ARIB_CAPTION => AV_CODEC_ID_ARIB_CAPTION,
18691806

18701807
#[cfg(feature = "ffmpeg_4_3")]

src/codec/packet/packet.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,10 @@ impl Clone for Packet {
264264

265265
#[inline]
266266
fn clone_from(&mut self, source: &Self) {
267-
#[cfg(feature = "ffmpeg_4_0")]
268267
unsafe {
269268
av_packet_ref(&mut self.0, &source.0);
270269
av_packet_make_writable(&mut self.0);
271270
}
272-
#[cfg(not(feature = "ffmpeg_4_0"))]
273-
unsafe {
274-
av_copy_packet(&mut self.0, &source.0);
275-
}
276271
}
277272
}
278273

src/codec/packet/side_data.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,9 @@ pub enum Type {
3737
ContentLightLevel,
3838
A53CC,
3939

40-
#[cfg(feature = "ffmpeg_4_0")]
4140
EncryptionInitInfo,
42-
#[cfg(feature = "ffmpeg_4_0")]
4341
EncryptionInfo,
4442

45-
#[cfg(feature = "ffmpeg_4_1")]
4643
AFD,
4744

4845
#[cfg(feature = "ffmpeg_4_3")]
@@ -98,12 +95,9 @@ impl From<AVPacketSideDataType> for Type {
9895
AV_PKT_DATA_CONTENT_LIGHT_LEVEL => Type::ContentLightLevel,
9996
AV_PKT_DATA_A53_CC => Type::A53CC,
10097

101-
#[cfg(feature = "ffmpeg_4_0")]
10298
AV_PKT_DATA_ENCRYPTION_INIT_INFO => Type::EncryptionInitInfo,
103-
#[cfg(feature = "ffmpeg_4_0")]
10499
AV_PKT_DATA_ENCRYPTION_INFO => Type::EncryptionInfo,
105100

106-
#[cfg(feature = "ffmpeg_4_1")]
107101
AV_PKT_DATA_AFD => Type::AFD,
108102

109103
#[cfg(feature = "ffmpeg_4_3")]
@@ -164,12 +158,9 @@ impl From<Type> for AVPacketSideDataType {
164158
Type::ContentLightLevel => AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
165159
Type::A53CC => AV_PKT_DATA_A53_CC,
166160

167-
#[cfg(feature = "ffmpeg_4_0")]
168161
Type::EncryptionInitInfo => AV_PKT_DATA_ENCRYPTION_INIT_INFO,
169-
#[cfg(feature = "ffmpeg_4_0")]
170162
Type::EncryptionInfo => AV_PKT_DATA_ENCRYPTION_INFO,
171163

172-
#[cfg(feature = "ffmpeg_4_1")]
173164
Type::AFD => AV_PKT_DATA_AFD,
174165

175166
#[cfg(feature = "ffmpeg_4_3")]

src/format/format/flag.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ bitflags! {
66
const NO_FILE = AVFMT_NOFILE;
77
const NEED_NUMBER = AVFMT_NEEDNUMBER;
88
const SHOW_IDS = AVFMT_SHOW_IDS;
9-
#[cfg(not(feature = "ffmpeg_4_0"))]
10-
const RAW_PICTURE = AVFMT_RAWPICTURE;
119
const GLOBAL_HEADER = AVFMT_GLOBALHEADER;
1210
const NO_TIMESTAMPS = AVFMT_NOTIMESTAMPS;
1311
const GENERIC_INDEX = AVFMT_GENERIC_INDEX;

src/format/format/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ pub use self::input::Input;
77
mod output;
88
pub use self::output::Output;
99

10-
#[cfg(feature = "ffmpeg_4_0")]
1110
mod iter;
12-
#[cfg(feature = "ffmpeg_4_0")]
1311
pub use self::iter::{DemuxerIter, MuxerIter};
1412

15-
#[cfg(feature = "ffmpeg_4_0")]
1613
pub fn list_demuxers() -> DemuxerIter {
1714
DemuxerIter::new()
1815
}
1916

20-
#[cfg(feature = "ffmpeg_4_0")]
2117
pub fn list_muxers() -> MuxerIter {
2218
MuxerIter::new()
2319
}

0 commit comments

Comments
 (0)