Set par to 1/1 nothing is set in MP42AVFImporter.

This commit is contained in:
Damiano Galassi committed 2016-11-30 10:50:20 +01:00
1 parent 2ac1f4d80e
commit 0a9adee00b
1 file changed
+51 -41
+51 -41
View File
@@ -138,6 +138,10 @@
videoTrack.hSpacing = hSpacing; videoTrack.hSpacing = hSpacing;
videoTrack.vSpacing = vSpacing; videoTrack.vSpacing = vSpacing;
} }
else {
videoTrack.hSpacing = 1;
videoTrack.vSpacing = 1;
}
// Reads the clean aperture information // Reads the clean aperture information
CFDictionaryRef cleanApertureFromCMFormatDescription = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_CleanAperture); CFDictionaryRef cleanApertureFromCMFormatDescription = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_CleanAperture);
@@ -167,55 +171,61 @@
// Color // Color
CFStringRef colorPrimaries = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_ColorPrimaries); CFStringRef colorPrimaries = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_ColorPrimaries);
if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_ITU_R_709_2)) { if (colorPrimaries) {
videoTrack.colorPrimaries = 1; 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_EBU_3213)) {
} videoTrack.colorPrimaries = 5;
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_SMPTE_C)) { }
videoTrack.colorPrimaries = 6; 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_ITU_R_2020)) {
} videoTrack.colorPrimaries = 9;
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_DCI_P3)) { }
videoTrack.colorPrimaries = 11; 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_P3_D65)) {
} videoTrack.colorPrimaries = 12;
else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_P22)) { }
// ??? else if (CFEqual(colorPrimaries, kCMFormatDescriptionColorPrimaries_P22)) {
videoTrack.colorPrimaries = 1; // ???
videoTrack.colorPrimaries = 1;
}
} }
CFStringRef transferFunctions = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_TransferFunction); CFStringRef transferFunctions = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_TransferFunction);
if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_ITU_R_709_2) || if (transferFunctions) {
CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_ITU_R_2020)) { if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_ITU_R_709_2) ||
videoTrack.transferCharacteristics = 1; 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_240M_1995)) {
} videoTrack.transferCharacteristics = 7;
else if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_SMPTE_ST_428_1)) { }
videoTrack.transferCharacteristics = 17; else if (CFEqual(transferFunctions, kCMFormatDescriptionTransferFunction_SMPTE_ST_428_1)) {
videoTrack.transferCharacteristics = 17;
}
} }
CFStringRef YCbCrMatrix = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_YCbCrMatrix); CFStringRef YCbCrMatrix = CMFormatDescriptionGetExtension(formatDescription, kCMFormatDescriptionExtension_YCbCrMatrix);
if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_ITU_R_709_2)) { if (YCbCrMatrix) {
videoTrack.matrixCoefficients = 1; 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_ITU_R_601_4)) {
} videoTrack.matrixCoefficients = 6;
else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_SMPTE_240M_1995)) { }
videoTrack.matrixCoefficients = 7; else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_SMPTE_240M_1995)) {
} videoTrack.matrixCoefficients = 7;
else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_ITU_R_2020)) { }
videoTrack.matrixCoefficients = 9; else if (CFEqual(YCbCrMatrix, kCMFormatDescriptionYCbCrMatrix_ITU_R_2020)) {
videoTrack.matrixCoefficients = 9;
}
} }
} }
newTrack = videoTrack; newTrack = videoTrack;