flag for whether autodetection is currently active
This commit is contained in:
parent
459a0eaa91
commit
a5a121ee00
@ -42,7 +42,9 @@ export interface AardPerformanceData {
|
|||||||
blackFrameDrawCount: number,
|
blackFrameDrawCount: number,
|
||||||
blackFrameCount: number,
|
blackFrameCount: number,
|
||||||
fastLetterboxCount: number,
|
fastLetterboxCount: number,
|
||||||
edgeDetectCount: number
|
edgeDetectCount: number,
|
||||||
|
|
||||||
|
aardActive: boolean, // whether autodetection is currently running or not
|
||||||
}
|
}
|
||||||
|
|
||||||
class ArDetector {
|
class ArDetector {
|
||||||
@ -91,7 +93,8 @@ class ArDetector {
|
|||||||
nextFrameCheckTime: Date.now()
|
nextFrameCheckTime: Date.now()
|
||||||
}
|
}
|
||||||
private status = {
|
private status = {
|
||||||
lastVideoStatus: VideoPlaybackState.Playing
|
lastVideoStatus: VideoPlaybackState.Playing,
|
||||||
|
aardActive: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
//#region debug variables
|
//#region debug variables
|
||||||
@ -157,7 +160,6 @@ class ArDetector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init(){
|
init(){
|
||||||
this.logger.log('info', 'init', `[ArDetect::init] <@${this.arid}> Initializing autodetection.`);
|
this.logger.log('info', 'init', `[ArDetect::init] <@${this.arid}> Initializing autodetection.`);
|
||||||
this.setup();
|
this.setup();
|
||||||
@ -287,11 +289,14 @@ class ArDetector {
|
|||||||
window.cancelAnimationFrame(this.animationFrameHandle);
|
window.cancelAnimationFrame(this.animationFrameHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.status.aardActive = true;
|
||||||
this.animationFrameHandle = window.requestAnimationFrame( (ts) => this.animationFrameBootstrap(ts));
|
this.animationFrameHandle = window.requestAnimationFrame( (ts) => this.animationFrameBootstrap(ts));
|
||||||
this.logger.log('info', 'debug', `"%c[ArDetect::startLoop] <@${this.arid}> AARD loop started.`, _ard_console_start);
|
this.logger.log('info', 'debug', `"%c[ArDetect::startLoop] <@${this.arid}> AARD loop started.`, _ard_console_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
this.status.aardActive = false;
|
||||||
|
|
||||||
if (this.animationFrameHandle) {
|
if (this.animationFrameHandle) {
|
||||||
this.logger.log('info', 'debug', `"%c[ArDetect::stop] <@${this.arid}> Stopping AnimationFrame loop.`, _ard_console_stop);
|
this.logger.log('info', 'debug', `"%c[ArDetect::stop] <@${this.arid}> Stopping AnimationFrame loop.`, _ard_console_stop);
|
||||||
window.cancelAnimationFrame(this.animationFrameHandle);
|
window.cancelAnimationFrame(this.animationFrameHandle);
|
||||||
@ -325,7 +330,7 @@ class ArDetector {
|
|||||||
//#region helper functions (general)
|
//#region helper functions (general)
|
||||||
|
|
||||||
isRunning(){
|
isRunning(){
|
||||||
return true;
|
return this.status.aardActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getVideoPlaybackState(): VideoPlaybackState {
|
private getVideoPlaybackState(): VideoPlaybackState {
|
||||||
@ -702,7 +707,8 @@ class ArDetector {
|
|||||||
blackFrameDrawCount,
|
blackFrameDrawCount,
|
||||||
blackFrameCount: blackFrameProcessCount,
|
blackFrameCount: blackFrameProcessCount,
|
||||||
fastLetterboxCount,
|
fastLetterboxCount,
|
||||||
edgeDetectCount
|
edgeDetectCount,
|
||||||
|
aardActive: this.status.aardActive,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.eventBus.send('uw-config-broadcast', {type: 'aard-performance-data', performanceData: res});
|
this.eventBus.send('uw-config-broadcast', {type: 'aard-performance-data', performanceData: res});
|
||||||
@ -777,9 +783,6 @@ class ArDetector {
|
|||||||
// check if aspect ratio is changed:
|
// check if aspect ratio is changed:
|
||||||
let lastAr = this.conf.resizer.getLastAr();
|
let lastAr = this.conf.resizer.getLastAr();
|
||||||
if (lastAr.type === AspectRatioType.AutomaticUpdate && lastAr.ratio !== null && lastAr.ratio !== undefined){
|
if (lastAr.type === AspectRatioType.AutomaticUpdate && lastAr.ratio !== null && lastAr.ratio !== undefined){
|
||||||
// spremembo lahko zavrnemo samo, če uporabljamo avtomatski način delovanja in če smo razmerje stranic
|
|
||||||
// že nastavili.
|
|
||||||
//
|
|
||||||
// we can only deny aspect ratio changes if we use automatic mode and if aspect ratio was set from here.
|
// we can only deny aspect ratio changes if we use automatic mode and if aspect ratio was set from here.
|
||||||
|
|
||||||
let arDiff = trueAr - lastAr.ratio;
|
let arDiff = trueAr - lastAr.ratio;
|
||||||
|
Loading…
Reference in New Issue
Block a user