util/frame/audio: change rate type to u32
This commit is contained in:
parent
72895052e6
commit
ea6b10ba84
@ -72,15 +72,15 @@ impl Audio {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rate(&self) -> i32 {
|
pub fn rate(&self) -> u32 {
|
||||||
unsafe {
|
unsafe {
|
||||||
av_frame_get_sample_rate(self.ptr)
|
av_frame_get_sample_rate(self.ptr) as u32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_rate(&mut self, value: i32) {
|
pub fn set_rate(&mut self, value: u32) {
|
||||||
unsafe {
|
unsafe {
|
||||||
av_frame_set_sample_rate(self.ptr, value);
|
av_frame_set_sample_rate(self.ptr, value as c_int);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,11 +97,11 @@ impl Audio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn samples(&self) -> Samples {
|
pub fn samples(&self) -> Samples {
|
||||||
Samples::wrap(self.ptr as *mut AVPicture, self.format(), self.sample_number(), self.channels())
|
Samples::wrap(self.ptr as *mut AVPicture, self.format(), self.rate(), self.sample_number(), self.channels())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn samples_mut(&mut self) -> Samples {
|
pub fn samples_mut(&mut self) -> Samples {
|
||||||
Samples::wrap(self.ptr as *mut AVPicture, self.format(), self.sample_number(), self.channels())
|
Samples::wrap(self.ptr as *mut AVPicture, self.format(), self.rate(), self.sample_number(), self.channels())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ pub struct Samples<'a> {
|
|||||||
pub ptr: *mut AVPicture,
|
pub ptr: *mut AVPicture,
|
||||||
|
|
||||||
format: Sample,
|
format: Sample,
|
||||||
|
rate: u32,
|
||||||
number: usize,
|
number: usize,
|
||||||
channels: u16,
|
channels: u16,
|
||||||
|
|
||||||
@ -18,11 +19,12 @@ pub struct Samples<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Samples<'a> {
|
impl<'a> Samples<'a> {
|
||||||
pub fn wrap(ptr: *mut AVPicture, format: Sample, number: usize, channels: u16) -> Self {
|
pub fn wrap(ptr: *mut AVPicture, format: Sample, rate: u32, number: usize, channels: u16) -> Self {
|
||||||
Samples {
|
Samples {
|
||||||
ptr: ptr,
|
ptr: ptr,
|
||||||
|
|
||||||
format: format,
|
format: format,
|
||||||
|
rate: rate,
|
||||||
number: number,
|
number: number,
|
||||||
channels: channels,
|
channels: channels,
|
||||||
|
|
||||||
@ -34,6 +36,10 @@ impl<'a> Samples<'a> {
|
|||||||
self.format
|
self.format
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn rate(&self) -> u32 {
|
||||||
|
self.rate
|
||||||
|
}
|
||||||
|
|
||||||
pub fn number(&self) -> usize {
|
pub fn number(&self) -> usize {
|
||||||
self.number
|
self.number
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user