pub struct Encoder { /* private fields */ }Expand description
Stateful encoder that accepts Images of any supported pixel format.
The codec is (re)created lazily whenever the input resolution changes.
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn new(settings: EncoderSettings) -> Result<Self>
pub fn new(settings: EncoderSettings) -> Result<Self>
Fails if settings.codec isn’t compiled into this build, or if settings.hardware is
Hardware::Require without the hw feature.
Sourcepub fn settings(&self) -> &EncoderSettings
pub fn settings(&self) -> &EncoderSettings
The settings this encoder was created with.
Sourcepub fn hardware_encoder(&self) -> Option<&'static str>
pub fn hardware_encoder(&self) -> Option<&'static str>
Name of the GStreamer element encoding on hardware, once the first frame picked one.
None while encoding in software.
Sourcepub fn set_bitrate(&mut self, bitrate: u32)
pub fn set_bitrate(&mut self, bitrate: u32)
Aim for bitrate bit/s from the next frame on.
VP8 and AV1 software encoders adjust in place. Other encoders (H.264, hardware) are recreated, so the next frame is a keyframe.
Sourcepub fn force_keyframe(&mut self)
pub fn force_keyframe(&mut self)
Request that the next frame is encoded as a keyframe.
Auto Trait Implementations§
impl !RefUnwindSafe for Encoder
impl !Sync for Encoder
impl !UnwindSafe for Encoder
impl Forget for Encoder
impl Freeze for Encoder
impl Move for Encoder
impl Send for Encoder
impl Unpin for Encoder
impl UnsafeUnpin for Encoder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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 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> ⓘ
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