Struct Parser

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

Implementations§

Source§

impl<'a> Parser<'a>

Source

pub fn new(graph: &mut Graph) -> Parser<'_>

Source

pub fn input(self, name: &str, pad: usize) -> Result<Self, Error>

Examples found in repository?
examples/transcode-audio.rs (line 34)
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}
Source

pub fn output(self, name: &str, pad: usize) -> Result<Self, Error>

Source

pub fn parse(self, spec: &str) -> Result<(), Error>

Examples found in repository?
examples/transcode-audio.rs (line 34)
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 Parser<'a>

§

impl<'a> RefUnwindSafe for Parser<'a>

§

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

§

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

§

impl<'a> Unpin for Parser<'a>

§

impl<'a> !UnwindSafe for Parser<'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.