UNPKG

mediasoup

Version:

Cutting Edge WebRTC Video Conferencing

232 lines (231 loc) 11.3 kB
"use strict"; // automatically generated by the FlatBuffers compiler, do not modify Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseConsumerDumpT = exports.BaseConsumerDump = 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 media_kind_1 = require("../../fbs/rtp-parameters/media-kind"); const rtp_encoding_parameters_1 = require("../../fbs/rtp-parameters/rtp-encoding-parameters"); const rtp_parameters_1 = require("../../fbs/rtp-parameters/rtp-parameters"); const type_1 = require("../../fbs/rtp-parameters/type"); class BaseConsumerDump { bb = null; bb_pos = 0; __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsBaseConsumerDump(bb, obj) { return (obj || new BaseConsumerDump()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsBaseConsumerDump(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new BaseConsumerDump()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } id(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.SIMPLE; } producerId(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } kind() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.readUint8(this.bb_pos + offset) : media_kind_1.MediaKind.AUDIO; } rtpParameters(obj) { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? (obj || new rtp_parameters_1.RtpParameters()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } consumableRtpEncodings(index, obj) { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? (obj || new rtp_encoding_parameters_1.RtpEncodingParameters()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } consumableRtpEncodingsLength() { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } supportedCodecPayloadTypes(index) { const offset = this.bb.__offset(this.bb_pos, 16); return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0; } supportedCodecPayloadTypesLength() { const offset = this.bb.__offset(this.bb_pos, 16); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } supportedCodecPayloadTypesArray() { const offset = this.bb.__offset(this.bb_pos, 16); 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; } traceEventTypes(index) { const offset = this.bb.__offset(this.bb_pos, 18); return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0; } traceEventTypesLength() { const offset = this.bb.__offset(this.bb_pos, 18); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } traceEventTypesArray() { const offset = this.bb.__offset(this.bb_pos, 18); 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; } paused() { const offset = this.bb.__offset(this.bb_pos, 20); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } producerPaused() { const offset = this.bb.__offset(this.bb_pos, 22); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } priority() { const offset = this.bb.__offset(this.bb_pos, 24); return offset ? this.bb.readUint8(this.bb_pos + offset) : 0; } static startBaseConsumerDump(builder) { builder.startObject(11); } static addId(builder, idOffset) { builder.addFieldOffset(0, idOffset, 0); } static addType(builder, type) { builder.addFieldInt8(1, type, type_1.Type.SIMPLE); } static addProducerId(builder, producerIdOffset) { builder.addFieldOffset(2, producerIdOffset, 0); } static addKind(builder, kind) { builder.addFieldInt8(3, kind, media_kind_1.MediaKind.AUDIO); } static addRtpParameters(builder, rtpParametersOffset) { builder.addFieldOffset(4, rtpParametersOffset, 0); } static addConsumableRtpEncodings(builder, consumableRtpEncodingsOffset) { builder.addFieldOffset(5, consumableRtpEncodingsOffset, 0); } static createConsumableRtpEncodingsVector(builder, data) { builder.startVector(4, data.length, 4); for (let i = data.length - 1; i >= 0; i--) { builder.addOffset(data[i]); } return builder.endVector(); } static startConsumableRtpEncodingsVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addSupportedCodecPayloadTypes(builder, supportedCodecPayloadTypesOffset) { builder.addFieldOffset(6, supportedCodecPayloadTypesOffset, 0); } static createSupportedCodecPayloadTypesVector(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 startSupportedCodecPayloadTypesVector(builder, numElems) { builder.startVector(1, numElems, 1); } static addTraceEventTypes(builder, traceEventTypesOffset) { builder.addFieldOffset(7, traceEventTypesOffset, 0); } static createTraceEventTypesVector(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 startTraceEventTypesVector(builder, numElems) { builder.startVector(1, numElems, 1); } static addPaused(builder, paused) { builder.addFieldInt8(8, +paused, +false); } static addProducerPaused(builder, producerPaused) { builder.addFieldInt8(9, +producerPaused, +false); } static addPriority(builder, priority) { builder.addFieldInt8(10, priority, 0); } static endBaseConsumerDump(builder) { const offset = builder.endObject(); builder.requiredField(offset, 4); // id builder.requiredField(offset, 8); // producer_id builder.requiredField(offset, 12); // rtp_parameters builder.requiredField(offset, 14); // consumable_rtp_encodings builder.requiredField(offset, 16); // supported_codec_payload_types builder.requiredField(offset, 18); // trace_event_types return offset; } unpack() { return new BaseConsumerDumpT(this.id(), this.type(), this.producerId(), this.kind(), (this.rtpParameters() !== null ? this.rtpParameters().unpack() : null), this.bb.createObjList(this.consumableRtpEncodings.bind(this), this.consumableRtpEncodingsLength()), this.bb.createScalarList(this.supportedCodecPayloadTypes.bind(this), this.supportedCodecPayloadTypesLength()), this.bb.createScalarList(this.traceEventTypes.bind(this), this.traceEventTypesLength()), this.paused(), this.producerPaused(), this.priority()); } unpackTo(_o) { _o.id = this.id(); _o.type = this.type(); _o.producerId = this.producerId(); _o.kind = this.kind(); _o.rtpParameters = (this.rtpParameters() !== null ? this.rtpParameters().unpack() : null); _o.consumableRtpEncodings = this.bb.createObjList(this.consumableRtpEncodings.bind(this), this.consumableRtpEncodingsLength()); _o.supportedCodecPayloadTypes = this.bb.createScalarList(this.supportedCodecPayloadTypes.bind(this), this.supportedCodecPayloadTypesLength()); _o.traceEventTypes = this.bb.createScalarList(this.traceEventTypes.bind(this), this.traceEventTypesLength()); _o.paused = this.paused(); _o.producerPaused = this.producerPaused(); _o.priority = this.priority(); } } exports.BaseConsumerDump = BaseConsumerDump; class BaseConsumerDumpT { id; type; producerId; kind; rtpParameters; consumableRtpEncodings; supportedCodecPayloadTypes; traceEventTypes; paused; producerPaused; priority; constructor(id = null, type = type_1.Type.SIMPLE, producerId = null, kind = media_kind_1.MediaKind.AUDIO, rtpParameters = null, consumableRtpEncodings = [], supportedCodecPayloadTypes = [], traceEventTypes = [], paused = false, producerPaused = false, priority = 0) { this.id = id; this.type = type; this.producerId = producerId; this.kind = kind; this.rtpParameters = rtpParameters; this.consumableRtpEncodings = consumableRtpEncodings; this.supportedCodecPayloadTypes = supportedCodecPayloadTypes; this.traceEventTypes = traceEventTypes; this.paused = paused; this.producerPaused = producerPaused; this.priority = priority; } pack(builder) { const id = (this.id !== null ? builder.createString(this.id) : 0); const producerId = (this.producerId !== null ? builder.createString(this.producerId) : 0); const rtpParameters = (this.rtpParameters !== null ? this.rtpParameters.pack(builder) : 0); const consumableRtpEncodings = BaseConsumerDump.createConsumableRtpEncodingsVector(builder, builder.createObjectOffsetList(this.consumableRtpEncodings)); const supportedCodecPayloadTypes = BaseConsumerDump.createSupportedCodecPayloadTypesVector(builder, this.supportedCodecPayloadTypes); const traceEventTypes = BaseConsumerDump.createTraceEventTypesVector(builder, this.traceEventTypes); BaseConsumerDump.startBaseConsumerDump(builder); BaseConsumerDump.addId(builder, id); BaseConsumerDump.addType(builder, this.type); BaseConsumerDump.addProducerId(builder, producerId); BaseConsumerDump.addKind(builder, this.kind); BaseConsumerDump.addRtpParameters(builder, rtpParameters); BaseConsumerDump.addConsumableRtpEncodings(builder, consumableRtpEncodings); BaseConsumerDump.addSupportedCodecPayloadTypes(builder, supportedCodecPayloadTypes); BaseConsumerDump.addTraceEventTypes(builder, traceEventTypes); BaseConsumerDump.addPaused(builder, this.paused); BaseConsumerDump.addProducerPaused(builder, this.producerPaused); BaseConsumerDump.addPriority(builder, this.priority); return BaseConsumerDump.endBaseConsumerDump(builder); } } exports.BaseConsumerDumpT = BaseConsumerDumpT;