Struct ffmpeg::swscale::SwConverter
source · pub struct SwConverter {
sws_context: *mut SwsContext,
src_pix_format: c_int,
dst_pix_format: c_int,
}
Expand description
A struct able to copy a decoded AvFrame
into an OutputBuffer
’s memory, converting the pixel
format if needed.
Fields§
§sws_context: *mut SwsContext
§src_pix_format: c_int
§dst_pix_format: c_int
Implementations§
source§impl SwConverter
impl SwConverter
sourcepub fn new(
width: usize,
height: usize,
src_pix_format: c_int,
dst_pix_format: c_int
) -> Result<Self>
pub fn new( width: usize, height: usize, src_pix_format: c_int, dst_pix_format: c_int ) -> Result<Self>
Create a new format converter that will convert frames from src_format
to dst_format
.
width
and height
are the coded size of the frames to be converted. The source and target
must have the same size in pixels.
sourcepub fn convert(
&mut self,
src: &AvFrame,
dst: &mut AvFrame
) -> Result<(), ConversionError>
pub fn convert( &mut self, src: &AvFrame, dst: &mut AvFrame ) -> Result<(), ConversionError>
Copy src
into dst
while converting its pixel format according to the parameters the
frame converter was created with.
dst
must be a writable frame with the same dimensions as src
and the same format as
dst_pix_format
passed to the constructor.
Note that empty dst
is not currently allowed as this function does not handle allocation.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SwConverter
impl !Send for SwConverter
impl !Sync for SwConverter
impl Unpin for SwConverter
impl UnwindSafe for SwConverter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more