Skip to content

Commit ef14631

Browse files
authored
Remove old FF_API_* features (shssoichiro#80)
* Clean up FF_API features Use (for avcodec): `git log -n1 -p -SFF_API_* -- libavcodec/version_major.h` to find the last change regarding the relevant FF_API feature. Removed all flags that are <4.0. Added comments for the remaining flags * Remove features gated behind old FF_API flags
1 parent 9ecb233 commit ef14631

File tree

4 files changed

+41
-161
lines changed

4 files changed

+41
-161
lines changed

ffmpeg-sys-the-third/build.rs

Lines changed: 41 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -84,36 +84,26 @@ impl AVFeature {
8484
}
8585

8686
static AVUTIL_FEATURES: &[AVFeature] = &[
87-
AVFeature::new("OLD_AVOPTIONS"),
88-
AVFeature::new("PIX_FMT"),
89-
AVFeature::new("CONTEXT_SIZE"),
90-
AVFeature::new("PIX_FMT_DESC"),
91-
AVFeature::new("AV_REVERSE"),
92-
AVFeature::new("AUDIOCONVERT"),
93-
AVFeature::new("CPU_FLAG_MMX2"),
94-
AVFeature::new("LLS_PRIVATE"),
95-
AVFeature::new("AVFRAME_LAVC"),
96-
AVFeature::new("VDPAU"),
97-
AVFeature::new("GET_CHANNEL_LAYOUT_COMPAT"),
98-
AVFeature::new("XVMC"),
99-
AVFeature::new("OPT_TYPE_METADATA"),
100-
AVFeature::new("DLOG"),
101-
AVFeature::new("HMAC"),
87+
// before 5.0 (< v57)
10288
AVFeature::new("VAAPI"),
10389
AVFeature::new("PKT_PTS"),
10490
AVFeature::new("ERROR_FRAME"),
10591
AVFeature::new("FRAME_QP"),
92+
// before 6.0 (< v58)
10693
AVFeature::new("D2STR"),
10794
AVFeature::new("DECLARE_ALIGNED"),
10895
AVFeature::new("COLORSPACE_NAME"),
10996
AVFeature::new("AV_MALLOCZ_ARRAY"),
97+
// before 7.0 (< v59)
98+
AVFeature::new("XVMC"),
11099
AVFeature::new("FIFO_PEEK2"),
111100
AVFeature::new("FIFO_OLD_API"),
112101
AVFeature::new("OLD_CHANNEL_LAYOUT"),
113102
AVFeature::new("AV_FOPEN_UTF8"),
114103
AVFeature::new("PKT_DURATION"),
115104
AVFeature::new("REORDERED_OPAQUE"),
116105
AVFeature::new("FRAME_PICTURE_NUMBER"),
106+
// before 8.0 (< v60)
117107
AVFeature::new("HDR_VIVID_THREE_SPLINE"),
118108
AVFeature::new("FRAME_PKT"),
119109
AVFeature::new("INTERLACED_FRAME"),
@@ -127,58 +117,9 @@ static AVUTIL_FEATURES: &[AVFeature] = &[
127117
];
128118

129119
static AVCODEC_FEATURES: &[AVFeature] = &[
130-
AVFeature::new("VIMA_DECODER"),
131-
AVFeature::new("REQUEST_CHANNELS"),
132-
AVFeature::new("OLD_DECODE_AUDIO"),
133-
AVFeature::new("OLD_ENCODE_AUDIO"),
134-
AVFeature::new("OLD_ENCODE_VIDEO"),
135-
AVFeature::new("CODEC_ID"),
136-
AVFeature::new("AUDIO_CONVERT"),
137-
AVFeature::new("AVCODEC_RESAMPLE"),
138-
AVFeature::new("DEINTERLACE"),
139-
AVFeature::new("DESTRUCT_PACKET"),
140-
AVFeature::new("GET_BUFFER"),
141-
AVFeature::new("MISSING_SAMPLE"),
120+
// before 5.0 (< v59)
142121
AVFeature::new("LOWRES"),
143-
AVFeature::new("CAP_VDPAU"),
144-
AVFeature::new("BUFS_VDPAU"),
145-
AVFeature::new("VOXWARE"),
146-
AVFeature::new("SET_DIMENSIONS"),
147-
AVFeature::new("DEBUG_MV"),
148-
AVFeature::new("AC_VLC"),
149-
AVFeature::new("OLD_MSMPEG4"),
150-
AVFeature::new("ASPECT_EXTENDED"),
151-
AVFeature::new("THREAD_OPAQUE"),
152-
AVFeature::new("CODEC_PKT"),
153-
AVFeature::new("ARCH_ALPHA"),
154-
AVFeature::new("ERROR_RATE"),
155-
AVFeature::new("QSCALE_TYPE"),
156-
AVFeature::new("MB_TYPE"),
157-
AVFeature::new("MAX_BFRAMES"),
158-
AVFeature::new("NEG_LINESIZES"),
159-
AVFeature::new("EMU_EDGE"),
160-
AVFeature::new("ARCH_SH4"),
161-
AVFeature::new("ARCH_SPARC"),
162-
AVFeature::new("UNUSED_MEMBERS"),
163-
AVFeature::new("IDCT_XVIDMMX"),
164-
AVFeature::new("INPUT_PRESERVED"),
165-
AVFeature::new("NORMALIZE_AQP"),
166-
AVFeature::new("GMC"),
167-
AVFeature::new("MV0"),
168-
AVFeature::new("CODEC_NAME"),
169-
AVFeature::new("AFD"),
170-
AVFeature::new("VISMV"),
171-
AVFeature::new("DV_FRAME_PROFILE"),
172-
AVFeature::new("AUDIOENC_DELAY"),
173-
AVFeature::new("VAAPI_CONTEXT"),
174-
AVFeature::new("AVCTX_TIMEBASE"),
175-
AVFeature::new("MPV_OPT"),
176-
AVFeature::new("STREAM_CODEC_TAG"),
177-
AVFeature::new("QUANT_BIAS"),
178-
AVFeature::new("RC_STRATEGY"),
179122
AVFeature::new("CODED_FRAME"),
180-
AVFeature::new("MOTION_EST"),
181-
AVFeature::new("WITHOUT_PREFIX"),
182123
AVFeature::new("CONVERGENCE_DURATION"),
183124
AVFeature::new("PRIVATE_OPT"),
184125
AVFeature::new("CODER_TYPE"),
@@ -187,15 +128,18 @@ static AVCODEC_FEATURES: &[AVFeature] = &[
187128
AVFeature::new("VBV_DELAY"),
188129
AVFeature::new("SIDEDATA_ONLY_PKT"),
189130
AVFeature::new("AVPICTURE"),
131+
// before 6.0 (< v60)
190132
AVFeature::new("OPENH264_SLICE_MODE"),
191133
AVFeature::new("OPENH264_CABAC"),
192134
AVFeature::new("UNUSED_CODEC_CAPS"),
193135
AVFeature::new("THREAD_SAFE_CALLBACKS"),
136+
AVFeature::new("DEBUG_MV"),
194137
AVFeature::new("GET_FRAME_CLASS"),
195138
AVFeature::new("AUTO_THREADS"),
196-
AVFeature::new("INIT_PACKET"),
139+
AVFeature::new("AVCTX_TIMEBASE"),
197140
AVFeature::new("FLAG_TRUNCATED"),
198141
AVFeature::new("SUB_TEXT_FORMAT"),
142+
// before 7.0 (< v61)
199143
AVFeature::new("IDCT_NONE"),
200144
AVFeature::new("SVTAV1_OPTS"),
201145
AVFeature::new("AYUV_CODECID"),
@@ -204,6 +148,7 @@ static AVCODEC_FEATURES: &[AVFeature] = &[
204148
AVFeature::new("VT_HWACCEL_CONTEXT"),
205149
AVFeature::new("AVCTX_FRAME_NUMBER"),
206150
AVFeature::new("SLICE_OFFSET"),
151+
// before 8.0 (< v62)
207152
AVFeature::new("SUBFRAMES"),
208153
AVFeature::new("TICKS_PER_FRAME"),
209154
AVFeature::new("DROPCHANGED"),
@@ -213,58 +158,67 @@ static AVCODEC_FEATURES: &[AVFeature] = &[
213158
AVFeature::new("BUFFER_MIN_SIZE"),
214159
AVFeature::new("VDPAU_ALLOC_GET_SET"),
215160
AVFeature::new("QUALITY_FACTOR"),
161+
AVFeature::new("INIT_PACKET"),
162+
AVFeature::new("TICKS_PER_FRAME"),
163+
AVFeature::new("DROPCHANGED"),
164+
AVFeature::new("AVFFT"),
165+
AVFeature::new("FF_PROFILE_LEVEL"),
166+
AVFeature::new("AVCODEC_CLOSE"),
167+
AVFeature::new("BUFFER_MIN_SIZE"),
168+
AVFeature::new("VDPAU_ALLOC_GET_SET"),
169+
AVFeature::new("QUALITY_FACTOR"),
216170
];
217171

218172
static AVFORMAT_FEATURES: &[AVFeature] = &[
219-
AVFeature::new("LAVF_BITEXACT"),
220-
AVFeature::new("LAVF_FRAC"),
221-
AVFeature::new("URL_FEOF"),
222-
AVFeature::new("PROBESIZE_32"),
173+
// before 5.0 (< v59)
223174
AVFeature::new("LAVF_AVCTX"),
224175
AVFeature::new("OLD_OPEN_CALLBACKS"),
176+
// before 6.0 (< v60)
225177
AVFeature::new("LAVF_PRIV_OPT"),
226-
AVFeature::new("COMPUTE_PKT_FIELDS2"),
227178
AVFeature::new("AVIOCONTEXT_WRITTEN"),
228-
AVFeature::new("AVSTREAM_CLASS"),
229-
AVFeature::new("R_FRAME_RATE"),
179+
// before 7.0 (< v61)
230180
AVFeature::new("GET_END_PTS"),
231181
AVFeature::new("AVIODIRCONTEXT"),
232182
AVFeature::new("AVFORMAT_IO_CLOSE"),
233183
AVFeature::new("AVIO_WRITE_NONCONST"),
184+
// before 8.0 (< v62)
185+
AVFeature::new("COMPUTE_PKT_FIELDS2"),
234186
AVFeature::new("LAVF_SHORTEST"),
235187
AVFeature::new("ALLOW_FLUSH"),
236188
AVFeature::new("AVSTREAM_SIDE_DATA"),
237189
AVFeature::new("GET_DUR_ESTIMATE_METHOD"),
238190
AVFeature::new("INTERNAL_TIMING"),
191+
// after 5.0 (> v59)
192+
AVFeature::new("AVSTREAM_CLASS"),
193+
// for all eternity
194+
AVFeature::new("R_FRAME_RATE"),
239195
];
240196

241197
static AVDEVICE_FEATURES: &[AVFeature] = &[
198+
// before 6.0 (< v60)
242199
AVFeature::new("DEVICE_CAPABILITIES"),
200+
// before 8.0 (< v62)
243201
AVFeature::new("BKTR_DEVICE"),
244202
AVFeature::new("OPENGL_DEVICE"),
245203
AVFeature::new("SDL2_DEVICE"),
246204
];
247205

248206
static AVFILTER_FEATURES: &[AVFeature] = &[
249-
AVFeature::new("AVFILTERPAD_PUBLIC"),
250-
AVFeature::new("FOO_COUNT"),
251-
AVFeature::new("OLD_FILTER_OPTS"),
207+
// before 5.0 (< v8)
252208
AVFeature::new("OLD_FILTER_OPTS_ERROR"),
253-
AVFeature::new("AVFILTER_OPEN"),
254-
AVFeature::new("OLD_FILTER_REGISTER"),
255-
AVFeature::new("OLD_GRAPH_PARSE"),
256-
AVFeature::new("NOCONST_GET_NAME"),
209+
// before 6.0 (< v9)
257210
AVFeature::new("SWS_PARAM_OPTION"),
258211
AVFeature::new("BUFFERSINK_ALLOC"),
259212
AVFeature::new("PAD_COUNT"),
213+
// before 7.0 (< v10)
260214
AVFeature::new("LIBPLACEBO_OPTS"),
215+
// before 8.0 (< v11)
261216
AVFeature::new("LINK_PUBLIC"),
262217
];
263218

264-
static AVRESAMPLE_FEATURES: &[AVFeature] = &[AVFeature::new("RESAMPLE_CLOSE_OPEN")];
219+
static AVRESAMPLE_FEATURES: &[AVFeature] = &[];
265220

266-
static SWSCALE_FEATURES: &[AVFeature] =
267-
&[AVFeature::new("SWS_CPU_CAPS"), AVFeature::new("ARCH_BFIN")];
221+
static SWSCALE_FEATURES: &[AVFeature] = &[];
268222

269223
static SWRESAMPLE_FEATURES: &[AVFeature] = &[];
270224

@@ -863,7 +817,10 @@ fn check_features(include_paths: &[PathBuf]) {
863817
.expect("Unable to find the version for lib{lib}");
864818

865819
// This allows removing a lot of #[cfg] attributes.
866-
assert!(lavc_version >= (58, 54), "FFmpeg 4.2 or higher is required, but found avcodec version {lavc_version:?}");
820+
assert!(
821+
lavc_version >= (58, 54),
822+
"FFmpeg 4.2 or higher is required, but found avcodec version {lavc_version:?}"
823+
);
867824

868825
for &(ffmpeg_version_flag, lavc_version_major, lavc_version_minor) in &ffmpeg_lavc_versions {
869826
// Every possible feature needs an unconditional check-cfg to prevent warnings

src/codec/encoder/video.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,6 @@ impl Video {
121121
unsafe { format::Pixel::from((*self.as_ptr()).pix_fmt) }
122122
}
123123

124-
#[inline]
125-
#[cfg(feature = "ff_api_motion_est")]
126-
pub fn set_motion_estimation(&mut self, value: MotionEstimation) {
127-
unsafe {
128-
(*self.as_mut_ptr()).me_method = value.into();
129-
}
130-
}
131-
132124
#[inline]
133125
pub fn set_max_b_frames(&mut self, value: usize) {
134126
unsafe {
@@ -292,30 +284,6 @@ impl Video {
292284
}
293285
}
294286

295-
#[inline]
296-
#[cfg(feature = "ff_api_quant_bias")]
297-
pub fn set_intra_quant_bias(&mut self, value: Option<usize>) {
298-
unsafe {
299-
if let Some(value) = value {
300-
(*self.as_mut_ptr()).intra_quant_bias = value as c_int;
301-
} else {
302-
(*self.as_mut_ptr()).intra_quant_bias = FF_DEFAULT_QUANT_BIAS;
303-
}
304-
}
305-
}
306-
307-
#[inline]
308-
#[cfg(feature = "ff_api_quant_bias")]
309-
pub fn set_inter_quant_bias(&mut self, value: Option<usize>) {
310-
unsafe {
311-
if let Some(value) = value {
312-
(*self.as_mut_ptr()).inter_quant_bias = value as c_int;
313-
} else {
314-
(*self.as_mut_ptr()).inter_quant_bias = FF_DEFAULT_QUANT_BIAS;
315-
}
316-
}
317-
}
318-
319287
#[inline]
320288
pub fn set_mb_decision(&mut self, value: Decision) {
321289
unsafe {

src/codec/id.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,6 @@ pub enum Id {
361361
MLP,
362362
GSM_MS,
363363
ATRAC3,
364-
#[cfg(feature = "ff_api_voxware")]
365-
VOXWARE,
366364
APE,
367365
NELLYMOSER,
368366
MUSEPACK8,
@@ -651,9 +649,6 @@ pub enum Id {
651649
}
652650

653651
impl Id {
654-
#[cfg(feature = "ff_api_vima_decoder")]
655-
pub const VIMA: Id = Id::ADPCM_VIMA;
656-
657652
pub fn medium(&self) -> media::Type {
658653
unsafe { media::Type::from(avcodec_get_type((*self).into())) }
659654
}
@@ -1016,8 +1011,6 @@ impl From<AVCodecID> for Id {
10161011
AV_CODEC_ID_MLP => Id::MLP,
10171012
AV_CODEC_ID_GSM_MS => Id::GSM_MS,
10181013
AV_CODEC_ID_ATRAC3 => Id::ATRAC3,
1019-
#[cfg(feature = "ff_api_voxware")]
1020-
AV_CODEC_ID_VOXWARE => Id::VOXWARE,
10211014
AV_CODEC_ID_APE => Id::APE,
10221015
AV_CODEC_ID_NELLYMOSER => Id::NELLYMOSER,
10231016
AV_CODEC_ID_MUSEPACK8 => Id::MUSEPACK8,
@@ -1664,8 +1657,6 @@ impl From<Id> for AVCodecID {
16641657
Id::MLP => AV_CODEC_ID_MLP,
16651658
Id::GSM_MS => AV_CODEC_ID_GSM_MS,
16661659
Id::ATRAC3 => AV_CODEC_ID_ATRAC3,
1667-
#[cfg(feature = "ff_api_voxware")]
1668-
Id::VOXWARE => AV_CODEC_ID_VOXWARE,
16691660
Id::APE => AV_CODEC_ID_APE,
16701661
Id::NELLYMOSER => AV_CODEC_ID_NELLYMOSER,
16711662
Id::MUSEPACK8 => AV_CODEC_ID_MUSEPACK8,

src/util/format/pixel.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,6 @@ pub enum Pixel {
5454
YUV440P,
5555
YUVJ440P,
5656
YUVA420P,
57-
#[cfg(feature = "ff_api_vdpau")]
58-
VDPAU_H264,
59-
#[cfg(feature = "ff_api_vdpau")]
60-
VDPAU_MPEG1,
61-
#[cfg(feature = "ff_api_vdpau")]
62-
VDPAU_MPEG2,
63-
#[cfg(feature = "ff_api_vdpau")]
64-
VDPAU_WMV3,
65-
#[cfg(feature = "ff_api_vdpau")]
66-
VDPAU_VC1,
6757
RGB48BE,
6858
RGB48LE,
6959

@@ -92,8 +82,6 @@ pub enum Pixel {
9282
YUV422P16BE,
9383
YUV444P16LE,
9484
YUV444P16BE,
95-
#[cfg(feature = "ff_api_vdpau")]
96-
VDPAU_MPEG4,
9785
DXVA2_VLD,
9886

9987
RGB444LE,
@@ -513,16 +501,6 @@ impl From<AVPixelFormat> for Pixel {
513501
AV_PIX_FMT_YUV440P => Pixel::YUV440P,
514502
AV_PIX_FMT_YUVJ440P => Pixel::YUVJ440P,
515503
AV_PIX_FMT_YUVA420P => Pixel::YUVA420P,
516-
#[cfg(feature = "ff_api_vdpau")]
517-
AV_PIX_FMT_VDPAU_H264 => Pixel::VDPAU_H264,
518-
#[cfg(feature = "ff_api_vdpau")]
519-
AV_PIX_FMT_VDPAU_MPEG1 => Pixel::VDPAU_MPEG1,
520-
#[cfg(feature = "ff_api_vdpau")]
521-
AV_PIX_FMT_VDPAU_MPEG2 => Pixel::VDPAU_MPEG2,
522-
#[cfg(feature = "ff_api_vdpau")]
523-
AV_PIX_FMT_VDPAU_WMV3 => Pixel::VDPAU_WMV3,
524-
#[cfg(feature = "ff_api_vdpau")]
525-
AV_PIX_FMT_VDPAU_VC1 => Pixel::VDPAU_VC1,
526504
AV_PIX_FMT_RGB48BE => Pixel::RGB48BE,
527505
AV_PIX_FMT_RGB48LE => Pixel::RGB48LE,
528506

@@ -551,8 +529,6 @@ impl From<AVPixelFormat> for Pixel {
551529
AV_PIX_FMT_YUV422P16BE => Pixel::YUV422P16BE,
552530
AV_PIX_FMT_YUV444P16LE => Pixel::YUV444P16LE,
553531
AV_PIX_FMT_YUV444P16BE => Pixel::YUV444P16BE,
554-
#[cfg(feature = "ff_api_vdpau")]
555-
AV_PIX_FMT_VDPAU_MPEG4 => Pixel::VDPAU_MPEG4,
556532
AV_PIX_FMT_DXVA2_VLD => Pixel::DXVA2_VLD,
557533

558534
AV_PIX_FMT_RGB444LE => Pixel::RGB444LE,
@@ -865,16 +841,6 @@ impl From<Pixel> for AVPixelFormat {
865841
Pixel::YUV440P => AV_PIX_FMT_YUV440P,
866842
Pixel::YUVJ440P => AV_PIX_FMT_YUVJ440P,
867843
Pixel::YUVA420P => AV_PIX_FMT_YUVA420P,
868-
#[cfg(feature = "ff_api_vdpau")]
869-
Pixel::VDPAU_H264 => AV_PIX_FMT_VDPAU_H264,
870-
#[cfg(feature = "ff_api_vdpau")]
871-
Pixel::VDPAU_MPEG1 => AV_PIX_FMT_VDPAU_MPEG1,
872-
#[cfg(feature = "ff_api_vdpau")]
873-
Pixel::VDPAU_MPEG2 => AV_PIX_FMT_VDPAU_MPEG2,
874-
#[cfg(feature = "ff_api_vdpau")]
875-
Pixel::VDPAU_WMV3 => AV_PIX_FMT_VDPAU_WMV3,
876-
#[cfg(feature = "ff_api_vdpau")]
877-
Pixel::VDPAU_VC1 => AV_PIX_FMT_VDPAU_VC1,
878844
Pixel::RGB48BE => AV_PIX_FMT_RGB48BE,
879845
Pixel::RGB48LE => AV_PIX_FMT_RGB48LE,
880846

@@ -903,8 +869,6 @@ impl From<Pixel> for AVPixelFormat {
903869
Pixel::YUV422P16BE => AV_PIX_FMT_YUV422P16BE,
904870
Pixel::YUV444P16LE => AV_PIX_FMT_YUV444P16LE,
905871
Pixel::YUV444P16BE => AV_PIX_FMT_YUV444P16BE,
906-
#[cfg(feature = "ff_api_vdpau")]
907-
Pixel::VDPAU_MPEG4 => AV_PIX_FMT_VDPAU_MPEG4,
908872
Pixel::DXVA2_VLD => AV_PIX_FMT_DXVA2_VLD,
909873

910874
Pixel::RGB444LE => AV_PIX_FMT_RGB444LE,

0 commit comments

Comments
 (0)