pub struct Sink<'a> { /* private fields */ }
Implementations§
Source§impl<'a> Sink<'a>
impl<'a> Sink<'a>
Sourcepub fn frame(&mut self, frame: &mut Frame) -> Result<(), Error>
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 }
pub fn samples( &mut self, frame: &mut Frame, samples: usize, ) -> Result<(), Error>
Sourcepub fn set_frame_size(&mut self, value: u32)
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> 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
Mutably borrows from an owned value. Read more