Support FFmpeg 7.0 (#48)

* sys: Run cargo fmt

* sys: Add new channel layout consts

* sys: Update build script for 7.0

- Add new FF_API flags
- Update version_check_info range
- Add ffmpeg_7_0 feature entry

* sys: Update non-exhaustive match statement

* Update enums

* Mark old APIs as removed with 7.0

* Make Audio frame work with 7.0

The .unwrap() in clone() is a bit wonky

* Add API for swr_alloc_set_opts2

* Use AVFrame::duration field in 7.0+

* Include 7.0 in CI runs

* Add fn ChanneLayoutIter::best

* Update examples for new API

* Add/update Context setter for ch layout
This commit is contained in:
FreezyLemon
2024-04-30 03:38:37 +02:00
committed by GitHub
parent 0107b62f56
commit fd2d71c92b
26 changed files with 419 additions and 43 deletions

View File

@ -2,9 +2,15 @@ use std::marker::PhantomData;
use super::{Sink, Source};
use crate::ffi::*;
use crate::{format, option, ChannelLayoutMask};
use crate::{format, option};
use libc::c_void;
#[cfg(feature = "ffmpeg_5_1")]
use crate::ChannelLayout;
#[cfg(not(feature = "ffmpeg_7_0"))]
use crate::ChannelLayoutMask;
pub struct Context<'a> {
ptr: *mut AVFilterContext,
@ -49,9 +55,15 @@ impl<'a> Context<'a> {
let _ = option::Settable::set(self, "sample_rates", &i64::from(value));
}
#[cfg(not(feature = "ffmpeg_7_0"))]
pub fn set_channel_layout(&mut self, value: ChannelLayoutMask) {
let _ = option::Settable::set(self, "channel_layouts", &value.bits());
}
#[cfg(feature = "ffmpeg_5_1")]
pub fn set_ch_layout(&mut self, value: ChannelLayout) {
let _ = option::Settable::set_str(self, "channel_layouts", &value.description());
}
}
unsafe impl<'a> option::Target for Context<'a> {