util/frame: handle unknown format case
This commit is contained in:
parent
72025673c9
commit
05921ce5d8
@ -141,9 +141,14 @@ impl Audio {
|
|||||||
|
|
||||||
pub fn format(&self) -> SampleFormat {
|
pub fn format(&self) -> SampleFormat {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
if (*self.ptr).format == -1 {
|
||||||
|
SampleFormat::None
|
||||||
|
}
|
||||||
|
else {
|
||||||
SampleFormat::from(mem::transmute::<_, AVSampleFormat>(((*self.ptr).format)))
|
SampleFormat::from(mem::transmute::<_, AVSampleFormat>(((*self.ptr).format)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn channel_layout(&self) -> i64 {
|
pub fn channel_layout(&self) -> i64 {
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -219,9 +224,14 @@ impl Video {
|
|||||||
|
|
||||||
pub fn format(&self) -> PixelFormat {
|
pub fn format(&self) -> PixelFormat {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
if (*self.ptr).format == -1 {
|
||||||
|
PixelFormat::None
|
||||||
|
}
|
||||||
|
else {
|
||||||
PixelFormat::from(mem::transmute::<_, AVPixelFormat>(((*self.ptr).format)))
|
PixelFormat::from(mem::transmute::<_, AVPixelFormat>(((*self.ptr).format)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn width(&self) -> usize {
|
pub fn width(&self) -> usize {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user