[mob][photos] Fix bug in parsing rotation metadata from video using FFProbe

This commit is contained in:
ashilkn 2024-08-01 16:51:36 +05:30
parent be00f015a7
commit af5e9b51e1
2 changed files with 20 additions and 1 deletions

View File

@ -72,6 +72,7 @@ class FFProbeKeys {
static const xiaomiSlowMoment = 'com.xiaomi.slow_moment';
static const sideDataList = 'side_data_list';
static const rotation = 'rotation';
static const sideDataType = 'side_data_type';
}
class MediaStreamTypes {
@ -83,3 +84,16 @@ class MediaStreamTypes {
static const unknown = 'unknown';
static const video = 'video';
}
enum SideDataType {
displayMatrix;
getString() {
switch (this) {
case SideDataType.displayMatrix:
return 'Display Matrix';
default:
assert(false, 'Unknown side data type: $this');
}
}
}

View File

@ -174,7 +174,12 @@ class FFProbeProps {
result._codecHeight = stream[key].toString();
parsedData[key] = result._codecHeight;
} else if (key == FFProbeKeys.sideDataList) {
result._rotation = stream[key][0][FFProbeKeys.rotation];
for (Map sideData in stream[key]) {
if (sideData[FFProbeKeys.sideDataType] ==
SideDataType.displayMatrix.getString()) {
result._rotation = sideData[FFProbeKeys.rotation];
}
}
}
}
}