Use camera, fd and display in sequence

This commit is contained in:
mmcwilliams 2024-08-04 22:34:03 -04:00
parent 7cbb4134f3
commit 53bf156d10
7 changed files with 35 additions and 12 deletions

10
dist/index.js vendored
View File

@ -35,7 +35,7 @@ const Handlebars = __importStar(require("handlebars"));
const ws_1 = require("ws");
const log_1 = require("./log");
const files_1 = require("./files");
const testimage_1 = require("./testimage");
const display_1 = require("./display");
const ffmpeg_1 = require("./ffmpeg");
const camera_1 = require("./camera");
const sequence_1 = require("./sequence");
@ -43,6 +43,7 @@ const log = (0, log_1.createLog)('fm');
const app = (0, express_1.default)();
let wss;
let fd;
let display;
let ffmpeg;
let camera;
let sequence;
@ -221,16 +222,17 @@ async function main() {
index = await createTemplate('./views/index.hbs');
ffmpeg = new ffmpeg_1.FFMPEG(process.env['FFMPEG']);
camera = new camera_1.Camera();
display = new display_1.Display(width, height);
//fd = new FD(process.env['FD'], width, height, process.env['FD_HOST'], parseInt(process.env['FD_PORT']));
sequence = new sequence_1.Sequence();
sequence = new sequence_1.Sequence(camera, fd, display);
app.listen(port, async () => {
log.info(`filmout_manager HTTP server running on port ${port}`);
});
wss = new ws_1.Server({ port: wsPort, clientTracking: true });
wss.on('connection', onWssConnection);
log.info(`filmout_manager WebSocket server running on port ${wsPort}`);
ffmpeg.listFormats();
log.info(await testimage_1.TestImage.Focus(640, 480));
//ffmpeg.listFormats();
//log.info(await TestImage.Focus(640, 480));
}
main();
//# sourceMappingURL=index.js.map

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,18 @@
import type { SequenceObject } from '../files';
import type { FD } from '../fd';
import type { Camera } from '../camera';
import type { Display } from '../display';
export declare class Sequence {
private log;
private current;
private images;
private camera;
private display;
private fd;
private running;
private progress;
private frames;
constructor();
constructor(camera: Camera, fd: FD, display: Display);
start(): void;
stop(): void;
isRunning(): boolean;

View File

@ -4,10 +4,13 @@ exports.Sequence = void 0;
const files_1 = require("../files");
const log_1 = require("../log");
class Sequence {
constructor() {
constructor(camera, fd, display) {
this.current = null;
this.images = [];
this.log = (0, log_1.createLog)('seq');
this.camera = camera;
this.fd = fd;
this.display = display;
}
start() {
this.running = true;

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sequence/index.ts"],"names":[],"mappings":";;;AAAA,oCAAiC;AACjC,gCAAkC;AAIlC,MAAa,QAAQ;IAQpB;QANQ,YAAO,GAAoB,IAAI,CAAC;QAChC,WAAM,GAAmB,EAAE,CAAC;QAMnC,IAAI,CAAC,GAAG,GAAG,IAAA,eAAS,EAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACrB,CAAC;IAEM,IAAI;QACV,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC;IAEM,SAAS;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,IAAI,CAAE,GAAoB;QAChC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACnB,IAAI,CAAC,SAAS,EAAE,CAAC;IAClB,CAAC;IAEO,KAAK,CAAC,SAAS;QACtB,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAG,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;YAClE,OAAO;QACR,CAAC;QAED,IAAI,CAAC;YACJ,IAAI,CAAC,MAAM,GAAG,MAAM,aAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yCAAyC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;YAClF,OAAO;QACR,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,IAAI,aAAa,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AAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAG,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;YAClE,OAAO;QACR,CAAC;QAED,IAAI,CAAC;YACJ,IAAI,CAAC,MAAM,GAAG,MAAM,aAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yCAAyC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;YAClF,OAAO;QACR,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,IAAI,aAAa,IAAI,CAAC,MAAM,CAAC,MAAM,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3H,CAAC;IAEM,MAAM;QACZ,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IAClB,CAAC;IAEM,QAAQ;QACd,OAAO;YACN,IAAI,EAAG,IAAI,CAAC,OAAO,CAAC,IAAI;YACxB,IAAI,EAAG,IAAI,CAAC,OAAO,CAAC,IAAI;YACxB,QAAQ,EAAG,IAAI,CAAC,QAAQ;SACxB,CAAA;IACF,CAAC;CACD;AA/DD,4BA+DC"}

View File

@ -22,6 +22,7 @@ import { Shell } from './shell';
import { delay } from './delay';
import { TestImage } from './testimage';
import { FD } from './fd';
import { Display } from './display';
import { FFMPEG } from './ffmpeg';
import { Camera } from './camera';
import { Sequence } from './sequence';
@ -30,6 +31,7 @@ const log : Logger = createLog('fm');
const app : Express = express();
let wss : Server;
let fd : FD;
let display : Display;
let ffmpeg : FFMPEG;
let camera : Camera;
let sequence : Sequence;
@ -214,8 +216,9 @@ async function main () {
index = await createTemplate('./views/index.hbs');
ffmpeg = new FFMPEG(process.env['FFMPEG']);
camera = new Camera();
display = new Display(width, height);
//fd = new FD(process.env['FD'], width, height, process.env['FD_HOST'], parseInt(process.env['FD_PORT']));
sequence = new Sequence();
sequence = new Sequence(camera, fd, display);
app.listen(port, async () => {
log.info(`filmout_manager HTTP server running on port ${port}`);
@ -225,8 +228,8 @@ async function main () {
wss.on('connection', onWssConnection);
log.info(`filmout_manager WebSocket server running on port ${wsPort}`);
ffmpeg.listFormats();
log.info(await TestImage.Focus(640, 480));
//ffmpeg.listFormats();
//log.info(await TestImage.Focus(640, 480));
}

View File

@ -2,17 +2,26 @@ import { Files } from '../files';
import { createLog } from '../log'
import type { Logger } from 'winston';
import type { SequenceObject, ImageObject } from '../files';
import type { FD } from '../fd';
import type { Camera } from '../camera';
import type { Display } from '../display';
export class Sequence {
private log : Logger;
private current : SequenceObject = null;
private images : ImageObject[] = [];
private camera : Camera;
private display : Display;
private fd : FD;
private running : boolean;
private progress : number;
private frames : number;
constructor () {
constructor (camera : Camera, fd : FD, display: Display) {
this.log = createLog('seq');
this.camera = camera;
this.fd = fd;
this.display = display;
}
public start () {