mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-09 16:53:47 +02:00
Ensure rotation is always clockwise, make CanvasSink more powerful, disable rotation metadata for Matroska outputs, & other changes
This commit is contained in:
@@ -29,6 +29,7 @@ import {
|
||||
isIso639Dash2LanguageCode,
|
||||
last,
|
||||
MATRIX_COEFFICIENTS_MAP_INVERSE,
|
||||
normalizeRotation,
|
||||
Rotation,
|
||||
roundToPrecision,
|
||||
TRANSFER_CHARACTERISTICS_MAP_INVERSE,
|
||||
@@ -820,9 +821,13 @@ export class MatroskaDemuxer extends Demuxer {
|
||||
case EBMLId.ProjectionPoseRoll: {
|
||||
if (this.currentTrack?.info?.type !== 'video') break;
|
||||
|
||||
const rotation = (reader.readFloat(size) + 360) % 360;
|
||||
if ([0, 90, 180, 270].includes(rotation)) {
|
||||
this.currentTrack.info.rotation = rotation as Rotation;
|
||||
const rotation = reader.readFloat(size);
|
||||
const flippedRotation = -rotation; // Convert clockwise to counter-clockwise
|
||||
|
||||
try {
|
||||
this.currentTrack.info.rotation = normalizeRotation(flippedRotation);
|
||||
} catch {
|
||||
// It wasn't a valid rotation
|
||||
}
|
||||
}; break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user