mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 10:53:50 +02:00
Implement Ogg demuxer
This commit is contained in:
+24
@@ -237,6 +237,16 @@ export const removeItem = <T>(arr: T[], item: T) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const findLast = <T>(arr: T[], predicate: (x: T) => boolean) => {
|
||||
for (let i = arr.length - 1; i >= 0; i--) {
|
||||
if (predicate(arr[i]!)) {
|
||||
return arr[i];
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const findLastIndex = <T>(arr: T[], predicate: (x: T) => boolean) => {
|
||||
for (let i = arr.length - 1; i >= 0; i--) {
|
||||
if (predicate(arr[i]!)) {
|
||||
@@ -367,3 +377,17 @@ export const setVideoFrameTiming = (frame: VideoFrame, timing: {
|
||||
|
||||
return clone;
|
||||
};
|
||||
|
||||
export const roundToPrecision = (value: number, digits: number) => {
|
||||
const factor = 10 ** digits;
|
||||
return Math.round(value * factor) / factor;
|
||||
};
|
||||
|
||||
export const ilog = (x: number) => {
|
||||
let ret = 0;
|
||||
while (x) {
|
||||
ret++;
|
||||
x >>= 1;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user