From 0fdd2d16b49c7576443ea73dd19b5d94f26cb39c Mon Sep 17 00:00:00 2001 From: Stuart Woodbury Date: Wed, 5 Jul 2023 11:52:19 -0400 Subject: [PATCH] chore(Mp4Box): use a trait function for to_json --- src/mp4box/avc1.rs | 8 -------- src/mp4box/co64.rs | 4 ---- src/mp4box/ctts.rs | 4 ---- src/mp4box/data.rs | 4 ---- src/mp4box/dinf.rs | 12 ------------ src/mp4box/edts.rs | 4 ---- src/mp4box/elst.rs | 4 ---- src/mp4box/emsg.rs | 4 ---- src/mp4box/ftyp.rs | 4 ---- src/mp4box/hdlr.rs | 4 ---- src/mp4box/hev1.rs | 8 -------- src/mp4box/ilst.rs | 4 ---- src/mp4box/mdhd.rs | 4 ---- src/mp4box/mdia.rs | 4 ---- src/mp4box/mehd.rs | 4 ---- src/mp4box/meta.rs | 4 ---- src/mp4box/mfhd.rs | 4 ---- src/mp4box/minf.rs | 4 ---- src/mp4box/mod.rs | 8 +++++++- src/mp4box/moof.rs | 4 ---- src/mp4box/moov.rs | 4 ---- src/mp4box/mp4a.rs | 8 -------- src/mp4box/mvex.rs | 4 ---- src/mp4box/mvhd.rs | 4 ---- src/mp4box/smhd.rs | 4 ---- src/mp4box/soun.rs | 4 ---- src/mp4box/stbl.rs | 4 ---- src/mp4box/stco.rs | 4 ---- src/mp4box/stsc.rs | 4 ---- src/mp4box/stsd.rs | 4 ---- src/mp4box/stss.rs | 4 ---- src/mp4box/stsz.rs | 4 ---- src/mp4box/stts.rs | 4 ---- src/mp4box/tfdt.rs | 4 ---- src/mp4box/tfhd.rs | 4 ---- src/mp4box/tkhd.rs | 4 ---- src/mp4box/traf.rs | 4 ---- src/mp4box/trak.rs | 4 ---- src/mp4box/trex.rs | 4 ---- src/mp4box/trun.rs | 4 ---- src/mp4box/tx3g.rs | 4 ---- src/mp4box/udta.rs | 4 ---- src/mp4box/vmhd.rs | 4 ---- src/mp4box/vp09.rs | 4 ---- src/mp4box/vpcc.rs | 4 ---- 45 files changed, 7 insertions(+), 197 deletions(-) diff --git a/src/mp4box/avc1.rs b/src/mp4box/avc1.rs index 7226d5d..b2a514f 100644 --- a/src/mp4box/avc1.rs +++ b/src/mp4box/avc1.rs @@ -67,10 +67,6 @@ impl Mp4Box for Avc1Box { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!( "data_reference_index={} width={} height={} frame_count={}", @@ -199,10 +195,6 @@ impl Mp4Box for AvcCBox { size } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("avc_profile_indication={}", self.avc_profile_indication); Ok(s) diff --git a/src/mp4box/co64.rs b/src/mp4box/co64.rs index c6f77d3..4ab94ff 100644 --- a/src/mp4box/co64.rs +++ b/src/mp4box/co64.rs @@ -33,10 +33,6 @@ impl Mp4Box for Co64Box { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("entries_count={}", self.entries.len()); Ok(s) diff --git a/src/mp4box/ctts.rs b/src/mp4box/ctts.rs index 7316c9b..7bad066 100644 --- a/src/mp4box/ctts.rs +++ b/src/mp4box/ctts.rs @@ -39,10 +39,6 @@ impl Mp4Box for CttsBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("entries_count={}", self.entries.len()); Ok(s) diff --git a/src/mp4box/data.rs b/src/mp4box/data.rs index f49631e..79ef769 100644 --- a/src/mp4box/data.rs +++ b/src/mp4box/data.rs @@ -36,10 +36,6 @@ impl Mp4Box for DataBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("type={:?} len={}", self.data_type, self.data.len()); Ok(s) diff --git a/src/mp4box/dinf.rs b/src/mp4box/dinf.rs index ad78a0f..a6943c7 100644 --- a/src/mp4box/dinf.rs +++ b/src/mp4box/dinf.rs @@ -27,10 +27,6 @@ impl Mp4Box for DinfBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) @@ -131,10 +127,6 @@ impl Mp4Box for DrefBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) @@ -248,10 +240,6 @@ impl Mp4Box for UrlBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("location={}", self.location); Ok(s) diff --git a/src/mp4box/edts.rs b/src/mp4box/edts.rs index 5ab5962..22f43ee 100644 --- a/src/mp4box/edts.rs +++ b/src/mp4box/edts.rs @@ -36,10 +36,6 @@ impl Mp4Box for EdtsBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) diff --git a/src/mp4box/elst.rs b/src/mp4box/elst.rs index 79267e5..1182e2a 100644 --- a/src/mp4box/elst.rs +++ b/src/mp4box/elst.rs @@ -47,10 +47,6 @@ impl Mp4Box for ElstBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("elst_entries={}", self.entries.len()); Ok(s) diff --git a/src/mp4box/emsg.rs b/src/mp4box/emsg.rs index c03bcae..921dd4d 100644 --- a/src/mp4box/emsg.rs +++ b/src/mp4box/emsg.rs @@ -48,10 +48,6 @@ impl Mp4Box for EmsgBox { + self.message_data.len() as u64 } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("id={} value={}", self.id, self.value); Ok(s) diff --git a/src/mp4box/ftyp.rs b/src/mp4box/ftyp.rs index 36c8e36..dd35bb5 100644 --- a/src/mp4box/ftyp.rs +++ b/src/mp4box/ftyp.rs @@ -30,10 +30,6 @@ impl Mp4Box for FtypBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let mut compatible_brands = Vec::new(); for brand in self.compatible_brands.iter() { diff --git a/src/mp4box/hdlr.rs b/src/mp4box/hdlr.rs index 99455ce..b5d9f5b 100644 --- a/src/mp4box/hdlr.rs +++ b/src/mp4box/hdlr.rs @@ -31,10 +31,6 @@ impl Mp4Box for HdlrBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("handler_type={} name={}", self.handler_type, self.name); Ok(s) diff --git a/src/mp4box/hev1.rs b/src/mp4box/hev1.rs index c0731c6..4472add 100644 --- a/src/mp4box/hev1.rs +++ b/src/mp4box/hev1.rs @@ -67,10 +67,6 @@ impl Mp4Box for Hev1Box { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!( "data_reference_index={} width={} height={} frame_count={}", @@ -180,10 +176,6 @@ impl Mp4Box for HvcCBox { HEADER_SIZE + 1 } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("configuration_version={}", self.configuration_version); Ok(s) diff --git a/src/mp4box/ilst.rs b/src/mp4box/ilst.rs index 5de336a..9336b90 100644 --- a/src/mp4box/ilst.rs +++ b/src/mp4box/ilst.rs @@ -36,10 +36,6 @@ impl Mp4Box for IlstBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("item_count={}", self.items.len()); Ok(s) diff --git a/src/mp4box/mdhd.rs b/src/mp4box/mdhd.rs index ee4e753..bd63a87 100644 --- a/src/mp4box/mdhd.rs +++ b/src/mp4box/mdhd.rs @@ -57,10 +57,6 @@ impl Mp4Box for MdhdBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!( "creation_time={} timescale={} duration={} language={}", diff --git a/src/mp4box/mdia.rs b/src/mp4box/mdia.rs index 3d1e159..ea4d647 100644 --- a/src/mp4box/mdia.rs +++ b/src/mp4box/mdia.rs @@ -30,10 +30,6 @@ impl Mp4Box for MdiaBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) diff --git a/src/mp4box/mehd.rs b/src/mp4box/mehd.rs index 0bab2a5..72db38a 100644 --- a/src/mp4box/mehd.rs +++ b/src/mp4box/mehd.rs @@ -37,10 +37,6 @@ impl Mp4Box for MehdBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("fragment_duration={}", self.fragment_duration); Ok(s) diff --git a/src/mp4box/meta.rs b/src/mp4box/meta.rs index a3fe74d..ad44120 100644 --- a/src/mp4box/meta.rs +++ b/src/mp4box/meta.rs @@ -56,10 +56,6 @@ impl Mp4Box for MetaBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = match self { Self::Mdir { .. } => "hdlr=ilst".to_string(), diff --git a/src/mp4box/mfhd.rs b/src/mp4box/mfhd.rs index 067aa22..f1b0f9f 100644 --- a/src/mp4box/mfhd.rs +++ b/src/mp4box/mfhd.rs @@ -40,10 +40,6 @@ impl Mp4Box for MfhdBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("sequence_number={}", self.sequence_number); Ok(s) diff --git a/src/mp4box/minf.rs b/src/mp4box/minf.rs index 2ec8878..6eb561f 100644 --- a/src/mp4box/minf.rs +++ b/src/mp4box/minf.rs @@ -44,10 +44,6 @@ impl Mp4Box for MinfBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) diff --git a/src/mp4box/mod.rs b/src/mp4box/mod.rs index f276222..19578b1 100644 --- a/src/mp4box/mod.rs +++ b/src/mp4box/mod.rs @@ -57,6 +57,7 @@ //! use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use serde::Serialize; use std::convert::TryInto; use std::io::{Read, Seek, SeekFrom, Write}; @@ -206,7 +207,12 @@ boxtype! { pub trait Mp4Box: Sized { fn box_type(&self) -> BoxType; fn box_size(&self) -> u64; - fn to_json(&self) -> Result; + fn to_json(&self) -> Result + where + Self: Serialize, + { + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) + } fn summary(&self) -> Result; } diff --git a/src/mp4box/moof.rs b/src/mp4box/moof.rs index 89bcf51..e90c1f5 100644 --- a/src/mp4box/moof.rs +++ b/src/mp4box/moof.rs @@ -35,10 +35,6 @@ impl Mp4Box for MoofBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("trafs={}", self.trafs.len()); Ok(s) diff --git a/src/mp4box/moov.rs b/src/mp4box/moov.rs index 194c9ae..70578d9 100644 --- a/src/mp4box/moov.rs +++ b/src/mp4box/moov.rs @@ -51,10 +51,6 @@ impl Mp4Box for MoovBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("traks={}", self.traks.len()); Ok(s) diff --git a/src/mp4box/mp4a.rs b/src/mp4box/mp4a.rs index e6c2a63..f8f411d 100644 --- a/src/mp4box/mp4a.rs +++ b/src/mp4box/mp4a.rs @@ -60,10 +60,6 @@ impl Mp4Box for Mp4aBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!( "channel_count={} sample_size={} sample_rate={}", @@ -169,10 +165,6 @@ impl Mp4Box for EsdsBox { + ESDescriptor::desc_size() as u64 } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { Ok(String::new()) } diff --git a/src/mp4box/mvex.rs b/src/mp4box/mvex.rs index 31a9eab..6e269f7 100644 --- a/src/mp4box/mvex.rs +++ b/src/mp4box/mvex.rs @@ -29,10 +29,6 @@ impl Mp4Box for MvexBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) diff --git a/src/mp4box/mvhd.rs b/src/mp4box/mvhd.rs index d0593b1..9bcd0db 100644 --- a/src/mp4box/mvhd.rs +++ b/src/mp4box/mvhd.rs @@ -66,10 +66,6 @@ impl Mp4Box for MvhdBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!( "creation_time={} timescale={} duration={} rate={} volume={}, matrix={}, next_track_id={}", diff --git a/src/mp4box/smhd.rs b/src/mp4box/smhd.rs index f0a34c2..bc919e5 100644 --- a/src/mp4box/smhd.rs +++ b/src/mp4box/smhd.rs @@ -42,10 +42,6 @@ impl Mp4Box for SmhdBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("balance={}", self.balance.value()); Ok(s) diff --git a/src/mp4box/soun.rs b/src/mp4box/soun.rs index e2b79c9..b2ddaba 100644 --- a/src/mp4box/soun.rs +++ b/src/mp4box/soun.rs @@ -22,10 +22,6 @@ impl Mp4Box for SounBox { todo!() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { todo!() } diff --git a/src/mp4box/stbl.rs b/src/mp4box/stbl.rs index 46199c1..03dd819 100644 --- a/src/mp4box/stbl.rs +++ b/src/mp4box/stbl.rs @@ -63,10 +63,6 @@ impl Mp4Box for StblBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) diff --git a/src/mp4box/stco.rs b/src/mp4box/stco.rs index daa37e0..3ce39d9 100644 --- a/src/mp4box/stco.rs +++ b/src/mp4box/stco.rs @@ -33,10 +33,6 @@ impl Mp4Box for StcoBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("entries={}", self.entries.len()); Ok(s) diff --git a/src/mp4box/stsc.rs b/src/mp4box/stsc.rs index 25d75bc..44834e4 100644 --- a/src/mp4box/stsc.rs +++ b/src/mp4box/stsc.rs @@ -41,10 +41,6 @@ impl Mp4Box for StscBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("entries={}", self.entries.len()); Ok(s) diff --git a/src/mp4box/stsd.rs b/src/mp4box/stsd.rs index 635ac89..9a995bb 100644 --- a/src/mp4box/stsd.rs +++ b/src/mp4box/stsd.rs @@ -58,10 +58,6 @@ impl Mp4Box for StsdBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) diff --git a/src/mp4box/stss.rs b/src/mp4box/stss.rs index 11b8d33..f6bed51 100644 --- a/src/mp4box/stss.rs +++ b/src/mp4box/stss.rs @@ -33,10 +33,6 @@ impl Mp4Box for StssBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("entries={}", self.entries.len()); Ok(s) diff --git a/src/mp4box/stsz.rs b/src/mp4box/stsz.rs index 38855df..738b98f 100644 --- a/src/mp4box/stsz.rs +++ b/src/mp4box/stsz.rs @@ -35,10 +35,6 @@ impl Mp4Box for StszBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!( "sample_size={} sample_count={} sample_sizes={}", diff --git a/src/mp4box/stts.rs b/src/mp4box/stts.rs index 66e76e5..9eab506 100644 --- a/src/mp4box/stts.rs +++ b/src/mp4box/stts.rs @@ -39,10 +39,6 @@ impl Mp4Box for SttsBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("entries={}", self.entries.len()); Ok(s) diff --git a/src/mp4box/tfdt.rs b/src/mp4box/tfdt.rs index 68e55e9..aa2d5ef 100644 --- a/src/mp4box/tfdt.rs +++ b/src/mp4box/tfdt.rs @@ -36,10 +36,6 @@ impl Mp4Box for TfdtBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("base_media_decode_time={}", self.base_media_decode_time); Ok(s) diff --git a/src/mp4box/tfhd.rs b/src/mp4box/tfhd.rs index bc51684..10b8d86 100644 --- a/src/mp4box/tfhd.rs +++ b/src/mp4box/tfhd.rs @@ -57,10 +57,6 @@ impl Mp4Box for TfhdBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("track_id={}", self.track_id); Ok(s) diff --git a/src/mp4box/tkhd.rs b/src/mp4box/tkhd.rs index 58b0f6a..56063b2 100644 --- a/src/mp4box/tkhd.rs +++ b/src/mp4box/tkhd.rs @@ -125,10 +125,6 @@ impl Mp4Box for TkhdBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!( "creation_time={} track_id={} duration={} layer={} volume={} matrix={} width={} height={}", diff --git a/src/mp4box/traf.rs b/src/mp4box/traf.rs index bdd5ffe..2c21290 100644 --- a/src/mp4box/traf.rs +++ b/src/mp4box/traf.rs @@ -35,10 +35,6 @@ impl Mp4Box for TrafBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) diff --git a/src/mp4box/trak.rs b/src/mp4box/trak.rs index e0c286a..40b06b4 100644 --- a/src/mp4box/trak.rs +++ b/src/mp4box/trak.rs @@ -43,10 +43,6 @@ impl Mp4Box for TrakBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = String::new(); Ok(s) diff --git a/src/mp4box/trex.rs b/src/mp4box/trex.rs index 2a45861..8cbc6e9 100644 --- a/src/mp4box/trex.rs +++ b/src/mp4box/trex.rs @@ -34,10 +34,6 @@ impl Mp4Box for TrexBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!( "track_id={} default_sample_duration={}", diff --git a/src/mp4box/trun.rs b/src/mp4box/trun.rs index 793d53d..444bf9c 100644 --- a/src/mp4box/trun.rs +++ b/src/mp4box/trun.rs @@ -68,10 +68,6 @@ impl Mp4Box for TrunBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("sample_size={}", self.sample_count); Ok(s) diff --git a/src/mp4box/tx3g.rs b/src/mp4box/tx3g.rs index 7edcc34..ef00900 100644 --- a/src/mp4box/tx3g.rs +++ b/src/mp4box/tx3g.rs @@ -61,10 +61,6 @@ impl Mp4Box for Tx3gBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!("data_reference_index={} horizontal_justification={} vertical_justification={} rgba={}{}{}{}", self.data_reference_index, self.horizontal_justification, diff --git a/src/mp4box/udta.rs b/src/mp4box/udta.rs index 3fb40b4..aedce92 100644 --- a/src/mp4box/udta.rs +++ b/src/mp4box/udta.rs @@ -34,10 +34,6 @@ impl Mp4Box for UdtaBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { Ok(String::new()) } diff --git a/src/mp4box/vmhd.rs b/src/mp4box/vmhd.rs index 3eb8c9f..e13df77 100644 --- a/src/mp4box/vmhd.rs +++ b/src/mp4box/vmhd.rs @@ -38,10 +38,6 @@ impl Mp4Box for VmhdBox { self.get_size() } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { let s = format!( "graphics_mode={} op_color={}{}{}", diff --git a/src/mp4box/vp09.rs b/src/mp4box/vp09.rs index 099339f..e3e95bc 100644 --- a/src/mp4box/vp09.rs +++ b/src/mp4box/vp09.rs @@ -74,10 +74,6 @@ impl Mp4Box for Vp09Box { 0x6A } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { Ok(format!("{self:?}")) } diff --git a/src/mp4box/vpcc.rs b/src/mp4box/vpcc.rs index f3beaf2..520ec29 100644 --- a/src/mp4box/vpcc.rs +++ b/src/mp4box/vpcc.rs @@ -31,10 +31,6 @@ impl Mp4Box for VpccBox { HEADER_SIZE + HEADER_EXT_SIZE + 8 } - fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) - } - fn summary(&self) -> Result { Ok(format!("{self:?}")) }