util/samples: use ChannelLayout
This commit is contained in:
@ -98,11 +98,11 @@ impl Audio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn samples(&self) -> Samples {
|
pub fn samples(&self) -> Samples {
|
||||||
Samples::wrap(self.ptr as *mut AVPicture, self.format(), self.rate(), self.sample_number(), self.channels())
|
Samples::wrap(self.ptr as *mut AVPicture, self.format(), self.rate(), self.sample_number(), self.channels(), self.channel_layout())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn samples_mut(&mut self) -> Samples {
|
pub fn samples_mut(&mut self) -> Samples {
|
||||||
Samples::wrap(self.ptr as *mut AVPicture, self.format(), self.rate(), self.sample_number(), self.channels())
|
Samples::wrap(self.ptr as *mut AVPicture, self.format(), self.rate(), self.sample_number(), self.channels(), self.channel_layout())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use std::marker::{Reflect, PhantomData};
|
|||||||
|
|
||||||
use ffi::*;
|
use ffi::*;
|
||||||
use ::util::format::Sample;
|
use ::util::format::Sample;
|
||||||
use ::Error;
|
use ::{Error, ChannelLayout};
|
||||||
|
|
||||||
pub struct Samples<'a> {
|
pub struct Samples<'a> {
|
||||||
pub ptr: *mut AVPicture,
|
pub ptr: *mut AVPicture,
|
||||||
@ -14,12 +14,13 @@ pub struct Samples<'a> {
|
|||||||
rate: u32,
|
rate: u32,
|
||||||
number: usize,
|
number: usize,
|
||||||
channels: u16,
|
channels: u16,
|
||||||
|
layout: ChannelLayout,
|
||||||
|
|
||||||
_marker: PhantomData<&'a ()>,
|
_marker: PhantomData<&'a ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Samples<'a> {
|
impl<'a> Samples<'a> {
|
||||||
pub fn wrap(ptr: *mut AVPicture, format: Sample, rate: u32, number: usize, channels: u16) -> Self {
|
pub fn wrap(ptr: *mut AVPicture, format: Sample, rate: u32, number: usize, channels: u16, layout: ChannelLayout) -> Self {
|
||||||
Samples {
|
Samples {
|
||||||
ptr: ptr,
|
ptr: ptr,
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ impl<'a> Samples<'a> {
|
|||||||
rate: rate,
|
rate: rate,
|
||||||
number: number,
|
number: number,
|
||||||
channels: channels,
|
channels: channels,
|
||||||
|
layout: layout,
|
||||||
|
|
||||||
_marker: PhantomData,
|
_marker: PhantomData,
|
||||||
}
|
}
|
||||||
@ -48,6 +50,10 @@ impl<'a> Samples<'a> {
|
|||||||
self.channels
|
self.channels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn channel_layout(&self) -> ChannelLayout {
|
||||||
|
self.layout
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_planar(&self) -> bool {
|
pub fn is_planar(&self) -> bool {
|
||||||
self.format.is_planar()
|
self.format.is_planar()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user