Skip to content

Commit c7407c0

Browse files
authored
[VideoToolbox] Implement up to Xcode 16.3 RC. (#22494)
This also required a fix for the introspection tests to properly ignore inlined protocol members.
1 parent c90957b commit c7407c0

File tree

12 files changed

+803
-124
lines changed

12 files changed

+803
-124
lines changed

src/CoreVideo/CVPixelBufferAttributes.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,33 @@ public CVPixelFormatType? PixelFormatType {
7171
}
7272
}
7373

74+
/// <summary>The pixel formats of the pixel buffer.</summary>
75+
/// <value></value>
76+
/// <remarks>The property uses constant kCVPixelBufferPixelFormatTypeKey value to access the underlying dictionary.</remarks>
77+
public CVPixelFormatType []? PixelFormatTypes {
78+
get {
79+
var obj = GetNativeValue<NSObject> (CVPixelBuffer.PixelFormatTypeKey);
80+
if (obj is null) {
81+
return null;
82+
} else if (obj is NSNumber number) {
83+
return new CVPixelFormatType [] { (CVPixelFormatType) number.UInt32Value };
84+
} else if (obj is NSArray array) {
85+
return Array.ConvertAll (array.ToArray (), (v) => (CVPixelFormatType) ((NSNumber) v).UInt32Value);
86+
} else {
87+
throw new InvalidOperationException ($"Unable to convert object of type {obj.GetType ()} into an array of CVPixelFormatType.");
88+
}
89+
}
90+
set {
91+
if (value is null) {
92+
SetNumberValue (CVPixelBuffer.PixelFormatTypeKey, (uint?) null);
93+
} else if (value.Length == 1) {
94+
SetNumberValue (CVPixelBuffer.PixelFormatTypeKey, (uint?) value [0]);
95+
} else {
96+
SetArrayValue (CVPixelBuffer.PixelFormatTypeKey, Array.ConvertAll (value, (v) => new NSNumber ((uint) v)));
97+
}
98+
}
99+
}
100+
74101
/// <summary>The allocator used for the pixel buffer.</summary>
75102
/// <value>
76103
/// </value>

src/Foundation/NSIndexSet.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,24 @@ public nuint [] ToArray ()
7575
return indexes;
7676
}
7777

78+
internal T [] ToInt64EnumArray<T> () where T: System.Enum
79+
{
80+
var array = ToArray ();
81+
var rv = new T [array.Length];
82+
for (var i = 0; i < array.Length; i++)
83+
rv [i] = (T) (object) (long) array [i];
84+
return rv;
85+
}
86+
87+
internal HashSet<T> ToInt64EnumHashSet<T> () where T: System.Enum
88+
{
89+
var array = ToArray ();
90+
var rv = new HashSet<T> ();
91+
for (var i = 0; i < array.Length; i++)
92+
rv.Add ((T) (object) (long) array [i]);
93+
return rv;
94+
}
95+
7896
public static NSIndexSet FromArray (nuint [] items)
7997
{
8098
if (items is null)

0 commit comments

Comments
 (0)