blob: 1ddcd9cf9c711017969ee02070ac08b64772c7e6 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="video-test.js"></script>
<script>
function HEVCParameterSetToString(set) {
return `{ ${set.generalProfileSpace }, ${set.generalProfileIDC }, ${set.generalProfileCompatibilityFlags }, ${set.generalTierFlag }, ${set.generalLevelIDC } }`;
}
function isEqualHEVCParameterSet(setA, setB) {
return setA.generalProfileSpace === setB.generalProfileSpace
&& setA.generalProfileIDC === setB.generalProfileIDC
&& setA.generalProfileCompatibilityFlags === setB.generalProfileCompatibilityFlags
&& setA.generalTierFlag === setB.generalTierFlag
&& setA.generalLevelIDC === setB.generalLevelIDC
}
function makeHEVCParameterSet(generalProfileSpace, generalProfileIDC, generalProfileCompatibilityFlags, generalTierFlag, generalLevelIDC)
{
return {
generalProfileSpace: generalProfileSpace,
generalProfileIDC: generalProfileIDC,
generalProfileCompatibilityFlags: generalProfileCompatibilityFlags,
generalTierFlag: generalTierFlag,
generalLevelIDC: generalLevelIDC,
};
}
function testExpectedHEVCParameterSet(testFuncString, expected)
{
let observed = eval(testFuncString);
let success = isEqualHEVCParameterSet(observed, expected);
reportExpected(success, testFuncString, '===', HEVCParameterSetToString(expected), HEVCParameterSetToString(observed));
}
window.addEventListener('load', event => {
testExpected('internals.parseHEVCCodecParameters("bad-parameter")', null);
testExpected('internals.parseHEVCCodecParameters("hvc1")', null);
testExpectedHEVCParameterSet('internals.parseHEVCCodecParameters("hev1.1.6.L93")', makeHEVCParameterSet(0, 1, 6, false, 93));
testExpectedHEVCParameterSet('internals.parseHEVCCodecParameters("hev1.A4.41.H120")', makeHEVCParameterSet(1, 4, 65, true, 120));
testExpectedHEVCParameterSet('internals.parseHEVCCodecParameters("hev1.B1.4.L63")', makeHEVCParameterSet(2, 1, 4, false, 63));
testExpected('internals.parseHEVCCodecParameters("hev1.D1.4.L63")', null);
testExpected('internals.parseHEVCCodecParameters("hev1.B1.4.L68000")', null);
endTest();
}, { once: true });
</script>
</head>
<body>
</body>
</html>