| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="video-test.js"></script> |
| <script> |
| function DoViParameterSetToString(set) { |
| if (!set) |
| return `null`; |
| return `{ ${set.codecName}, ${set.bitstreamProfileID }, ${set.bitstreamLevelID } }`; |
| } |
| function isEqualDoViParameterSet(setA, setB) { |
| return setA && setB |
| && setA.codecName === setB.codecName |
| && setA.bitstreamProfileID === setB.bitstreamProfileID |
| && setA.bitstreamLevelID === setB.bitstreamLevelID |
| } |
| function makeDoViParameterSet(codecName, bitstreamProfileID, bitstreamLevelID) |
| { |
| return { |
| codecName: codecName, |
| bitstreamProfileID: bitstreamProfileID, |
| bitstreamLevelID: bitstreamLevelID, |
| }; |
| } |
| function testExpectedDoViParameterSet(testFuncString, expected) |
| { |
| let observed = eval(testFuncString); |
| let success = isEqualDoViParameterSet(observed, expected); |
| reportExpected(success, testFuncString, '===', DoViParameterSetToString(expected), DoViParameterSetToString(observed)); |
| } |
| window.addEventListener('load', event => { |
| testExpected('internals.parseDoViCodecParameters("bad-parameter")', null); |
| testExpected('internals.parseDoViCodecParameters("dvh1")', null); |
| testExpectedDoViParameterSet('internals.parseDoViCodecParameters("dvh1.04.09")', makeDoViParameterSet('hvc1', 4, 9)); |
| testExpectedDoViParameterSet('internals.parseDoViCodecParameters("dvh1.05.13")', makeDoViParameterSet('hvc1', 5, 13)); |
| testExpectedDoViParameterSet('internals.parseDoViCodecParameters("dvhe.07.09")', makeDoViParameterSet('hev1', 7, 9)); |
| testExpectedDoViParameterSet('internals.parseDoViCodecParameters("dvhe.dtr.9")', makeDoViParameterSet('hev1', 4, 9)); |
| testExpectedDoViParameterSet('internals.parseDoViCodecParameters("dvhe.stn.9")', makeDoViParameterSet('hev1', 5, 9)); |
| testExpectedDoViParameterSet('internals.parseDoViCodecParameters("dvhe.dtb.9")', makeDoViParameterSet('hev1', 7, 9)); |
| testExpectedDoViParameterSet('internals.parseDoViCodecParameters("dvhe.st.9")', makeDoViParameterSet('hev1', 8, 9)); |
| testExpectedDoViParameterSet('internals.parseDoViCodecParameters("dvav.se.5")', makeDoViParameterSet('avc3', 9, 5)); |
| testExpected('internals.parseDoViCodecParameters("dvh1.06.01")', null); |
| testExpected('internals.parseDoViCodecParameters("dvhe.03.01")', null); |
| testExpected('internals.parseDoViCodecParameters("dvh1.09.01")', null); |
| testExpected('internals.parseDoViCodecParameters("dvav.04.01")', null); |
| |
| endTest(); |
| }, { once: true }); |
| </script> |
| </head> |
| <body> |
| </body> |
| </html> |