UNPKG

mediasoup

Version:

Cutting Edge WebRTC Video Conferencing

72 lines (71 loc) 2.5 kB
"use strict"; // automatically generated by the FlatBuffers compiler, do not modify Object.defineProperty(exports, "__esModule", { value: true }); exports.Uint32StringT = exports.Uint32String = void 0; /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ const flatbuffers = require("flatbuffers"); class Uint32String { bb = null; bb_pos = 0; __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsUint32String(bb, obj) { return (obj || new Uint32String()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsUint32String(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new Uint32String()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } key() { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.readUint32(this.bb_pos + offset) : 0; } value(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } static startUint32String(builder) { builder.startObject(2); } static addKey(builder, key) { builder.addFieldInt32(0, key, 0); } static addValue(builder, valueOffset) { builder.addFieldOffset(1, valueOffset, 0); } static endUint32String(builder) { const offset = builder.endObject(); builder.requiredField(offset, 6); // value return offset; } static createUint32String(builder, key, valueOffset) { Uint32String.startUint32String(builder); Uint32String.addKey(builder, key); Uint32String.addValue(builder, valueOffset); return Uint32String.endUint32String(builder); } unpack() { return new Uint32StringT(this.key(), this.value()); } unpackTo(_o) { _o.key = this.key(); _o.value = this.value(); } } exports.Uint32String = Uint32String; class Uint32StringT { key; value; constructor(key = 0, value = null) { this.key = key; this.value = value; } pack(builder) { const value = (this.value !== null ? builder.createString(this.value) : 0); return Uint32String.createUint32String(builder, this.key, value); } } exports.Uint32StringT = Uint32StringT;