Skip to main content

EncoderInput

Struct EncoderInput 

Source
pub struct EncoderInput {
    pub pixel_format: AVPixelFormat,
    pub hw_frames_ctx: Option<AvBuffer>,
    pub hw_device_ctx: Option<AvBuffer>,
    pub color_matrix: YuvMatrix,
}
Expand description

What the video encoders of a render are opened with, the outcome of FFramesRenderBackend::negotiate_encoder_input. Every VideoFrame submitted to the render has to match it.

Fields§

§pixel_format: AVPixelFormat

AVCodecContext::pix_fmt: a software format, or a hardware one together with hw_frames_ctx.

§hw_frames_ctx: Option<AvBuffer>

The pool the hardware frames come from (AVCodecContext::hw_frames_ctx).

§hw_device_ctx: Option<AvBuffer>

AVCodecContext::hw_device_ctx for encoders that want the device only.

§color_matrix: YuvMatrix

The matrix the frames are converted to YUV with. The encoder tags the stream with it.

Implementations§

Source§

impl EncoderInput

Source

pub fn software(pixel_format: AVPixelFormat) -> Self

Frames with pixels in memory, converted with BT.601.

Source

pub fn for_options(options: &EncoderOptions<'_>) -> Self

Frames with pixels in memory in the pixel format and color matrix of options.

Source

pub fn with_color_matrix(self, color_matrix: YuvMatrix) -> Self

The same frames converted with color_matrix.

Source

pub fn requested(encoder: &VideoEncoderInfo<'_>) -> RenderEncodingResult<Self>

The pixel format the user requested, as long as the encoder takes it.

Source

pub fn hardware_frames( device: &AvBuffer, format: AVPixelFormat, sw_format: AVPixelFormat, (width, height): (i32, i32), configure: impl FnOnce(&mut AVHWFramesContext), ) -> RenderEncodingResult<Self>

Hardware frames of format holding sw_format pixels, allocated by libav on device (see hardware_device). Get the frames with VideoFrame::from_hw_frames. They are converted with BT.601 unless Self::with_color_matrix says otherwise.

configure runs before the pool is initialized and may adjust the API specific context (AVHWFramesContext::hwctx).

Source

pub fn is_hardware(&self) -> bool

Source

pub fn software_format(&self) -> AVPixelFormat

The format of the pixels: pixel_format itself, or what the hardware frames hold.

Trait Implementations§

Source§

impl Clone for EncoderInput

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EncoderInput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.