Skip to content

Commit

Permalink
feat: parse mp4protection ContentProtection tags
Browse files Browse the repository at this point in the history
  • Loading branch information
adrums86 committed Dec 8, 2023
1 parent 56eee17 commit cc0c2e4
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/inheritAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const keySystemsMap = {
'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey',
'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha',
'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready',
'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime'
'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime',
// ISO-IEC 23009-1_2022 5.8.5.2.2 The mp4 Protection Scheme
'urn:mpeg:dash:mp4protection:2011': 'mp4protection'
};

/**
Expand Down
14 changes: 14 additions & 0 deletions test/inheritAttributes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2556,6 +2556,13 @@ QUnit.test('keySystem info for representation - lowercase UUIDs', function(asser
value: 'Widevine'
},
pssh: widevinePsshBytes
},
'mp4protection': {
attributes: {
'cenc:default_KID': '0872786e-f9e7-465f-a3a2-4e5b0ef8fa45',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
},
'height': 404,
Expand Down Expand Up @@ -2644,6 +2651,13 @@ QUnit.test('keySystem info for representation - uppercase UUIDs', function(asser
value: 'Widevine'
},
pssh: widevinePsshBytes
},
'mp4protection': {
attributes: {
'cenc:default_KID': '0872786E-F9E7-465F-A3A2-4E5B0EF8FA45',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
},
'height': 404,
Expand Down
42 changes: 42 additions & 0 deletions test/manifests/maat_vtt_segmentTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -159,6 +166,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down Expand Up @@ -242,6 +256,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -317,6 +338,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down Expand Up @@ -480,6 +508,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -562,6 +597,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down
35 changes: 35 additions & 0 deletions test/manifests/multiperiod-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -596,6 +603,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down Expand Up @@ -901,6 +915,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -1194,6 +1215,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -1487,6 +1515,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down
35 changes: 35 additions & 0 deletions test/manifests/multiperiod.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -596,6 +603,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down Expand Up @@ -901,6 +915,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -1194,6 +1215,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -1487,6 +1515,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down
42 changes: 42 additions & 0 deletions test/manifests/vtt_codecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -168,6 +175,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down Expand Up @@ -254,6 +268,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -332,6 +353,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down Expand Up @@ -505,6 +533,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
},
Expand Down Expand Up @@ -590,6 +625,13 @@ export const parsedManifest = {
schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
},
pssh: new Uint8Array([181, 235, 45])
},
'mp4protection': {
attributes: {
'cenc:default_KID': 'aaa',
'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',
'value': 'cenc'
}
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions test/segment/segmentTemplate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,13 +760,6 @@ QUnit.test('correctly handles negative @r repeat value for last S', function(ass
);
});

QUnit.skip(
'detects discontinuity when @t time is greater than expected start time',
function(assert) {

}
);

QUnit.module('segmentTemplate - type ="dynamic"');

QUnit.test('correctly handles duration', function(assert) {
Expand Down

0 comments on commit cc0c2e4

Please sign in to comment.