Skip to content

Commit 118f7e7

Browse files
AdrianEddyzmwangx
authored andcommitted
FFmpeg 8.0 support
Closes #244. Signed-off-by: Zhiming Wang <i@zhimingwang.org>
1 parent a7b50dd commit 118f7e7

File tree

31 files changed

+502
-87
lines changed

31 files changed

+502
-87
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ jobs:
1111
container: jrottenberg/ffmpeg:${{ matrix.ffmpeg_version }}-ubuntu
1212
strategy:
1313
matrix:
14-
ffmpeg_version: ["3.4", "4.0", "4.1", "4.2", "4.3", "4.4", "5.0", "5.1", "6.0", "6.1", "7.0"]
14+
ffmpeg_version: ["3.4", "4.0", "4.1", "4.2", "4.3", "4.4", "5.0", "5.1", "6.0"]
1515
fail-fast: false
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: Install dependencies
1919
run: |
2020
apt update
21-
apt install -y --no-install-recommends clang curl pkg-config
21+
apt install -y --no-install-recommends clang curl pkg-config ca-certificates
2222
- name: Set up Rust
2323
uses: actions-rs/toolchain@v1
2424
with:
@@ -106,22 +106,24 @@ jobs:
106106
- name: Check format
107107
run: |
108108
cargo fmt -- --check
109-
# Added only because there is no ffmpeg7.1 docker image here yet
109+
# Added only because there is no ffmpeg8.0 docker image here yet
110110
# https://github.com/jrottenberg/ffmpeg
111-
build-test-lint-7-1:
112-
name: FFmpeg 7.1 - build, test and lint
111+
build-test-lint-8-0:
112+
name: FFmpeg${{ matrix.ffmpeg_version }} - build, test and lint
113113
runs-on: ubuntu-latest
114114
strategy:
115115
fail-fast: false
116+
matrix:
117+
ffmpeg_version: ["6.1", "7.0", "7.1", "8.0"]
116118
env:
117-
FFMPEG_DIR: /home/runner/work/rust-ffmpeg/rust-ffmpeg/ffmpeg-7.1-linux-clang-default
119+
FFMPEG_DIR: /home/runner/work/rust-ffmpeg/rust-ffmpeg/ffmpeg-${{ matrix.ffmpeg_version }}-linux-clang-default
118120
steps:
119121
- uses: actions/checkout@v2
120122
- name: Install dependencies
121123
run: |
122124
sudo apt update
123-
sudo apt install -y --no-install-recommends clang curl pkg-config xz-utils libxv-dev
124-
curl -L https://sourceforge.net/projects/avbuild/files/linux/ffmpeg-7.1-linux-clang-default.tar.xz/download -o ffmpeg.tar.xz
125+
sudo apt install -y --no-install-recommends clang curl pkg-config xz-utils libxv-dev libc++-dev
126+
curl -L https://sourceforge.net/projects/avbuild/files/linux/ffmpeg-${{ matrix.ffmpeg_version }}-linux-clang-default.tar.xz/download -o ffmpeg.tar.xz
125127
tar -xf ffmpeg.tar.xz
126128
- name: Set up Rust
127129
uses: actions-rs/toolchain@v1

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ffmpeg-next"
3-
version = "7.1.0"
3+
version = "8.0.0"
44
build = "build.rs"
55

66
authors = ["meh. <meh@schizofreni.co>", "Zhiming Wang <i@zhimingwang.org>"]
@@ -107,12 +107,12 @@ rpi = []
107107

108108
[dependencies]
109109
libc = "0.2"
110-
bitflags = "2.6"
110+
bitflags = "2.9"
111111

112112
[dependencies.image]
113113
version = "0.25"
114114
optional = true
115115

116116
[dependencies.ffmpeg-sys-next]
117-
version = "7.1.0"
117+
version = "8.0.0"
118118
default-features = false

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
This is a fork of the abandoned [ffmpeg](https://crates.io/crates/ffmpeg) crate by [meh.](https://github.com/meh/rust-ffmpeg).
66

77
This crate is currently in maintenance mode, and aims to be compatible with all of FFmpeg's versions from 3.4
8-
(currently from 3.4 til 7.0)
8+
(currently from 3.4 til 8.0)
99

1010
Build instructions can be found on the [wiki](https://github.com/zmwangx/rust-ffmpeg/wiki/Notes-on-building).
1111

src/codec/capabilities.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ bitflags! {
1212
const SMALL_LAST_FRAME = AV_CODEC_CAP_SMALL_LAST_FRAME;
1313
#[cfg(not(feature = "ffmpeg_4_0"))]
1414
const HWACCEL_VDPAU = AV_CODEC_CAP_HWACCEL_VDPAU;
15+
#[cfg(not(feature = "ffmpeg_8_0"))]
1516
const SUBFRAMES = AV_CODEC_CAP_SUBFRAMES;
1617
const EXPERIMENTAL = AV_CODEC_CAP_EXPERIMENTAL;
1718
const CHANNEL_CONF = AV_CODEC_CAP_CHANNEL_CONF;

src/codec/decoder/opened.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ impl Opened {
9595

9696
impl Drop for Opened {
9797
fn drop(&mut self) {
98+
#[cfg(not(feature = "ffmpeg_8_0"))]
9899
unsafe {
99100
avcodec_close(self.as_mut_ptr());
100101
}

src/codec/id.rs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,27 @@ pub enum Id {
670670
LC3,
671671
#[cfg(feature = "ffmpeg_7_1")]
672672
LCEVC,
673+
674+
#[cfg(feature = "ffmpeg_8_0")]
675+
JPEGXL_ANIM,
676+
#[cfg(feature = "ffmpeg_8_0")]
677+
PRORES_RAW,
678+
#[cfg(feature = "ffmpeg_8_0")]
679+
SMPTE_436M_ANC,
680+
#[cfg(feature = "ffmpeg_8_0")]
681+
DNXUC,
682+
#[cfg(feature = "ffmpeg_8_0")]
683+
RV60,
684+
#[cfg(feature = "ffmpeg_8_0")]
685+
APV,
686+
#[cfg(feature = "ffmpeg_8_0")]
687+
ADPCM_IMA_XBOX,
688+
#[cfg(feature = "ffmpeg_8_0")]
689+
ADPCM_SANYO,
690+
#[cfg(feature = "ffmpeg_8_0")]
691+
G728,
692+
#[cfg(feature = "ffmpeg_8_0")]
693+
IVTV_VBI,
673694
}
674695

675696
impl Id {
@@ -1347,6 +1368,27 @@ impl From<AVCodecID> for Id {
13471368
AV_CODEC_ID_LC3 => Id::LC3,
13481369
#[cfg(feature = "ffmpeg_7_1")]
13491370
AV_CODEC_ID_LCEVC => Id::LCEVC,
1371+
1372+
#[cfg(feature = "ffmpeg_8_0")]
1373+
AV_CODEC_ID_JPEGXL_ANIM => Id::JPEGXL_ANIM,
1374+
#[cfg(feature = "ffmpeg_8_0")]
1375+
AV_CODEC_ID_PRORES_RAW => Id::PRORES_RAW,
1376+
#[cfg(feature = "ffmpeg_8_0")]
1377+
AV_CODEC_ID_SMPTE_436M_ANC => Id::SMPTE_436M_ANC,
1378+
#[cfg(feature = "ffmpeg_8_0")]
1379+
AV_CODEC_ID_DNXUC => Id::DNXUC,
1380+
#[cfg(feature = "ffmpeg_8_0")]
1381+
AV_CODEC_ID_RV60 => Id::RV60,
1382+
#[cfg(feature = "ffmpeg_8_0")]
1383+
AV_CODEC_ID_APV => Id::APV,
1384+
#[cfg(feature = "ffmpeg_8_0")]
1385+
AV_CODEC_ID_ADPCM_IMA_XBOX => Id::ADPCM_IMA_XBOX,
1386+
#[cfg(feature = "ffmpeg_8_0")]
1387+
AV_CODEC_ID_ADPCM_SANYO => Id::ADPCM_SANYO,
1388+
#[cfg(feature = "ffmpeg_8_0")]
1389+
AV_CODEC_ID_G728 => Id::G728,
1390+
#[cfg(feature = "ffmpeg_8_0")]
1391+
AV_CODEC_ID_IVTV_VBI => Id::IVTV_VBI,
13501392
}
13511393
}
13521394
}
@@ -2016,6 +2058,27 @@ impl From<Id> for AVCodecID {
20162058
Id::LC3 => AV_CODEC_ID_LC3,
20172059
#[cfg(feature = "ffmpeg_7_1")]
20182060
Id::LCEVC => AV_CODEC_ID_LCEVC,
2061+
2062+
#[cfg(feature = "ffmpeg_8_0")]
2063+
Id::JPEGXL_ANIM => AV_CODEC_ID_JPEGXL_ANIM,
2064+
#[cfg(feature = "ffmpeg_8_0")]
2065+
Id::PRORES_RAW => AV_CODEC_ID_PRORES_RAW,
2066+
#[cfg(feature = "ffmpeg_8_0")]
2067+
Id::SMPTE_436M_ANC => AV_CODEC_ID_SMPTE_436M_ANC,
2068+
#[cfg(feature = "ffmpeg_8_0")]
2069+
Id::DNXUC => AV_CODEC_ID_DNXUC,
2070+
#[cfg(feature = "ffmpeg_8_0")]
2071+
Id::RV60 => AV_CODEC_ID_RV60,
2072+
#[cfg(feature = "ffmpeg_8_0")]
2073+
Id::APV => AV_CODEC_ID_APV,
2074+
#[cfg(feature = "ffmpeg_8_0")]
2075+
Id::ADPCM_IMA_XBOX => AV_CODEC_ID_ADPCM_IMA_XBOX,
2076+
#[cfg(feature = "ffmpeg_8_0")]
2077+
Id::ADPCM_SANYO => AV_CODEC_ID_ADPCM_SANYO,
2078+
#[cfg(feature = "ffmpeg_8_0")]
2079+
Id::G728 => AV_CODEC_ID_G728,
2080+
#[cfg(feature = "ffmpeg_8_0")]
2081+
Id::IVTV_VBI => AV_CODEC_ID_IVTV_VBI,
20192082
}
20202083
}
20212084
}

src/codec/packet/borrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct Borrow<'a> {
1111
}
1212

1313
impl<'a> Borrow<'a> {
14-
pub fn new(data: &[u8]) -> Borrow {
14+
pub fn new(data: &[u8]) -> Borrow<'_> {
1515
unsafe {
1616
let mut packet: AVPacket = mem::zeroed();
1717

src/codec/packet/packet.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Packet {
5454
}
5555

5656
#[inline]
57-
pub fn borrow(data: &[u8]) -> Borrow {
57+
pub fn borrow(data: &[u8]) -> Borrow<'_> {
5858
Borrow::new(data)
5959
}
6060

@@ -187,7 +187,7 @@ impl Packet {
187187
}
188188

189189
#[inline]
190-
pub fn side_data(&self) -> SideDataIter {
190+
pub fn side_data(&self) -> SideDataIter<'_> {
191191
SideDataIter::new(&self.0)
192192
}
193193

src/codec/packet/side_data.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ pub enum Type {
6868
FRAME_CROPPING,
6969
#[cfg(feature = "ffmpeg_7_1")]
7070
LCEVC,
71+
72+
#[cfg(feature = "ffmpeg_8_0")]
73+
THREE_D_REFERENCE_DISPLAYS,
74+
#[cfg(feature = "ffmpeg_8_0")]
75+
RTCP_SR,
7176
}
7277

7378
impl From<AVPacketSideDataType> for Type {
@@ -134,6 +139,11 @@ impl From<AVPacketSideDataType> for Type {
134139
AV_PKT_DATA_FRAME_CROPPING => Type::FRAME_CROPPING,
135140
#[cfg(feature = "ffmpeg_7_1")]
136141
AV_PKT_DATA_LCEVC => Type::LCEVC,
142+
143+
#[cfg(feature = "ffmpeg_8_0")]
144+
AV_PKT_DATA_3D_REFERENCE_DISPLAYS => Type::THREE_D_REFERENCE_DISPLAYS,
145+
#[cfg(feature = "ffmpeg_8_0")]
146+
AV_PKT_DATA_RTCP_SR => Type::RTCP_SR,
137147
}
138148
}
139149
}
@@ -202,6 +212,11 @@ impl From<Type> for AVPacketSideDataType {
202212
Type::FRAME_CROPPING => AV_PKT_DATA_FRAME_CROPPING,
203213
#[cfg(feature = "ffmpeg_7_1")]
204214
Type::LCEVC => AV_PKT_DATA_LCEVC,
215+
216+
#[cfg(feature = "ffmpeg_8_0")]
217+
Type::THREE_D_REFERENCE_DISPLAYS => AV_PKT_DATA_3D_REFERENCE_DISPLAYS,
218+
#[cfg(feature = "ffmpeg_8_0")]
219+
Type::RTCP_SR => AV_PKT_DATA_RTCP_SR,
205220
}
206221
}
207222
}

src/codec/subtitle/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ impl Subtitle {
8888
self.0.end_display_time = value;
8989
}
9090

91-
pub fn rects(&self) -> RectIter {
91+
pub fn rects(&self) -> RectIter<'_> {
9292
RectIter::new(&self.0)
9393
}
9494

95-
pub fn rects_mut(&mut self) -> RectMutIter {
95+
pub fn rects_mut(&mut self) -> RectMutIter<'_> {
9696
RectMutIter::new(&mut self.0)
9797
}
9898

99-
pub fn add_rect(&mut self, kind: Type) -> RectMut {
99+
pub fn add_rect(&mut self, kind: Type) -> RectMut<'_> {
100100
unsafe {
101101
self.0.num_rects += 1;
102102
self.0.rects = av_realloc(

0 commit comments

Comments
 (0)