Reformat code with latest cargo fmt
This commit is contained in:
parent
fdea9d77e7
commit
307f52c002
@ -66,14 +66,16 @@ fn transcoder<P: AsRef<Path>>(
|
||||
path: &P,
|
||||
filter_spec: &str,
|
||||
) -> Result<Transcoder, ffmpeg::Error> {
|
||||
let input = ictx.streams()
|
||||
let input = ictx
|
||||
.streams()
|
||||
.best(media::Type::Audio)
|
||||
.expect("could not find best audio stream");
|
||||
let mut decoder = input.codec().decoder().audio()?;
|
||||
let codec = ffmpeg::encoder::find(octx.format().codec(path, media::Type::Audio))
|
||||
.expect("failed to find encoder")
|
||||
.audio()?;
|
||||
let global = octx.format()
|
||||
let global = octx
|
||||
.format()
|
||||
.flags()
|
||||
.contains(ffmpeg::format::flag::Flags::GLOBAL_HEADER);
|
||||
|
||||
|
@ -422,7 +422,8 @@ impl Encoder {
|
||||
out: &mut P,
|
||||
) -> Result<bool, Error> {
|
||||
unsafe {
|
||||
if self.format() != frame.format() || self.width() != frame.width()
|
||||
if self.format() != frame.format()
|
||||
|| self.width() != frame.width()
|
||||
|| self.height() != frame.height()
|
||||
{
|
||||
return Err(Error::InvalidData);
|
||||
|
@ -147,9 +147,9 @@ impl<'a> Iterator for RectIter<'a> {
|
||||
None
|
||||
} else {
|
||||
self.cur += 1;
|
||||
Some(Rect::wrap(*(*self.ptr)
|
||||
.rects
|
||||
.offset((self.cur - 1) as isize)))
|
||||
Some(Rect::wrap(
|
||||
*(*self.ptr).rects.offset((self.cur - 1) as isize),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,9 +191,9 @@ impl<'a> Iterator for RectMutIter<'a> {
|
||||
None
|
||||
} else {
|
||||
self.cur += 1;
|
||||
Some(RectMut::wrap(*(*self.ptr)
|
||||
.rects
|
||||
.offset((self.cur - 1) as isize)))
|
||||
Some(RectMut::wrap(
|
||||
*(*self.ptr).rects.offset((self.cur - 1) as isize),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,9 +59,9 @@ impl<'a> Iterator for DeviceIter<'a> {
|
||||
None
|
||||
} else {
|
||||
self.cur += 1;
|
||||
Some(device::Info::wrap(*(*self.ptr)
|
||||
.devices
|
||||
.offset((self.cur - 1) as isize)))
|
||||
Some(device::Info::wrap(
|
||||
*(*self.ptr).devices.offset((self.cur - 1) as isize),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,8 @@ impl Context {
|
||||
}
|
||||
|
||||
pub fn run(&mut self, input: &frame::Video, output: &mut frame::Video) -> Result<(), Error> {
|
||||
if input.format() != self.input.format || input.width() != self.input.width
|
||||
if input.format() != self.input.format
|
||||
|| input.width() != self.input.width
|
||||
|| input.height() != self.input.height
|
||||
{
|
||||
return Err(Error::InputChanged);
|
||||
@ -140,7 +141,8 @@ impl Context {
|
||||
}
|
||||
}
|
||||
|
||||
if output.format() != self.output.format || output.width() != self.output.width
|
||||
if output.format() != self.output.format
|
||||
|| output.width() != self.output.width
|
||||
|| output.height() != self.output.height
|
||||
{
|
||||
return Err(Error::OutputChanged);
|
||||
|
@ -31,7 +31,8 @@ impl Primaries {
|
||||
}
|
||||
unsafe {
|
||||
let ptr = av_color_primaries_name((*self).into());
|
||||
ptr.as_ref().map(|ptr| from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()))
|
||||
ptr.as_ref()
|
||||
.map(|ptr| from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ impl Range {
|
||||
}
|
||||
unsafe {
|
||||
let ptr = av_color_range_name((*self).into());
|
||||
ptr.as_ref().map(|ptr| from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()))
|
||||
ptr.as_ref()
|
||||
.map(|ptr| from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,8 @@ impl Space {
|
||||
}
|
||||
unsafe {
|
||||
let ptr = av_color_space_name((*self).into());
|
||||
ptr.as_ref().map(|ptr| from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()))
|
||||
ptr.as_ref()
|
||||
.map(|ptr| from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ impl TransferCharacteristic {
|
||||
}
|
||||
unsafe {
|
||||
let ptr = av_color_transfer_name((*self).into());
|
||||
ptr.as_ref().map(|ptr| from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()))
|
||||
ptr.as_ref()
|
||||
.map(|ptr| from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,9 @@ impl Audio {
|
||||
#[inline]
|
||||
pub fn channel_layout(&self) -> ChannelLayout {
|
||||
unsafe {
|
||||
ChannelLayout::from_bits_truncate(av_frame_get_channel_layout(self.as_ptr()) as c_ulonglong)
|
||||
ChannelLayout::from_bits_truncate(
|
||||
av_frame_get_channel_layout(self.as_ptr()) as c_ulonglong
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -399,19 +399,27 @@ unsafe impl Component for (u8, u8, u8) {
|
||||
unsafe impl Component for [u8; 4] {
|
||||
#[inline(always)]
|
||||
fn is_valid(format: format::Pixel) -> bool {
|
||||
format == format::Pixel::RGBA || format == format::Pixel::BGRA
|
||||
|| format == format::Pixel::ARGB || format == format::Pixel::ABGR
|
||||
|| format == format::Pixel::RGBZ || format == format::Pixel::BGRZ
|
||||
|| format == format::Pixel::ZRGB || format == format::Pixel::ZBGR
|
||||
format == format::Pixel::RGBA
|
||||
|| format == format::Pixel::BGRA
|
||||
|| format == format::Pixel::ARGB
|
||||
|| format == format::Pixel::ABGR
|
||||
|| format == format::Pixel::RGBZ
|
||||
|| format == format::Pixel::BGRZ
|
||||
|| format == format::Pixel::ZRGB
|
||||
|| format == format::Pixel::ZBGR
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Component for (u8, u8, u8, u8) {
|
||||
#[inline(always)]
|
||||
fn is_valid(format: format::Pixel) -> bool {
|
||||
format == format::Pixel::RGBA || format == format::Pixel::BGRA
|
||||
|| format == format::Pixel::ARGB || format == format::Pixel::ABGR
|
||||
|| format == format::Pixel::RGBZ || format == format::Pixel::BGRZ
|
||||
|| format == format::Pixel::ZRGB || format == format::Pixel::ZBGR
|
||||
format == format::Pixel::RGBA
|
||||
|| format == format::Pixel::BGRA
|
||||
|| format == format::Pixel::ARGB
|
||||
|| format == format::Pixel::ABGR
|
||||
|| format == format::Pixel::RGBZ
|
||||
|| format == format::Pixel::BGRZ
|
||||
|| format == format::Pixel::ZRGB
|
||||
|| format == format::Pixel::ZBGR
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user