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.Uint16StringT = exports.Uint16String = 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 Uint16String { bb = null; bb_pos = 0; __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsUint16String(bb, obj) { return (obj || new Uint16String()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsUint16String(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new Uint16String()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } key() { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.readUint16(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 startUint16String(builder) { builder.startObject(2); } static addKey(builder, key) { builder.addFieldInt16(0, key, 0); } static addValue(builder, valueOffset) { builder.addFieldOffset(1, valueOffset, 0); } static endUint16String(builder) { const offset = builder.endObject(); builder.requiredField(offset, 6); // value return offset; } static createUint16String(builder, key, valueOffset) { Uint16String.startUint16String(builder); Uint16String.addKey(builder, key); Uint16String.addValue(builder, valueOffset); return Uint16String.endUint16String(builder); } unpack() { return new Uint16StringT(this.key(), this.value()); } unpackTo(_o) { _o.key = this.key(); _o.value = this.value(); } } exports.Uint16String = Uint16String; class Uint16StringT { 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 Uint16String.createUint16String(builder, this.key, value); } } exports.Uint16StringT = Uint16StringT;