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 fs_extra_1 = require("fs-extra");
|
||||
const delay_1 = require("delay");
|
||||
console.dir(animated_gif_detector_1.default);
|
||||
/**
|
||||
* @module 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) {
|
||||
this.id = 'filmout';
|
||||
|
@ -36,7 +45,7 @@ class FilmOut {
|
|||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Async function for requiring log, ipcMain and bind events.
|
||||
**/
|
||||
async init() {
|
||||
const Log = require('log');
|
||||
|
@ -58,13 +67,15 @@ class FilmOut {
|
|||
this.ipc.on('display', this.onDisplay.bind(this));
|
||||
}
|
||||
/**
|
||||
* Sets filmout direction.
|
||||
*
|
||||
* @param {boolean} dir Direction of filmout
|
||||
**/
|
||||
set(dir) {
|
||||
this.state.dir = dir;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Moves filmout a frame at a time.
|
||||
**/
|
||||
async move() {
|
||||
let start = +new Date();
|
||||
|
@ -83,7 +94,7 @@ class FilmOut {
|
|||
return (+new Date()) - start;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Begin the process of exporting single frames from the video for display.
|
||||
**/
|
||||
async start() {
|
||||
try {
|
||||
|
@ -104,7 +115,7 @@ class FilmOut {
|
|||
await delay_1.delay(20);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Ends the filmout process and closes the display.
|
||||
**/
|
||||
async end() {
|
||||
await delay_1.delay(20);
|
||||
|
@ -113,6 +124,8 @@ class FilmOut {
|
|||
/**
|
||||
* 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) {
|
||||
let frames = 0;
|
||||
|
@ -120,8 +133,8 @@ class FilmOut {
|
|||
let info;
|
||||
let ext;
|
||||
ext = path_1.extname(arg.fileName.toLowerCase());
|
||||
console.dir(arg);
|
||||
console.log(ext);
|
||||
//console.dir(arg)
|
||||
//console.log(ext)
|
||||
if (ext === this.gifExtension) {
|
||||
try {
|
||||
isAnimated = await this.isGifAnimated(arg.path);
|
||||
|
@ -175,7 +188,7 @@ class FilmOut {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
console.dir(info);
|
||||
//console.dir(info)
|
||||
this.state.frame = 0;
|
||||
this.state.path = arg.path;
|
||||
this.state.fileName = arg.fileName;
|
||||
|
@ -188,6 +201,10 @@ class FilmOut {
|
|||
}
|
||||
/**
|
||||
* 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) {
|
||||
let gifBuffer;
|
||||
|
@ -202,12 +219,19 @@ class FilmOut {
|
|||
}
|
||||
/**
|
||||
* 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) {
|
||||
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) {
|
||||
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) {
|
||||
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 fs_extra_1 = require("fs-extra");
|
||||
const delay_1 = require("delay");
|
||||
console.dir(animated_gif_detector_1.default);
|
||||
/**
|
||||
* @module 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) {
|
||||
this.id = 'filmout';
|
||||
|
@ -36,7 +45,7 @@ class FilmOut {
|
|||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Async function for requiring log, ipcMain and bind events.
|
||||
**/
|
||||
async init() {
|
||||
const Log = require('log');
|
||||
|
@ -58,13 +67,15 @@ class FilmOut {
|
|||
this.ipc.on('display', this.onDisplay.bind(this));
|
||||
}
|
||||
/**
|
||||
* Sets filmout direction.
|
||||
*
|
||||
* @param {boolean} dir Direction of filmout
|
||||
**/
|
||||
set(dir) {
|
||||
this.state.dir = dir;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Moves filmout a frame at a time.
|
||||
**/
|
||||
async move() {
|
||||
let start = +new Date();
|
||||
|
@ -83,7 +94,7 @@ class FilmOut {
|
|||
return (+new Date()) - start;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Begin the process of exporting single frames from the video for display.
|
||||
**/
|
||||
async start() {
|
||||
try {
|
||||
|
@ -104,7 +115,7 @@ class FilmOut {
|
|||
await delay_1.delay(20);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Ends the filmout process and closes the display.
|
||||
**/
|
||||
async end() {
|
||||
await delay_1.delay(20);
|
||||
|
@ -113,6 +124,8 @@ class FilmOut {
|
|||
/**
|
||||
* 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) {
|
||||
let frames = 0;
|
||||
|
@ -120,8 +133,8 @@ class FilmOut {
|
|||
let info;
|
||||
let ext;
|
||||
ext = path_1.extname(arg.fileName.toLowerCase());
|
||||
console.dir(arg);
|
||||
console.log(ext);
|
||||
//console.dir(arg)
|
||||
//console.log(ext)
|
||||
if (ext === this.gifExtension) {
|
||||
try {
|
||||
isAnimated = await this.isGifAnimated(arg.path);
|
||||
|
@ -175,7 +188,7 @@ class FilmOut {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
console.dir(info);
|
||||
//console.dir(info)
|
||||
this.state.frame = 0;
|
||||
this.state.path = arg.path;
|
||||
this.state.fileName = arg.fileName;
|
||||
|
@ -188,6 +201,10 @@ class FilmOut {
|
|||
}
|
||||
/**
|
||||
* 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) {
|
||||
let gifBuffer;
|
||||
|
@ -202,12 +219,19 @@ class FilmOut {
|
|||
}
|
||||
/**
|
||||
* 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) {
|
||||
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) {
|
||||
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) {
|
||||
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 fs_extra_1 = require("fs-extra");
|
||||
const delay_1 = require("delay");
|
||||
console.dir(animated_gif_detector_1.default);
|
||||
/**
|
||||
* @module 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) {
|
||||
this.id = 'filmout';
|
||||
|
@ -36,7 +45,7 @@ class FilmOut {
|
|||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Async function for requiring log, ipcMain and bind events.
|
||||
**/
|
||||
async init() {
|
||||
const Log = require('log');
|
||||
|
@ -58,13 +67,15 @@ class FilmOut {
|
|||
this.ipc.on('display', this.onDisplay.bind(this));
|
||||
}
|
||||
/**
|
||||
* Sets filmout direction.
|
||||
*
|
||||
* @param {boolean} dir Direction of filmout
|
||||
**/
|
||||
set(dir) {
|
||||
this.state.dir = dir;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Moves filmout a frame at a time.
|
||||
**/
|
||||
async move() {
|
||||
let start = +new Date();
|
||||
|
@ -83,7 +94,7 @@ class FilmOut {
|
|||
return (+new Date()) - start;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Begin the process of exporting single frames from the video for display.
|
||||
**/
|
||||
async start() {
|
||||
try {
|
||||
|
@ -104,7 +115,7 @@ class FilmOut {
|
|||
await delay_1.delay(20);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Ends the filmout process and closes the display.
|
||||
**/
|
||||
async end() {
|
||||
await delay_1.delay(20);
|
||||
|
@ -113,6 +124,8 @@ class FilmOut {
|
|||
/**
|
||||
* 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) {
|
||||
let frames = 0;
|
||||
|
@ -120,8 +133,8 @@ class FilmOut {
|
|||
let info;
|
||||
let ext;
|
||||
ext = path_1.extname(arg.fileName.toLowerCase());
|
||||
console.dir(arg);
|
||||
console.log(ext);
|
||||
//console.dir(arg)
|
||||
//console.log(ext)
|
||||
if (ext === this.gifExtension) {
|
||||
try {
|
||||
isAnimated = await this.isGifAnimated(arg.path);
|
||||
|
@ -175,7 +188,7 @@ class FilmOut {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
console.dir(info);
|
||||
//console.dir(info)
|
||||
this.state.frame = 0;
|
||||
this.state.path = arg.path;
|
||||
this.state.fileName = arg.fileName;
|
||||
|
@ -188,6 +201,10 @@ class FilmOut {
|
|||
}
|
||||
/**
|
||||
* 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) {
|
||||
let gifBuffer;
|
||||
|
@ -202,12 +219,19 @@ class FilmOut {
|
|||
}
|
||||
/**
|
||||
* 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) {
|
||||
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) {
|
||||
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) {
|
||||
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 { delay } from 'delay';
|
||||
|
||||
console.dir(animated)
|
||||
/**
|
||||
* @module FilmOut
|
||||
**/
|
||||
|
||||
class FilmOut {
|
||||
private id : string = 'filmout';
|
||||
|
@ -31,7 +33,14 @@ class FilmOut {
|
|||
private ui : 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) {
|
||||
this.display = display;
|
||||
|
@ -42,7 +51,7 @@ class FilmOut {
|
|||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Async function for requiring log, ipcMain and bind events.
|
||||
**/
|
||||
private async init () {
|
||||
const Log = require('log');
|
||||
|
@ -65,13 +74,15 @@ class FilmOut {
|
|||
this.ipc.on('display', this.onDisplay.bind(this));
|
||||
}
|
||||
/**
|
||||
* Sets filmout direction.
|
||||
*
|
||||
* @param {boolean} dir Direction of filmout
|
||||
**/
|
||||
public set (dir : boolean) {
|
||||
this.state.dir = dir;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Moves filmout a frame at a time.
|
||||
**/
|
||||
public async move () {
|
||||
let start : number = +new Date();
|
||||
|
@ -89,7 +100,7 @@ class FilmOut {
|
|||
return (+new Date()) - start;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Begin the process of exporting single frames from the video for display.
|
||||
**/
|
||||
async start () {
|
||||
try {
|
||||
|
@ -109,7 +120,7 @@ class FilmOut {
|
|||
await delay(20);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Ends the filmout process and closes the display.
|
||||
**/
|
||||
private async end () {
|
||||
await delay(20);
|
||||
|
@ -118,6 +129,8 @@ class FilmOut {
|
|||
/**
|
||||
* 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) {
|
||||
let frames : number = 0;
|
||||
|
@ -127,8 +140,8 @@ class FilmOut {
|
|||
|
||||
ext = extname(arg.fileName.toLowerCase());
|
||||
|
||||
console.dir(arg)
|
||||
console.log(ext)
|
||||
//console.dir(arg)
|
||||
//console.log(ext)
|
||||
|
||||
if (ext === this.gifExtension) {
|
||||
try {
|
||||
|
@ -177,7 +190,7 @@ class FilmOut {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
console.dir(info)
|
||||
//console.dir(info)
|
||||
this.state.frame = 0;
|
||||
this.state.path = arg.path;
|
||||
this.state.fileName = arg.fileName;
|
||||
|
@ -191,6 +204,10 @@ class FilmOut {
|
|||
}
|
||||
/**
|
||||
* 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) {
|
||||
let gifBuffer : Buffer;
|
||||
|
@ -204,12 +221,19 @@ class FilmOut {
|
|||
}
|
||||
/**
|
||||
* 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) {
|
||||
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) {
|
||||
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) {
|
||||
const state : any = JSON.parse(JSON.stringify(this.state));
|
||||
|
|
Loading…
Reference in New Issue