@@ -1648,8 +1648,8 @@ fn read_hdlr<T: Read>(src: &mut BMFFBox<T>) -> Result<HandlerBox> {
1648
1648
// Skip uninteresting fields.
1649
1649
skip ( src, 12 ) ?;
1650
1650
1651
- let bytes_left = src . bytes_left ( ) ;
1652
- let _name = read_null_terminated_string ( src, bytes_left ) ?;
1651
+ // Skip name.
1652
+ skip_box_remain ( src) ?;
1653
1653
1654
1654
Ok ( HandlerBox {
1655
1655
handler_type : handler_type,
@@ -1679,12 +1679,7 @@ fn read_video_sample_entry<T: Read>(src: &mut BMFFBox<T>) -> Result<(CodecType,
1679
1679
let height = be_u16 ( src) ?;
1680
1680
1681
1681
// Skip uninteresting fields.
1682
- skip ( src, 14 ) ?;
1683
-
1684
- let _compressorname = read_fixed_length_pascal_string ( src, 32 ) ?;
1685
-
1686
- // Skip uninteresting fields.
1687
- skip ( src, 4 ) ?;
1682
+ skip ( src, 50 ) ?;
1688
1683
1689
1684
// Skip clap/pasp/etc. for now.
1690
1685
let mut codec_specific = None ;
@@ -2001,43 +1996,6 @@ fn read_buf<T: ReadBytesExt>(src: &mut T, size: usize) -> Result<Vec<u8>> {
2001
1996
Ok ( buf)
2002
1997
}
2003
1998
2004
- // TODO(kinetik): Find a copy of ISO/IEC 14496-1 to confirm various string encodings.
2005
- // XXX(kinetik): definition of "null-terminated" string is fuzzy, we have:
2006
- // - zero or more byte strings, with a single null terminating the string.
2007
- // - zero byte strings with no null terminator (i.e. zero space in the box for the string)
2008
- // - length-prefixed strings with no null terminator (e.g. bear_rotate_0.mp4)
2009
- // - multiple byte strings where more than one byte is a null.
2010
- fn read_null_terminated_string < T : ReadBytesExt > ( src : & mut T , mut size : usize ) -> Result < String > {
2011
- let mut buf = Vec :: new ( ) ;
2012
- while size > 0 {
2013
- let c = src. read_u8 ( ) ?;
2014
- size -= 1 ;
2015
- if c == 0 {
2016
- break ;
2017
- }
2018
- buf. push ( c) ;
2019
- }
2020
- skip ( src, size) ?;
2021
- String :: from_utf8 ( buf) . map_err ( From :: from)
2022
- }
2023
-
2024
- #[ allow( dead_code) ]
2025
- fn read_pascal_string < T : ReadBytesExt > ( src : & mut T ) -> Result < String > {
2026
- let len = src. read_u8 ( ) ?;
2027
- let buf = read_buf ( src, len as usize ) ?;
2028
- String :: from_utf8 ( buf) . map_err ( From :: from)
2029
- }
2030
-
2031
- // Weird string encoding with a length prefix and a fixed sized buffer which
2032
- // contains padding if the string doesn't fill the buffer.
2033
- fn read_fixed_length_pascal_string < T : Read > ( src : & mut T , size : usize ) -> Result < String > {
2034
- assert ! ( size > 0 ) ;
2035
- let len = cmp:: min ( src. read_u8 ( ) ? as usize , size - 1 ) ;
2036
- let buf = read_buf ( src, len) ?;
2037
- skip ( src, size - 1 - buf. len ( ) ) ?;
2038
- String :: from_utf8 ( buf) . map_err ( From :: from)
2039
- }
2040
-
2041
1999
fn be_i16 < T : ReadBytesExt > ( src : & mut T ) -> Result < i16 > {
2042
2000
src. read_i16 :: < byteorder:: BigEndian > ( ) . map_err ( From :: from)
2043
2001
}
0 commit comments