Parse 'pssh' box for eme playback.#43
Conversation
| } | ||
|
|
||
| fn read_pssh<T: Read>(src: &mut BMFFBox<T>) -> Result<ProtectionSystemSpecificHeaderBox> { | ||
| let mut box_content = Vec::new(); |
There was a problem hiding this comment.
You might save some allocations here if you use Vec::with_capacity(src.head.size); but it probably doesn't matter.
| let item = try!(read_buf(pssh, 16)); | ||
| kid.push(item); | ||
| count -= 1; | ||
| } |
There was a problem hiding this comment.
I think for _ in 0..count would be better than a while loop here. It's a little awkward, but there's one less line of code, and count doesn't need to be mut.
| // pssh data format in gecko: | ||
| // system_id | ||
| // pssh size (in native endian) | ||
| // pssh box content (including header) |
There was a problem hiding this comment.
It might be better to put this description in the function-level doc-comment above, since it's something a caller would need to know, not just an internal implementation detail.
|
|
||
| let mut pssh_box = Vec::new(); | ||
| try!(write_be_u32(&mut pssh_box, src.head.size as u32)); | ||
| pssh_box.append(&mut vec![b'p', b's', b's', b'h']); |
There was a problem hiding this comment.
You can pssh_box.extend(b"pssh"); which is a bit easier to read.
NB there's also Vec::extend_from_slice() but extend is equally fast in rust 1.14, so I don't think it's worth using the longer method name here. rust-lang/rust#37094
|
Thanks for review. All comments addressed. |
61b3a46 to
c7f93c2
Compare
c7f93c2 to
e545d15
Compare
|
Thanks! |
No description provided.