mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Add support for SAMPLE-AES and SAMPLE-AES-CTR decryption, add "Common Encryption" support to ISOBMFF demuxer, add InputFormatOptions, rewrite ISOBMFF track codec resolution
This commit is contained in:
+11
@@ -199,10 +199,21 @@ export class AsyncMutex {
|
||||
}
|
||||
}
|
||||
|
||||
export const HEX_STRING_REGEX = /^[0-9a-fA-F]+$/;
|
||||
|
||||
export const bytesToHexString = (bytes: Uint8Array) => {
|
||||
return [...bytes].map(x => x.toString(16).padStart(2, '0')).join('');
|
||||
};
|
||||
|
||||
export const hexStringToBytes = (hexString: string) => {
|
||||
assert(hexString.length % 2 === 0);
|
||||
const bytes = new Uint8Array(hexString.length / 2);
|
||||
for (let i = 0; i < hexString.length; i += 2) {
|
||||
bytes[i / 2] = parseInt(hexString.slice(i, i + 2), 16);
|
||||
}
|
||||
return bytes;
|
||||
};
|
||||
|
||||
export const reverseBitsU32 = (x: number): number => {
|
||||
x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
|
||||
x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);
|
||||
|
||||
Reference in New Issue
Block a user