File tree 2 files changed +10
-10
lines changed
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -627,7 +627,7 @@ fn read_moov<T: Read>(f: &mut BMFFBox<T>, context: &mut MediaContext) -> Result<
627
627
}
628
628
629
629
fn read_pssh < T : Read > ( src : & mut BMFFBox < T > ) -> Result < ProtectionSystemSpecificHeaderBox > {
630
- let mut box_content = Vec :: new ( ) ;
630
+ let mut box_content = Vec :: with_capacity ( src . head . size as usize ) ;
631
631
try!( src. read_to_end ( & mut box_content) ) ;
632
632
633
633
let ( system_id, kid, data) = {
@@ -639,11 +639,10 @@ fn read_pssh<T: Read>(src: &mut BMFFBox<T>) -> Result<ProtectionSystemSpecificHe
639
639
640
640
let mut kid: Vec < ByteData > = Vec :: new ( ) ;
641
641
if version > 0 {
642
- let mut count = try!( be_i32 ( pssh) ) ;
643
- while count > 0 {
642
+ let count = try!( be_i32 ( pssh) ) ;
643
+ for _ in 0 ..count {
644
644
let item = try!( read_buf ( pssh, 16 ) ) ;
645
645
kid. push ( item) ;
646
- count -= 1 ;
647
646
}
648
647
}
649
648
@@ -655,7 +654,7 @@ fn read_pssh<T: Read>(src: &mut BMFFBox<T>) -> Result<ProtectionSystemSpecificHe
655
654
656
655
let mut pssh_box = Vec :: new ( ) ;
657
656
try!( write_be_u32 ( & mut pssh_box, src. head . size as u32 ) ) ;
658
- pssh_box. append ( & mut vec ! [ b'p' , b's' , b's' , b'h' ] ) ;
657
+ pssh_box. append ( & mut b"pssh" . to_vec ( ) ) ;
659
658
pssh_box. append ( & mut box_content) ;
660
659
661
660
Ok ( ProtectionSystemSpecificHeaderBox {
Original file line number Diff line number Diff line change @@ -603,7 +603,12 @@ pub unsafe extern fn mp4parse_is_fragmented(parser: *mut mp4parse_parser, track_
603
603
MP4PARSE_OK
604
604
}
605
605
606
- /// Get pssh system id and pssh box content for eme playback.
606
+ /// Get 'pssh' system id and 'pssh' box content for eme playback.
607
+ ///
608
+ /// The data format in 'info' passing to gecko is:
609
+ /// system_id
610
+ /// pssh box size (in native endian)
611
+ /// pssh box content (including header)
607
612
#[ no_mangle]
608
613
pub unsafe extern fn mp4parse_get_pssh_info ( parser : * mut mp4parse_parser , info : * mut mp4parse_pssh_info ) -> mp4parse_error {
609
614
if parser. is_null ( ) || info. is_null ( ) || ( * parser) . poisoned ( ) {
@@ -623,10 +628,6 @@ pub unsafe extern fn mp4parse_get_pssh_info(parser: *mut mp4parse_parser, info:
623
628
} ,
624
629
_ => ( ) ,
625
630
}
626
- // pssh data format in gecko:
627
- // system_id
628
- // pssh size (in native endian)
629
- // pssh box content (including header)
630
631
pssh_data. extend_from_slice ( pssh. system_id . as_slice ( ) ) ;
631
632
pssh_data. extend_from_slice ( data_len. as_slice ( ) ) ;
632
633
pssh_data. extend_from_slice ( pssh. box_content . as_slice ( ) ) ;
You can’t perform that action at this time.
0 commit comments