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