@@ -31,7 +31,7 @@ pub struct Box {
3131 pub uuid : Option < String > ,
3232 /// Version field for FullBox types
3333 pub version : Option < u8 > ,
34- /// Flags field for FullBox types
34+ /// Flags field for FullBox types
3535 pub flags : Option < u32 > ,
3636 /// Box classification: "leaf", "full", "container", or "unknown"
3737 pub kind : String ,
@@ -49,7 +49,7 @@ pub struct Box {
4949///
5050/// # Parameters
5151/// - `r`: A reader that implements `Read + Seek` (e.g., `File`, `Cursor<Vec<u8>>`)
52- /// - `size`: The total size of the MP4 data to parse (typically file length)
52+ /// - `size`: The total size of the MP4 data to parse (typically file length)
5353/// - `decode`: Whether to decode known box types using the default registry
5454///
5555/// # Returns
@@ -66,7 +66,12 @@ pub struct Box {
6666/// let boxes = get_boxes(&mut file, size, true)?; // decode known boxes
6767/// # Ok::<(), anyhow::Error>(())
6868/// ```
69- pub fn get_boxes < R : Read + Seek > ( r : & mut R , size : u64 , decode : bool ) -> anyhow:: Result < Vec < Box > > {
69+ pub fn get_boxes < R : Read + Seek > (
70+ r : & mut R ,
71+ size : u64 ,
72+ decode : bool ,
73+ additional_registrations : impl FnOnce ( crate :: Registry ) -> crate :: Registry ,
74+ ) -> anyhow:: Result < Vec < Box > > {
7075 // let mut f = File::open(&path)?;
7176 // let file_len = f.metadata()?.len();
7277
@@ -114,7 +119,7 @@ pub fn get_boxes<R: Read + Seek>(r: &mut R, size: u64, decode: bool) -> anyhow::
114119 }
115120
116121 // build JSON tree
117- let reg = default_registry ( ) ;
122+ let reg = additional_registrations ( default_registry ( ) ) ;
118123 let json_boxes = boxes
119124 . iter ( )
120125 . map ( |b| build_box ( r, b, decode, & reg) )
0 commit comments