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: AVPixelFormatAVCodecContext::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: YuvMatrixThe matrix the frames are converted to YUV with. The encoder tags the stream with it.
Implementations§
Source§impl EncoderInput
impl EncoderInput
Sourcepub fn software(pixel_format: AVPixelFormat) -> Self
pub fn software(pixel_format: AVPixelFormat) -> Self
Frames with pixels in memory, converted with BT.601.
Sourcepub fn for_options(options: &EncoderOptions<'_>) -> Self
pub fn for_options(options: &EncoderOptions<'_>) -> Self
Frames with pixels in memory in the pixel format and color matrix of options.
Sourcepub fn with_color_matrix(self, color_matrix: YuvMatrix) -> Self
pub fn with_color_matrix(self, color_matrix: YuvMatrix) -> Self
The same frames converted with color_matrix.
Sourcepub fn requested(encoder: &VideoEncoderInfo<'_>) -> RenderEncodingResult<Self>
pub fn requested(encoder: &VideoEncoderInfo<'_>) -> RenderEncodingResult<Self>
The pixel format the user requested, as long as the encoder takes it.
Sourcepub fn hardware_frames(
device: &AvBuffer,
format: AVPixelFormat,
sw_format: AVPixelFormat,
(width, height): (i32, i32),
configure: impl FnOnce(&mut AVHWFramesContext),
) -> RenderEncodingResult<Self>
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).
pub fn is_hardware(&self) -> bool
Sourcepub fn software_format(&self) -> AVPixelFormat
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
impl Clone for EncoderInput
Auto Trait Implementations§
impl Freeze for EncoderInput
impl RefUnwindSafe for EncoderInput
impl Send for EncoderInput
impl Sync for EncoderInput
impl Unpin for EncoderInput
impl UnsafeUnpin for EncoderInput
impl UnwindSafe for EncoderInput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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