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

Function generateVp9CodecString

src/codec_data.ts:1156–1174  ·  view source on GitHub ↗
(codecInfo: Vp9CodecInfo)

Source from the content-addressed store, hash-verified

1154const VP9_DEFAULT_SUFFIX = '.01.01.01.01.00';
1155
1156export const generateVp9CodecString = (codecInfo: Vp9CodecInfo) => {
1157 const profile = codecInfo.profile.toString().padStart(2, '0');
1158 const level = codecInfo.level.toString().padStart(2, '0');
1159 const bitDepth = codecInfo.bitDepth.toString().padStart(2, '0');
1160 const chromaSubsampling = codecInfo.chromaSubsampling.toString().padStart(2, '0');
1161 const colourPrimaries = codecInfo.colourPrimaries.toString().padStart(2, '0');
1162 const transferCharacteristics = codecInfo.transferCharacteristics.toString().padStart(2, '0');
1163 const matrixCoefficients = codecInfo.matrixCoefficients.toString().padStart(2, '0');
1164 const videoFullRangeFlag = codecInfo.videoFullRangeFlag.toString().padStart(2, '0');
1165
1166 let string = `vp09.${profile}.${level}.${bitDepth}.${chromaSubsampling}`;
1167 string += `.${colourPrimaries}.${transferCharacteristics}.${matrixCoefficients}.${videoFullRangeFlag}`;
1168
1169 if (string.endsWith(VP9_DEFAULT_SUFFIX)) {
1170 string = string.slice(0, -VP9_DEFAULT_SUFFIX.length);
1171 }
1172
1173 return string;
1174};
1175
1176export type Av1CodecInfo = {
1177 profile: number;

Callers 1

outputChunkMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected