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,
|
path: &P,
|
||||||
filter_spec: &str,
|
filter_spec: &str,
|
||||||
) -> Result<Transcoder, ffmpeg::Error> {
|
) -> Result<Transcoder, ffmpeg::Error> {
|
||||||
let input = ictx.streams()
|
let input = ictx
|
||||||
|
.streams()
|
||||||
.best(media::Type::Audio)
|
.best(media::Type::Audio)
|
||||||
.expect("could not find best audio stream");
|
.expect("could not find best audio stream");
|
||||||
let mut decoder = input.codec().decoder().audio()?;
|
let mut decoder = input.codec().decoder().audio()?;
|
||||||
let codec = ffmpeg::encoder::find(octx.format().codec(path, media::Type::Audio))
|
let codec = ffmpeg::encoder::find(octx.format().codec(path, media::Type::Audio))
|
||||||
.expect("failed to find encoder")
|
.expect("failed to find encoder")
|
||||||
.audio()?;
|
.audio()?;
|
||||||
let global = octx.format()
|
let global = octx
|
||||||
|
.format()
|
||||||
.flags()
|
.flags()
|
||||||
.contains(ffmpeg::format::flag::Flags::GLOBAL_HEADER);
|
.contains(ffmpeg::format::flag::Flags::GLOBAL_HEADER);
|
||||||
|
|
||||||
|
@ -422,7 +422,8 @@ impl Encoder {
|
|||||||
out: &mut P,
|
out: &mut P,
|
||||||
) -> Result<bool, Error> {
|
) -> Result<bool, Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
if self.format() != frame.format() || self.width() != frame.width()
|
if self.format() != frame.format()
|
||||||
|
|| self.width() != frame.width()
|
||||||
|| self.height() != frame.height()
|
|| self.height() != frame.height()
|
||||||
{
|
{
|
||||||
return Err(Error::InvalidData);
|
return Err(Error::InvalidData);
|
||||||
|
@ -147,9 +147,9 @@ impl<'a> Iterator for RectIter<'a> {
|
|||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
self.cur += 1;
|
self.cur += 1;
|
||||||
Some(Rect::wrap(*(*self.ptr)
|
Some(Rect::wrap(
|
||||||
.rects
|
*(*self.ptr).rects.offset((self.cur - 1) as isize),
|
||||||
.offset((self.cur - 1) as isize)))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,9 +191,9 @@ impl<'a> Iterator for RectMutIter<'a> {
|
|||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
self.cur += 1;
|
self.cur += 1;
|
||||||
Some(RectMut::wrap(*(*self.ptr)
|
Some(RectMut::wrap(
|
||||||
.rects
|
*(*self.ptr).rects.offset((self.cur - 1) as isize),
|
||||||
.offset((self.cur - 1) as isize)))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,9 +59,9 @@ impl<'a> Iterator for DeviceIter<'a> {
|
|||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
self.cur += 1;
|
self.cur += 1;
|
||||||
Some(device::Info::wrap(*(*self.ptr)
|
Some(device::Info::wrap(
|
||||||
.devices
|
*(*self.ptr).devices.offset((self.cur - 1) as isize),
|
||||||
.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> {
|
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
|
|| input.height() != self.input.height
|
||||||
{
|
{
|
||||||
return Err(Error::InputChanged);
|
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
|
|| output.height() != self.output.height
|
||||||
{
|
{
|
||||||
return Err(Error::OutputChanged);
|
return Err(Error::OutputChanged);
|
||||||
|
@ -31,7 +31,8 @@ impl Primaries {
|
|||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = av_color_primaries_name((*self).into());
|
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 {
|
unsafe {
|
||||||
let ptr = av_color_range_name((*self).into());
|
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 {
|
unsafe {
|
||||||
let ptr = av_color_space_name((*self).into());
|
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 {
|
unsafe {
|
||||||
let ptr = av_color_transfer_name((*self).into());
|
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]
|
#[inline]
|
||||||
pub fn channel_layout(&self) -> ChannelLayout {
|
pub fn channel_layout(&self) -> ChannelLayout {
|
||||||
unsafe {
|
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] {
|
unsafe impl Component for [u8; 4] {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn is_valid(format: format::Pixel) -> bool {
|
fn is_valid(format: format::Pixel) -> bool {
|
||||||
format == format::Pixel::RGBA || format == format::Pixel::BGRA
|
format == format::Pixel::RGBA
|
||||||
|| format == format::Pixel::ARGB || format == format::Pixel::ABGR
|
|| format == format::Pixel::BGRA
|
||||||
|| format == format::Pixel::RGBZ || format == format::Pixel::BGRZ
|
|| format == format::Pixel::ARGB
|
||||||
|| format == format::Pixel::ZRGB || format == format::Pixel::ZBGR
|
|| 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) {
|
unsafe impl Component for (u8, u8, u8, u8) {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn is_valid(format: format::Pixel) -> bool {
|
fn is_valid(format: format::Pixel) -> bool {
|
||||||
format == format::Pixel::RGBA || format == format::Pixel::BGRA
|
format == format::Pixel::RGBA
|
||||||
|| format == format::Pixel::ARGB || format == format::Pixel::ABGR
|
|| format == format::Pixel::BGRA
|
||||||
|| format == format::Pixel::RGBZ || format == format::Pixel::BGRZ
|
|| format == format::Pixel::ARGB
|
||||||
|| format == format::Pixel::ZRGB || format == format::Pixel::ZBGR
|
|| 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