Bump version to use ffmpeg 5

This commit is contained in:
Polochon-street
2022-01-24 21:03:47 +01:00
parent 5ed41c84ff
commit 22ad8b9598
43 changed files with 310 additions and 102 deletions

View File

@ -142,7 +142,9 @@ impl Context {
input: &frame::Audio,
output: &mut frame::Audio,
) -> Result<Option<Delay>, Error> {
output.set_rate(self.output.rate);
unsafe {
(*output.as_mut_ptr()).sample_rate = self.output.rate as i32;
}
unsafe {
if output.is_empty() {
@ -165,7 +167,9 @@ impl Context {
///
/// When there are no more internal frames `Ok(None)` will be returned.
pub fn flush(&mut self, output: &mut frame::Audio) -> Result<Option<Delay>, Error> {
output.set_rate(self.output.rate);
unsafe {
(*output.as_mut_ptr()).sample_rate = self.output.rate as i32;
}
unsafe {
match swr_convert_frame(self.as_mut_ptr(), output.as_mut_ptr(), ptr::null()) {

View File

@ -13,7 +13,7 @@ impl frame::Audio {
Context::get(
self.format(),
self.channel_layout(),
self.rate(),
unsafe { (*self.as_ptr()).sample_rate as u32 },
format,
channel_layout,
rate,

View File

@ -1,7 +1,10 @@
use super::{Context, Flags};
use util::format;
use {decoder, frame, Error, Picture};
#[cfg(not(feature = "ffmpeg_5_0"))]
use Picture;
use {decoder, frame, Error};
#[cfg(not(feature = "ffmpeg_5_0"))]
impl<'a> Picture<'a> {
#[inline]
pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> {

View File

@ -50,6 +50,7 @@ impl<'a> Vector<'a> {
}
}
#[cfg(not(feature = "ffmpeg_5_0"))]
pub fn value(value: f64, length: usize) -> Self {
unsafe {
Vector {
@ -60,6 +61,7 @@ impl<'a> Vector<'a> {
}
}
#[cfg(not(feature = "ffmpeg_5_0"))]
pub fn identity() -> Self {
unsafe {
Vector {
@ -82,24 +84,28 @@ impl<'a> Vector<'a> {
}
}
#[cfg(not(feature = "ffmpeg_5_0"))]
pub fn conv(&mut self, other: &Vector) {
unsafe {
sws_convVec(self.as_mut_ptr(), other.as_ptr() as *mut _);
}
}
#[cfg(not(feature = "ffmpeg_5_0"))]
pub fn add(&mut self, other: &Vector) {
unsafe {
sws_addVec(self.as_mut_ptr(), other.as_ptr() as *mut _);
}
}
#[cfg(not(feature = "ffmpeg_5_0"))]
pub fn sub(&mut self, other: &Vector) {
unsafe {
sws_subVec(self.as_mut_ptr(), other.as_ptr() as *mut _);
}
}
#[cfg(not(feature = "ffmpeg_5_0"))]
pub fn shift(&mut self, value: usize) {
unsafe {
sws_shiftVec(self.as_mut_ptr(), value as c_int);
@ -117,6 +123,7 @@ impl<'a> Vector<'a> {
}
}
#[cfg(not(feature = "ffmpeg_5_0"))]
impl<'a> Clone for Vector<'a> {
fn clone(&self) -> Self {
unsafe {