Preview a frame using the webview. Select monitor to display images on. Wooo!
This commit is contained in:
parent
073e778a3b
commit
084916c317
|
@ -379,7 +379,7 @@
|
|||
</div>
|
||||
<div id="filmout_functions">
|
||||
<div>
|
||||
<button id="filmout_preview">PREVIEW</button>
|
||||
<button id="filmout_preview" onclick="filmout.preview();">PREVIEW</button>
|
||||
<button id="filmout_meter" onclick="filmout.meter();">METER</button>
|
||||
<button id="filmout_focus" onclick="filmout.focus();">FOCUS</button>
|
||||
<button id="filmout_field" onclick="filmout.field();">FIELD GUIDE</button>
|
||||
|
|
|
@ -17,10 +17,10 @@ function padded_frame(i) {
|
|||
return str;
|
||||
}
|
||||
class WebView {
|
||||
constructor(platform) {
|
||||
constructor(platform, display) {
|
||||
this.opened = false;
|
||||
this.showing = false;
|
||||
this.digitalWindow = new BrowserWindow({
|
||||
const prefs = {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
allowRunningInsecureContent: false
|
||||
|
@ -30,7 +30,12 @@ class WebView {
|
|||
minWidth: 800,
|
||||
minHeight: 600 //,
|
||||
//icon: path.join(__dirname, '../../assets/icons/icon.png')
|
||||
});
|
||||
};
|
||||
if (!display.primary) {
|
||||
prefs.x = display.x + 50;
|
||||
prefs.y = display.y + 50;
|
||||
}
|
||||
this.digitalWindow = new BrowserWindow(prefs);
|
||||
this.digitalWindow.loadURL('file://' + __dirname + '../../../display.html');
|
||||
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
|
||||
this.digitalWindow.webContents.openDevTools();
|
||||
|
@ -41,6 +46,7 @@ class WebView {
|
|||
});
|
||||
//this.digitalWindow.hide();
|
||||
this.platform = platform;
|
||||
this.display = display;
|
||||
}
|
||||
async open() {
|
||||
this.digitalWindow.show();
|
||||
|
@ -149,51 +155,36 @@ class EOG {
|
|||
class Display {
|
||||
constructor(sys) {
|
||||
this.platform = sys.platform;
|
||||
this.displays = sys.displays;
|
||||
this.tmpdir = path_1.join(sys.tmp, 'mcopy_digital');
|
||||
this.display = this.displays.find((display) => {
|
||||
if (display.primary)
|
||||
return true;
|
||||
});
|
||||
}
|
||||
async open() {
|
||||
//if (this.platform !== 'nix') {
|
||||
if (this.wv && this.wv.display && this.wv.display.id !== this.display.id) {
|
||||
this.wv.close();
|
||||
}
|
||||
if (!this.wv || !this.wv.opened) {
|
||||
this.wv = new WebView(this.platform);
|
||||
this.wv = new WebView(this.platform, this.display);
|
||||
await this.wv.open();
|
||||
}
|
||||
//} else {
|
||||
// if (!this.eog) {
|
||||
// this.eog = new EOG()
|
||||
// }
|
||||
//}
|
||||
}
|
||||
async show(frame) {
|
||||
let padded = padded_frame(frame);
|
||||
let ext = 'tif';
|
||||
let ext = 'png';
|
||||
let tmppath;
|
||||
//if (this.platform !== 'nix') {
|
||||
ext = 'png';
|
||||
//}
|
||||
tmppath = path_1.join(this.tmpdir, `export-${padded}.${ext}`);
|
||||
//if (this.platform !== 'nix') {
|
||||
await this.wv.show(tmppath);
|
||||
//} else {
|
||||
//await this.eog.show(tmppath);
|
||||
//}
|
||||
}
|
||||
async showPath(pathStr) {
|
||||
return await this.wv.show(pathStr);
|
||||
}
|
||||
hide() {
|
||||
//if (this.platform !== 'nix') {
|
||||
//don't hide between frames
|
||||
//this.wv.hide();
|
||||
//} else {
|
||||
//this.eog.hide();
|
||||
//}
|
||||
}
|
||||
close() {
|
||||
//if (this.platform !== 'nix') {
|
||||
this.wv.close();
|
||||
//} else {
|
||||
//this.eog.close()
|
||||
//}
|
||||
async close() {
|
||||
return await this.wv.close();
|
||||
}
|
||||
async focus() {
|
||||
return await this.wv.focus();
|
||||
|
@ -204,6 +195,12 @@ class Display {
|
|||
async meter() {
|
||||
return await this.wv.meter();
|
||||
}
|
||||
change(id) {
|
||||
this.display = this.displays.find((display) => {
|
||||
if (display.id == id)
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = function (sys) {
|
||||
return new Display(sys);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -41,8 +41,9 @@ class FilmOut {
|
|||
this.ipc.on('field', this.field.bind(this));
|
||||
this.ipc.on('meter', this.meter.bind(this));
|
||||
this.ipc.on('filmout_close', this.close.bind(this));
|
||||
//preview
|
||||
this.ipc.on('preview', this.preview.bind(this));
|
||||
this.ipc.on('preview_frame', this.previewFrame.bind(this));
|
||||
this.ipc.on('display', this.onDisplay.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -74,14 +75,14 @@ class FilmOut {
|
|||
await this.ffmpeg.clearAll();
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
await this.ffmpeg.frame(this.state, this.light.state);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
await this.display.show(this.state.frame);
|
||||
|
@ -137,14 +138,34 @@ class FilmOut {
|
|||
path = await this.ffmpeg.frame(state, { color: [255, 255, 255] });
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
;
|
||||
throw err;
|
||||
}
|
||||
this.ui.send('preview_frame', { path, frame: arg.frame });
|
||||
}
|
||||
async preview(evt, arg) {
|
||||
const state = JSON.parse(JSON.stringify(this.state));
|
||||
let path;
|
||||
state.frame = arg.frame;
|
||||
this.log.info(`Previewing frame ${state.frame} of ${state.fileName}`);
|
||||
try {
|
||||
path = await this.ffmpeg.frame(state, { color: [255, 255, 255] });
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.show(arg.frame);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
async focus(evt, arg) {
|
||||
this.log.info(`Showing focus screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.focus();
|
||||
|
@ -154,6 +175,7 @@ class FilmOut {
|
|||
}
|
||||
}
|
||||
async field(evt, arg) {
|
||||
this.log.info(`Showing field guide screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.field();
|
||||
|
@ -163,6 +185,7 @@ class FilmOut {
|
|||
}
|
||||
}
|
||||
async meter(evt, arg) {
|
||||
this.log.info(`Showing meter screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.meter();
|
||||
|
@ -180,6 +203,10 @@ class FilmOut {
|
|||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
onDisplay(evt, arg) {
|
||||
this.display.change(arg.display);
|
||||
this.log.info(`Changing the display to ${arg.display}`);
|
||||
}
|
||||
}
|
||||
module.exports = (display, ffmpeg, ffprobe, ui, light) => {
|
||||
return new FilmOut(display, ffmpeg, ffprobe, ui, light);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -36,7 +36,8 @@ class FilmOut {
|
|||
this.id = 'filmout';
|
||||
this.displays = [];
|
||||
this.state = {
|
||||
frame: 0
|
||||
frame: 0,
|
||||
display: null
|
||||
};
|
||||
}
|
||||
init() {
|
||||
|
@ -86,16 +87,21 @@ class FilmOut {
|
|||
h = display.height / scale;
|
||||
top = Math.floor((maxH - h) / 2);
|
||||
elem.height(h);
|
||||
elem.css('margin-top', `${top}px`);
|
||||
elem.width(maxW - 4);
|
||||
elem.css('top', `${top}px`);
|
||||
}
|
||||
else {
|
||||
elem.width(w);
|
||||
elem.height(maxH - 4);
|
||||
elem.css('top', `0px`);
|
||||
}
|
||||
elem.addClass('on');
|
||||
$('#filmout_stats_monitor_size').text(`${display.width} x ${display.height}`);
|
||||
$('#filmout_stats_monitor_aspect').text(`${aspect}`);
|
||||
$('#filmout_stats_monitor_scale').text(`${parseFloat(display.scale).toFixed(1)} scale factor`);
|
||||
console.dir(display);
|
||||
this.state.display = id;
|
||||
ipcRenderer.send('display', { display: id });
|
||||
}
|
||||
selectFile() {
|
||||
const elem = $('#digital');
|
||||
|
@ -160,10 +166,7 @@ class FilmOut {
|
|||
gui.spinner(false);
|
||||
gui.overlay(false);
|
||||
if (args.valid && args.valid === true) {
|
||||
//success state
|
||||
state = JSON.parse(args.state);
|
||||
//console.dir(args)
|
||||
//console.dir(state)
|
||||
$('#digital').addClass('active');
|
||||
$('#projector_type_digital').prop('checked', 'checked');
|
||||
gui.notify('DEVICES', `Using video ${state.fileName}`);
|
||||
|
@ -217,7 +220,9 @@ class FilmOut {
|
|||
}
|
||||
$('#filmout_position').val(this.state.frame).trigger('change');
|
||||
}
|
||||
preview(evt, arg) {
|
||||
preview() {
|
||||
const frame = this.state.frame;
|
||||
ipcRenderer.send('preview', { frame });
|
||||
}
|
||||
focus() {
|
||||
ipcRenderer.send('focus', { focus: true });
|
||||
|
|
|
@ -51,7 +51,8 @@ class FilmOut {
|
|||
private id : string = 'filmout';
|
||||
private displays : any[] = [];
|
||||
private state : any = {
|
||||
frame : 0
|
||||
frame : 0,
|
||||
display : null
|
||||
}
|
||||
constructor () {
|
||||
|
||||
|
@ -107,9 +108,12 @@ class FilmOut {
|
|||
h = display.height / scale;
|
||||
top = Math.floor((maxH - h) / 2);
|
||||
elem.height(h);
|
||||
elem.css('margin-top', `${top}px`);
|
||||
elem.width(maxW - 4);
|
||||
elem.css('top', `${top}px`);
|
||||
} else {
|
||||
elem.width(w);
|
||||
elem.height(maxH - 4);
|
||||
elem.css('top', `0px`);
|
||||
}
|
||||
|
||||
elem.addClass('on');
|
||||
|
@ -117,6 +121,8 @@ class FilmOut {
|
|||
$('#filmout_stats_monitor_aspect').text(`${aspect}`);
|
||||
$('#filmout_stats_monitor_scale').text(`${parseFloat(display.scale).toFixed(1)} scale factor`);
|
||||
console.dir(display);
|
||||
this.state.display = id;
|
||||
ipcRenderer.send('display', { display : id });
|
||||
}
|
||||
selectFile () {
|
||||
const elem : any = $('#digital');
|
||||
|
@ -182,10 +188,7 @@ class FilmOut {
|
|||
gui.overlay(false);
|
||||
|
||||
if (args.valid && args.valid === true) {
|
||||
//success state
|
||||
state = JSON.parse(args.state);
|
||||
//console.dir(args)
|
||||
//console.dir(state)
|
||||
$('#digital').addClass('active');
|
||||
$('#projector_type_digital').prop('checked', 'checked');
|
||||
gui.notify('DEVICES', `Using video ${state.fileName}`);
|
||||
|
@ -245,18 +248,23 @@ class FilmOut {
|
|||
$('#filmout_position').val(this.state.frame).trigger('change');
|
||||
}
|
||||
|
||||
preview (evt : any, arg : any) {
|
||||
|
||||
preview () {
|
||||
const frame : number = this.state.frame;
|
||||
ipcRenderer.send('preview', { frame });
|
||||
}
|
||||
|
||||
focus () {
|
||||
ipcRenderer.send('focus', { focus : true });
|
||||
}
|
||||
|
||||
field () {
|
||||
ipcRenderer.send('field', { field : true });
|
||||
}
|
||||
|
||||
meter () {
|
||||
ipcRenderer.send('meter', { meter : true });
|
||||
}
|
||||
|
||||
close (evt : any, arg : any) {
|
||||
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ function padded_frame(i) {
|
|||
return str;
|
||||
}
|
||||
class WebView {
|
||||
constructor(platform) {
|
||||
constructor(platform, display) {
|
||||
this.opened = false;
|
||||
this.showing = false;
|
||||
this.digitalWindow = new BrowserWindow({
|
||||
const prefs = {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
allowRunningInsecureContent: false
|
||||
|
@ -30,7 +30,12 @@ class WebView {
|
|||
minWidth: 800,
|
||||
minHeight: 600 //,
|
||||
//icon: path.join(__dirname, '../../assets/icons/icon.png')
|
||||
});
|
||||
};
|
||||
if (!display.primary) {
|
||||
prefs.x = display.x + 50;
|
||||
prefs.y = display.y + 50;
|
||||
}
|
||||
this.digitalWindow = new BrowserWindow(prefs);
|
||||
this.digitalWindow.loadURL('file://' + __dirname + '../../../display.html');
|
||||
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
|
||||
this.digitalWindow.webContents.openDevTools();
|
||||
|
@ -41,6 +46,7 @@ class WebView {
|
|||
});
|
||||
//this.digitalWindow.hide();
|
||||
this.platform = platform;
|
||||
this.display = display;
|
||||
}
|
||||
async open() {
|
||||
this.digitalWindow.show();
|
||||
|
@ -149,51 +155,36 @@ class EOG {
|
|||
class Display {
|
||||
constructor(sys) {
|
||||
this.platform = sys.platform;
|
||||
this.displays = sys.displays;
|
||||
this.tmpdir = path_1.join(sys.tmp, 'mcopy_digital');
|
||||
this.display = this.displays.find((display) => {
|
||||
if (display.primary)
|
||||
return true;
|
||||
});
|
||||
}
|
||||
async open() {
|
||||
//if (this.platform !== 'nix') {
|
||||
if (this.wv && this.wv.display && this.wv.display.id !== this.display.id) {
|
||||
this.wv.close();
|
||||
}
|
||||
if (!this.wv || !this.wv.opened) {
|
||||
this.wv = new WebView(this.platform);
|
||||
this.wv = new WebView(this.platform, this.display);
|
||||
await this.wv.open();
|
||||
}
|
||||
//} else {
|
||||
// if (!this.eog) {
|
||||
// this.eog = new EOG()
|
||||
// }
|
||||
//}
|
||||
}
|
||||
async show(frame) {
|
||||
let padded = padded_frame(frame);
|
||||
let ext = 'tif';
|
||||
let ext = 'png';
|
||||
let tmppath;
|
||||
//if (this.platform !== 'nix') {
|
||||
ext = 'png';
|
||||
//}
|
||||
tmppath = path_1.join(this.tmpdir, `export-${padded}.${ext}`);
|
||||
//if (this.platform !== 'nix') {
|
||||
await this.wv.show(tmppath);
|
||||
//} else {
|
||||
//await this.eog.show(tmppath);
|
||||
//}
|
||||
}
|
||||
async showPath(pathStr) {
|
||||
return await this.wv.show(pathStr);
|
||||
}
|
||||
hide() {
|
||||
//if (this.platform !== 'nix') {
|
||||
//don't hide between frames
|
||||
//this.wv.hide();
|
||||
//} else {
|
||||
//this.eog.hide();
|
||||
//}
|
||||
}
|
||||
close() {
|
||||
//if (this.platform !== 'nix') {
|
||||
this.wv.close();
|
||||
//} else {
|
||||
//this.eog.close()
|
||||
//}
|
||||
async close() {
|
||||
return await this.wv.close();
|
||||
}
|
||||
async focus() {
|
||||
return await this.wv.focus();
|
||||
|
@ -204,6 +195,12 @@ class Display {
|
|||
async meter() {
|
||||
return await this.wv.meter();
|
||||
}
|
||||
change(id) {
|
||||
this.display = this.displays.find((display) => {
|
||||
if (display.id == id)
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = function (sys) {
|
||||
return new Display(sys);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -41,8 +41,9 @@ class FilmOut {
|
|||
this.ipc.on('field', this.field.bind(this));
|
||||
this.ipc.on('meter', this.meter.bind(this));
|
||||
this.ipc.on('filmout_close', this.close.bind(this));
|
||||
//preview
|
||||
this.ipc.on('preview', this.preview.bind(this));
|
||||
this.ipc.on('preview_frame', this.previewFrame.bind(this));
|
||||
this.ipc.on('display', this.onDisplay.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -74,14 +75,14 @@ class FilmOut {
|
|||
await this.ffmpeg.clearAll();
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
await this.ffmpeg.frame(this.state, this.light.state);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
await this.display.show(this.state.frame);
|
||||
|
@ -137,14 +138,34 @@ class FilmOut {
|
|||
path = await this.ffmpeg.frame(state, { color: [255, 255, 255] });
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
;
|
||||
throw err;
|
||||
}
|
||||
this.ui.send('preview_frame', { path, frame: arg.frame });
|
||||
}
|
||||
async preview(evt, arg) {
|
||||
const state = JSON.parse(JSON.stringify(this.state));
|
||||
let path;
|
||||
state.frame = arg.frame;
|
||||
this.log.info(`Previewing frame ${state.frame} of ${state.fileName}`);
|
||||
try {
|
||||
path = await this.ffmpeg.frame(state, { color: [255, 255, 255] });
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.show(arg.frame);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
async focus(evt, arg) {
|
||||
this.log.info(`Showing focus screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.focus();
|
||||
|
@ -154,6 +175,7 @@ class FilmOut {
|
|||
}
|
||||
}
|
||||
async field(evt, arg) {
|
||||
this.log.info(`Showing field guide screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.field();
|
||||
|
@ -163,6 +185,7 @@ class FilmOut {
|
|||
}
|
||||
}
|
||||
async meter(evt, arg) {
|
||||
this.log.info(`Showing meter screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.meter();
|
||||
|
@ -180,6 +203,10 @@ class FilmOut {
|
|||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
onDisplay(evt, arg) {
|
||||
this.display.change(arg.display);
|
||||
this.log.info(`Changing the display to ${arg.display}`);
|
||||
}
|
||||
}
|
||||
module.exports = (display, ffmpeg, ffprobe, ui, light) => {
|
||||
return new FilmOut(display, ffmpeg, ffprobe, ui, light);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -17,10 +17,10 @@ function padded_frame(i) {
|
|||
return str;
|
||||
}
|
||||
class WebView {
|
||||
constructor(platform) {
|
||||
constructor(platform, display) {
|
||||
this.opened = false;
|
||||
this.showing = false;
|
||||
this.digitalWindow = new BrowserWindow({
|
||||
const prefs = {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
allowRunningInsecureContent: false
|
||||
|
@ -30,7 +30,12 @@ class WebView {
|
|||
minWidth: 800,
|
||||
minHeight: 600 //,
|
||||
//icon: path.join(__dirname, '../../assets/icons/icon.png')
|
||||
});
|
||||
};
|
||||
if (!display.primary) {
|
||||
prefs.x = display.x + 50;
|
||||
prefs.y = display.y + 50;
|
||||
}
|
||||
this.digitalWindow = new BrowserWindow(prefs);
|
||||
this.digitalWindow.loadURL('file://' + __dirname + '../../../display.html');
|
||||
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
|
||||
this.digitalWindow.webContents.openDevTools();
|
||||
|
@ -41,6 +46,7 @@ class WebView {
|
|||
});
|
||||
//this.digitalWindow.hide();
|
||||
this.platform = platform;
|
||||
this.display = display;
|
||||
}
|
||||
async open() {
|
||||
this.digitalWindow.show();
|
||||
|
@ -149,51 +155,36 @@ class EOG {
|
|||
class Display {
|
||||
constructor(sys) {
|
||||
this.platform = sys.platform;
|
||||
this.displays = sys.displays;
|
||||
this.tmpdir = path_1.join(sys.tmp, 'mcopy_digital');
|
||||
this.display = this.displays.find((display) => {
|
||||
if (display.primary)
|
||||
return true;
|
||||
});
|
||||
}
|
||||
async open() {
|
||||
//if (this.platform !== 'nix') {
|
||||
if (this.wv && this.wv.display && this.wv.display.id !== this.display.id) {
|
||||
this.wv.close();
|
||||
}
|
||||
if (!this.wv || !this.wv.opened) {
|
||||
this.wv = new WebView(this.platform);
|
||||
this.wv = new WebView(this.platform, this.display);
|
||||
await this.wv.open();
|
||||
}
|
||||
//} else {
|
||||
// if (!this.eog) {
|
||||
// this.eog = new EOG()
|
||||
// }
|
||||
//}
|
||||
}
|
||||
async show(frame) {
|
||||
let padded = padded_frame(frame);
|
||||
let ext = 'tif';
|
||||
let ext = 'png';
|
||||
let tmppath;
|
||||
//if (this.platform !== 'nix') {
|
||||
ext = 'png';
|
||||
//}
|
||||
tmppath = path_1.join(this.tmpdir, `export-${padded}.${ext}`);
|
||||
//if (this.platform !== 'nix') {
|
||||
await this.wv.show(tmppath);
|
||||
//} else {
|
||||
//await this.eog.show(tmppath);
|
||||
//}
|
||||
}
|
||||
async showPath(pathStr) {
|
||||
return await this.wv.show(pathStr);
|
||||
}
|
||||
hide() {
|
||||
//if (this.platform !== 'nix') {
|
||||
//don't hide between frames
|
||||
//this.wv.hide();
|
||||
//} else {
|
||||
//this.eog.hide();
|
||||
//}
|
||||
}
|
||||
close() {
|
||||
//if (this.platform !== 'nix') {
|
||||
this.wv.close();
|
||||
//} else {
|
||||
//this.eog.close()
|
||||
//}
|
||||
async close() {
|
||||
return await this.wv.close();
|
||||
}
|
||||
async focus() {
|
||||
return await this.wv.focus();
|
||||
|
@ -204,6 +195,12 @@ class Display {
|
|||
async meter() {
|
||||
return await this.wv.meter();
|
||||
}
|
||||
change(id) {
|
||||
this.display = this.displays.find((display) => {
|
||||
if (display.id == id)
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = function (sys) {
|
||||
return new Display(sys);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -41,8 +41,9 @@ class FilmOut {
|
|||
this.ipc.on('field', this.field.bind(this));
|
||||
this.ipc.on('meter', this.meter.bind(this));
|
||||
this.ipc.on('filmout_close', this.close.bind(this));
|
||||
//preview
|
||||
this.ipc.on('preview', this.preview.bind(this));
|
||||
this.ipc.on('preview_frame', this.previewFrame.bind(this));
|
||||
this.ipc.on('display', this.onDisplay.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -74,14 +75,14 @@ class FilmOut {
|
|||
await this.ffmpeg.clearAll();
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
await this.ffmpeg.frame(this.state, this.light.state);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
await this.display.show(this.state.frame);
|
||||
|
@ -137,14 +138,34 @@ class FilmOut {
|
|||
path = await this.ffmpeg.frame(state, { color: [255, 255, 255] });
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
;
|
||||
throw err;
|
||||
}
|
||||
this.ui.send('preview_frame', { path, frame: arg.frame });
|
||||
}
|
||||
async preview(evt, arg) {
|
||||
const state = JSON.parse(JSON.stringify(this.state));
|
||||
let path;
|
||||
state.frame = arg.frame;
|
||||
this.log.info(`Previewing frame ${state.frame} of ${state.fileName}`);
|
||||
try {
|
||||
path = await this.ffmpeg.frame(state, { color: [255, 255, 255] });
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.show(arg.frame);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
async focus(evt, arg) {
|
||||
this.log.info(`Showing focus screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.focus();
|
||||
|
@ -154,6 +175,7 @@ class FilmOut {
|
|||
}
|
||||
}
|
||||
async field(evt, arg) {
|
||||
this.log.info(`Showing field guide screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.field();
|
||||
|
@ -163,6 +185,7 @@ class FilmOut {
|
|||
}
|
||||
}
|
||||
async meter(evt, arg) {
|
||||
this.log.info(`Showing meter screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.meter();
|
||||
|
@ -180,6 +203,10 @@ class FilmOut {
|
|||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
onDisplay(evt, arg) {
|
||||
this.display.change(arg.display);
|
||||
this.log.info(`Changing the display to ${arg.display}`);
|
||||
}
|
||||
}
|
||||
module.exports = (display, ffmpeg, ffprobe, ui, light) => {
|
||||
return new FilmOut(display, ffmpeg, ffprobe, ui, light);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -26,9 +26,10 @@ class WebView {
|
|||
public opened : boolean = false;
|
||||
public showing : boolean = false;
|
||||
private platform : string;
|
||||
public display : any;
|
||||
|
||||
constructor (platform : string) {
|
||||
this.digitalWindow = new BrowserWindow({
|
||||
constructor (platform : string, display : any) {
|
||||
const prefs : any = {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
allowRunningInsecureContent: false
|
||||
|
@ -38,7 +39,12 @@ class WebView {
|
|||
minWidth : 800,
|
||||
minHeight : 600//,
|
||||
//icon: path.join(__dirname, '../../assets/icons/icon.png')
|
||||
});
|
||||
}
|
||||
if (!display.primary) {
|
||||
prefs.x = display.x + 50;
|
||||
prefs.y = display.y + 50;
|
||||
}
|
||||
this.digitalWindow = new BrowserWindow(prefs);
|
||||
this.digitalWindow.loadURL('file://' + __dirname + '../../../display.html');
|
||||
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
|
||||
this.digitalWindow.webContents.openDevTools();
|
||||
|
@ -49,6 +55,7 @@ class WebView {
|
|||
});
|
||||
//this.digitalWindow.hide();
|
||||
this.platform = platform;
|
||||
this.display = display;
|
||||
}
|
||||
async open () {
|
||||
this.digitalWindow.show();
|
||||
|
@ -159,60 +166,46 @@ class EOG {
|
|||
|
||||
class Display {
|
||||
private platform : string;
|
||||
private displays : any[];
|
||||
private display : any;
|
||||
private tmpdir : string;
|
||||
private wv : WebView;
|
||||
private eog : EOG;
|
||||
|
||||
constructor (sys : any) {
|
||||
this.platform = sys.platform;
|
||||
this.displays = sys.displays;
|
||||
this.tmpdir = pathJoin(sys.tmp, 'mcopy_digital');
|
||||
this.display = this.displays.find((display : any) => {
|
||||
if (display.primary) return true;
|
||||
})
|
||||
}
|
||||
public async open () {
|
||||
//if (this.platform !== 'nix') {
|
||||
if (!this.wv || !this.wv.opened) {
|
||||
this.wv = new WebView(this.platform);
|
||||
await this.wv.open()
|
||||
if (this.wv && this.wv.display && this.wv.display.id !== this.display.id) {
|
||||
this.wv.close();
|
||||
}
|
||||
if (!this.wv || !this.wv.opened) {
|
||||
this.wv = new WebView(this.platform, this.display);
|
||||
await this.wv.open();
|
||||
}
|
||||
//} else {
|
||||
// if (!this.eog) {
|
||||
// this.eog = new EOG()
|
||||
// }
|
||||
//}
|
||||
}
|
||||
public async show (frame : number) {
|
||||
let padded : string = padded_frame(frame);
|
||||
let ext : string = 'tif';
|
||||
let ext : string = 'png';
|
||||
let tmppath : string;
|
||||
|
||||
//if (this.platform !== 'nix') {
|
||||
ext = 'png';
|
||||
//}
|
||||
|
||||
tmppath = pathJoin(this.tmpdir, `export-${padded}.${ext}`);
|
||||
|
||||
//if (this.platform !== 'nix') {
|
||||
await this.wv.show(tmppath);
|
||||
//} else {
|
||||
//await this.eog.show(tmppath);
|
||||
//}
|
||||
}
|
||||
public async showPath (pathStr : string) {
|
||||
return await this.wv.show(pathStr);
|
||||
}
|
||||
public hide () {
|
||||
//if (this.platform !== 'nix') {
|
||||
//don't hide between frames
|
||||
//this.wv.hide();
|
||||
//} else {
|
||||
//this.eog.hide();
|
||||
//}
|
||||
|
||||
}
|
||||
public close () {
|
||||
//if (this.platform !== 'nix') {
|
||||
this.wv.close()
|
||||
//} else {
|
||||
//this.eog.close()
|
||||
//}
|
||||
public async close () {
|
||||
return await this.wv.close()
|
||||
}
|
||||
public async focus () {
|
||||
return await this.wv.focus();
|
||||
|
@ -223,6 +216,11 @@ class Display {
|
|||
public async meter () {
|
||||
return await this.wv.meter();
|
||||
}
|
||||
public change (id : any) {
|
||||
this.display = this.displays.find((display : any) => {
|
||||
if (display.id == id) return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (sys : any) {
|
||||
|
|
|
@ -49,8 +49,9 @@ class FilmOut {
|
|||
this.ipc.on('field', this.field.bind(this));
|
||||
this.ipc.on('meter', this.meter.bind(this));
|
||||
this.ipc.on('filmout_close', this.close.bind(this));
|
||||
//preview
|
||||
this.ipc.on('preview', this.preview.bind(this));
|
||||
this.ipc.on('preview_frame', this.previewFrame.bind(this));
|
||||
this.ipc.on('display', this.onDisplay.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -80,14 +81,14 @@ class FilmOut {
|
|||
try {
|
||||
await this.ffmpeg.clearAll();
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
|
||||
try {
|
||||
await this.ffmpeg.frame(this.state, this.light.state);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
await this.display.show(this.state.frame);
|
||||
|
@ -140,20 +141,42 @@ class FilmOut {
|
|||
async previewFrame (evt : any, arg : any) {
|
||||
const state : any = JSON.parse(JSON.stringify(this.state));
|
||||
let path : string;
|
||||
|
||||
state.frame = arg.frame;
|
||||
|
||||
try {
|
||||
path = await this.ffmpeg.frame(state, { color : [255, 255, 255] });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
this.log.error(err, 'FILMOUT', true, true);;
|
||||
throw err;
|
||||
}
|
||||
this.ui.send('preview_frame', { path, frame : arg.frame })
|
||||
}
|
||||
|
||||
async preview (evt : any, arg : any) {
|
||||
const state : any = JSON.parse(JSON.stringify(this.state));
|
||||
let path : string;
|
||||
|
||||
state.frame = arg.frame;
|
||||
|
||||
this.log.info(`Previewing frame ${state.frame} of ${state.fileName}`);
|
||||
try {
|
||||
path = await this.ffmpeg.frame(state, { color : [255, 255, 255] });
|
||||
} catch (err) {
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
throw err;
|
||||
}
|
||||
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.show(arg.frame);
|
||||
} catch (err) {
|
||||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
async focus (evt : any, arg : any) {
|
||||
this.log.info(`Showing focus screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.focus();
|
||||
|
@ -161,7 +184,9 @@ class FilmOut {
|
|||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
async field (evt : any, arg : any) {
|
||||
this.log.info(`Showing field guide screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.field();
|
||||
|
@ -169,7 +194,9 @@ class FilmOut {
|
|||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
async meter (evt : any, arg : any) {
|
||||
this.log.info(`Showing meter screen`);
|
||||
try {
|
||||
await this.display.open();
|
||||
await this.display.meter();
|
||||
|
@ -177,6 +204,7 @@ class FilmOut {
|
|||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
async close (evt : any, arg : any) {
|
||||
try {
|
||||
await this.display.hide();
|
||||
|
@ -185,6 +213,11 @@ class FilmOut {
|
|||
this.log.error(err, 'FILMOUT', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
onDisplay (evt : any, arg : any) {
|
||||
this.display.change(arg.display);
|
||||
this.log.info(`Changing the display to ${arg.display}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = (display : any, ffmpeg : any, ffprobe : any, ui : any, light : any) => {
|
||||
|
|
Loading…
Reference in New Issue