Struct ffmpeg_next::util::frame::audio::Audio

source ·
pub struct Audio(_);

Implementations§

source§

impl Audio

source

pub unsafe fn wrap(ptr: *mut AVFrame) -> Self

source

pub unsafe fn alloc( &mut self, format: Sample, samples: usize, layout: ChannelLayout )

source§

impl Audio

source

pub fn empty() -> Self

Examples found in repository?
examples/transcode-audio.rs (line 161)
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
    fn get_and_process_filtered_frames(&mut self, octx: &mut format::context::Output) {
        let mut filtered = frame::Audio::empty();
        while self
            .filter
            .get("out")
            .unwrap()
            .sink()
            .frame(&mut filtered)
            .is_ok()
        {
            self.send_frame_to_encoder(&filtered);
            self.receive_and_process_encoded_packets(octx);
        }
    }

    fn send_packet_to_decoder(&mut self, packet: &ffmpeg::Packet) {
        self.decoder.send_packet(packet).unwrap();
    }

    fn send_eof_to_decoder(&mut self) {
        self.decoder.send_eof().unwrap();
    }

    fn receive_and_process_decoded_frames(&mut self, octx: &mut format::context::Output) {
        let mut decoded = frame::Audio::empty();
        while self.decoder.receive_frame(&mut decoded).is_ok() {
            let timestamp = decoded.timestamp();
            decoded.set_pts(timestamp);
            self.add_frame_to_filter(&decoded);
            self.get_and_process_filtered_frames(octx);
        }
    }
source

pub fn new(format: Sample, samples: usize, layout: ChannelLayout) -> Self

source

pub fn format(&self) -> Sample

source

pub fn set_format(&mut self, value: Sample)

source

pub fn channel_layout(&self) -> ChannelLayout

source

pub fn set_channel_layout(&mut self, value: ChannelLayout)

source

pub fn channels(&self) -> u16

source

pub fn set_channels(&mut self, value: u16)

source

pub fn rate(&self) -> u32

source

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

source

pub fn samples(&self) -> usize

source

pub fn set_samples(&mut self, value: usize)

source

pub fn is_planar(&self) -> bool

source

pub fn is_packed(&self) -> bool

source

pub fn planes(&self) -> usize

source

pub fn plane<T: Sample>(&self, index: usize) -> &[T]

source

pub fn plane_mut<T: Sample>(&mut self, index: usize) -> &mut [T]

source

pub fn data(&self, index: usize) -> &[u8]

source

pub fn data_mut(&mut self, index: usize) -> &mut [u8]

source§

impl Audio

source

pub fn resampler( &self, format: Sample, channel_layout: ChannelLayout, rate: u32 ) -> Result<Context, Error>

Methods from Deref<Target = Frame>§

source

pub unsafe fn as_ptr(&self) -> *const AVFrame

source

pub unsafe fn as_mut_ptr(&mut self) -> *mut AVFrame

source

pub unsafe fn is_empty(&self) -> bool

source

pub fn is_key(&self) -> bool

source

pub fn is_corrupt(&self) -> bool

source

pub fn packet(&self) -> Packet

source

pub fn pts(&self) -> Option<i64>

source

pub fn set_pts(&mut self, value: Option<i64>)

Examples found in repository?
examples/transcode-audio.rs (line 187)
183
184
185
186
187
188
189
190
191
    fn receive_and_process_decoded_frames(&mut self, octx: &mut format::context::Output) {
        let mut decoded = frame::Audio::empty();
        while self.decoder.receive_frame(&mut decoded).is_ok() {
            let timestamp = decoded.timestamp();
            decoded.set_pts(timestamp);
            self.add_frame_to_filter(&decoded);
            self.get_and_process_filtered_frames(octx);
        }
    }
More examples
Hide additional examples
examples/transcode-x264.rs (line 108)
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
    fn receive_and_process_decoded_frames(
        &mut self,
        octx: &mut format::context::Output,
        ost_time_base: Rational,
    ) {
        let mut frame = frame::Video::empty();
        while self.decoder.receive_frame(&mut frame).is_ok() {
            self.frame_count += 1;
            let timestamp = frame.timestamp();
            self.log_progress(f64::from(
                Rational(timestamp.unwrap_or(0) as i32, 1) * self.decoder.time_base(),
            ));
            frame.set_pts(timestamp);
            frame.set_kind(picture::Type::None);
            self.send_frame_to_encoder(&frame);
            self.receive_and_process_encoded_packets(octx, ost_time_base);
        }
    }
source

pub fn timestamp(&self) -> Option<i64>

Examples found in repository?
examples/transcode-audio.rs (line 186)
183
184
185
186
187
188
189
190
191
    fn receive_and_process_decoded_frames(&mut self, octx: &mut format::context::Output) {
        let mut decoded = frame::Audio::empty();
        while self.decoder.receive_frame(&mut decoded).is_ok() {
            let timestamp = decoded.timestamp();
            decoded.set_pts(timestamp);
            self.add_frame_to_filter(&decoded);
            self.get_and_process_filtered_frames(octx);
        }
    }
More examples
Hide additional examples
examples/transcode-x264.rs (line 104)
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
    fn receive_and_process_decoded_frames(
        &mut self,
        octx: &mut format::context::Output,
        ost_time_base: Rational,
    ) {
        let mut frame = frame::Video::empty();
        while self.decoder.receive_frame(&mut frame).is_ok() {
            self.frame_count += 1;
            let timestamp = frame.timestamp();
            self.log_progress(f64::from(
                Rational(timestamp.unwrap_or(0) as i32, 1) * self.decoder.time_base(),
            ));
            frame.set_pts(timestamp);
            frame.set_kind(picture::Type::None);
            self.send_frame_to_encoder(&frame);
            self.receive_and_process_encoded_packets(octx, ost_time_base);
        }
    }
source

pub fn quality(&self) -> usize

source

pub fn flags(&self) -> Flags

source

pub fn metadata(&self) -> DictionaryRef<'_>

source

pub fn set_metadata(&mut self, value: Dictionary<'_>)

source

pub fn side_data(&self, kind: Type) -> Option<SideData<'_>>

source

pub fn new_side_data(&mut self, kind: Type, size: usize) -> Option<SideData<'_>>

source

pub fn remove_side_data(&mut self, kind: Type)

Trait Implementations§

source§

impl Clone for Audio

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Audio

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Deref for Audio

§

type Target = Frame

The resulting type after dereferencing.
source§

fn deref(&self) -> &<Self as Deref>::Target

Dereferences the value.
source§

impl DerefMut for Audio

source§

fn deref_mut(&mut self) -> &mut <Self as Deref>::Target

Mutably dereferences the value.
source§

impl From<Frame> for Audio

source§

fn from(frame: Frame) -> Self

Converts to this type from the input type.
source§

impl PartialEq<Audio> for Audio

source§

fn eq(&self, other: &Audio) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Audio

source§

impl StructuralEq for Audio

source§

impl StructuralPartialEq for Audio

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.