Struct Sink

Source
pub struct Sink<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Sink<'a>

Source

pub unsafe fn wrap<'b>(ctx: &'b mut Context<'b>) -> Sink<'b>

Source§

impl<'a> Sink<'a>

Source

pub fn frame(&mut self, frame: &mut Frame) -> Result<(), Error>

Examples found in repository?
examples/transcode-audio.rs (line 166)
159    fn get_and_process_filtered_frames(&mut self, octx: &mut format::context::Output) {
160        let mut filtered = frame::Audio::empty();
161        while self
162            .filter
163            .get("out")
164            .unwrap()
165            .sink()
166            .frame(&mut filtered)
167            .is_ok()
168        {
169            self.send_frame_to_encoder(&filtered);
170            self.receive_and_process_encoded_packets(octx);
171        }
172    }
Source

pub fn samples( &mut self, frame: &mut Frame, samples: usize, ) -> Result<(), Error>

Source

pub fn set_frame_size(&mut self, value: u32)

Examples found in repository?
examples/transcode-audio.rs (line 48)
8fn filter(
9    spec: &str,
10    decoder: &codec::decoder::Audio,
11    encoder: &codec::encoder::Audio,
12) -> Result<filter::Graph, ffmpeg_rs::Error> {
13    let mut filter = filter::Graph::new();
14
15    let args = format!(
16        "time_base={}:sample_rate={}:sample_fmt={}:channel_layout=0x{:x}",
17        decoder.time_base(),
18        decoder.rate(),
19        decoder.format().name(),
20        decoder.channel_layout().bits()
21    );
22
23    filter.add(&filter::find("abuffer").unwrap(), "in", &args)?;
24    filter.add(&filter::find("abuffersink").unwrap(), "out", "")?;
25
26    {
27        let mut out = filter.get("out").unwrap();
28
29        out.set_sample_format(encoder.format());
30        out.set_channel_layout(encoder.channel_layout());
31        out.set_sample_rate(encoder.rate());
32    }
33
34    filter.output("in", 0)?.input("out", 0)?.parse(spec)?;
35    filter.validate()?;
36
37    println!("{}", filter.dump());
38
39    if let Some(codec) = encoder.codec() {
40        if !codec
41            .capabilities()
42            .contains(ffmpeg_rs::codec::capabilities::Capabilities::VARIABLE_FRAME_SIZE)
43        {
44            filter
45                .get("out")
46                .unwrap()
47                .sink()
48                .set_frame_size(encoder.frame_size());
49        }
50    }
51
52    Ok(filter)
53}

Auto Trait Implementations§

§

impl<'a> Freeze for Sink<'a>

§

impl<'a> RefUnwindSafe for Sink<'a>

§

impl<'a> !Send for Sink<'a>

§

impl<'a> !Sync for Sink<'a>

§

impl<'a> Unpin for Sink<'a>

§

impl<'a> !UnwindSafe for Sink<'a>

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.