autoar: presume video aspect ratio as default (rather than null)
This commit is contained in:
parent
5329f0a600
commit
04fe2a6c6a
@ -195,7 +195,7 @@ class ArDetector {
|
|||||||
this.resetBlackLevel();
|
this.resetBlackLevel();
|
||||||
|
|
||||||
// if we're restarting ArDetect, we need to do this in order to force-recalculate aspect ratio
|
// if we're restarting ArDetect, we need to do this in order to force-recalculate aspect ratio
|
||||||
this.conf.resizer.setLastAr({type: AspectRatio.Automatic, ratio: null});
|
this.conf.resizer.setLastAr({type: AspectRatio.Automatic, ratio: this.getDefaultAr()});
|
||||||
|
|
||||||
this.canvasImageDataRowLength = cwidth << 2;
|
this.canvasImageDataRowLength = cwidth << 2;
|
||||||
this.noLetterboxCanvasReset = false;
|
this.noLetterboxCanvasReset = false;
|
||||||
@ -218,7 +218,7 @@ class ArDetector {
|
|||||||
}
|
}
|
||||||
if (this.conf.resizer.lastAr.type === AspectRatio.Automatic) {
|
if (this.conf.resizer.lastAr.type === AspectRatio.Automatic) {
|
||||||
// ensure first autodetection will run in any case
|
// ensure first autodetection will run in any case
|
||||||
this.conf.resizer.setLastAr({type: AspectRatio.Automatic, ratio: null});
|
this.conf.resizer.setLastAr({type: AspectRatio.Automatic, ratio: this.getDefaultAr()});
|
||||||
}
|
}
|
||||||
|
|
||||||
// launch main() if it's currently not running:
|
// launch main() if it's currently not running:
|
||||||
@ -247,7 +247,7 @@ class ArDetector {
|
|||||||
console.log("%c[ArDetect::_ard_stop] Stopping automatic aspect ratio detection", _ard_console_stop);
|
console.log("%c[ArDetect::_ard_stop] Stopping automatic aspect ratio detection", _ard_console_stop);
|
||||||
}
|
}
|
||||||
this._halted = true;
|
this._halted = true;
|
||||||
// this.conf.resizer.resetLastAr();
|
// this.conf.resizer.setArLastAr();
|
||||||
}
|
}
|
||||||
|
|
||||||
async main() {
|
async main() {
|
||||||
@ -428,6 +428,10 @@ class ArDetector {
|
|||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
getDefaultAr() {
|
||||||
|
return this.video.videoWidth / this.video.videoHeight;
|
||||||
|
}
|
||||||
|
|
||||||
calculateArFromEdges(edges) {
|
calculateArFromEdges(edges) {
|
||||||
// if we don't specify these things, they'll have some default values.
|
// if we don't specify these things, they'll have some default values.
|
||||||
if(edges.top === undefined){
|
if(edges.top === undefined){
|
||||||
@ -632,7 +636,7 @@ class ArDetector {
|
|||||||
// da je letterbox izginil.
|
// da je letterbox izginil.
|
||||||
// If we don't detect letterbox, we reset aspect ratio to aspect ratio of the video file. The aspect ratio could
|
// If we don't detect letterbox, we reset aspect ratio to aspect ratio of the video file. The aspect ratio could
|
||||||
// have been corrected manually. It's also possible that letterbox (that was there before) disappeared.
|
// have been corrected manually. It's also possible that letterbox (that was there before) disappeared.
|
||||||
this.conf.resizer.reset({type: AspectRatio.Automatic, ratio: null});
|
this.conf.resizer.setAr({type: AspectRatio.Automatic, ratio: this.getDefaultAr()});
|
||||||
this.guardLine.reset();
|
this.guardLine.reset();
|
||||||
this.noLetterboxCanvasReset = true;
|
this.noLetterboxCanvasReset = true;
|
||||||
|
|
||||||
@ -675,7 +679,7 @@ class ArDetector {
|
|||||||
// (since the new letterbox edge isn't present in our sample due to technical
|
// (since the new letterbox edge isn't present in our sample due to technical
|
||||||
// limitations)
|
// limitations)
|
||||||
if (this.fallbackMode && guardLineOut.blackbarFail) {
|
if (this.fallbackMode && guardLineOut.blackbarFail) {
|
||||||
this.conf.resizer.reset({type: AspectRatio.Automatic, ratio: null});
|
this.conf.resizer.setAr({type: AspectRatio.Automatic, ratio: this.getDefaultAr()});
|
||||||
this.guardLine.reset();
|
this.guardLine.reset();
|
||||||
this.noLetterboxCanvasReset = true;
|
this.noLetterboxCanvasReset = true;
|
||||||
|
|
||||||
@ -701,7 +705,7 @@ class ArDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(guardLineOut.blackbarFail){
|
if(guardLineOut.blackbarFail){
|
||||||
this.conf.resizer.reset({type: AspectRatio.Automatic, ratio: null});
|
this.conf.resizer.setAr({type: AspectRatio.Automatic, ratio: this.getDefaultAr()});
|
||||||
this.guardLine.reset();
|
this.guardLine.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,8 +381,9 @@ class PlayerData {
|
|||||||
console.log("[PlayerDetect] player size changed. reason: exited fullscreen");
|
console.log("[PlayerDetect] player size changed. reason: exited fullscreen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(! this.element)
|
if(! this.element && Debug.debug && Debug.playerDetect) {
|
||||||
console.log("[PlayerDetect] player element isnt defined");
|
console.log("[PlayerDetect] player element isnt defined");
|
||||||
|
}
|
||||||
|
|
||||||
if ( this.element &&
|
if ( this.element &&
|
||||||
( this.dimensions.width != this.element.offsetWidth ||
|
( this.dimensions.width != this.element.offsetWidth ||
|
||||||
|
Loading…
Reference in New Issue
Block a user