mirror of
https://github.com/alfg/mp4-rust.git
synced 2025-01-07 02:35:26 +00:00
fix(mp4box): remove unwrap() in to_json() for Mp4Box implementation.
This commit is contained in:
parent
6a6e746c3f
commit
3e23adae7f
43 changed files with 48 additions and 48 deletions
|
@ -68,7 +68,7 @@ impl Mp4Box for Avc1Box {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
@ -200,7 +200,7 @@ impl Mp4Box for AvcCBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -34,7 +34,7 @@ impl Mp4Box for Co64Box {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -40,7 +40,7 @@ impl Mp4Box for CttsBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -37,7 +37,7 @@ impl Mp4Box for DataBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -28,7 +28,7 @@ impl Mp4Box for DinfBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
@ -132,7 +132,7 @@ impl Mp4Box for DrefBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
@ -249,7 +249,7 @@ impl Mp4Box for UrlBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -37,7 +37,7 @@ impl Mp4Box for EdtsBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -48,7 +48,7 @@ impl Mp4Box for ElstBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -49,7 +49,7 @@ impl Mp4Box for EmsgBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -31,7 +31,7 @@ impl Mp4Box for FtypBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -32,7 +32,7 @@ impl Mp4Box for HdlrBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -68,7 +68,7 @@ impl Mp4Box for Hev1Box {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
@ -181,7 +181,7 @@ impl Mp4Box for HvcCBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -37,7 +37,7 @@ impl Mp4Box for IlstBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -58,7 +58,7 @@ impl Mp4Box for MdhdBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -31,7 +31,7 @@ impl Mp4Box for MdiaBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -38,7 +38,7 @@ impl Mp4Box for MehdBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -57,7 +57,7 @@ impl Mp4Box for MetaBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -41,7 +41,7 @@ impl Mp4Box for MfhdBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -45,7 +45,7 @@ impl Mp4Box for MinfBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -36,7 +36,7 @@ impl Mp4Box for MoofBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -52,7 +52,7 @@ impl Mp4Box for MoovBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -61,7 +61,7 @@ impl Mp4Box for Mp4aBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
@ -170,7 +170,7 @@ impl Mp4Box for EsdsBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -30,7 +30,7 @@ impl Mp4Box for MvexBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -67,7 +67,7 @@ impl Mp4Box for MvhdBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -43,7 +43,7 @@ impl Mp4Box for SmhdBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -64,7 +64,7 @@ impl Mp4Box for StblBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -34,7 +34,7 @@ impl Mp4Box for StcoBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -42,7 +42,7 @@ impl Mp4Box for StscBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -59,7 +59,7 @@ impl Mp4Box for StsdBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -34,7 +34,7 @@ impl Mp4Box for StssBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -36,7 +36,7 @@ impl Mp4Box for StszBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -40,7 +40,7 @@ impl Mp4Box for SttsBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -37,7 +37,7 @@ impl Mp4Box for TfdtBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -58,7 +58,7 @@ impl Mp4Box for TfhdBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -126,7 +126,7 @@ impl Mp4Box for TkhdBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -36,7 +36,7 @@ impl Mp4Box for TrafBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -44,7 +44,7 @@ impl Mp4Box for TrakBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -35,7 +35,7 @@ impl Mp4Box for TrexBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -69,7 +69,7 @@ impl Mp4Box for TrunBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -62,7 +62,7 @@ impl Mp4Box for Tx3gBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -35,7 +35,7 @@ impl Mp4Box for UdtaBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -39,7 +39,7 @@ impl Mp4Box for VmhdBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -75,7 +75,7 @@ impl Mp4Box for Vp09Box {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
|
@ -32,7 +32,7 @@ impl Mp4Box for VpccBox {
|
|||
}
|
||||
|
||||
fn to_json(&self) -> Result<String> {
|
||||
Ok(serde_json::to_string(&self).unwrap())
|
||||
serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into()))
|
||||
}
|
||||
|
||||
fn summary(&self) -> Result<String> {
|
||||
|
|
Loading…
Reference in a new issue