UNPKG

mediasoup

Version:

Cutting Edge WebRTC Video Conferencing

118 lines (117 loc) 5.26 kB
"use strict"; // automatically generated by the FlatBuffers compiler, do not modify Object.defineProperty(exports, "__esModule", { value: true }); exports.ProduceDataRequestT = exports.ProduceDataRequest = void 0; /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ const flatbuffers = require("flatbuffers"); const type_1 = require("../../fbs/data-producer/type"); const sctp_stream_parameters_1 = require("../../fbs/sctp-parameters/sctp-stream-parameters"); class ProduceDataRequest { bb = null; bb_pos = 0; __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsProduceDataRequest(bb, obj) { return (obj || new ProduceDataRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsProduceDataRequest(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new ProduceDataRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } dataProducerId(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } type() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.readUint8(this.bb_pos + offset) : type_1.Type.SCTP; } sctpStreamParameters(obj) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? (obj || new sctp_stream_parameters_1.SctpStreamParameters()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } label(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } protocol(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } paused() { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } static startProduceDataRequest(builder) { builder.startObject(6); } static addDataProducerId(builder, dataProducerIdOffset) { builder.addFieldOffset(0, dataProducerIdOffset, 0); } static addType(builder, type) { builder.addFieldInt8(1, type, type_1.Type.SCTP); } static addSctpStreamParameters(builder, sctpStreamParametersOffset) { builder.addFieldOffset(2, sctpStreamParametersOffset, 0); } static addLabel(builder, labelOffset) { builder.addFieldOffset(3, labelOffset, 0); } static addProtocol(builder, protocolOffset) { builder.addFieldOffset(4, protocolOffset, 0); } static addPaused(builder, paused) { builder.addFieldInt8(5, +paused, +false); } static endProduceDataRequest(builder) { const offset = builder.endObject(); builder.requiredField(offset, 4); // data_producer_id return offset; } unpack() { return new ProduceDataRequestT(this.dataProducerId(), this.type(), (this.sctpStreamParameters() !== null ? this.sctpStreamParameters().unpack() : null), this.label(), this.protocol(), this.paused()); } unpackTo(_o) { _o.dataProducerId = this.dataProducerId(); _o.type = this.type(); _o.sctpStreamParameters = (this.sctpStreamParameters() !== null ? this.sctpStreamParameters().unpack() : null); _o.label = this.label(); _o.protocol = this.protocol(); _o.paused = this.paused(); } } exports.ProduceDataRequest = ProduceDataRequest; class ProduceDataRequestT { dataProducerId; type; sctpStreamParameters; label; protocol; paused; constructor(dataProducerId = null, type = type_1.Type.SCTP, sctpStreamParameters = null, label = null, protocol = null, paused = false) { this.dataProducerId = dataProducerId; this.type = type; this.sctpStreamParameters = sctpStreamParameters; this.label = label; this.protocol = protocol; this.paused = paused; } pack(builder) { const dataProducerId = (this.dataProducerId !== null ? builder.createString(this.dataProducerId) : 0); const sctpStreamParameters = (this.sctpStreamParameters !== null ? this.sctpStreamParameters.pack(builder) : 0); const label = (this.label !== null ? builder.createString(this.label) : 0); const protocol = (this.protocol !== null ? builder.createString(this.protocol) : 0); ProduceDataRequest.startProduceDataRequest(builder); ProduceDataRequest.addDataProducerId(builder, dataProducerId); ProduceDataRequest.addType(builder, this.type); ProduceDataRequest.addSctpStreamParameters(builder, sctpStreamParameters); ProduceDataRequest.addLabel(builder, label); ProduceDataRequest.addProtocol(builder, protocol); ProduceDataRequest.addPaused(builder, this.paused); return ProduceDataRequest.endProduceDataRequest(builder); } } exports.ProduceDataRequestT = ProduceDataRequestT;