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

source

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.

source

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§

source§

impl Drop for SwConverter

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.