Changeset 286953 in webkit
- Timestamp:
- Dec 13, 2021, 9:53:55 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/avfoundation/FormatDescriptionUtilities.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286952 r286953 1 2021-12-13 Jer Noble <jer.noble@apple.com> 2 3 Unreviewed build fix; add a convenience function to safely compare possibly null CFStringRefs. 4 5 * platform/graphics/avfoundation/FormatDescriptionUtilities.cpp: 6 (WebCore::presentationSizeFromFormatDescription): 7 (WebCore::colorSpaceFromFormatDescription): 8 1 9 2021-12-13 Sergio Villar Senin <svillar@igalia.com> 2 10 -
trunk/Source/WebCore/platform/graphics/avfoundation/FormatDescriptionUtilities.cpp
r286937 r286953 50 50 if (!formatDescription) 51 51 return { }; 52 52 53 53 return FloatSize(PAL::CMVideoFormatDescriptionGetPresentationDimensions(formatDescription, true, true)); 54 54 } … … 59 59 return std::nullopt; 60 60 61 auto safeCFStringEquals = [] (CFStringRef one, CFStringRef two) -> bool { 62 if (!one || !two) 63 return false; 64 return CFStringCompare(one, two, 0) == kCFCompareEqualTo; 65 }; 66 61 67 PlatformVideoColorSpace colorSpace; 62 68 if (auto primaries = static_cast<CFStringRef>(PAL::CMFormatDescriptionGetExtension(formatDescription, PAL::get_CoreMedia_kCMFormatDescriptionExtension_ColorPrimaries()))) { 63 if ( CFStringCompare(primaries, PAL::get_CoreMedia_kCMFormatDescriptionColorPrimaries_ITU_R_709_2(), 0) == kCFCompareEqualTo)69 if (safeCFStringEquals(primaries, PAL::get_CoreMedia_kCMFormatDescriptionColorPrimaries_ITU_R_709_2())) 64 70 colorSpace.primaries = PlatformVideoColorPrimaries::Bt709; 65 else if ( CFStringCompare(primaries, PAL::get_CoreMedia_kCMFormatDescriptionColorPrimaries_EBU_3213(), 0) == kCFCompareEqualTo)71 else if (safeCFStringEquals(primaries, PAL::get_CoreMedia_kCMFormatDescriptionColorPrimaries_EBU_3213())) 66 72 colorSpace.primaries = PlatformVideoColorPrimaries::Bt470bg; 67 else if ( CFStringCompare(primaries, PAL::get_CoreMedia_kCMFormatDescriptionColorPrimaries_SMPTE_C(), 0) == kCFCompareEqualTo)73 else if (safeCFStringEquals(primaries, PAL::get_CoreMedia_kCMFormatDescriptionColorPrimaries_SMPTE_C())) 68 74 colorSpace.primaries = PlatformVideoColorPrimaries::Smpte170m; 69 75 } 70 76 71 77 if (auto transfer = static_cast<CFStringRef>(PAL::CMFormatDescriptionGetExtension(formatDescription, PAL::get_CoreMedia_kCMFormatDescriptionExtension_TransferFunction()))) { 72 if ( CFStringCompare(transfer, PAL::get_CoreMedia_kCMFormatDescriptionTransferFunction_ITU_R_709_2(), 0) == kCFCompareEqualTo)78 if (safeCFStringEquals(transfer, PAL::get_CoreMedia_kCMFormatDescriptionTransferFunction_ITU_R_709_2())) 73 79 colorSpace.transfer = PlatformVideoTransferCharacteristics::Bt709; 74 else if ( CFStringCompare(transfer, PAL::get_CoreMedia_kCMFormatDescriptionTransferFunction_sRGB(), 0) == kCFCompareEqualTo)80 else if (safeCFStringEquals(transfer, PAL::get_CoreMedia_kCMFormatDescriptionTransferFunction_sRGB())) 75 81 colorSpace.transfer = PlatformVideoTransferCharacteristics::Iec6196621; 76 82 } 77 83 78 84 if (auto matrix = static_cast<CFStringRef>(PAL::CMFormatDescriptionGetExtension(formatDescription, PAL::get_CoreMedia_kCMFormatDescriptionExtension_YCbCrMatrix()))) { 79 if ( CFStringCompare(matrix, PAL::get_CoreMedia_kCVImageBufferYCbCrMatrix_ITU_R_709_2(), 0) == kCFCompareEqualTo)85 if (safeCFStringEquals(matrix, PAL::get_CoreMedia_kCVImageBufferYCbCrMatrix_ITU_R_709_2())) 80 86 colorSpace.matrix = PlatformVideoMatrixCoefficients::Bt709; 81 else if ( CFStringCompare(matrix, PAL::get_CoreMedia_kCVImageBufferYCbCrMatrix_ITU_R_601_4(), 0) == kCFCompareEqualTo)87 else if (safeCFStringEquals(matrix, PAL::get_CoreMedia_kCVImageBufferYCbCrMatrix_ITU_R_601_4())) 82 88 colorSpace.matrix = PlatformVideoMatrixCoefficients::Bt470bg; 83 else if ( CFStringCompare(matrix, PAL::get_CoreMedia_kCMFormatDescriptionYCbCrMatrix_SMPTE_240M_1995(), 0) == kCFCompareEqualTo)89 else if (safeCFStringEquals(matrix, PAL::get_CoreMedia_kCMFormatDescriptionYCbCrMatrix_SMPTE_240M_1995())) 84 90 colorSpace.matrix = PlatformVideoMatrixCoefficients::Smpte170m; 85 91 }
Note:
See TracChangeset
for help on using the changeset viewer.