Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

Commit 3301db9

Browse files
committed
Add support for PSSH box version 1
* According to https://docs.axinom.com/services/drm/technical-articles/pssh/#versions-of-the-pssh-box version 1 of PSSH box contains two additional fields kid_count and kids.
1 parent e051aff commit 3301db9

File tree

1 file changed

+13
-3
lines changed
  • crates/playready/src/binary_format

1 file changed

+13
-3
lines changed

crates/playready/src/binary_format/pssh.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
#![allow(dead_code)]
22

3-
use binrw::BinRead;
3+
use binrw::{helpers::read_u24, BinRead};
44

55
#[derive(BinRead, Debug, Clone)]
6-
#[br(big, assert(&pssh == b"pssh" && system_id == [0x9a, 0x04, 0xf0, 0x79, 0x98, 0x40, 0x42, 0x86, 0xab, 0x92, 0xe6, 0x5b, 0xe0, 0x88, 0x5f, 0x95]))]
6+
#[br(big,
7+
assert(&pssh == b"pssh" &&
8+
system_id == [0x9a, 0x04, 0xf0, 0x79, 0x98, 0x40, 0x42, 0x86, 0xab, 0x92, 0xe6, 0x5b, 0xe0, 0x88, 0x5f, 0x95] &&
9+
[0, 1].contains(&version))
10+
)]
711
pub struct PSSHBox {
812
pub length: u32,
913
pub pssh: [u8; 4],
10-
pub fullbox: u32,
14+
pub version: u8,
15+
#[br(parse_with = read_u24)]
16+
pub flags: u32,
1117
pub system_id: [u8; 16],
18+
#[br(if(version == 1))]
19+
pub kid_count: u32,
20+
#[br(if(version == 1), count = kid_count)]
21+
pub kids: Vec<[u8; 16]>,
1222
pub data_length: u32,
1323
pub data: PlayreadyHeader,
1424
}

0 commit comments

Comments
 (0)