From cc0c2e40c5185e26e70bb1e8ea03de358d2a8d7e Mon Sep 17 00:00:00 2001 From: Adam Waldron Date: Thu, 7 Dec 2023 19:33:14 -0800 Subject: [PATCH 1/2] feat: parse mp4protection ContentProtection tags --- src/inheritAttributes.js | 4 ++- test/inheritAttributes.test.js | 14 ++++++++ test/manifests/maat_vtt_segmentTemplate.js | 42 ++++++++++++++++++++++ test/manifests/multiperiod-dynamic.js | 35 ++++++++++++++++++ test/manifests/multiperiod.js | 35 ++++++++++++++++++ test/manifests/vtt_codecs.js | 42 ++++++++++++++++++++++ test/segment/segmentTemplate.test.js | 7 ---- 7 files changed, 171 insertions(+), 8 deletions(-) diff --git a/src/inheritAttributes.js b/src/inheritAttributes.js index f6983a6e..23c9a912 100644 --- a/src/inheritAttributes.js +++ b/src/inheritAttributes.js @@ -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' }; /** diff --git a/test/inheritAttributes.test.js b/test/inheritAttributes.test.js index dae013fe..637fecd2 100644 --- a/test/inheritAttributes.test.js +++ b/test/inheritAttributes.test.js @@ -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, @@ -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, diff --git a/test/manifests/maat_vtt_segmentTemplate.js b/test/manifests/maat_vtt_segmentTemplate.js index 38894c9c..b9987e07 100644 --- a/test/manifests/maat_vtt_segmentTemplate.js +++ b/test/manifests/maat_vtt_segmentTemplate.js @@ -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' + } } } }, @@ -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' + } } } } @@ -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' + } } } }, @@ -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' + } } } } @@ -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' + } } } }, @@ -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' + } } } } diff --git a/test/manifests/multiperiod-dynamic.js b/test/manifests/multiperiod-dynamic.js index 2d98b4ee..bc6807d8 100644 --- a/test/manifests/multiperiod-dynamic.js +++ b/test/manifests/multiperiod-dynamic.js @@ -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' + } } } }, @@ -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' + } } } } @@ -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' + } } } }, @@ -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' + } } } }, @@ -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' + } } } } diff --git a/test/manifests/multiperiod.js b/test/manifests/multiperiod.js index c0550ad4..30275115 100644 --- a/test/manifests/multiperiod.js +++ b/test/manifests/multiperiod.js @@ -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' + } } } }, @@ -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' + } } } } @@ -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' + } } } }, @@ -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' + } } } }, @@ -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' + } } } } diff --git a/test/manifests/vtt_codecs.js b/test/manifests/vtt_codecs.js index aa80010a..bbc03eee 100644 --- a/test/manifests/vtt_codecs.js +++ b/test/manifests/vtt_codecs.js @@ -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' + } } } }, @@ -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' + } } } } @@ -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' + } } } }, @@ -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' + } } } } @@ -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' + } } } }, @@ -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' + } } } } diff --git a/test/segment/segmentTemplate.test.js b/test/segment/segmentTemplate.test.js index a40edb6e..04232861 100644 --- a/test/segment/segmentTemplate.test.js +++ b/test/segment/segmentTemplate.test.js @@ -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) { From d771b45fa7d61511e7adb29a3b9e86230f14e0b2 Mon Sep 17 00:00:00 2001 From: Adam Waldron Date: Thu, 7 Dec 2023 19:49:05 -0800 Subject: [PATCH 2/2] fix comment --- src/inheritAttributes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inheritAttributes.js b/src/inheritAttributes.js index 23c9a912..494c59de 100644 --- a/src/inheritAttributes.js +++ b/src/inheritAttributes.js @@ -11,7 +11,7 @@ const keySystemsMap = { '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', - // ISO-IEC 23009-1_2022 5.8.5.2.2 The mp4 Protection Scheme + // ISO_IEC 23009-1_2022 5.8.5.2.2 The mp4 Protection Scheme 'urn:mpeg:dash:mp4protection:2011': 'mp4protection' };