UNPKG

camstreamerlib

Version:

Helper library for CamStreamer ACAP applications.

124 lines (123 loc) 4.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.internalVapixParametersSchema = exports.streamCommonSchema = void 0; const zod_1 = require("zod"); const common_1 = require("../common"); exports.streamCommonSchema = zod_1.z.object({ streamId: zod_1.z.string(), enabled: zod_1.z.boolean(), active: zod_1.z.boolean(), title: zod_1.z.string(), trigger: zod_1.z.discriminatedUnion('type', [ zod_1.z.object({ type: zod_1.z.literal('manual'), port: zod_1.z.number().optional(), }), zod_1.z.object({ type: zod_1.z.literal('onetime'), startTime: zod_1.z.number(), stopTime: zod_1.z.number(), everActivated: zod_1.z.boolean(), prepareAheadS: zod_1.z.number().int().optional(), }), zod_1.z.object({ type: zod_1.z.literal('recurrent'), schedule: zod_1.z.array(zod_1.z.object({ start: zod_1.z.object({ day: zod_1.z.number().int().min(0).max(6), timeS: zod_1.z.number().int().min(0).max(86400), }), stop: zod_1.z.object({ day: zod_1.z.number().int().min(0).max(6), timeS: zod_1.z.number().int().min(0).max(86400), }), isActive: zod_1.z.boolean(), })), prepareAheadS: zod_1.z.number().int().optional(), }), ]), video: zod_1.z.object({ output: zod_1.z.discriminatedUnion('type', [ zod_1.z.object({ type: zod_1.z.literal('video'), url: zod_1.z.string().nullable(), parameters: zod_1.z.string(), saveToSdCard: zod_1.z .object({ ruleId: zod_1.z.string(), configurationId: zod_1.z.string(), }) .optional(), }), zod_1.z.object({ type: zod_1.z.literal('images'), url: zod_1.z.string().nullable(), imageIntervalS: zod_1.z.number(), }), zod_1.z.object({ type: zod_1.z.literal('none'), saveToSdCard: zod_1.z.object({ ruleId: zod_1.z.string(), configurationId: zod_1.z.string(), }), }), ]), input: zod_1.z.discriminatedUnion('type', [ zod_1.z.object({ type: zod_1.z.literal('RTSP_URL'), url: zod_1.z.string(), internalVapixParameters: zod_1.z.string(), }), zod_1.z.object({ type: zod_1.z.literal('CSw'), }), zod_1.z.object({ type: zod_1.z.literal('CRS'), internalVapixParameters: zod_1.z.string(), userVapixParameters: zod_1.z.string(), }), ]), delayS: zod_1.z.number().int().nonnegative().optional(), }), audio: zod_1.z.discriminatedUnion('source', [ zod_1.z.object({ source: zod_1.z.literal('none'), }), zod_1.z.object({ source: zod_1.z.literal('microphone'), audioChannelNbr: zod_1.z.number().int(), forceStereo: zod_1.z.boolean(), }), zod_1.z.object({ source: zod_1.z.literal('file'), name: zod_1.z.string(), path: zod_1.z.string(), forceStereo: zod_1.z.boolean(), }), zod_1.z.object({ source: zod_1.z.literal('url'), name: zod_1.z.string(), url: zod_1.z.string(), avSyncMsec: zod_1.z.number().int().nonnegative(), forceStereo: zod_1.z.boolean(), }), ]), status: zod_1.z.object({ led: zod_1.z.boolean(), port: zod_1.z.number().optional(), }), }); exports.internalVapixParametersSchema = common_1.bitrateVapixParamsSchema.extend({ camera: zod_1.z.string(), resolution: zod_1.z.string(), fps: zod_1.z.number().int(), compression: zod_1.z.number().int(), govLength: zod_1.z.number().int(), videoCodec: zod_1.z.union([zod_1.z.literal('h264'), zod_1.z.literal('h265'), zod_1.z.literal('av1')]), h264Profile: common_1.h264ProfileSchema.optional(), audio: common_1.booleanSchema, nbrOfChannels: zod_1.z.union([zod_1.z.literal(1), zod_1.z.literal(2)]).optional(), overlays: zod_1.z .union([zod_1.z.literal('all'), zod_1.z.literal('text'), zod_1.z.literal('image'), zod_1.z.literal('application'), zod_1.z.literal('off')]) .optional(), });