Add comments to filmout lib.
This commit is contained in:
parent
5ce0aed2ff
commit
51acbdfd30
|
@ -8,10 +8,19 @@ const animated_gif_detector_1 = __importDefault(require("animated-gif-detector")
|
||||||
const path_1 = require("path");
|
const path_1 = require("path");
|
||||||
const fs_extra_1 = require("fs-extra");
|
const fs_extra_1 = require("fs-extra");
|
||||||
const delay_1 = require("delay");
|
const delay_1 = require("delay");
|
||||||
console.dir(animated_gif_detector_1.default);
|
/**
|
||||||
|
* @module FilmOut
|
||||||
|
**/
|
||||||
class FilmOut {
|
class FilmOut {
|
||||||
/**
|
/**
|
||||||
|
* @constructor
|
||||||
|
* Builds FilmOut class with display, ffmpeg, ffprobe, ui and light as internal properties.
|
||||||
*
|
*
|
||||||
|
* @param {object} display Display object for showing frames
|
||||||
|
* @param {object} ffmpeg FFMPEG wrapper
|
||||||
|
* @param {object} ffprobe FFPROBE wrapper for file info
|
||||||
|
* @param {object} ui Electron ui object
|
||||||
|
* @param {object} light Light device object
|
||||||
**/
|
**/
|
||||||
constructor(display, ffmpeg, ffprobe, ui, light) {
|
constructor(display, ffmpeg, ffprobe, ui, light) {
|
||||||
this.id = 'filmout';
|
this.id = 'filmout';
|
||||||
|
@ -36,7 +45,7 @@ class FilmOut {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Async function for requiring log, ipcMain and bind events.
|
||||||
**/
|
**/
|
||||||
async init() {
|
async init() {
|
||||||
const Log = require('log');
|
const Log = require('log');
|
||||||
|
@ -58,13 +67,15 @@ class FilmOut {
|
||||||
this.ipc.on('display', this.onDisplay.bind(this));
|
this.ipc.on('display', this.onDisplay.bind(this));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Sets filmout direction.
|
||||||
*
|
*
|
||||||
|
* @param {boolean} dir Direction of filmout
|
||||||
**/
|
**/
|
||||||
set(dir) {
|
set(dir) {
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Moves filmout a frame at a time.
|
||||||
**/
|
**/
|
||||||
async move() {
|
async move() {
|
||||||
let start = +new Date();
|
let start = +new Date();
|
||||||
|
@ -83,7 +94,7 @@ class FilmOut {
|
||||||
return (+new Date()) - start;
|
return (+new Date()) - start;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Begin the process of exporting single frames from the video for display.
|
||||||
**/
|
**/
|
||||||
async start() {
|
async start() {
|
||||||
try {
|
try {
|
||||||
|
@ -104,7 +115,7 @@ class FilmOut {
|
||||||
await delay_1.delay(20);
|
await delay_1.delay(20);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Ends the filmout process and closes the display.
|
||||||
**/
|
**/
|
||||||
async end() {
|
async end() {
|
||||||
await delay_1.delay(20);
|
await delay_1.delay(20);
|
||||||
|
@ -113,6 +124,8 @@ class FilmOut {
|
||||||
/**
|
/**
|
||||||
* Use a video file as a film out source on "projector"
|
* Use a video file as a film out source on "projector"
|
||||||
*
|
*
|
||||||
|
* @param {object} evt Original connect event
|
||||||
|
* @param {object} arg Arguments from ipc message
|
||||||
**/
|
**/
|
||||||
async onConnect(evt, arg) {
|
async onConnect(evt, arg) {
|
||||||
let frames = 0;
|
let frames = 0;
|
||||||
|
@ -120,8 +133,8 @@ class FilmOut {
|
||||||
let info;
|
let info;
|
||||||
let ext;
|
let ext;
|
||||||
ext = path_1.extname(arg.fileName.toLowerCase());
|
ext = path_1.extname(arg.fileName.toLowerCase());
|
||||||
console.dir(arg);
|
//console.dir(arg)
|
||||||
console.log(ext);
|
//console.log(ext)
|
||||||
if (ext === this.gifExtension) {
|
if (ext === this.gifExtension) {
|
||||||
try {
|
try {
|
||||||
isAnimated = await this.isGifAnimated(arg.path);
|
isAnimated = await this.isGifAnimated(arg.path);
|
||||||
|
@ -175,7 +188,7 @@ class FilmOut {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.dir(info);
|
//console.dir(info)
|
||||||
this.state.frame = 0;
|
this.state.frame = 0;
|
||||||
this.state.path = arg.path;
|
this.state.path = arg.path;
|
||||||
this.state.fileName = arg.fileName;
|
this.state.fileName = arg.fileName;
|
||||||
|
@ -188,6 +201,10 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return true if gif is animated, false if it is a still
|
* Return true if gif is animated, false if it is a still
|
||||||
|
*
|
||||||
|
* @param {string} pathStr Path to gif to check
|
||||||
|
*
|
||||||
|
* @returns {boolean} Whether or not gif is animated
|
||||||
**/
|
**/
|
||||||
async isGifAnimated(pathStr) {
|
async isGifAnimated(pathStr) {
|
||||||
let gifBuffer;
|
let gifBuffer;
|
||||||
|
@ -202,12 +219,19 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return information on a still image using the sharp module
|
* Return information on a still image using the sharp module
|
||||||
|
*
|
||||||
|
* @param {string} pathStr Path to gif to check
|
||||||
|
*
|
||||||
|
* @returns {object} Info about still from sharp
|
||||||
**/
|
**/
|
||||||
async stillInfo(pathStr) {
|
async stillInfo(pathStr) {
|
||||||
return sharp_1.default(pathStr).metadata();
|
return sharp_1.default(pathStr).metadata();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Preview a frame from the selected video.
|
||||||
*
|
*
|
||||||
|
* @param {object} evt Original event
|
||||||
|
* @param {object} arg Arguments from message
|
||||||
**/
|
**/
|
||||||
async previewFrame(evt, arg) {
|
async previewFrame(evt, arg) {
|
||||||
const state = JSON.parse(JSON.stringify(this.state));
|
const state = JSON.parse(JSON.stringify(this.state));
|
||||||
|
@ -225,6 +249,9 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @param {object} evt Original event
|
||||||
|
* @param {object} arg Arguments from message
|
||||||
**/
|
**/
|
||||||
async preview(evt, arg) {
|
async preview(evt, arg) {
|
||||||
const state = JSON.parse(JSON.stringify(this.state));
|
const state = JSON.parse(JSON.stringify(this.state));
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -8,10 +8,19 @@ const animated_gif_detector_1 = __importDefault(require("animated-gif-detector")
|
||||||
const path_1 = require("path");
|
const path_1 = require("path");
|
||||||
const fs_extra_1 = require("fs-extra");
|
const fs_extra_1 = require("fs-extra");
|
||||||
const delay_1 = require("delay");
|
const delay_1 = require("delay");
|
||||||
console.dir(animated_gif_detector_1.default);
|
/**
|
||||||
|
* @module FilmOut
|
||||||
|
**/
|
||||||
class FilmOut {
|
class FilmOut {
|
||||||
/**
|
/**
|
||||||
|
* @constructor
|
||||||
|
* Builds FilmOut class with display, ffmpeg, ffprobe, ui and light as internal properties.
|
||||||
*
|
*
|
||||||
|
* @param {object} display Display object for showing frames
|
||||||
|
* @param {object} ffmpeg FFMPEG wrapper
|
||||||
|
* @param {object} ffprobe FFPROBE wrapper for file info
|
||||||
|
* @param {object} ui Electron ui object
|
||||||
|
* @param {object} light Light device object
|
||||||
**/
|
**/
|
||||||
constructor(display, ffmpeg, ffprobe, ui, light) {
|
constructor(display, ffmpeg, ffprobe, ui, light) {
|
||||||
this.id = 'filmout';
|
this.id = 'filmout';
|
||||||
|
@ -36,7 +45,7 @@ class FilmOut {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Async function for requiring log, ipcMain and bind events.
|
||||||
**/
|
**/
|
||||||
async init() {
|
async init() {
|
||||||
const Log = require('log');
|
const Log = require('log');
|
||||||
|
@ -58,13 +67,15 @@ class FilmOut {
|
||||||
this.ipc.on('display', this.onDisplay.bind(this));
|
this.ipc.on('display', this.onDisplay.bind(this));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Sets filmout direction.
|
||||||
*
|
*
|
||||||
|
* @param {boolean} dir Direction of filmout
|
||||||
**/
|
**/
|
||||||
set(dir) {
|
set(dir) {
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Moves filmout a frame at a time.
|
||||||
**/
|
**/
|
||||||
async move() {
|
async move() {
|
||||||
let start = +new Date();
|
let start = +new Date();
|
||||||
|
@ -83,7 +94,7 @@ class FilmOut {
|
||||||
return (+new Date()) - start;
|
return (+new Date()) - start;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Begin the process of exporting single frames from the video for display.
|
||||||
**/
|
**/
|
||||||
async start() {
|
async start() {
|
||||||
try {
|
try {
|
||||||
|
@ -104,7 +115,7 @@ class FilmOut {
|
||||||
await delay_1.delay(20);
|
await delay_1.delay(20);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Ends the filmout process and closes the display.
|
||||||
**/
|
**/
|
||||||
async end() {
|
async end() {
|
||||||
await delay_1.delay(20);
|
await delay_1.delay(20);
|
||||||
|
@ -113,6 +124,8 @@ class FilmOut {
|
||||||
/**
|
/**
|
||||||
* Use a video file as a film out source on "projector"
|
* Use a video file as a film out source on "projector"
|
||||||
*
|
*
|
||||||
|
* @param {object} evt Original connect event
|
||||||
|
* @param {object} arg Arguments from ipc message
|
||||||
**/
|
**/
|
||||||
async onConnect(evt, arg) {
|
async onConnect(evt, arg) {
|
||||||
let frames = 0;
|
let frames = 0;
|
||||||
|
@ -120,8 +133,8 @@ class FilmOut {
|
||||||
let info;
|
let info;
|
||||||
let ext;
|
let ext;
|
||||||
ext = path_1.extname(arg.fileName.toLowerCase());
|
ext = path_1.extname(arg.fileName.toLowerCase());
|
||||||
console.dir(arg);
|
//console.dir(arg)
|
||||||
console.log(ext);
|
//console.log(ext)
|
||||||
if (ext === this.gifExtension) {
|
if (ext === this.gifExtension) {
|
||||||
try {
|
try {
|
||||||
isAnimated = await this.isGifAnimated(arg.path);
|
isAnimated = await this.isGifAnimated(arg.path);
|
||||||
|
@ -175,7 +188,7 @@ class FilmOut {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.dir(info);
|
//console.dir(info)
|
||||||
this.state.frame = 0;
|
this.state.frame = 0;
|
||||||
this.state.path = arg.path;
|
this.state.path = arg.path;
|
||||||
this.state.fileName = arg.fileName;
|
this.state.fileName = arg.fileName;
|
||||||
|
@ -188,6 +201,10 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return true if gif is animated, false if it is a still
|
* Return true if gif is animated, false if it is a still
|
||||||
|
*
|
||||||
|
* @param {string} pathStr Path to gif to check
|
||||||
|
*
|
||||||
|
* @returns {boolean} Whether or not gif is animated
|
||||||
**/
|
**/
|
||||||
async isGifAnimated(pathStr) {
|
async isGifAnimated(pathStr) {
|
||||||
let gifBuffer;
|
let gifBuffer;
|
||||||
|
@ -202,12 +219,19 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return information on a still image using the sharp module
|
* Return information on a still image using the sharp module
|
||||||
|
*
|
||||||
|
* @param {string} pathStr Path to gif to check
|
||||||
|
*
|
||||||
|
* @returns {object} Info about still from sharp
|
||||||
**/
|
**/
|
||||||
async stillInfo(pathStr) {
|
async stillInfo(pathStr) {
|
||||||
return sharp_1.default(pathStr).metadata();
|
return sharp_1.default(pathStr).metadata();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Preview a frame from the selected video.
|
||||||
*
|
*
|
||||||
|
* @param {object} evt Original event
|
||||||
|
* @param {object} arg Arguments from message
|
||||||
**/
|
**/
|
||||||
async previewFrame(evt, arg) {
|
async previewFrame(evt, arg) {
|
||||||
const state = JSON.parse(JSON.stringify(this.state));
|
const state = JSON.parse(JSON.stringify(this.state));
|
||||||
|
@ -225,6 +249,9 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @param {object} evt Original event
|
||||||
|
* @param {object} arg Arguments from message
|
||||||
**/
|
**/
|
||||||
async preview(evt, arg) {
|
async preview(evt, arg) {
|
||||||
const state = JSON.parse(JSON.stringify(this.state));
|
const state = JSON.parse(JSON.stringify(this.state));
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -8,10 +8,19 @@ const animated_gif_detector_1 = __importDefault(require("animated-gif-detector")
|
||||||
const path_1 = require("path");
|
const path_1 = require("path");
|
||||||
const fs_extra_1 = require("fs-extra");
|
const fs_extra_1 = require("fs-extra");
|
||||||
const delay_1 = require("delay");
|
const delay_1 = require("delay");
|
||||||
console.dir(animated_gif_detector_1.default);
|
/**
|
||||||
|
* @module FilmOut
|
||||||
|
**/
|
||||||
class FilmOut {
|
class FilmOut {
|
||||||
/**
|
/**
|
||||||
|
* @constructor
|
||||||
|
* Builds FilmOut class with display, ffmpeg, ffprobe, ui and light as internal properties.
|
||||||
*
|
*
|
||||||
|
* @param {object} display Display object for showing frames
|
||||||
|
* @param {object} ffmpeg FFMPEG wrapper
|
||||||
|
* @param {object} ffprobe FFPROBE wrapper for file info
|
||||||
|
* @param {object} ui Electron ui object
|
||||||
|
* @param {object} light Light device object
|
||||||
**/
|
**/
|
||||||
constructor(display, ffmpeg, ffprobe, ui, light) {
|
constructor(display, ffmpeg, ffprobe, ui, light) {
|
||||||
this.id = 'filmout';
|
this.id = 'filmout';
|
||||||
|
@ -36,7 +45,7 @@ class FilmOut {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Async function for requiring log, ipcMain and bind events.
|
||||||
**/
|
**/
|
||||||
async init() {
|
async init() {
|
||||||
const Log = require('log');
|
const Log = require('log');
|
||||||
|
@ -58,13 +67,15 @@ class FilmOut {
|
||||||
this.ipc.on('display', this.onDisplay.bind(this));
|
this.ipc.on('display', this.onDisplay.bind(this));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Sets filmout direction.
|
||||||
*
|
*
|
||||||
|
* @param {boolean} dir Direction of filmout
|
||||||
**/
|
**/
|
||||||
set(dir) {
|
set(dir) {
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Moves filmout a frame at a time.
|
||||||
**/
|
**/
|
||||||
async move() {
|
async move() {
|
||||||
let start = +new Date();
|
let start = +new Date();
|
||||||
|
@ -83,7 +94,7 @@ class FilmOut {
|
||||||
return (+new Date()) - start;
|
return (+new Date()) - start;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Begin the process of exporting single frames from the video for display.
|
||||||
**/
|
**/
|
||||||
async start() {
|
async start() {
|
||||||
try {
|
try {
|
||||||
|
@ -104,7 +115,7 @@ class FilmOut {
|
||||||
await delay_1.delay(20);
|
await delay_1.delay(20);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Ends the filmout process and closes the display.
|
||||||
**/
|
**/
|
||||||
async end() {
|
async end() {
|
||||||
await delay_1.delay(20);
|
await delay_1.delay(20);
|
||||||
|
@ -113,6 +124,8 @@ class FilmOut {
|
||||||
/**
|
/**
|
||||||
* Use a video file as a film out source on "projector"
|
* Use a video file as a film out source on "projector"
|
||||||
*
|
*
|
||||||
|
* @param {object} evt Original connect event
|
||||||
|
* @param {object} arg Arguments from ipc message
|
||||||
**/
|
**/
|
||||||
async onConnect(evt, arg) {
|
async onConnect(evt, arg) {
|
||||||
let frames = 0;
|
let frames = 0;
|
||||||
|
@ -120,8 +133,8 @@ class FilmOut {
|
||||||
let info;
|
let info;
|
||||||
let ext;
|
let ext;
|
||||||
ext = path_1.extname(arg.fileName.toLowerCase());
|
ext = path_1.extname(arg.fileName.toLowerCase());
|
||||||
console.dir(arg);
|
//console.dir(arg)
|
||||||
console.log(ext);
|
//console.log(ext)
|
||||||
if (ext === this.gifExtension) {
|
if (ext === this.gifExtension) {
|
||||||
try {
|
try {
|
||||||
isAnimated = await this.isGifAnimated(arg.path);
|
isAnimated = await this.isGifAnimated(arg.path);
|
||||||
|
@ -175,7 +188,7 @@ class FilmOut {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.dir(info);
|
//console.dir(info)
|
||||||
this.state.frame = 0;
|
this.state.frame = 0;
|
||||||
this.state.path = arg.path;
|
this.state.path = arg.path;
|
||||||
this.state.fileName = arg.fileName;
|
this.state.fileName = arg.fileName;
|
||||||
|
@ -188,6 +201,10 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return true if gif is animated, false if it is a still
|
* Return true if gif is animated, false if it is a still
|
||||||
|
*
|
||||||
|
* @param {string} pathStr Path to gif to check
|
||||||
|
*
|
||||||
|
* @returns {boolean} Whether or not gif is animated
|
||||||
**/
|
**/
|
||||||
async isGifAnimated(pathStr) {
|
async isGifAnimated(pathStr) {
|
||||||
let gifBuffer;
|
let gifBuffer;
|
||||||
|
@ -202,12 +219,19 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return information on a still image using the sharp module
|
* Return information on a still image using the sharp module
|
||||||
|
*
|
||||||
|
* @param {string} pathStr Path to gif to check
|
||||||
|
*
|
||||||
|
* @returns {object} Info about still from sharp
|
||||||
**/
|
**/
|
||||||
async stillInfo(pathStr) {
|
async stillInfo(pathStr) {
|
||||||
return sharp_1.default(pathStr).metadata();
|
return sharp_1.default(pathStr).metadata();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Preview a frame from the selected video.
|
||||||
*
|
*
|
||||||
|
* @param {object} evt Original event
|
||||||
|
* @param {object} arg Arguments from message
|
||||||
**/
|
**/
|
||||||
async previewFrame(evt, arg) {
|
async previewFrame(evt, arg) {
|
||||||
const state = JSON.parse(JSON.stringify(this.state));
|
const state = JSON.parse(JSON.stringify(this.state));
|
||||||
|
@ -225,6 +249,9 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @param {object} evt Original event
|
||||||
|
* @param {object} arg Arguments from message
|
||||||
**/
|
**/
|
||||||
async preview(evt, arg) {
|
async preview(evt, arg) {
|
||||||
const state = JSON.parse(JSON.stringify(this.state));
|
const state = JSON.parse(JSON.stringify(this.state));
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,9 @@ import { extname } from 'path';
|
||||||
import { readFile } from 'fs-extra';
|
import { readFile } from 'fs-extra';
|
||||||
import { delay } from 'delay';
|
import { delay } from 'delay';
|
||||||
|
|
||||||
console.dir(animated)
|
/**
|
||||||
|
* @module FilmOut
|
||||||
|
**/
|
||||||
|
|
||||||
class FilmOut {
|
class FilmOut {
|
||||||
private id : string = 'filmout';
|
private id : string = 'filmout';
|
||||||
|
@ -31,7 +33,14 @@ class FilmOut {
|
||||||
private ui : any;
|
private ui : any;
|
||||||
private log : any;
|
private log : any;
|
||||||
/**
|
/**
|
||||||
|
* @constructor
|
||||||
|
* Builds FilmOut class with display, ffmpeg, ffprobe, ui and light as internal properties.
|
||||||
*
|
*
|
||||||
|
* @param {object} display Display object for showing frames
|
||||||
|
* @param {object} ffmpeg FFMPEG wrapper
|
||||||
|
* @param {object} ffprobe FFPROBE wrapper for file info
|
||||||
|
* @param {object} ui Electron ui object
|
||||||
|
* @param {object} light Light device object
|
||||||
**/
|
**/
|
||||||
constructor (display : any, ffmpeg : any, ffprobe : any, ui : any, light : any) {
|
constructor (display : any, ffmpeg : any, ffprobe : any, ui : any, light : any) {
|
||||||
this.display = display;
|
this.display = display;
|
||||||
|
@ -42,7 +51,7 @@ class FilmOut {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Async function for requiring log, ipcMain and bind events.
|
||||||
**/
|
**/
|
||||||
private async init () {
|
private async init () {
|
||||||
const Log = require('log');
|
const Log = require('log');
|
||||||
|
@ -65,13 +74,15 @@ class FilmOut {
|
||||||
this.ipc.on('display', this.onDisplay.bind(this));
|
this.ipc.on('display', this.onDisplay.bind(this));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Sets filmout direction.
|
||||||
*
|
*
|
||||||
|
* @param {boolean} dir Direction of filmout
|
||||||
**/
|
**/
|
||||||
public set (dir : boolean) {
|
public set (dir : boolean) {
|
||||||
this.state.dir = dir;
|
this.state.dir = dir;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Moves filmout a frame at a time.
|
||||||
**/
|
**/
|
||||||
public async move () {
|
public async move () {
|
||||||
let start : number = +new Date();
|
let start : number = +new Date();
|
||||||
|
@ -89,7 +100,7 @@ class FilmOut {
|
||||||
return (+new Date()) - start;
|
return (+new Date()) - start;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Begin the process of exporting single frames from the video for display.
|
||||||
**/
|
**/
|
||||||
async start () {
|
async start () {
|
||||||
try {
|
try {
|
||||||
|
@ -109,7 +120,7 @@ class FilmOut {
|
||||||
await delay(20);
|
await delay(20);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* Ends the filmout process and closes the display.
|
||||||
**/
|
**/
|
||||||
private async end () {
|
private async end () {
|
||||||
await delay(20);
|
await delay(20);
|
||||||
|
@ -118,6 +129,8 @@ class FilmOut {
|
||||||
/**
|
/**
|
||||||
* Use a video file as a film out source on "projector"
|
* Use a video file as a film out source on "projector"
|
||||||
*
|
*
|
||||||
|
* @param {object} evt Original connect event
|
||||||
|
* @param {object} arg Arguments from ipc message
|
||||||
**/
|
**/
|
||||||
async onConnect (evt : any, arg : any) {
|
async onConnect (evt : any, arg : any) {
|
||||||
let frames : number = 0;
|
let frames : number = 0;
|
||||||
|
@ -127,8 +140,8 @@ class FilmOut {
|
||||||
|
|
||||||
ext = extname(arg.fileName.toLowerCase());
|
ext = extname(arg.fileName.toLowerCase());
|
||||||
|
|
||||||
console.dir(arg)
|
//console.dir(arg)
|
||||||
console.log(ext)
|
//console.log(ext)
|
||||||
|
|
||||||
if (ext === this.gifExtension) {
|
if (ext === this.gifExtension) {
|
||||||
try {
|
try {
|
||||||
|
@ -177,7 +190,7 @@ class FilmOut {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.dir(info)
|
//console.dir(info)
|
||||||
this.state.frame = 0;
|
this.state.frame = 0;
|
||||||
this.state.path = arg.path;
|
this.state.path = arg.path;
|
||||||
this.state.fileName = arg.fileName;
|
this.state.fileName = arg.fileName;
|
||||||
|
@ -191,6 +204,10 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return true if gif is animated, false if it is a still
|
* Return true if gif is animated, false if it is a still
|
||||||
|
*
|
||||||
|
* @param {string} pathStr Path to gif to check
|
||||||
|
*
|
||||||
|
* @returns {boolean} Whether or not gif is animated
|
||||||
**/
|
**/
|
||||||
async isGifAnimated (pathStr : string) {
|
async isGifAnimated (pathStr : string) {
|
||||||
let gifBuffer : Buffer;
|
let gifBuffer : Buffer;
|
||||||
|
@ -204,12 +221,19 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return information on a still image using the sharp module
|
* Return information on a still image using the sharp module
|
||||||
|
*
|
||||||
|
* @param {string} pathStr Path to gif to check
|
||||||
|
*
|
||||||
|
* @returns {object} Info about still from sharp
|
||||||
**/
|
**/
|
||||||
async stillInfo (pathStr : string) {
|
async stillInfo (pathStr : string) {
|
||||||
return sharp(pathStr).metadata();
|
return sharp(pathStr).metadata();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Preview a frame from the selected video.
|
||||||
*
|
*
|
||||||
|
* @param {object} evt Original event
|
||||||
|
* @param {object} arg Arguments from message
|
||||||
**/
|
**/
|
||||||
async previewFrame (evt : any, arg : any) {
|
async previewFrame (evt : any, arg : any) {
|
||||||
const state : any = JSON.parse(JSON.stringify(this.state));
|
const state : any = JSON.parse(JSON.stringify(this.state));
|
||||||
|
@ -227,6 +251,9 @@ class FilmOut {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @param {object} evt Original event
|
||||||
|
* @param {object} arg Arguments from message
|
||||||
**/
|
**/
|
||||||
async preview (evt : any, arg : any) {
|
async preview (evt : any, arg : any) {
|
||||||
const state : any = JSON.parse(JSON.stringify(this.state));
|
const state : any = JSON.parse(JSON.stringify(this.state));
|
||||||
|
|
Loading…
Reference in New Issue