-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
593016b
commit c887b3e
Showing
38 changed files
with
1,184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import manifestInfos from "./infos.mjs"; | ||
|
||
export { manifestInfos }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const BASE_URL = | ||
"http://" + | ||
/* eslint-disable no-undef */ | ||
__TEST_CONTENT_SERVER__.URL + | ||
":" + | ||
__TEST_CONTENT_SERVER__.PORT + | ||
/* eslint-enable no-undef */ | ||
"/DASH_DRM_static_SegmentTemplate/media/"; | ||
|
||
export default { | ||
url: BASE_URL + "encrypted_multiple_keys_number.mpd", | ||
transport: "dash", | ||
isDynamic: false, | ||
isLive: false, | ||
duration: 734, | ||
minimumPosition: 0, | ||
maximumPosition: 734, | ||
availabilityStartTime: 0, | ||
periods: [ | ||
{ | ||
start: 0, | ||
duration: 734, | ||
// TODO? | ||
adaptations: { | ||
audio: [], | ||
video: [], | ||
text: [], | ||
}, | ||
}, | ||
], | ||
}; |
Binary file added
BIN
+3.03 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/1-80399bf5/0001.m4s
Binary file not shown.
Binary file added
BIN
+990 Bytes
tests/contents/DASH_DRM_static_SegmentTemplate/media/1-80399bf5/init.mp4
Binary file not shown.
Binary file added
BIN
+3.04 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/10-80399bf5/0001.m4s
Binary file not shown.
Binary file added
BIN
+1.05 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/10-80399bf5/init.mp4
Binary file not shown.
Binary file added
BIN
+3.04 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/11-90953e09/0001.m4s
Binary file not shown.
Binary file added
BIN
+1.03 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/11-90953e09/init.mp4
Binary file not shown.
Binary file added
BIN
+3.04 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/12-90953e09/0001.m4s
Binary file not shown.
Binary file added
BIN
+1.03 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/12-90953e09/init.mp4
Binary file not shown.
Binary file added
BIN
+1.4 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/15-585f233f/0001.m4s
Binary file not shown.
Binary file added
BIN
+1.71 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/15-585f233f/init.mp4
Binary file not shown.
Binary file added
BIN
+1.4 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/16-4222bd78/0001.m4s
Binary file not shown.
Binary file added
BIN
+1.71 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/16-4222bd78/init.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+3.03 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/2-80399bf5/0001.m4s
Binary file not shown.
Binary file added
BIN
+991 Bytes
tests/contents/DASH_DRM_static_SegmentTemplate/media/2-80399bf5/init.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+3.03 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/3-80399bf5/0001.m4s
Binary file not shown.
Binary file added
BIN
+995 Bytes
tests/contents/DASH_DRM_static_SegmentTemplate/media/3-80399bf5/init.mp4
Binary file not shown.
Binary file added
BIN
+3.03 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/4-90953e09/0001.m4s
Binary file not shown.
Binary file added
BIN
+990 Bytes
tests/contents/DASH_DRM_static_SegmentTemplate/media/4-90953e09/init.mp4
Binary file not shown.
Binary file added
BIN
+3.03 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/5-90953e09/0001.m4s
Binary file not shown.
Binary file added
BIN
+992 Bytes
tests/contents/DASH_DRM_static_SegmentTemplate/media/5-90953e09/init.mp4
Binary file not shown.
Binary file added
BIN
+3.04 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/8-80399bf5/0001.m4s
Binary file not shown.
Binary file added
BIN
+1.03 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/8-80399bf5/init.mp4
Binary file not shown.
Binary file added
BIN
+3.04 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/9-80399bf5/0001.m4s
Binary file not shown.
Binary file added
BIN
+1.03 KB
tests/contents/DASH_DRM_static_SegmentTemplate/media/9-80399bf5/init.mp4
Binary file not shown.
127 changes: 127 additions & 0 deletions
127
tests/contents/DASH_DRM_static_SegmentTemplate/media/encrypted_multiple_keys_number.mpd
Large diffs are not rendered by default.
Oops, something went wrong.
138 changes: 138 additions & 0 deletions
138
tests/contents/DASH_DRM_static_SegmentTemplate/urls.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/* eslint-env node */ | ||
|
||
import * as path from "path"; | ||
import patchSegmentWithTimeOffset from "../utils/patchSegmentWithTimeOffset.mjs"; | ||
import { fileURLToPath } from "url"; | ||
|
||
const currentDirectory = path.dirname(fileURLToPath(import.meta.url)); | ||
|
||
const baseURL = "/DASH_DRM_static_SegmentTemplate/media/"; | ||
|
||
const segments = []; | ||
|
||
// video | ||
[ | ||
"8-80399bf5", | ||
"9-80399bf5", | ||
"10-80399bf5", | ||
"11-90953e09", | ||
"12-90953e09", | ||
"1-80399bf5", | ||
"2-80399bf5", | ||
"3-80399bf5", | ||
"4-90953e09", | ||
"5-90953e09", | ||
].forEach((dir) => { | ||
segments.push({ | ||
url: baseURL + dir + "/init.mp4", | ||
path: path.join(currentDirectory, `./media/${dir}/init.mp4`), | ||
content: "video/mp4", | ||
}); | ||
const duration = [ | ||
"1-80399bf5", | ||
"2-80399bf5", | ||
"3-80399bf5", | ||
"4-90953e09", | ||
"5-90953e09", | ||
].includes(dir) | ||
? 96 | ||
: 4799983; | ||
for (let i = 1; i <= 184; i++) { | ||
const nb = String(i).padStart(4, "0"); | ||
segments.push({ | ||
url: baseURL + dir + `/${nb}.m4s`, | ||
path: path.join(currentDirectory, `./media/${dir}/0001.m4s`), | ||
postProcess: (buffer) => patchMp4(buffer, (i - 1) * duration), | ||
content: "video/mp4", | ||
}); | ||
} | ||
}); | ||
|
||
[ | ||
// audio | ||
"15-585f233f", | ||
"16-4222bd78", | ||
"17", | ||
].forEach((dir) => { | ||
segments.push({ | ||
url: baseURL + dir + "/init.mp4", | ||
path: path.join(currentDirectory, `./media/${dir}/init.mp4`), | ||
content: "audio/mp4", | ||
}); | ||
const duration = 95232; | ||
for (let i = 1; i <= 185; i++) { | ||
const nb = String(i).padStart(4, "0"); | ||
segments.push({ | ||
url: baseURL + dir + `/${nb}.m4s`, | ||
path: path.join(currentDirectory, `./media/${dir}/0001.m4s`), | ||
postProcess: (buffer) => patchMp4(buffer, (i - 1) * duration), | ||
content: "audio/mp4", | ||
}); | ||
} | ||
}); | ||
|
||
[ | ||
// subtitles | ||
"19", | ||
"27", | ||
].forEach((dir) => { | ||
segments.push({ | ||
url: baseURL + dir + "/init.mp4", | ||
path: path.join(currentDirectory, `./media/${dir}/init.mp4`), | ||
content: "application/mp4", | ||
}); | ||
const duration = 4000; | ||
for (let i = 1; i <= 184; i++) { | ||
const nb = String(i).padStart(4, "0"); | ||
segments.push({ | ||
url: baseURL + dir + `/${nb}.m4s`, | ||
path: path.join(currentDirectory, `./media/${dir}/0001.m4s`), | ||
postProcess: (buffer) => patchMp4(buffer, (i - 1) * duration), | ||
content: "application/mp4", | ||
}); | ||
} | ||
}); | ||
|
||
export default [ | ||
// Manifest | ||
{ | ||
url: baseURL + "encrypted_multiple_keys_number.mpd", | ||
path: path.join(currentDirectory, "./media/encrypted_multiple_keys_number.mpd"), | ||
contentType: "application/dash+xml", | ||
}, | ||
...segments, | ||
]; | ||
|
||
/** | ||
* Translate groups of 4 big-endian bytes to Integer. | ||
* @param {Uint8Array} bytes | ||
* @param {Number} offset - The offset (from the start of the given array) | ||
* @returns {Number} | ||
*/ | ||
function be4toi(bytes, offset) { | ||
return ( | ||
bytes[offset + 0] * 0x1000000 + | ||
bytes[offset + 1] * 0x0010000 + | ||
bytes[offset + 2] * 0x0000100 + | ||
bytes[offset + 3] | ||
); | ||
} | ||
|
||
function patchMp4(buffer, startTime) { | ||
const bufferu8 = new Uint8Array(buffer); | ||
let ret = bufferu8; | ||
|
||
// If it just finishes with "mdat", fill in the rest with 0 | ||
if ( | ||
bufferu8[bufferu8.length - 4] === 0x6d && | ||
bufferu8[bufferu8.length - 3] === 0x64 && | ||
bufferu8[bufferu8.length - 2] === 0x61 && | ||
bufferu8[bufferu8.length - 1] === 0x74 | ||
) { | ||
const mdatLen = be4toi(bufferu8, bufferu8.length - 8); | ||
const remainingLength = mdatLen - 8; | ||
ret = new Uint8Array(bufferu8.length + remainingLength); | ||
ret.set(bufferu8, 0); | ||
} | ||
return patchSegmentWithTimeOffset(ret, startTime).buffer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.