Skip to main content

NativeAvEncodeSink

Struct NativeAvEncodeSink 

Source
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

Source

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.

Source

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.

Source

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.

Source

pub fn stage_timings(&self) -> EncodeStageTimings

Where this sink’s time has gone so far, both threads together.

Source

pub fn video_selection(&self) -> &NativeVideoEncoderSelection

The video encoder this sink opened, and the candidates it passed over.

Source

pub fn publish_report(&self) -> Option<PublishReport>

How the finished file was published; None until it is.

Source

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

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl EncodeSink for NativeAvEncodeSink

Source§

fn write( &mut self, event: EncodeEvent, cancel: &CancelToken, ) -> Result<(), EncodeError>

Queues one timestamped media item. Read more
Source§

fn finish(&mut self, cancel: &CancelToken) -> Result<(), EncodeError>

Drains encoder delay, interleaves remaining packets, and writes the trailer. Read more
Source§

fn abort(&mut self) -> Result<(), EncodeError>

Aborts and applies the adapter’s partial-output cleanup policy. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for NativeAvEncodeSink

§

impl !Sync for NativeAvEncodeSink

§

impl !UnwindSafe for NativeAvEncodeSink

§

impl Forget for NativeAvEncodeSink

§

impl Freeze for NativeAvEncodeSink
where *const AVFormatContext is !null: Freeze, *const AVIOContext is !null: Freeze, *const Opaque is !null: Freeze, PhantomData<Opaque>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, I32NotAllOnes: Freeze, *const AVCodecContext is !null: Freeze, *const OpenH264Encoder is !null: Freeze, PhantomData<OpenH264Encoder>: Freeze, *const AVBSFContext is !null: Freeze, PhantomData<AVPacket>: Freeze, *const SwsContext is !null: Freeze, *const AVFrame is !null: Freeze, *mut Counter<Channel<AudioCommand>>: Freeze, *mut Counter<Channel<AudioCommand>>: Freeze, *mut Counter<Channel<AudioCommand>>: Freeze, *const ArcInner<Inner> is !null: Freeze, PhantomData<ArcInner<Inner>>: Freeze, *const ArcInner<Packet<'static, ()>> is !null: Freeze, PhantomData<ArcInner<Packet<'static, ()>>>: Freeze, *const ArcInner<Mutex<AudioQueueState>> is !null: Freeze, PhantomData<ArcInner<Mutex<AudioQueueState>>>: Freeze, PhantomData<Segment>: Freeze, PhantomData<VecDeque<f32>>: Freeze, PhantomData<QueuedPacket>: Freeze, PhantomData<NativeVideoEncoderFallback>: Freeze,

§

impl Move for NativeAvEncodeSink

§

impl Send for NativeAvEncodeSink
where AVFormatContextOutput: Send, RawVecInner: Send, I32NotAllOnes: Send, AVCodecContext: Send, BoxRaw<OpenH264Encoder>: Send, AVBSFContextUninit: Send, AVPacket: Send, SwsContext: Send, AVFrame: Send, SyncSender<AudioCommand>: Send, JoinHandle<()>: Send, Arc<Mutex<AudioQueueState>>: Send,

§

impl Unpin for NativeAvEncodeSink
where *const AVFormatContext is !null: Unpin, *const AVIOContext is !null: Unpin, Box<Opaque>: Unpin, *const u8 is !null: Unpin, I32NotAllOnes: Unpin, *const AVCodecContext is !null: Unpin, Box<OpenH264Encoder>: Unpin, *const AVBSFContext is !null: Unpin, *const AVPacket is !null: Unpin, *const SwsContext is !null: Unpin, *const AVFrame is !null: Unpin, *mut Counter<Channel<AudioCommand>>: Unpin, *mut Counter<Channel<AudioCommand>>: Unpin, *mut Counter<Channel<AudioCommand>>: Unpin, Arc<Inner, System>: Unpin, Arc<Packet<'static, ()>>: Unpin, Arc<Mutex<AudioQueueState>>: Unpin,

§

impl UnsafeUnpin for NativeAvEncodeSink
where *const AVFormatContext is !null: UnsafeUnpin, *const AVIOContext is !null: UnsafeUnpin, *const Opaque is !null: UnsafeUnpin, PhantomData<Opaque>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, I32NotAllOnes: UnsafeUnpin, *const AVCodecContext is !null: UnsafeUnpin, *const OpenH264Encoder is !null: UnsafeUnpin, PhantomData<OpenH264Encoder>: UnsafeUnpin, *const AVBSFContext is !null: UnsafeUnpin, PhantomData<AVPacket>: UnsafeUnpin, *const SwsContext is !null: UnsafeUnpin, *const AVFrame is !null: UnsafeUnpin, *mut Counter<Channel<AudioCommand>>: UnsafeUnpin, *mut Counter<Channel<AudioCommand>>: UnsafeUnpin, *mut Counter<Channel<AudioCommand>>: UnsafeUnpin, *const ArcInner<Inner> is !null: UnsafeUnpin, PhantomData<ArcInner<Inner>>: UnsafeUnpin, *const ArcInner<Packet<'static, ()>> is !null: UnsafeUnpin, PhantomData<ArcInner<Packet<'static, ()>>>: UnsafeUnpin, *const ArcInner<Mutex<AudioQueueState>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<AudioQueueState>>>: UnsafeUnpin, PhantomData<Segment>: UnsafeUnpin, PhantomData<VecDeque<f32>>: UnsafeUnpin, PhantomData<QueuedPacket>: UnsafeUnpin, PhantomData<NativeVideoEncoderFallback>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,