Context

Struct Context 

Source
pub struct Context<M: Muxer + Send, W: Write> {
    pub user_private: Option<Box<dyn Any + Send + Sync>>,
    /* private fields */
}
Expand description

Auxiliary structure to encapsulate a muxer object and its additional data.

Fields§

§user_private: Option<Box<dyn Any + Send + Sync>>

User private data.

This data cannot be cloned.

Implementations§

Source§

impl<M: Muxer, W: Write> Context<M, W>

Source

pub fn new(muxer: M, writer: Writer<W>) -> Self

Creates a new Context instance.

Source

pub fn configure(&mut self) -> Result<()>

Configures a muxer.

Source

pub fn write_header(&mut self) -> Result<()>

Writes a stream header to an internal buffer and returns how many bytes were written or an error.

Source

pub fn write_packet(&mut self, pkt: Arc<Packet>) -> Result<()>

Writes a stream packet to an internal buffer and returns how many bytes were written or an error.

Source

pub fn write_trailer(&mut self) -> Result<()>

Writes a stream trailer to an internal buffer and returns how many bytes were written or an error.

Source

pub fn set_global_info(&mut self, info: GlobalInfo) -> Result<()>

Sets global media file information for a muxer.

Source

pub fn set_option<'a, V>(&mut self, key: &str, val: V) -> Result<()>
where V: Into<Value<'a>>,

Sets a muxer option.

This method should be called as many times as the number of options present in a muxer.

Source

pub fn writer(&self) -> &Writer<W>

Returns the underlying writer.

Source

pub fn into_writer(self) -> Writer<W>

Consumes this muxer and returns the underlying writer.

Auto Trait Implementations§

§

impl<M, W> Freeze for Context<M, W>
where M: Freeze, W: Freeze,

§

impl<M, W> !RefUnwindSafe for Context<M, W>

§

impl<M, W> Send for Context<M, W>
where W: Send,

§

impl<M, W> Sync for Context<M, W>
where M: Sync, W: Sync,

§

impl<M, W> Unpin for Context<M, W>
where M: Unpin, W: Unpin,

§

impl<M, W> !UnwindSafe for Context<M, W>

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.