mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-03-31 01:33:42 -04:00
better logging for ffmpeg errors
This commit is contained in:
parent
0a29f62fd3
commit
1fdf6eb022
@ -301,7 +301,7 @@ impl MediaType {
|
|||||||
pub fn is_video(self) -> bool { self.0 == unsafe { moonfire_ffmpeg_avmedia_type_video } }
|
pub fn is_video(self) -> bool { self.0 == unsafe { moonfire_ffmpeg_avmedia_type_video } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Error(libc::c_int);
|
pub struct Error(libc::c_int);
|
||||||
|
|
||||||
impl Error {
|
impl Error {
|
||||||
@ -326,6 +326,12 @@ impl std::error::Error for Error {
|
|||||||
fn cause(&self) -> Option<&dyn std::error::Error> { None }
|
fn cause(&self) -> Option<&dyn std::error::Error> { None }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for Error {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "Error({} /* {} */)", self.0, self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
const ARRAYLEN: usize = 64;
|
const ARRAYLEN: usize = 64;
|
||||||
@ -487,7 +493,9 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_error() {
|
fn test_error() {
|
||||||
let eof_formatted = format!("{}", Error::eof());
|
let eof_formatted = format!("{}", Error::eof());
|
||||||
assert!(eof_formatted.contains("End of file"), "eof is: {}", eof_formatted);
|
assert!(eof_formatted.contains("End of file"), "eof formatted is: {}", eof_formatted);
|
||||||
|
let eof_debug = format!("{:?}", Error::eof());
|
||||||
|
assert!(eof_debug.contains("End of file"), "eof debug is: {}", eof_debug);
|
||||||
|
|
||||||
// Errors should be round trippable to a CString. (This will fail if they contain NUL
|
// Errors should be round trippable to a CString. (This will fail if they contain NUL
|
||||||
// bytes.)
|
// bytes.)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user