pub struct VpxEncoder { /* private fields */ }Expand description
One libvpx session for one capture.
Implementations§
Source§impl VpxEncoder
impl VpxEncoder
Sourcepub fn new(
settings: &RustCaptureSettings,
codec: Codec,
rgba: bool,
) -> Result<Self, String>
pub fn new( settings: &RustCaptureSettings, codec: Codec, rgba: bool, ) -> Result<Self, String>
Open a VP8 or VP9 session on host frames in the byte order rgba names.
pub fn codec(&self) -> Codec
Sourcepub fn is_fullcolor(&self) -> bool
pub fn is_fullcolor(&self) -> bool
Whether the session carries 4:4:4 (VP9 profile 1, or 3 at 10 bits).
Sourcepub fn bit_depth(&self) -> u32
pub fn bit_depth(&self) -> u32
The bits per sample the session codes: 10 in VP9 profiles 2 and 3.
Sourcepub fn is_full_range(&self) -> bool
pub fn is_full_range(&self) -> bool
VP9 keeps the limited range of its 4:2:0 in profile 1, so the decoder hint a client sends for it stays true; VP8 has no other.
Sourcepub fn last_reference(&self) -> Reference
pub fn last_reference(&self) -> Reference
The frame the last encoded frame predicted from.
Sourcepub fn invalidate_reference(&mut self, frame_id: u16) -> bool
pub fn invalidate_reference(&mut self, frame_id: u16) -> bool
Leave frame frame_id and every frame after it out of the predictions; the next frame
predicts from an earlier buffer, or is a key frame when none is left.
Sourcepub fn acknowledge_reference(&mut self, frame_id: u16, held: bool)
pub fn acknowledge_reference(&mut self, frame_id: u16, held: bool)
Every consumer holds frame frame_id, or where not held was sent it
(ReferenceSlots::acknowledge).
Sourcepub fn last_quality(&self) -> Option<u32>
pub fn last_quality(&self) -> Option<u32>
The quality index the rate control last coded a frame at, held frames aside.
Sourcepub fn last_size(&self) -> Option<usize>
pub fn last_size(&self) -> Option<usize>
The bytes of the last frame the rate control coded, held frames aside, where a
constant-rate cleanup runs through that rate control (holds_quantizer).
Sourcepub fn holds_quantizer(&self) -> bool
pub fn holds_quantizer(&self) -> bool
Whether the cleanup of a still screen holds a frame at its quantizer: at a constant quantizer, and at a constant rate for VP8, whose rate control leaves a still screen as it is (a screen of text at 2 Mbit/s at 1080p stayed at 33.6 dB, where the held refresh reached 42.8). VP9’s refines one, so its constant-rate cleanup runs through the rate control instead: 43.6 dB in 2.5 s with no frame over 75 kB, where the held refresh was one of 347 kB.
Sourcepub fn hold_quantizer(&mut self, crf: u32, band: Option<(f64, f64)>)
pub fn hold_quantizer(&mut self, crf: u32, band: Option<(f64, f64)>)
Encode the next frame at the quantizer the quality index crf selects, whatever the rate
control, and put the session’s own rate control back for the frame after: the cleanup of a
still screen. A held key frame of a constant-rate session starts at the quantizer the
last one says fits HELD_KEY_BUDGET_S of the target (held_key_start), and one that
comes out past it is coded again, as a key frame, at the coarser quantizer
held_key_retry picks.
band, the share of the picture from and to in raster order, confines the quantizer to
the macroblocks it covers where the session holds a band (band_size), and the rest of
the frame is left as the reference has it.
Sourcepub fn band_size(&self) -> Option<usize>
pub fn band_size(&self) -> Option<usize>
The bytes of the last held frame (0 before one), where the session holds a band of a
frame at a quantizer: VP8, through libvpx’s region-of-interest map (band_roi), at a rate
that leaves a band room in a frame. A VP8 frame codes every macroblock’s mode even where
it skips them all, about a third of a bit each at 720p and 1080p, so below
BAND_BITS_PER_MB of frame budget a band a frame is mostly that and the sweep cannot keep
the rate: 1080p text at 0.25 Mbit/s (half a bit) ended at 29.5 dB in bands against 42.0
held whole, where 720p at 0.25 (1.2 bits) ended at 41.5 against 42.0 with the worst wait
at the target 5.0 s against 18.5. The refresh is held whole below it.
Sourcepub fn reconfigure_rate(
&mut self,
settings: &RustCaptureSettings,
) -> Result<(), String>
pub fn reconfigure_rate( &mut self, settings: &RustCaptureSettings, ) -> Result<(), String>
Re-program the rate control when a rate or frame-rate setting changed, live.
Trait Implementations§
Source§impl Drop for VpxEncoder
impl Drop for VpxEncoder
impl Send for VpxEncoder
Auto Trait Implementations§
impl !Sync for VpxEncoder
impl Freeze for VpxEncoder
impl RefUnwindSafe for VpxEncoder
impl Unpin for VpxEncoder
impl UnsafeUnpin for VpxEncoder
impl UnwindSafe for VpxEncoder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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