pub struct NativeAvEncodeSink { /* private fields */ }Expand description
Audio/video sink that encodes and interleaves through the linked FFmpeg libraries.
Video frames and audio blocks must arrive in nondecreasing start-time order; ready packets are muxed incrementally.
Implementations§
Source§impl NativeAvEncodeSink
impl NativeAvEncodeSink
Sourcepub fn create(
path: impl Into<OutputTarget>,
config: AvEncodeConfig,
) -> Result<Self, EncodeError>
pub fn create( path: impl Into<OutputTarget>, config: AvEncodeConfig, ) -> Result<Self, EncodeError>
Creates linked-library video, audio, and container encoders without touching the destination.
§Errors
Returns an encoder error for invalid configuration, paths, or stale component outputs.
Sourcepub fn create_with_video_encoder(
path: impl Into<OutputTarget>,
config: AvEncodeConfig,
encoder_name: &str,
) -> Result<Self, EncodeError>
pub fn create_with_video_encoder( path: impl Into<OutputTarget>, config: AvEncodeConfig, encoder_name: &str, ) -> Result<Self, EncodeError>
Creates the requested concrete video encoder by its FFmpeg short name.
§Errors
Returns an encoder error when the name is unavailable, implements a different codec, or the remaining configuration is invalid.
Sourcepub fn create_with_video_encoder_threads(
path: impl Into<OutputTarget>,
config: AvEncodeConfig,
encoder_name: Option<&str>,
software_threads: &dyn Fn(Option<usize>) -> i64,
) -> Result<Self, EncodeError>
pub fn create_with_video_encoder_threads( path: impl Into<OutputTarget>, config: AvEncodeConfig, encoder_name: Option<&str>, software_threads: &dyn Fn(Option<usize>) -> i64, ) -> Result<Self, EncodeError>
Creates an encoder whose software thread count the caller decides.
software_threads is asked at most once, only when a CPU candidate opens, so a hardware
candidate that falls through to software still gets a software share of the CPU.
encoder_name pins one encoder; None tries the codec’s candidates in preference order.
§Errors
Returns an encoder error when no candidate opens, or for invalid configuration, paths, codecs, or muxers.
Sourcepub fn stage_timings(&self) -> EncodeStageTimings
pub fn stage_timings(&self) -> EncodeStageTimings
Where this sink’s time has gone so far, both threads together.
Sourcepub fn video_selection(&self) -> &NativeVideoEncoderSelection
pub fn video_selection(&self) -> &NativeVideoEncoderSelection
The video encoder this sink opened, and the candidates it passed over.
Sourcepub fn publish_report(&self) -> Option<PublishReport>
pub fn publish_report(&self) -> Option<PublishReport>
How the finished file was published; None until it is.
Sourcepub fn write_prepared_video(
&mut self,
frame: &mut Yuv420pFrameBuffer,
pts: MediaTime,
) -> Result<(), EncodeError>
pub fn write_prepared_video( &mut self, frame: &mut Yuv420pFrameBuffer, pts: MediaTime, ) -> Result<(), EncodeError>
Encodes a frame the caller already packed, without copying it (see
crate::NativeVideoEncodeSink::write_prepared_video).
§Errors
Returns an error for a frame sized differently from this encoder, a non-monotonic timestamp, or a codec failure.
Trait Implementations§
Source§impl Drop for NativeAvEncodeSink
impl Drop for NativeAvEncodeSink
Source§impl EncodeSink for NativeAvEncodeSink
impl EncodeSink for NativeAvEncodeSink
Source§fn write(
&mut self,
event: EncodeEvent,
cancel: &CancelToken,
) -> Result<(), EncodeError>
fn write( &mut self, event: EncodeEvent, cancel: &CancelToken, ) -> Result<(), EncodeError>
Source§fn finish(&mut self, cancel: &CancelToken) -> Result<(), EncodeError>
fn finish(&mut self, cancel: &CancelToken) -> Result<(), EncodeError>
Auto Trait Implementations§
impl !RefUnwindSafe for NativeAvEncodeSink
impl !Sync for NativeAvEncodeSink
impl !UnwindSafe for NativeAvEncodeSink
impl Freeze for NativeAvEncodeSink
impl Send for NativeAvEncodeSink
impl Unpin for NativeAvEncodeSink
impl UnsafeUnpin for NativeAvEncodeSink
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
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