UNPKG

casparcg-state

Version:

Node.js Javascript/Typescript library for keeping and resolving a given state of CasparCG into commands for casparcg-connection.

131 lines 3.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Mixer = void 0; const _ = require("underscore"); const casparcg_connection_1 = require("casparcg-connection"); class Mixer { static getValue(val) { if (_.isObject(val) && val.valueOf) return val.valueOf(); return val; } static supportedAttributes() { return [ 'anchor', 'blendmode', 'brightness', 'chroma', 'clip', 'contrast', 'crop', 'fill', 'keyer', 'levels', 'mastervolume', 'opacity', 'perspective', 'rotation', 'saturation', 'straightAlpha', 'volume', 'bundleWithCommands', ]; } static getDefaultValues(attr) { // this is a temporary function, to replaced by some logic from ccg-connection switch (attr) { case 'anchor': return { _spread: true, x: 0, y: 0, }; case 'blendmode': return casparcg_connection_1.Enum.BlendMode.Normal; case 'brightness': return 1; case 'chroma': return { _spread: true, enable: false, targetHue: 0, hueWidth: 0, minSaturation: 0, minBrightness: 0, softness: 0, spillSuppress: 0, spillSuppressSaturation: 0, showMask: false, }; case 'clip': return { _spread: true, x: 0, y: 0, width: 1, height: 1, }; case 'contrast': return 1; case 'crop': return { _spread: true, left: 0, top: 0, right: 0, bottom: 0, }; case 'fill': return { _spread: true, x: 0, y: 0, xScale: 1, yScale: 1, }; // grid case 'keyer': // Layer mask return false; case 'levels': return { _spread: true, minInput: 0, maxInput: 1, gamma: 1, minOutput: 0, maxOutput: 1, }; case 'mastervolume': return 1; // mipmap case 'opacity': return 1; case 'perspective': return { _spread: true, topLeftX: 0, topLeftY: 0, topRightX: 1, topRightY: 0, bottomRightX: 1, bottomRightY: 1, bottomLeftX: 0, bottomLeftY: 1, }; case 'rotation': return 0; case 'saturation': return 1; case 'straightAlpha': return false; case 'volume': return 1; default: // code... break; } return null; } } exports.Mixer = Mixer; //# sourceMappingURL=mixer.js.map