MPEG4Writer.cpp
void MPEG4Writer::writeCompositionMatrix(int degrees)
MPEG4Extractor.cpp
status_t MPEG4Extractor::parseTrackHeader(off64_t data_offset, off64_t data_size)
static const int32_t kFixedOne = 0x10000;
if (a00 == kFixedOne && a01 == 0 && a10 == 0 && a11 == kFixedOne) {
// Identity, no rotation
rotationDegrees = 0;
} else if (a00 == 0 && a01 == kFixedOne && a10 == -kFixedOne && a11 == 0) {
rotationDegrees = 90;
} else if (a00 == 0 && a01 == -kFixedOne && a10 == kFixedOne && a11 == 0) {
rotationDegrees = 270;
} else if (a00 == -kFixedOne && a01 == 0 && a10 == 0 && a11 == -kFixedOne) {
rotationDegrees = 180;
} else {
LOGW("We only support 0,90,180,270 degree rotation matrices");
rotationDegrees = 0;
}
if (rotationDegrees != 0) {
mLastTrack->meta->setInt32(kKeyRotation, rotationDegrees);
}
......
}
void MPEG4Writer::writeCompositionMatrix(int degrees)
MPEG4Extractor.cpp
status_t MPEG4Extractor::parseTrackHeader(off64_t data_offset, off64_t data_size)
{
......
static const int32_t kFixedOne = 0x10000;
if (a00 == kFixedOne && a01 == 0 && a10 == 0 && a11 == kFixedOne) {
// Identity, no rotation
rotationDegrees = 0;
} else if (a00 == 0 && a01 == kFixedOne && a10 == -kFixedOne && a11 == 0) {
rotationDegrees = 90;
} else if (a00 == 0 && a01 == -kFixedOne && a10 == kFixedOne && a11 == 0) {
rotationDegrees = 270;
} else if (a00 == -kFixedOne && a01 == 0 && a10 == 0 && a11 == -kFixedOne) {
rotationDegrees = 180;
} else {
LOGW("We only support 0,90,180,270 degree rotation matrices");
rotationDegrees = 0;
}
if (rotationDegrees != 0) {
mLastTrack->meta->setInt32(kKeyRotation, rotationDegrees);
}
......
}
本文介绍了MPEG4Extractor类中对于视频旋转矩阵的解析逻辑,通过不同的矩阵配置来确定视频旋转的角度,并设置到对应的元数据中。支持的旋转角度包括0度、90度、180度和270度。
2万+

被折叠的 条评论
为什么被折叠?



