UNPKG

mediasoup

Version:

Cutting Edge WebRTC Video Conferencing

132 lines (131 loc) 5.64 kB
"use strict"; // automatically generated by the FlatBuffers compiler, do not modify Object.defineProperty(exports, "__esModule", { value: true }); exports.SendNotificationT = exports.SendNotification = 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 SendNotification { bb = null; bb_pos = 0; __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsSendNotification(bb, obj) { return (obj || new SendNotification()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsSendNotification(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new SendNotification()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } ppid() { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.readUint32(this.bb_pos + offset) : 0; } data(index) { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0; } dataLength() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } dataArray() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null; } subchannels(index) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.readUint16(this.bb.__vector(this.bb_pos + offset) + index * 2) : 0; } subchannelsLength() { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } subchannelsArray() { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? new Uint16Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null; } requiredSubchannel() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.readUint16(this.bb_pos + offset) : null; } static startSendNotification(builder) { builder.startObject(4); } static addPpid(builder, ppid) { builder.addFieldInt32(0, ppid, 0); } static addData(builder, dataOffset) { builder.addFieldOffset(1, dataOffset, 0); } static createDataVector(builder, data) { builder.startVector(1, data.length, 1); for (let i = data.length - 1; i >= 0; i--) { builder.addInt8(data[i]); } return builder.endVector(); } static startDataVector(builder, numElems) { builder.startVector(1, numElems, 1); } static addSubchannels(builder, subchannelsOffset) { builder.addFieldOffset(2, subchannelsOffset, 0); } static createSubchannelsVector(builder, data) { builder.startVector(2, data.length, 2); for (let i = data.length - 1; i >= 0; i--) { builder.addInt16(data[i]); } return builder.endVector(); } static startSubchannelsVector(builder, numElems) { builder.startVector(2, numElems, 2); } static addRequiredSubchannel(builder, requiredSubchannel) { builder.addFieldInt16(3, requiredSubchannel, null); } static endSendNotification(builder) { const offset = builder.endObject(); builder.requiredField(offset, 6); // data return offset; } static createSendNotification(builder, ppid, dataOffset, subchannelsOffset, requiredSubchannel) { SendNotification.startSendNotification(builder); SendNotification.addPpid(builder, ppid); SendNotification.addData(builder, dataOffset); SendNotification.addSubchannels(builder, subchannelsOffset); if (requiredSubchannel !== null) SendNotification.addRequiredSubchannel(builder, requiredSubchannel); return SendNotification.endSendNotification(builder); } unpack() { return new SendNotificationT(this.ppid(), this.bb.createScalarList(this.data.bind(this), this.dataLength()), this.bb.createScalarList(this.subchannels.bind(this), this.subchannelsLength()), this.requiredSubchannel()); } unpackTo(_o) { _o.ppid = this.ppid(); _o.data = this.bb.createScalarList(this.data.bind(this), this.dataLength()); _o.subchannels = this.bb.createScalarList(this.subchannels.bind(this), this.subchannelsLength()); _o.requiredSubchannel = this.requiredSubchannel(); } } exports.SendNotification = SendNotification; class SendNotificationT { ppid; data; subchannels; requiredSubchannel; constructor(ppid = 0, data = [], subchannels = [], requiredSubchannel = null) { this.ppid = ppid; this.data = data; this.subchannels = subchannels; this.requiredSubchannel = requiredSubchannel; } pack(builder) { const data = SendNotification.createDataVector(builder, this.data); const subchannels = SendNotification.createSubchannelsVector(builder, this.subchannels); return SendNotification.createSendNotification(builder, this.ppid, data, subchannels, this.requiredSubchannel); } } exports.SendNotificationT = SendNotificationT;