mirror of
https://github.com/encounter/rust-ffmpeg-zmwangx.git
synced 2026-07-10 21:18:40 -07:00
util/frame: handle unknown format case
This commit is contained in:
+12
-2
@@ -141,7 +141,12 @@ impl Audio {
|
||||
|
||||
pub fn format(&self) -> SampleFormat {
|
||||
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 {
|
||||
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)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user