Set par to 1/1 nothing is set in MP42AVFImporter.
This commit is contained in:
1 parent
2ac1f4d80e
commit
0a9adee00b
1 file changed
+51
-41
+51
-41
@@ -138,6 +138,10 @@
|
||||
videoTrack.hSpacing = hSpacing;
|
||||
videoTrack.vSpacing = vSpacing;
|
||||
}
|
||||
else {
|
||||
videoTrack.hSpacing = 1;
|
||||
videoTrack.vSpacing = 1;
|
||||
}
|
||||
|
||||
// Reads the clean aperture information
|
||||
CFDictionaryRef cleanApertureFromCMFormatDescription = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_CleanAperture);
|
||||
@@ -167,55 +171,61 @@
|
||||
// Color
|
||||
CFStringRef colorPrimaries = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_ColorPrimaries);
|
||||
|
||||
if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_ITU_R_709_2)) {
|
||||
videoTrack.colorPrimaries = 1;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_EBU_3213)) {
|
||||
videoTrack.colorPrimaries = 5;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_SMPTE_C)) {
|
||||
videoTrack.colorPrimaries = 6;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_ITU_R_2020)) {
|
||||
videoTrack.colorPrimaries = 9;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_DCI_P3)) {
|
||||
videoTrack.colorPrimaries = 11;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_P3_D65)) {
|
||||
videoTrack.colorPrimaries = 12;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_P22)) {
|
||||
// ???
|
||||
videoTrack.colorPrimaries = 1;
|
||||
if (colorPrimaries) {
|
||||
if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_ITU_R_709_2)) {
|
||||
videoTrack.colorPrimaries = 1;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_EBU_3213)) {
|
||||
videoTrack.colorPrimaries = 5;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_SMPTE_C)) {
|
||||
videoTrack.colorPrimaries = 6;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_ITU_R_2020)) {
|
||||
videoTrack.colorPrimaries = 9;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_DCI_P3)) {
|
||||
videoTrack.colorPrimaries = 11;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_P3_D65)) {
|
||||
videoTrack.colorPrimaries = 12;
|
||||
}
|
||||
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_P22)) {
|
||||
// ???
|
||||
videoTrack.colorPrimaries = 1;
|
||||
}
|
||||
}
|
||||
|
||||
CFStringRef transferFunctions = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_TransferFunction);
|
||||
|
||||
if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_ITU_R_709_2) ||
|
||||
CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_ITU_R_2020)) {
|
||||
videoTrack.transferCharacteristics = 1;
|
||||
}
|
||||
else if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_SMPTE_240M_1995)) {
|
||||
videoTrack.transferCharacteristics = 7;
|
||||
}
|
||||
else if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_SMPTE_ST_428_1)) {
|
||||
videoTrack.transferCharacteristics = 17;
|
||||
if (transferFunctions) {
|
||||
if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_ITU_R_709_2) ||
|
||||
CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_ITU_R_2020)) {
|
||||
videoTrack.transferCharacteristics = 1;
|
||||
}
|
||||
else if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_SMPTE_240M_1995)) {
|
||||
videoTrack.transferCharacteristics = 7;
|
||||
}
|
||||
else if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_SMPTE_ST_428_1)) {
|
||||
videoTrack.transferCharacteristics = 17;
|
||||
}
|
||||
}
|
||||
|
||||
CFStringRef YCbCrMatrix = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_YCbCrMatrix);
|
||||
|
||||
if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_ITU_R_709_2)) {
|
||||
videoTrack.matrixCoefficients = 1;
|
||||
}
|
||||
else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_ITU_R_601_4)) {
|
||||
videoTrack.matrixCoefficients = 6;
|
||||
}
|
||||
else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_SMPTE_240M_1995)) {
|
||||
videoTrack.matrixCoefficients = 7;
|
||||
}
|
||||
else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_ITU_R_2020)) {
|
||||
videoTrack.matrixCoefficients = 9;
|
||||
if (YCbCrMatrix) {
|
||||
if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_ITU_R_709_2)) {
|
||||
videoTrack.matrixCoefficients = 1;
|
||||
}
|
||||
else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_ITU_R_601_4)) {
|
||||
videoTrack.matrixCoefficients = 6;
|
||||
}
|
||||
else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_SMPTE_240M_1995)) {
|
||||
videoTrack.matrixCoefficients = 7;
|
||||
}
|
||||
else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_ITU_R_2020)) {
|
||||
videoTrack.matrixCoefficients = 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
newTrack = videoTrack;
|
||||
|
||||
Reference in new issue
Block a user