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

Function generateHevcCodecString

src/codec_data.ts:854–881  ·  view source on GitHub ↗
(record: HevcDecoderConfigurationRecord)

Source from the content-addressed store, hash-verified

852};
853
854export const generateHevcCodecString = (record: HevcDecoderConfigurationRecord) => {
855 const generalProfileSpace = record.generalProfileSpace;
856 const generalProfileIdc = record.generalProfileIdc;
857 const compatibilityFlags = reverseBitsU32(record.generalProfileCompatibilityFlags);
858 const generalTierFlag = record.generalTierFlag;
859 const generalLevelIdc = record.generalLevelIdc;
860 const constraintFlags = [...record.generalConstraintIndicatorFlags];
861
862 let codecString = 'hev1.';
863
864 codecString += ['', 'A', 'B', 'C'][generalProfileSpace] + generalProfileIdc;
865 codecString += '.';
866 codecString += compatibilityFlags.toString(16).toUpperCase();
867 codecString += '.';
868 codecString += generalTierFlag === 0 ? 'L' : 'H';
869 codecString += generalLevelIdc;
870
871 while (constraintFlags.length > 0 && constraintFlags[constraintFlags.length - 1] === 0) {
872 constraintFlags.pop();
873 }
874
875 if (constraintFlags.length > 0) {
876 codecString += '.';
877 codecString += constraintFlags.map(x => x.toString(16).toUpperCase()).join('.');
878 }
879
880 return codecString;
881};
882
883/** Serializes an HevcDecoderConfigurationRecord into the format specified in Section 8.3.3.1 of ISO 14496-15. */
884export const serializeHevcDecoderConfigurationRecord = (record: HevcDecoderConfigurationRecord) => {

Callers 1

outputChunkMethod · 0.85

Calls 1

reverseBitsU32Function · 0.85

Tested by

no test coverage detected