pub struct Audio(/* private fields */);
Implementations§
Source§impl Audio
impl Audio
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Examples found in repository?
examples/transcode-audio.rs (line 160)
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 }
173
174 fn send_packet_to_decoder(&mut self, packet: &ffmpeg_rs::Packet) {
175 self.decoder.send_packet(packet).unwrap();
176 }
177
178 fn send_eof_to_decoder(&mut self) {
179 self.decoder.send_eof().unwrap();
180 }
181
182 fn receive_and_process_decoded_frames(&mut self, octx: &mut format::context::Output) {
183 let mut decoded = frame::Audio::empty();
184 while self.decoder.receive_frame(&mut decoded).is_ok() {
185 let timestamp = decoded.timestamp();
186 decoded.set_pts(timestamp);
187 self.add_frame_to_filter(&decoded);
188 self.get_and_process_filtered_frames(octx);
189 }
190 }
pub fn new(format: Sample, samples: usize, layout: ChannelLayout) -> Self
pub fn format(&self) -> Sample
pub fn set_format(&mut self, value: Sample)
pub fn channel_layout(&self) -> ChannelLayout
pub fn set_channel_layout(&mut self, value: ChannelLayout)
pub fn channels(&self) -> u16
pub fn set_channels(&mut self, value: u16)
pub fn rate(&self) -> u32
pub fn set_rate(&mut self, value: u32)
pub fn samples(&self) -> usize
pub fn set_samples(&mut self, value: usize)
pub fn is_planar(&self) -> bool
pub fn is_packed(&self) -> bool
pub fn planes(&self) -> usize
pub fn plane<T: Sample>(&self, index: usize) -> &[T]
pub fn plane_mut<T: Sample>(&mut self, index: usize) -> &mut [T]
pub fn data(&self, index: usize) -> &[u8] ⓘ
pub fn data_mut(&mut self, index: usize) -> &mut [u8] ⓘ
Methods from Deref<Target = Frame>§
pub unsafe fn as_ptr(&self) -> *const AVFrame
pub unsafe fn as_mut_ptr(&mut self) -> *mut AVFrame
pub unsafe fn is_empty(&self) -> bool
pub fn is_key(&self) -> bool
pub fn is_corrupt(&self) -> bool
pub fn packet(&self) -> Packet
pub fn pts(&self) -> Option<i64>
Sourcepub fn set_pts(&mut self, value: Option<i64>)
pub fn set_pts(&mut self, value: Option<i64>)
Examples found in repository?
More examples
examples/transcode-x264.rs (line 106)
94 fn receive_and_process_decoded_frames(
95 &mut self,
96 octx: &mut format::context::Output,
97 ost_time_base: Rational,
98 ) {
99 let mut frame = frame::Video::empty();
100 while self.decoder.receive_frame(&mut frame).is_ok() {
101 self.frame_count += 1;
102 let timestamp = frame.timestamp();
103 self.log_progress(f64::from(
104 Rational(timestamp.unwrap_or(0) as i32, 1) * self.decoder.time_base(),
105 ));
106 frame.set_pts(timestamp);
107 frame.set_kind(picture::Type::None);
108 self.send_frame_to_encoder(&frame);
109 self.receive_and_process_encoded_packets(octx, ost_time_base);
110 }
111 }
Sourcepub fn timestamp(&self) -> Option<i64>
pub fn timestamp(&self) -> Option<i64>
Examples found in repository?
More examples
examples/transcode-x264.rs (line 102)
94 fn receive_and_process_decoded_frames(
95 &mut self,
96 octx: &mut format::context::Output,
97 ost_time_base: Rational,
98 ) {
99 let mut frame = frame::Video::empty();
100 while self.decoder.receive_frame(&mut frame).is_ok() {
101 self.frame_count += 1;
102 let timestamp = frame.timestamp();
103 self.log_progress(f64::from(
104 Rational(timestamp.unwrap_or(0) as i32, 1) * self.decoder.time_base(),
105 ));
106 frame.set_pts(timestamp);
107 frame.set_kind(picture::Type::None);
108 self.send_frame_to_encoder(&frame);
109 self.receive_and_process_encoded_packets(octx, ost_time_base);
110 }
111 }
pub fn quality(&self) -> usize
pub fn flags(&self) -> Flags
pub fn metadata(&self) -> DictionaryRef<'_>
pub fn set_metadata(&mut self, value: Dictionary<'_>)
pub fn side_data(&self, kind: Type) -> Option<SideData<'_>>
pub fn new_side_data(&mut self, kind: Type, size: usize) -> Option<SideData<'_>>
pub fn remove_side_data(&mut self, kind: Type)
Trait Implementations§
impl Eq for Audio
impl StructuralPartialEq for Audio
Auto Trait Implementations§
impl Freeze for Audio
impl RefUnwindSafe for Audio
impl Send for Audio
impl Sync for Audio
impl Unpin for Audio
impl UnwindSafe for Audio
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