@@ -228,7 +228,7 @@ pub struct AudioSampleEntry {
228
228
pub samplesize : u16 ,
229
229
pub samplerate : u32 ,
230
230
pub codec_specific : AudioCodecSpecific ,
231
- pub protect_info : Option < ProtectionSchemeInfoBox > ,
231
+ pub protection_info : Option < ProtectionSchemeInfoBox > ,
232
232
}
233
233
234
234
#[ derive( Debug , Clone ) ]
@@ -243,7 +243,7 @@ pub struct VideoSampleEntry {
243
243
pub width : u16 ,
244
244
pub height : u16 ,
245
245
pub codec_specific : VideoCodecSpecific ,
246
- pub protect_info : Option < ProtectionSchemeInfoBox > ,
246
+ pub protection_info : Option < ProtectionSchemeInfoBox > ,
247
247
}
248
248
249
249
/// Represent a Video Partition Codec Configuration 'vpcC' box (aka vp9).
@@ -1491,7 +1491,7 @@ fn read_video_sample_entry<T: Read>(src: &mut BMFFBox<T>, track: &mut Track) ->
1491
1491
1492
1492
// Skip clap/pasp/etc. for now.
1493
1493
let mut codec_specific = None ;
1494
- let mut protect_info = None ;
1494
+ let mut protection_info = None ;
1495
1495
let mut iter = src. box_iter ( ) ;
1496
1496
while let Some ( mut b) = iter. next_box ( ) ? {
1497
1497
match b. head . name {
@@ -1526,7 +1526,7 @@ fn read_video_sample_entry<T: Read>(src: &mut BMFFBox<T>, track: &mut Track) ->
1526
1526
}
1527
1527
let sinf = read_sinf ( & mut b) ?;
1528
1528
log ! ( "{:?} (sinf)" , sinf) ;
1529
- protect_info = Some ( sinf) ;
1529
+ protection_info = Some ( sinf) ;
1530
1530
}
1531
1531
_ => skip_box_content ( & mut b) ?,
1532
1532
}
@@ -1539,7 +1539,7 @@ fn read_video_sample_entry<T: Read>(src: &mut BMFFBox<T>, track: &mut Track) ->
1539
1539
width : width,
1540
1540
height : height,
1541
1541
codec_specific : codec_specific,
1542
- protect_info : protect_info ,
1542
+ protection_info : protection_info ,
1543
1543
} ) )
1544
1544
. ok_or_else ( || Error :: InvalidData ( "malformed video sample entry" ) )
1545
1545
}
@@ -1598,7 +1598,7 @@ fn read_audio_sample_entry<T: Read>(src: &mut BMFFBox<T>, track: &mut Track) ->
1598
1598
1599
1599
// Skip chan/etc. for now.
1600
1600
let mut codec_specific = None ;
1601
- let mut protect_info = None ;
1601
+ let mut protection_info = None ;
1602
1602
let mut iter = src. box_iter ( ) ;
1603
1603
while let Some ( mut b) = iter. next_box ( ) ? {
1604
1604
match b. head . name {
@@ -1643,7 +1643,7 @@ fn read_audio_sample_entry<T: Read>(src: &mut BMFFBox<T>, track: &mut Track) ->
1643
1643
let sinf = read_sinf ( & mut b) ?;
1644
1644
log ! ( "{:?} (sinf)" , sinf) ;
1645
1645
track. codec_type = CodecType :: EncryptedAudio ;
1646
- protect_info = Some ( sinf) ;
1646
+ protection_info = Some ( sinf) ;
1647
1647
}
1648
1648
_ => skip_box_content ( & mut b) ?,
1649
1649
}
@@ -1657,7 +1657,7 @@ fn read_audio_sample_entry<T: Read>(src: &mut BMFFBox<T>, track: &mut Track) ->
1657
1657
samplesize : samplesize,
1658
1658
samplerate : samplerate,
1659
1659
codec_specific : codec_specific,
1660
- protect_info : protect_info ,
1660
+ protection_info : protection_info ,
1661
1661
} ) )
1662
1662
. ok_or_else ( || Error :: InvalidData ( "malformed audio sample entry" ) )
1663
1663
}
@@ -1714,23 +1714,30 @@ fn read_stsd<T: Read>(src: &mut BMFFBox<T>, track: &mut Track) -> Result<SampleD
1714
1714
fn read_sinf < T : Read > ( src : & mut BMFFBox < T > ) -> Result < ProtectionSchemeInfoBox > {
1715
1715
let mut sinf = ProtectionSchemeInfoBox :: default ( ) ;
1716
1716
1717
+ let mut has_frma_schi_boxes = ( false , false ) ;
1717
1718
let mut iter = src. box_iter ( ) ;
1718
1719
while let Some ( mut b) = iter. next_box ( ) ? {
1719
1720
match b. head . name {
1720
1721
BoxType :: OriginalFormatBox => {
1721
1722
let frma = read_frma ( & mut b) ?;
1722
1723
sinf. code_name = frma;
1724
+ has_frma_schi_boxes. 0 = true ;
1723
1725
} ,
1724
1726
BoxType :: SchemeInformationBox => {
1725
1727
// We only need tenc box in schi box so far.
1726
1728
let schi_tenc = read_schi ( & mut b) ?;
1727
1729
sinf. tenc = schi_tenc;
1730
+ has_frma_schi_boxes. 1 = true
1728
1731
} ,
1729
1732
_ => skip_box_content ( & mut b) ?,
1730
1733
}
1731
1734
check_parser_state ! ( b. content) ;
1732
1735
}
1733
1736
1737
+ if has_frma_schi_boxes != ( true , true ) {
1738
+ return Err ( Error :: InvalidData ( "malformat sinf box" ) ) ;
1739
+ }
1740
+
1734
1741
Ok ( sinf)
1735
1742
}
1736
1743
0 commit comments