MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / getHardwareEncoderCodec

Function getHardwareEncoderCodec

src/misc.ts:533–539  ·  view source on GitHub ↗
(codecId: AVCodecID)

Source from the content-addressed store, hash-verified

531
532const hardwareEncoderCodecCache = new Map<AVCodecID, Codec | null>();
533export const getHardwareEncoderCodec = (codecId: AVCodecID): Codec | null => {
534 if (!hardwareEncoderCodecCache.has(codecId)) {
535 const hw = getHardwareContext();
536 hardwareEncoderCodecCache.set(codecId, hw?.getEncoderCodec(codecId) ?? null);
537 }
538 return hardwareEncoderCodecCache.get(codecId)!;
539};
540
541const hardwareDecoderCodecCache = new Map<AVCodecID, Codec | null>();
542export const getHardwareDecoderCodec = (codecId: AVCodecID): Codec | null => {

Callers 1

createCodecContextMethod · 0.85

Calls 1

getHardwareContextFunction · 0.85

Tested by

no test coverage detected