Skip to content

Commit e45ceac

Browse files
committed
[CoreVideo] Update to Xcode 26 beta 1-7.
TODO: * Remove unrelated changes.
1 parent 4ddfd41 commit e45ceac

File tree

10 files changed

+230
-222
lines changed

10 files changed

+230
-222
lines changed

src/CoreVideo/CVImageBuffer.cs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,44 +97,30 @@ public bool IsFlipped {
9797
}
9898
}
9999

100-
// it was mentioned in iOS4 diff (without an architecture) but it's never been seen elsewhere for iOS
101-
#if MONOMAC
102100
[DllImport (Constants.CoreVideoLibrary)]
103101
extern static /* CGColorSpaceRef */ IntPtr CVImageBufferGetColorSpace (/* CVImageBufferRef */ IntPtr imageBuffer);
104102

105-
/// <summary>Developers should not use this deprecated property. </summary>
106-
/// <value>To be added.</value>
107-
/// <remarks>To be added.</remarks>
108-
[UnsupportedOSPlatform ("maccatalyst")]
109-
[UnsupportedOSPlatform ("tvos")]
110-
[UnsupportedOSPlatform ("ios")]
111-
[SupportedOSPlatform ("macos")]
112-
[ObsoletedOSPlatform ("macos10.4")]
103+
/// <summary>Get the color space for this image buffer</summary>
104+
/// <value>The color space for this image buffer.</value>
113105
public CGColorSpace? ColorSpace {
114106
get {
115107
var h = CVImageBufferGetColorSpace (Handle);
116108
return h == IntPtr.Zero ? null : new CGColorSpace (h, false);
117109
}
118110
}
119-
#endif
120111

121-
#if MONOMAC
122112
[DllImport (Constants.CoreVideoLibrary)]
123113
extern static /* CGColorSpaceRef */ IntPtr CVImageBufferCreateColorSpaceFromAttachments (/* CFDictionaryRef */ IntPtr attachments);
124114

125-
/// <param name="attachments">To be added.</param>
126-
/// <summary>To be added.</summary>
127-
/// <returns>To be added.</returns>
128-
/// <remarks>To be added.</remarks>
115+
/// <summary>Try to create a <see cref="CGColorSpace" /> from an image buffer's attachments.</summary>
116+
/// <param name="attachments">An image buffer's attachments to use when trying to create a new color space.</param>
117+
/// <returns>If successful, a new <see cref="CGColorSpace" /> instance, otherwise <see langword="null" />.</returns>
129118
public static CGColorSpace? CreateFrom (NSDictionary attachments)
130119
{
131-
if (attachments is null)
132-
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (attachments));
133-
var h = CVImageBufferCreateColorSpaceFromAttachments (attachments.Handle);
120+
var h = CVImageBufferCreateColorSpaceFromAttachments (attachments.GetCheckedHandle ());
134121
GC.KeepAlive (attachments);
135122
return h == IntPtr.Zero ? null : new CGColorSpace (h, true);
136123
}
137-
#endif
138124

139125
[SupportedOSPlatform ("ios")]
140126
[SupportedOSPlatform ("macos")]

src/CoreVideo/CVPixelBuffer.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,27 @@ public CVReturn Unlock (CVPixelBufferLock unlockFlags)
595595
{
596596
return CVPixelBufferUnlockBaseAddress (Handle, unlockFlags);
597597
}
598+
599+
[DllImport (Constants.CoreVideoLibrary)]
600+
static extern byte CVPixelBufferIsCompatibleWithAttributes (IntPtr /* CVPixelBufferRef CV_NONNULL */ pixelBuffer, IntPtr /* CFDictionaryRef CV_NULLABLE */ attributes);
601+
602+
/// <summary>Check if this pixel buffer is compatible with the specified pixel buffer attributes.</summary>
603+
/// <param name="attributes">The attributes to check.</param>
604+
/// <returns><see langword="true" /> if this pixel buffer is compatible with the specified pixel buffer attributes, <see langword="false" /> otherwise.</returns>
605+
public bool IsCompatibleWithAttributes (NSDictionary? attributes)
606+
{
607+
var rv = CVPixelBufferIsCompatibleWithAttributes (GetCheckedHandle (), attributes.GetHandle ());
608+
GC.KeepAlive (attributes);
609+
return rv != 0;
610+
}
611+
612+
/// <summary>Check if this pixel buffer is compatible with the specified pixel buffer attributes.</summary>
613+
/// <param name="attributes">The attributes to check.</param>
614+
/// <returns><see langword="true" /> if this pixel buffer is compatible with the specified pixel buffer attributes, <see langword="false" /> otherwise.</returns>
615+
public bool IsCompatibleWithAttributes (CVPixelBufferAttributes? attributes)
616+
{
617+
return IsCompatibleWithAttributes (attributes?.Dictionary);
618+
}
598619
#endif // !COREBUILD
599620
}
600621
}

src/CoreVideo/CVPixelFormatType.cs

Lines changed: 101 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -28,168 +28,101 @@
2828
//
2929
using System;
3030
using System.Runtime.InteropServices;
31+
32+
using CoreFoundation;
3133
using ObjCRuntime;
3234

3335
#nullable enable
3436

3537
namespace CoreVideo {
36-
37-
// Note: CoreVideo is not supported in watchOS except for this enum
38-
// for which ObjC API uses `int` instead of the enum
39-
40-
// untyped enum, some are 4CC -> CVPixelBuffer.h
4138
/// <summary>An enumeration of known pixel formats.</summary>
42-
/// <remarks>To be added.</remarks>
4339
public enum CVPixelFormatType : uint {
44-
// FIXME: These all start with integers; what should we do here?
45-
/// <summary>To be added.</summary>
4640
CV1Monochrome = 0x00000001,
47-
/// <summary>To be added.</summary>
4841
CV2Indexed = 0x00000002,
49-
/// <summary>To be added.</summary>
5042
CV4Indexed = 0x00000004,
51-
/// <summary>To be added.</summary>
5243
CV8Indexed = 0x00000008,
53-
/// <summary>To be added.</summary>
5444
CV1IndexedGray_WhiteIsZero = 0x00000021,
55-
/// <summary>To be added.</summary>
5645
CV2IndexedGray_WhiteIsZero = 0x00000022,
57-
/// <summary>To be added.</summary>
5846
CV4IndexedGray_WhiteIsZero = 0x00000024,
59-
/// <summary>To be added.</summary>
6047
CV8IndexedGray_WhiteIsZero = 0x00000028,
61-
/// <summary>To be added.</summary>
6248
CV16BE555 = 0x00000010,
63-
/// <summary>To be added.</summary>
49+
CV16LE555 = ('L' << 24) + ('5' << 16) + ('5' << 8) + '5', // 'L555'
50+
CV16LE5551 = ('5' << 24) + ('5' << 16) + ('5' << 8) + '1', // '5551'
51+
CV16BE565 = ('B' << 24) + ('5' << 16) + ('6' << 8) + '5', // 'B565'
52+
CV16LE565 = ('L' << 24) + ('5' << 16) + ('6' << 8) + '5', // 'L565'
6453
CV24RGB = 0x00000018,
65-
/// <summary>To be added.</summary>
54+
CV24BGR = ('2' << 24) + ('4' << 16) + ('B' << 8) + 'G', // '24BG'
6655
CV32ARGB = 0x00000020,
67-
/// <summary>To be added.</summary>
68-
CV16LE555 = 0x4c353535,
69-
/// <summary>To be added.</summary>
70-
CV16LE5551 = 0x35353531,
71-
/// <summary>To be added.</summary>
72-
CV16BE565 = 0x42353635,
73-
/// <summary>To be added.</summary>
74-
CV16LE565 = 0x4c353635,
75-
/// <summary>To be added.</summary>
76-
CV24BGR = 0x32344247,
77-
/// <summary>To be added.</summary>
78-
CV32BGRA = 0x42475241,
79-
/// <summary>To be added.</summary>
80-
CV32ABGR = 0x41424752,
81-
/// <summary>To be added.</summary>
82-
CV32RGBA = 0x52474241,
83-
/// <summary>To be added.</summary>
84-
CV64ARGB = 0x62363461,
85-
/// <summary>To be added.</summary>
86-
CV48RGB = 0x62343872,
87-
/// <summary>To be added.</summary>
88-
CV32AlphaGray = 0x62333261,
89-
/// <summary>To be added.</summary>
90-
CV16Gray = 0x62313667,
56+
CV32BGRA = ('B' << 24) + ('G' << 16) + ('R' << 8) + 'A', // 'BGRA'
57+
CV32ABGR = ('A' << 24) + ('B' << 16) + ('G' << 8) + 'R', // 'ABGR'
58+
CV32RGBA = ('R' << 24) + ('G' << 16) + ('B' << 8) + 'A', // 'RGBA'
59+
CV64ARGB = ('b' << 24) + ('6' << 16) + ('4' << 8) + 'a', // 'b64a'
60+
CV64RGBALE = ('l' << 24) + ('6' << 16) + ('4' << 8) + 'r', // 'l64r'
61+
CV48RGB = ('b' << 24) + ('4' << 16) + ('8' << 8) + 'r', // 'b48r'
62+
CV32AlphaGray = ('b' << 24) + ('3' << 16) + ('2' << 8) + 'a', // 'b32a'
63+
CV16Gray = ('b' << 24) + ('1' << 16) + ('6' << 8) + 'g', // 'b16g'
64+
CV30RGB = ('R' << 24) + ('1' << 16) + ('0' << 8) + 'k', // 'R10k'
9165
/// <summary>30-bit RGB, 10-bit big endian samples, 2 unused padding bits (at most significant end).</summary>
92-
CV30RGB_r210 = 0x72323130, // 'r210'
93-
/// <summary>To be added.</summary>
94-
CV422YpCbCr8 = 0x32767579,
95-
/// <summary>To be added.</summary>
96-
CV4444YpCbCrA8 = 0x76343038,
97-
/// <summary>To be added.</summary>
98-
CV4444YpCbCrA8R = 0x72343038,
99-
/// <summary>To be added.</summary>
100-
CV444YpCbCr8 = 0x76333038,
101-
/// <summary>To be added.</summary>
102-
CV422YpCbCr16 = 0x76323136,
103-
/// <summary>To be added.</summary>
104-
CV422YpCbCr10 = 0x76323130,
105-
/// <summary>To be added.</summary>
106-
CV444YpCbCr10 = 0x76343130,
107-
/// <summary>To be added.</summary>
108-
CV420YpCbCr8Planar = 0x79343230,
109-
/// <summary>To be added.</summary>
110-
CV420YpCbCr8PlanarFullRange = 0x66343230,
111-
/// <summary>To be added.</summary>
112-
CV422YpCbCr_4A_8BiPlanar = 0x61327679,
113-
/// <summary>To be added.</summary>
114-
CV420YpCbCr8BiPlanarVideoRange = 0x34323076,
115-
/// <summary>To be added.</summary>
116-
CV420YpCbCr8BiPlanarFullRange = 0x34323066,
117-
/// <summary>To be added.</summary>
118-
CV422YpCbCr8_yuvs = 0x79757673,
119-
/// <summary>To be added.</summary>
120-
CV422YpCbCr8FullRange = 0x79757666,
121-
/// <summary>To be added.</summary>
122-
CV30RGB = 0x5231306b,
123-
/// <summary>To be added.</summary>
124-
CV4444AYpCbCr8 = 0x79343038,
125-
/// <summary>To be added.</summary>
126-
CV4444AYpCbCr16 = 0x79343136,
127-
// Since 5.1
128-
/// <summary>To be added.</summary>
129-
OneComponent8 = 0x4C303038,
130-
/// <summary>To be added.</summary>
131-
TwoComponent8 = 0x32433038,
132-
// Since 6.0
133-
/// <summary>To be added.</summary>
134-
OneComponent16Half = 0x4C303068, // 'L00h'
135-
/// <summary>To be added.</summary>
136-
OneComponent32Float = 0x4C303066, // 'L00f'
137-
/// <summary>To be added.</summary>
138-
TwoComponent16Half = 0x32433068, // '2C0h'
139-
/// <summary>To be added.</summary>
140-
TwoComponent32Float = 0x32433066, // '2C0f'
141-
/// <summary>To be added.</summary>
142-
CV64RGBAHalf = 0x52476841, // 'RGhA'
143-
/// <summary>To be added.</summary>
144-
CV128RGBAFloat = 0x52476641, // 'RGfA'
145-
// iOS 10
146-
/// <summary>To be added.</summary>
147-
CV30RgbLePackedWideGamut = 0x77333072, // 'w30r'
148-
/// <summary>To be added.</summary>
149-
CV14BayerGrbg = 0x67726234, // 'grb4',
150-
/// <summary>To be added.</summary>
151-
CV14BayerRggb = 0x72676734, // 'rgg4',
152-
/// <summary>To be added.</summary>
153-
CV14BayerBggr = 0x62676734, // 'bgg4',
154-
/// <summary>To be added.</summary>
155-
CV14BayerGbrg = 0x67627234, // 'gbr4',
156-
// iOS 10.3
157-
/// <summary>To be added.</summary>
158-
Argb2101010LEPacked = 0x6C313072, // 'l10r'
159-
// iOS 11.0
160-
/// <summary>To be added.</summary>
161-
DisparityFloat16 = 0x68646973, // hdis
162-
/// <summary>To be added.</summary>
163-
DisparityFloat32 = 0x66646973, // fdis
164-
/// <summary>To be added.</summary>
165-
DepthFloat16 = 0x68646570, // hdep
166-
/// <summary>To be added.</summary>
167-
DepthFloat32 = 0x66646570, // fdep
168-
/// <summary>To be added.</summary>
169-
CV420YpCbCr10BiPlanarVideoRange = 0x78343230, // x420
170-
/// <summary>To be added.</summary>
171-
CV422YpCbCr10BiPlanarVideoRange = 0x78343232, // x422
172-
/// <summary>To be added.</summary>
173-
CV444YpCbCr10BiPlanarVideoRange = 0x78343434, // x444
174-
/// <summary>To be added.</summary>
175-
CV420YpCbCr10BiPlanarFullRange = 0x78663230, // xf20
176-
/// <summary>To be added.</summary>
177-
CV422YpCbCr10BiPlanarFullRange = 0x78663232, // xf22
178-
/// <summary>To be added.</summary>
179-
CV444YpCbCr10BiPlanarFullRange = 0x78663434, // xf44
180-
// iOS 14.0
181-
CV422YpCbCr8BiPlanarVideoRange = 0x34323276, // '422v'
182-
CV422YpCbCr8BiPlanarFullRange = 0x34323266, // '422f'
183-
CV444YpCbCr8BiPlanarVideoRange = 0x34343476, // '444v'
184-
CV444YpCbCr8BiPlanarFullRange = 0x34343466, // '444f'
185-
OneComponent10 = 0x4c303130, // 'L010'
186-
OneComponent12 = 0x4c303132, // 'L012'
187-
OneComponent16 = 0x4c303136, // 'L016'
188-
TwoComponent16 = 0x32433136, // '2C16'
189-
CV16VersatileBayer = 0x62703136, // 'bp16'
190-
CV64Rgba_DownscaledProResRaw = 0x62703634, // 'bp64'
191-
// iOS 14.2
192-
CV64RgbaLE = 0x6C363472,
66+
CV30RGB_r210 = ('r' << 24) + ('2' << 16) + ('1' << 8) + '0', // 'r210'
67+
CV422YpCbCr8 = ('2' << 24) + ('v' << 16) + ('u' << 8) + 'y', // '2vuy'
68+
CV4444YpCbCrA8 = ('v' << 24) + ('4' << 16) + ('0' << 8) + '8', // 'v408'
69+
CV4444YpCbCrA8R = ('r' << 24) + ('4' << 16) + ('0' << 8) + '8', // 'r408'
70+
CV4444AYpCbCr8 = ('y' << 24) + ('4' << 16) + ('0' << 8) + '8', // 'y408'
71+
CV4444AYpCbCr16 = ('y' << 24) + ('4' << 16) + ('1' << 8) + '6', // 'y416'
72+
CV4444AYpCbCrFloat = ('r' << 24) + ('4' << 16) + ('f' << 8) + 'l', // 'r4fl'
73+
CV444YpCbCr8 = ('v' << 24) + ('3' << 16) + ('0' << 8) + '8', // 'v308'
74+
CV422YpCbCr16 = ('v' << 24) + ('2' << 16) + ('1' << 8) + '6', // 'v216'
75+
CV422YpCbCr10 = ('v' << 24) + ('2' << 16) + ('1' << 8) + '0', // 'v210'
76+
CV444YpCbCr10 = ('v' << 24) + ('4' << 16) + ('1' << 8) + '0', // 'v410'
77+
CV420YpCbCr8Planar = ('y' << 24) + ('4' << 16) + ('2' << 8) + '0', // 'y420'
78+
CV420YpCbCr8PlanarFullRange = ('f' << 24) + ('4' << 16) + ('2' << 8) + '0', // 'f420'
79+
CV422YpCbCr_4A_8BiPlanar = ('a' << 24) + ('2' << 16) + ('v' << 8) + 'y', // 'a2vy'
80+
CV420YpCbCr8BiPlanarVideoRange = ('4' << 24) + ('2' << 16) + ('0' << 8) + 'v', // '420v'
81+
CV420YpCbCr8BiPlanarFullRange = ('4' << 24) + ('2' << 16) + ('0' << 8) + 'f', // '420f'
82+
CV422YpCbCr8BiPlanarVideoRange = ('4' << 24) + ('2' << 16) + ('2' << 8) + 'v', // '422v'
83+
CV422YpCbCr8BiPlanarFullRange = ('4' << 24) + ('2' << 16) + ('2' << 8) + 'f', // '422f'
84+
CV444YpCbCr8BiPlanarVideoRange = ('4' << 24) + ('4' << 16) + ('4' << 8) + 'v', // '444v'
85+
CV444YpCbCr8BiPlanarFullRange = ('4' << 24) + ('4' << 16) + ('4' << 8) + 'f', // '444f'
86+
CV422YpCbCr8_yuvs = ('y' << 24) + ('u' << 16) + ('v' << 8) + 's', // 'yuvs'
87+
CV422YpCbCr8FullRange = ('y' << 24) + ('u' << 16) + ('v' << 8) + 'f', // 'yuvf'
88+
OneComponent8 = ('L' << 24) + ('0' << 16) + ('0' << 8) + '8', // 'L008'
89+
TwoComponent8 = ('2' << 24) + ('C' << 16) + ('0' << 8) + '8', // '2C08'
90+
CV30RGBLEPackedWideGamut = ('w' << 24) + ('3' << 16) + ('0' << 8) + 'r', // 'w30r'
91+
ARGB2101010LEPacked = ('l' << 24) + ('1' << 16) + ('0' << 8) + 'r', // 'l10r'
92+
CV40ARGBLEWideGamut = ('w' << 24) + ('4' << 16) + ('0' << 8) + 'a', // 'w40a'
93+
CV40ARGBLEWideGamutPremultiplied = ('w' << 24) + ('4' << 16) + ('0' << 8) + 'm', // 'w40m'
94+
OneComponent10 = ('L' << 24) + ('0' << 16) + ('1' << 8) + '0', // 'L010'
95+
OneComponent12 = ('L' << 24) + ('0' << 16) + ('1' << 8) + '2', // 'L012'
96+
OneComponent16 = ('L' << 24) + ('0' << 16) + ('1' << 8) + '6', // 'L016'
97+
TwoComponent16 = ('2' << 24) + ('C' << 16) + ('1' << 8) + '6', // '2C16'
98+
OneComponent16Half = ('L' << 24) + ('0' << 16) + ('0' << 8) + 'h', // 'L00h'
99+
OneComponent32Float = ('L' << 24) + ('0' << 16) + ('0' << 8) + 'f', // 'L00f'
100+
TwoComponent16Half = ('2' << 24) + ('C' << 16) + ('0' << 8) + 'h', // '2C0h'
101+
TwoComponent32Float = ('2' << 24) + ('C' << 16) + ('0' << 8) + 'f', // '2C0f'
102+
CV64RGBAHalf = ('R' << 24) + ('G' << 16) + ('h' << 8) + 'A', // 'RGhA'
103+
CV128RGBAFloat = ('R' << 24) + ('G' << 16) + ('f' << 8) + 'A', // 'RGfA'
104+
CV14BayerGrbg = ('g' << 24) + ('r' << 16) + ('b' << 8) + '4', // 'grb4'
105+
CV14BayerRggb = ('r' << 24) + ('g' << 16) + ('g' << 8) + '4', // 'rgg4'
106+
CV14BayerBggr = ('b' << 24) + ('g' << 16) + ('g' << 8) + '4', // 'bgg4'
107+
CV14BayerGbrg = ('g' << 24) + ('b' << 16) + ('r' << 8) + '4', // 'gbr4'
108+
DisparityFloat16 = ('h' << 24) + ('d' << 16) + ('i' << 8) + 's', // 'hdis'
109+
DisparityFloat32 = ('f' << 24) + ('d' << 16) + ('i' << 8) + 's', // 'fdis'
110+
DepthFloat16 = ('h' << 24) + ('d' << 16) + ('e' << 8) + 'p', // 'hdep'
111+
DepthFloat32 = ('f' << 24) + ('d' << 16) + ('e' << 8) + 'p', // 'fdep'
112+
CV420YpCbCr10BiPlanarVideoRange = ('x' << 24) + ('4' << 16) + ('2' << 8) + '0', // 'x420'
113+
CV422YpCbCr10BiPlanarVideoRange = ('x' << 24) + ('4' << 16) + ('2' << 8) + '2', // 'x422'
114+
CV444YpCbCr10BiPlanarVideoRange = ('x' << 24) + ('4' << 16) + ('4' << 8) + '4', // 'x444'
115+
CV420YpCbCr10BiPlanarFullRange = ('x' << 24) + ('f' << 16) + ('2' << 8) + '0', // 'xf20'
116+
CV422YpCbCr10BiPlanarFullRange = ('x' << 24) + ('f' << 16) + ('2' << 8) + '2', // 'xf22'
117+
CV444YpCbCr10BiPlanarFullRange = ('x' << 24) + ('f' << 16) + ('4' << 8) + '4', // 'xf44'
118+
CV420YpCbCr8VideoRange_8A_TriPlanar = ('v' << 24) + ('0' << 16) + ('a' << 8) + '8', // 'v0a8'
119+
CV16VersatileBayer = ('b' << 24) + ('p' << 16) + ('1' << 8) + '6', // 'bp16'
120+
CV96VersatileBayerPacked12 = ('b' << 24) + ('t' << 16) + ('p' << 8) + '2', // 'btp2'
121+
CV64RGBA_DownscaledProResRAW = ('b' << 24) + ('p' << 16) + ('6' << 8) + '4', // 'bp64'
122+
CV422YpCbCr16BiPlanarVideoRange = ('s' << 24) + ('v' << 16) + ('2' << 8) + '2', // 'sv22'
123+
CV444YpCbCr16BiPlanarVideoRange = ('s' << 24) + ('v' << 16) + ('4' << 8) + '4', // 'sv44'
124+
CV444YpCbCr16VideoRange_16A_TriPlanar = ('s' << 24) + ('4' << 16) + ('a' << 8) + 's', // 's4as'
125+
CV30RGBLE_8A_BiPlanar = ('b' << 24) + ('3' << 16) + ('a' << 8) + '8', // 'b3a8'
193126

194127
/* Lossless pixel formats */
195128

@@ -214,6 +147,11 @@ public enum CVPixelFormatType : uint {
214147
/// <summary>Lossless-compressed form of <see cref="CV420YpCbCr10BiPlanarFullRange" />. No CVPlanarPixelBufferInfo struct. Compressed-packed with bo padding bits between pixels.</summary>
215148
Lossless_420YpCbCr10PackedBiPlanarFullRange = ('&' << 24) + ('x' << 16) + ('f' << 8) + '0', // '&xf0'
216149

150+
/// <summary>Lossless-compressed form of <see cref="CV30RGBLE_8A_BiPlanar" />. No CVPlanarPixelBufferInfo struct.</summary>
151+
Lossless_30RGBLE_8A_BiPlanar = ('&' << 24) + ('b' << 16) + ('3' << 8) + '8', // '&b38'
152+
/// <summary>Lossless-compressed form of <see cref="CV30RGBLEPackedWideGamut" />. No CVPlanarPixelBufferInfo struct.</summary>
153+
Lossless_30RGBLEPackedWideGamut = ('&' << 24) + ('w' << 16) + ('3' << 8) + 'r', // '&w3r'
154+
217155
/* Lossy pixel formats */
218156

219157
/// <summary>Lossy-compressed form of <see cref="CV32BGRA" />. No CVPlanarPixelBufferInfo struct.</summary>
@@ -252,6 +190,26 @@ public static class CVPixelFormatTypeExtensions {
252190
[SupportedOSPlatform ("maccatalyst")]
253191
public static bool IsCompressedPixelFormatAvailable (this CVPixelFormatType type)
254192
=> CVIsCompressedPixelFormatAvailable ((uint) type) != 0;
193+
194+
[SupportedOSPlatform ("tvos26.0")]
195+
[SupportedOSPlatform ("macos26.0")]
196+
[SupportedOSPlatform ("ios26.0")]
197+
[SupportedOSPlatform ("maccatalyst26.0")]
198+
[DllImport (Constants.CoreVideoLibrary)]
199+
static extern IntPtr /* CFStringRef CV_NONNULL CF_RETURNS_RETAINED */ CVPixelFormatTypeCopyFourCharCodeString (CVPixelFormatType /* uint */ pixelFormatType);
200+
201+
/// <summary>Get the pixel format type's FourCC code as a string.</summary>
202+
/// <param name="type">The pixel format type to convert to a string.</param>
203+
/// <summary>The pixel format type's FourCC code as a string.</summary>
204+
[SupportedOSPlatform ("tvos26.0")]
205+
[SupportedOSPlatform ("macos26.0")]
206+
[SupportedOSPlatform ("ios26.0")]
207+
[SupportedOSPlatform ("maccatalyst26.0")]
208+
public static string? ToFourCharCodeString (this CVPixelFormatType type)
209+
{
210+
var rv = CVPixelFormatTypeCopyFourCharCodeString (type);
211+
return CFString.FromHandle (rv, releaseHandle: true);
212+
}
255213
}
256214
#endif
257215
}

0 commit comments

Comments
 (0)