"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParamsT = exports.Params = 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 Params {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsParams(bb, obj) {
        return (obj || new Params()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsParams(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new Params()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    encodingIdx() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
    }
    ssrc() {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
    }
    payloadType() {
        const offset = this.bb.__offset(this.bb_pos, 8);
        return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
    }
    mimeType(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 10);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    clockRate() {
        const offset = this.bb.__offset(this.bb_pos, 12);
        return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
    }
    rid(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 14);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    cname(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 16);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    rtxSsrc() {
        const offset = this.bb.__offset(this.bb_pos, 18);
        return offset ? this.bb.readUint32(this.bb_pos + offset) : null;
    }
    rtxPayloadType() {
        const offset = this.bb.__offset(this.bb_pos, 20);
        return offset ? this.bb.readUint8(this.bb_pos + offset) : null;
    }
    useNack() {
        const offset = this.bb.__offset(this.bb_pos, 22);
        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
    }
    usePli() {
        const offset = this.bb.__offset(this.bb_pos, 24);
        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
    }
    useFir() {
        const offset = this.bb.__offset(this.bb_pos, 26);
        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
    }
    useInBandFec() {
        const offset = this.bb.__offset(this.bb_pos, 28);
        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
    }
    useDtx() {
        const offset = this.bb.__offset(this.bb_pos, 30);
        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
    }
    spatialLayers() {
        const offset = this.bb.__offset(this.bb_pos, 32);
        return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
    }
    temporalLayers() {
        const offset = this.bb.__offset(this.bb_pos, 34);
        return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
    }
    static startParams(builder) {
        builder.startObject(16);
    }
    static addEncodingIdx(builder, encodingIdx) {
        builder.addFieldInt32(0, encodingIdx, 0);
    }
    static addSsrc(builder, ssrc) {
        builder.addFieldInt32(1, ssrc, 0);
    }
    static addPayloadType(builder, payloadType) {
        builder.addFieldInt8(2, payloadType, 0);
    }
    static addMimeType(builder, mimeTypeOffset) {
        builder.addFieldOffset(3, mimeTypeOffset, 0);
    }
    static addClockRate(builder, clockRate) {
        builder.addFieldInt32(4, clockRate, 0);
    }
    static addRid(builder, ridOffset) {
        builder.addFieldOffset(5, ridOffset, 0);
    }
    static addCname(builder, cnameOffset) {
        builder.addFieldOffset(6, cnameOffset, 0);
    }
    static addRtxSsrc(builder, rtxSsrc) {
        builder.addFieldInt32(7, rtxSsrc, null);
    }
    static addRtxPayloadType(builder, rtxPayloadType) {
        builder.addFieldInt8(8, rtxPayloadType, null);
    }
    static addUseNack(builder, useNack) {
        builder.addFieldInt8(9, +useNack, +false);
    }
    static addUsePli(builder, usePli) {
        builder.addFieldInt8(10, +usePli, +false);
    }
    static addUseFir(builder, useFir) {
        builder.addFieldInt8(11, +useFir, +false);
    }
    static addUseInBandFec(builder, useInBandFec) {
        builder.addFieldInt8(12, +useInBandFec, +false);
    }
    static addUseDtx(builder, useDtx) {
        builder.addFieldInt8(13, +useDtx, +false);
    }
    static addSpatialLayers(builder, spatialLayers) {
        builder.addFieldInt8(14, spatialLayers, 0);
    }
    static addTemporalLayers(builder, temporalLayers) {
        builder.addFieldInt8(15, temporalLayers, 0);
    }
    static endParams(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 10); // mime_type
        builder.requiredField(offset, 16); // cname
        return offset;
    }
    static createParams(builder, encodingIdx, ssrc, payloadType, mimeTypeOffset, clockRate, ridOffset, cnameOffset, rtxSsrc, rtxPayloadType, useNack, usePli, useFir, useInBandFec, useDtx, spatialLayers, temporalLayers) {
        Params.startParams(builder);
        Params.addEncodingIdx(builder, encodingIdx);
        Params.addSsrc(builder, ssrc);
        Params.addPayloadType(builder, payloadType);
        Params.addMimeType(builder, mimeTypeOffset);
        Params.addClockRate(builder, clockRate);
        Params.addRid(builder, ridOffset);
        Params.addCname(builder, cnameOffset);
        if (rtxSsrc !== null)
            Params.addRtxSsrc(builder, rtxSsrc);
        if (rtxPayloadType !== null)
            Params.addRtxPayloadType(builder, rtxPayloadType);
        Params.addUseNack(builder, useNack);
        Params.addUsePli(builder, usePli);
        Params.addUseFir(builder, useFir);
        Params.addUseInBandFec(builder, useInBandFec);
        Params.addUseDtx(builder, useDtx);
        Params.addSpatialLayers(builder, spatialLayers);
        Params.addTemporalLayers(builder, temporalLayers);
        return Params.endParams(builder);
    }
    unpack() {
        return new ParamsT(this.encodingIdx(), this.ssrc(), this.payloadType(), this.mimeType(), this.clockRate(), this.rid(), this.cname(), this.rtxSsrc(), this.rtxPayloadType(), this.useNack(), this.usePli(), this.useFir(), this.useInBandFec(), this.useDtx(), this.spatialLayers(), this.temporalLayers());
    }
    unpackTo(_o) {
        _o.encodingIdx = this.encodingIdx();
        _o.ssrc = this.ssrc();
        _o.payloadType = this.payloadType();
        _o.mimeType = this.mimeType();
        _o.clockRate = this.clockRate();
        _o.rid = this.rid();
        _o.cname = this.cname();
        _o.rtxSsrc = this.rtxSsrc();
        _o.rtxPayloadType = this.rtxPayloadType();
        _o.useNack = this.useNack();
        _o.usePli = this.usePli();
        _o.useFir = this.useFir();
        _o.useInBandFec = this.useInBandFec();
        _o.useDtx = this.useDtx();
        _o.spatialLayers = this.spatialLayers();
        _o.temporalLayers = this.temporalLayers();
    }
}
exports.Params = Params;
class ParamsT {
    encodingIdx;
    ssrc;
    payloadType;
    mimeType;
    clockRate;
    rid;
    cname;
    rtxSsrc;
    rtxPayloadType;
    useNack;
    usePli;
    useFir;
    useInBandFec;
    useDtx;
    spatialLayers;
    temporalLayers;
    constructor(encodingIdx = 0, ssrc = 0, payloadType = 0, mimeType = null, clockRate = 0, rid = null, cname = null, rtxSsrc = null, rtxPayloadType = null, useNack = false, usePli = false, useFir = false, useInBandFec = false, useDtx = false, spatialLayers = 0, temporalLayers = 0) {
        this.encodingIdx = encodingIdx;
        this.ssrc = ssrc;
        this.payloadType = payloadType;
        this.mimeType = mimeType;
        this.clockRate = clockRate;
        this.rid = rid;
        this.cname = cname;
        this.rtxSsrc = rtxSsrc;
        this.rtxPayloadType = rtxPayloadType;
        this.useNack = useNack;
        this.usePli = usePli;
        this.useFir = useFir;
        this.useInBandFec = useInBandFec;
        this.useDtx = useDtx;
        this.spatialLayers = spatialLayers;
        this.temporalLayers = temporalLayers;
    }
    pack(builder) {
        const mimeType = (this.mimeType !== null ? builder.createString(this.mimeType) : 0);
        const rid = (this.rid !== null ? builder.createString(this.rid) : 0);
        const cname = (this.cname !== null ? builder.createString(this.cname) : 0);
        return Params.createParams(builder, this.encodingIdx, this.ssrc, this.payloadType, mimeType, this.clockRate, rid, cname, this.rtxSsrc, this.rtxPayloadType, this.useNack, this.usePli, this.useFir, this.useInBandFec, this.useDtx, this.spatialLayers, this.temporalLayers);
    }
}
exports.ParamsT = ParamsT;
