[net9.0] Merge main into net9.0.
This commit is contained in:
Коммит
08cb6b2140
|
@ -14,6 +14,7 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -139,12 +140,14 @@ namespace CoreMedia {
|
|||
}
|
||||
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
extern static /* OSStatus */ CMFormatDescriptionError CMFormatDescriptionCreate (/* CFAllocatorRef */ IntPtr allocator, CMMediaType mediaType, /* FourCharCode */ uint mediaSubtype, /* CFDictionaryRef */ IntPtr extensions, /* CMFormatDescriptionRef* */ out IntPtr descOut);
|
||||
unsafe extern static /* OSStatus */ CMFormatDescriptionError CMFormatDescriptionCreate (/* CFAllocatorRef */ IntPtr allocator, CMMediaType mediaType, /* FourCharCode */ uint mediaSubtype, /* CFDictionaryRef */ IntPtr extensions, /* CMFormatDescriptionRef* */ IntPtr* descOut);
|
||||
|
||||
public static CMFormatDescription? Create (CMMediaType mediaType, uint mediaSubtype, out CMFormatDescriptionError error)
|
||||
{
|
||||
IntPtr handle;
|
||||
error = CMFormatDescriptionCreate (IntPtr.Zero, mediaType, mediaSubtype, IntPtr.Zero, out handle);
|
||||
unsafe {
|
||||
error = CMFormatDescriptionCreate (IntPtr.Zero, mediaType, mediaSubtype, IntPtr.Zero, &handle);
|
||||
}
|
||||
if (error != CMFormatDescriptionError.None)
|
||||
return null;
|
||||
|
||||
|
@ -192,12 +195,15 @@ namespace CoreMedia {
|
|||
}
|
||||
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
extern static /* AudioChannelLayout* */ IntPtr CMAudioFormatDescriptionGetChannelLayout (/* CMAudioFormatDescriptionRef */ IntPtr desc, /* size_t* */ out nint size);
|
||||
unsafe extern static /* AudioChannelLayout* */ IntPtr CMAudioFormatDescriptionGetChannelLayout (/* CMAudioFormatDescriptionRef */ IntPtr desc, /* size_t* */ nint* size);
|
||||
|
||||
public AudioChannelLayout? AudioChannelLayout {
|
||||
get {
|
||||
nint size;
|
||||
var res = CMAudioFormatDescriptionGetChannelLayout (Handle, out size);
|
||||
IntPtr res;
|
||||
unsafe {
|
||||
res = CMAudioFormatDescriptionGetChannelLayout (Handle, &size);
|
||||
}
|
||||
if (res == IntPtr.Zero || size == 0)
|
||||
return null;
|
||||
return AudioChannelLayout.FromHandle (res);
|
||||
|
@ -205,13 +211,16 @@ namespace CoreMedia {
|
|||
}
|
||||
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
extern static /* AudioFormatListItem* */ IntPtr CMAudioFormatDescriptionGetFormatList (/* CMAudioFormatDescriptionRef */ IntPtr desc, /* size_t* */ out nint size);
|
||||
unsafe extern static /* AudioFormatListItem* */ IntPtr CMAudioFormatDescriptionGetFormatList (/* CMAudioFormatDescriptionRef */ IntPtr desc, /* size_t* */ nint* size);
|
||||
|
||||
public AudioFormat []? AudioFormats {
|
||||
get {
|
||||
unsafe {
|
||||
nint size;
|
||||
var v = CMAudioFormatDescriptionGetFormatList (Handle, out size);
|
||||
IntPtr v;
|
||||
unsafe {
|
||||
v = CMAudioFormatDescriptionGetFormatList (Handle, &size);
|
||||
}
|
||||
if (v == IntPtr.Zero)
|
||||
return null;
|
||||
var items = size / sizeof (AudioFormat);
|
||||
|
@ -225,12 +234,15 @@ namespace CoreMedia {
|
|||
}
|
||||
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
extern static /* const void* */ IntPtr CMAudioFormatDescriptionGetMagicCookie (/* CMAudioFormatDescriptionRef */ IntPtr desc, /* size_t* */ out nint size);
|
||||
unsafe extern static /* const void* */ IntPtr CMAudioFormatDescriptionGetMagicCookie (/* CMAudioFormatDescriptionRef */ IntPtr desc, /* size_t* */ nint* size);
|
||||
|
||||
public byte []? AudioMagicCookie {
|
||||
get {
|
||||
nint size;
|
||||
var h = CMAudioFormatDescriptionGetMagicCookie (Handle, out size);
|
||||
IntPtr h;
|
||||
unsafe {
|
||||
h = CMAudioFormatDescriptionGetMagicCookie (Handle, &size);
|
||||
}
|
||||
if (h == IntPtr.Zero)
|
||||
return null;
|
||||
|
||||
|
@ -274,17 +286,16 @@ namespace CoreMedia {
|
|||
internal extern static CMVideoDimensions CMVideoFormatDescriptionGetDimensions (/* CMVideoFormatDescriptionRef */ IntPtr videoDesc);
|
||||
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
internal extern static CGRect CMVideoFormatDescriptionGetCleanAperture (/* CMVideoFormatDescriptionRef */ IntPtr videoDesc, /* Boolean */ [MarshalAs (UnmanagedType.I1)] bool originIsAtTopLeft);
|
||||
internal extern static CGRect CMVideoFormatDescriptionGetCleanAperture (/* CMVideoFormatDescriptionRef */ IntPtr videoDesc, /* Boolean */ byte originIsAtTopLeft);
|
||||
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
internal extern static /* CFArrayRef */ IntPtr CMVideoFormatDescriptionGetExtensionKeysCommonWithImageBuffers ();
|
||||
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
internal extern static CGSize CMVideoFormatDescriptionGetPresentationDimensions (/* CMVideoFormatDescriptionRef */ IntPtr videoDesc, /* Boolean */ [MarshalAs (UnmanagedType.I1)] bool usePixelAspectRatio, /* Boolean */ [MarshalAs (UnmanagedType.I1)] bool useCleanAperture);
|
||||
internal extern static CGSize CMVideoFormatDescriptionGetPresentationDimensions (/* CMVideoFormatDescriptionRef */ IntPtr videoDesc, /* Boolean */ byte usePixelAspectRatio, /* Boolean */ byte useCleanAperture);
|
||||
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
[return: MarshalAs (UnmanagedType.I1)]
|
||||
internal extern static /* Boolean */ bool CMVideoFormatDescriptionMatchesImageBuffer (/* CMVideoFormatDescriptionRef */ IntPtr videoDesc, /* CVImageBufferRef */ IntPtr imageBuffer);
|
||||
internal extern static /* Boolean */ byte CMVideoFormatDescriptionMatchesImageBuffer (/* CMVideoFormatDescriptionRef */ IntPtr videoDesc, /* CVImageBufferRef */ IntPtr imageBuffer);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -324,18 +335,21 @@ namespace CoreMedia {
|
|||
|
||||
#if !COREBUILD
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionCreate (
|
||||
unsafe static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionCreate (
|
||||
/* CFAllocatorRef */ IntPtr allocator,
|
||||
CMVideoCodecType codecType,
|
||||
/* int32_t */ int width,
|
||||
/* int32_t */ int height,
|
||||
/* CFDictionaryRef */ IntPtr extensions,
|
||||
/* CMVideoFormatDescriptionRef* */ out IntPtr outDesc);
|
||||
/* CMVideoFormatDescriptionRef* */ IntPtr* outDesc);
|
||||
|
||||
static IntPtr CreateCMVideoFormatDescription (CMVideoCodecType codecType, CMVideoDimensions size)
|
||||
{
|
||||
IntPtr handle;
|
||||
var error = CMVideoFormatDescriptionCreate (IntPtr.Zero, codecType, size.Width, size.Height, IntPtr.Zero, out handle);
|
||||
CMFormatDescriptionError error;
|
||||
unsafe {
|
||||
error = CMVideoFormatDescriptionCreate (IntPtr.Zero, codecType, size.Width, size.Height, IntPtr.Zero, &handle);
|
||||
}
|
||||
if (error != CMFormatDescriptionError.None)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentException (error.ToString ());
|
||||
return handle;
|
||||
|
@ -353,10 +367,10 @@ namespace CoreMedia {
|
|||
}
|
||||
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionCreateForImageBuffer (
|
||||
unsafe static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionCreateForImageBuffer (
|
||||
/* CFAllocatorRef */ IntPtr allocator,
|
||||
/* CVImageBufferRef */ IntPtr imageBuffer,
|
||||
/* CMVideoFormatDescriptionRef* */ out IntPtr outDesc);
|
||||
/* CMVideoFormatDescriptionRef* */ IntPtr* outDesc);
|
||||
|
||||
public static CMVideoFormatDescription? CreateForImageBuffer (CVImageBuffer imageBuffer, out CMFormatDescriptionError error)
|
||||
{
|
||||
|
@ -364,7 +378,9 @@ namespace CoreMedia {
|
|||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (imageBuffer));
|
||||
|
||||
IntPtr desc;
|
||||
error = CMVideoFormatDescriptionCreateForImageBuffer (IntPtr.Zero, imageBuffer.Handle, out desc);
|
||||
unsafe {
|
||||
error = CMVideoFormatDescriptionCreateForImageBuffer (IntPtr.Zero, imageBuffer.Handle, &desc);
|
||||
}
|
||||
if (error != CMFormatDescriptionError.None)
|
||||
return null;
|
||||
|
||||
|
@ -378,13 +394,13 @@ namespace CoreMedia {
|
|||
[SupportedOSPlatform ("tvos")]
|
||||
#endif
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionCreateFromH264ParameterSets (
|
||||
unsafe static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionCreateFromH264ParameterSets (
|
||||
/* CFAllocatorRef */ IntPtr allocator,
|
||||
/* size_t */ nuint parameterSetCount,
|
||||
/* const uint8_t* const* */ IntPtr [] parameterSetPointers,
|
||||
/* size_t* */ nuint [] parameterSetSizes,
|
||||
/* const uint8_t* const* */ IntPtr* parameterSetPointers,
|
||||
/* size_t* */ nuint* parameterSetSizes,
|
||||
/* int */ int NALUnitHeaderLength,
|
||||
/* CMFormatDescriptionRef* */ out IntPtr formatDescriptionOut);
|
||||
/* CMFormatDescriptionRef* */ IntPtr* formatDescriptionOut);
|
||||
|
||||
#if NET
|
||||
[SupportedOSPlatform ("ios")]
|
||||
|
@ -415,7 +431,13 @@ namespace CoreMedia {
|
|||
}
|
||||
|
||||
IntPtr desc;
|
||||
error = CMVideoFormatDescriptionCreateFromH264ParameterSets (IntPtr.Zero, (nuint) parameterSets.Count, parameterSetPtrs, parameterSetSizes, nalUnitHeaderLength, out desc);
|
||||
unsafe {
|
||||
fixed (IntPtr* parameterSetPtrsPtr = parameterSetPtrs) {
|
||||
fixed (nuint* parameterSetSizesPtr = parameterSetSizes) {
|
||||
error = CMVideoFormatDescriptionCreateFromH264ParameterSets (IntPtr.Zero, (nuint) parameterSets.Count, parameterSetPtrsPtr, parameterSetSizesPtr, nalUnitHeaderLength, &desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (error != CMFormatDescriptionError.None)
|
||||
return null;
|
||||
|
||||
|
@ -435,13 +457,13 @@ namespace CoreMedia {
|
|||
[SupportedOSPlatform ("tvos")]
|
||||
#endif
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionGetH264ParameterSetAtIndex (
|
||||
unsafe static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionGetH264ParameterSetAtIndex (
|
||||
/* CMFormatDescriptionRef */ IntPtr videoDesc,
|
||||
/* size_t */ nuint parameterSetIndex,
|
||||
/* const uint8_t** */ out IntPtr parameterSetPointerOut,
|
||||
/* size_t* */ out nuint parameterSetSizeOut,
|
||||
/* size_t* */ out nuint parameterSetCountOut,
|
||||
/* int* */ out int nalUnitHeaderLengthOut);
|
||||
/* const uint8_t** */ IntPtr* parameterSetPointerOut,
|
||||
/* size_t* */ nuint* parameterSetSizeOut,
|
||||
/* size_t* */ nuint* parameterSetCountOut,
|
||||
/* int* */ int* nalUnitHeaderLengthOut);
|
||||
|
||||
#if NET
|
||||
[SupportedOSPlatform ("ios")]
|
||||
|
@ -453,7 +475,17 @@ namespace CoreMedia {
|
|||
{
|
||||
IntPtr ret;
|
||||
nuint parameterSetSizeOut;
|
||||
error = CMVideoFormatDescriptionGetH264ParameterSetAtIndex (GetCheckedHandle (), index, out ret, out parameterSetSizeOut, out parameterSetCount, out nalUnitHeaderLength);
|
||||
parameterSetCount = default;
|
||||
nalUnitHeaderLength = default;
|
||||
unsafe {
|
||||
error = CMVideoFormatDescriptionGetH264ParameterSetAtIndex (
|
||||
GetCheckedHandle (),
|
||||
index,
|
||||
&ret,
|
||||
¶meterSetSizeOut,
|
||||
(nuint*) Unsafe.AsPointer<nuint> (ref parameterSetCount),
|
||||
(int*) Unsafe.AsPointer<int> (ref nalUnitHeaderLength));
|
||||
}
|
||||
if (error != CMFormatDescriptionError.None)
|
||||
return null;
|
||||
|
||||
|
@ -465,12 +497,12 @@ namespace CoreMedia {
|
|||
|
||||
public CGRect GetCleanAperture (bool originIsAtTopLeft)
|
||||
{
|
||||
return CMVideoFormatDescriptionGetCleanAperture (Handle, originIsAtTopLeft);
|
||||
return CMVideoFormatDescriptionGetCleanAperture (Handle, originIsAtTopLeft.AsByte ());
|
||||
}
|
||||
|
||||
public CGSize GetPresentationDimensions (bool usePixelAspectRatio, bool useCleanAperture)
|
||||
{
|
||||
return CMVideoFormatDescriptionGetPresentationDimensions (Handle, usePixelAspectRatio, useCleanAperture);
|
||||
return CMVideoFormatDescriptionGetPresentationDimensions (Handle, usePixelAspectRatio.AsByte (), useCleanAperture.AsByte ());
|
||||
}
|
||||
|
||||
public static NSObject? []? GetExtensionKeysCommonWithImageBuffers ()
|
||||
|
@ -483,7 +515,7 @@ namespace CoreMedia {
|
|||
{
|
||||
if (imageBuffer is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (imageBuffer));
|
||||
return CMVideoFormatDescriptionMatchesImageBuffer (Handle, imageBuffer.Handle);
|
||||
return CMVideoFormatDescriptionMatchesImageBuffer (Handle, imageBuffer.Handle) != 0;
|
||||
}
|
||||
|
||||
#if NET
|
||||
|
@ -493,14 +525,14 @@ namespace CoreMedia {
|
|||
[SupportedOSPlatform ("maccatalyst")]
|
||||
#endif
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionCreateFromHEVCParameterSets (
|
||||
unsafe static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionCreateFromHEVCParameterSets (
|
||||
/* CFAllocatorRef */ IntPtr allocator,
|
||||
/* size_t */ nuint parameterSetCount,
|
||||
/* const uint8_t* const* */ IntPtr [] parameterSetPointers,
|
||||
/* size_t* */ nuint [] parameterSetSizes,
|
||||
/* const uint8_t* const* */ IntPtr* parameterSetPointers,
|
||||
/* size_t* */ nuint* parameterSetSizes,
|
||||
/* int */ int NALUnitHeaderLength,
|
||||
/* CFDictionaryRef */ IntPtr extensions,
|
||||
/* CMFormatDescriptionRef* */ out IntPtr formatDescriptionOut);
|
||||
/* CMFormatDescriptionRef* */ IntPtr* formatDescriptionOut);
|
||||
|
||||
#if NET
|
||||
[SupportedOSPlatform ("ios")]
|
||||
|
@ -531,7 +563,13 @@ namespace CoreMedia {
|
|||
}
|
||||
|
||||
IntPtr desc;
|
||||
error = CMVideoFormatDescriptionCreateFromHEVCParameterSets (IntPtr.Zero, (nuint) parameterSets.Count, parameterSetPtrs, parameterSetSizes, nalUnitHeaderLength, extensions.GetHandle (), out desc);
|
||||
unsafe {
|
||||
fixed (IntPtr* parameterSetPtrsPtr = parameterSetPtrs) {
|
||||
fixed (nuint* parameterSetSizesPtr = parameterSetSizes) {
|
||||
error = CMVideoFormatDescriptionCreateFromHEVCParameterSets (IntPtr.Zero, (nuint) parameterSets.Count, parameterSetPtrsPtr, parameterSetSizesPtr, nalUnitHeaderLength, extensions.GetHandle (), &desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (error != CMFormatDescriptionError.None || desc == IntPtr.Zero)
|
||||
return null;
|
||||
|
||||
|
@ -551,13 +589,13 @@ namespace CoreMedia {
|
|||
[SupportedOSPlatform ("maccatalyst")]
|
||||
#endif
|
||||
[DllImport (Constants.CoreMediaLibrary)]
|
||||
static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionGetHEVCParameterSetAtIndex (
|
||||
unsafe static extern /* OSStatus */ CMFormatDescriptionError CMVideoFormatDescriptionGetHEVCParameterSetAtIndex (
|
||||
/* CMFormatDescriptionRef */ IntPtr videoDesc,
|
||||
/* size_t */ nuint parameterSetIndex,
|
||||
/* const uint8_t** */ out IntPtr parameterSetPointerOut,
|
||||
/* size_t* */ out nuint parameterSetSizeOut,
|
||||
/* size_t* */ out nuint parameterSetCountOut,
|
||||
/* int* */ out int nalUnitHeaderLengthOut);
|
||||
/* const uint8_t** */ IntPtr* parameterSetPointerOut,
|
||||
/* size_t* */ nuint* parameterSetSizeOut,
|
||||
/* size_t* */ nuint* parameterSetCountOut,
|
||||
/* int* */ int* nalUnitHeaderLengthOut);
|
||||
|
||||
#if NET
|
||||
[SupportedOSPlatform ("ios")]
|
||||
|
@ -569,7 +607,17 @@ namespace CoreMedia {
|
|||
{
|
||||
IntPtr ret;
|
||||
nuint parameterSetSizeOut;
|
||||
error = CMVideoFormatDescriptionGetHEVCParameterSetAtIndex (GetCheckedHandle (), index, out ret, out parameterSetSizeOut, out parameterSetCount, out nalUnitHeaderLength);
|
||||
parameterSetCount = default;
|
||||
nalUnitHeaderLength = default;
|
||||
unsafe {
|
||||
error = CMVideoFormatDescriptionGetHEVCParameterSetAtIndex (
|
||||
GetCheckedHandle (),
|
||||
index,
|
||||
&ret,
|
||||
¶meterSetSizeOut,
|
||||
(nuint*) Unsafe.AsPointer<nuint> (ref parameterSetCount),
|
||||
(int*) Unsafe.AsPointer<int> (ref nalUnitHeaderLength));
|
||||
}
|
||||
if (error != CMFormatDescriptionError.None)
|
||||
return null;
|
||||
|
||||
|
|
|
@ -221,7 +221,6 @@ namespace Foundation {
|
|||
if (inflightRequests.TryGetValue (task, out var data)) {
|
||||
if (cancel)
|
||||
data.CancellationTokenSource.Cancel ();
|
||||
data.Dispose ();
|
||||
inflightRequests.Remove (task);
|
||||
}
|
||||
#if !MONOMAC && !__WATCHOS__ && !NET8_0
|
||||
|
@ -247,7 +246,6 @@ namespace Foundation {
|
|||
foreach (var pair in inflightRequests) {
|
||||
pair.Key?.Cancel ();
|
||||
pair.Key?.Dispose ();
|
||||
pair.Value?.Dispose ();
|
||||
}
|
||||
|
||||
inflightRequests.Clear ();
|
||||
|
@ -852,11 +850,23 @@ namespace Foundation {
|
|||
|
||||
[Preserve (Conditional = true)]
|
||||
public override void DidReceiveResponse (NSUrlSession session, NSUrlSessionDataTask dataTask, NSUrlResponse response, Action<NSUrlSessionResponseDisposition> completionHandler)
|
||||
{
|
||||
try {
|
||||
DidReceiveResponseImpl (session, dataTask, response, completionHandler);
|
||||
} catch {
|
||||
completionHandler (NSUrlSessionResponseDisposition.Cancel);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void DidReceiveResponseImpl (NSUrlSession session, NSUrlSessionDataTask dataTask, NSUrlResponse response, Action<NSUrlSessionResponseDisposition> completionHandler)
|
||||
{
|
||||
var inflight = GetInflightData (dataTask);
|
||||
|
||||
if (inflight is null)
|
||||
if (inflight is null) {
|
||||
completionHandler (NSUrlSessionResponseDisposition.Cancel);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var urlResponse = (NSHttpUrlResponse) response;
|
||||
|
@ -977,18 +987,30 @@ namespace Foundation {
|
|||
|
||||
inflight.ResponseSent = true;
|
||||
|
||||
// EVIL HACK: having TrySetResult inline was blocking the request from completing
|
||||
Task.Run (() => inflight.CompletionSource.TrySetResult (httpResponse!));
|
||||
inflight.CompletionSource.TrySetResult (httpResponse!);
|
||||
}
|
||||
}
|
||||
|
||||
[Preserve (Conditional = true)]
|
||||
public override void WillCacheResponse (NSUrlSession session, NSUrlSessionDataTask dataTask, NSCachedUrlResponse proposedResponse, Action<NSCachedUrlResponse> completionHandler)
|
||||
{
|
||||
try {
|
||||
WillCacheResponseImpl (session, dataTask, proposedResponse, completionHandler);
|
||||
} catch {
|
||||
completionHandler (null!);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void WillCacheResponseImpl (NSUrlSession session, NSUrlSessionDataTask dataTask, NSCachedUrlResponse proposedResponse, Action<NSCachedUrlResponse> completionHandler)
|
||||
{
|
||||
var inflight = GetInflightData (dataTask);
|
||||
|
||||
if (inflight is null)
|
||||
if (inflight is null) {
|
||||
completionHandler (null!);
|
||||
return;
|
||||
}
|
||||
|
||||
// apple caches post request with a body, which should not happen. https://github.com/xamarin/maccore/issues/2571
|
||||
var disableCache = sessionHandler.DisableCaching || (inflight.Request.Method == HttpMethod.Post && inflight.Request.Content is not null);
|
||||
completionHandler (disableCache ? null! : proposedResponse);
|
||||
|
@ -1002,11 +1024,24 @@ namespace Foundation {
|
|||
|
||||
[Preserve (Conditional = true)]
|
||||
public override void DidReceiveChallenge (NSUrlSession session, NSUrlSessionTask task, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler)
|
||||
{
|
||||
try {
|
||||
DidReceiveChallengeImpl (session, task, challenge, completionHandler);
|
||||
} catch {
|
||||
completionHandler (NSUrlSessionAuthChallengeDisposition.CancelAuthenticationChallenge, null!);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void DidReceiveChallengeImpl (NSUrlSession session, NSUrlSessionTask task, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler)
|
||||
{
|
||||
var inflight = GetInflightData (task);
|
||||
|
||||
if (inflight is null)
|
||||
if (inflight is null) {
|
||||
// Request was probably cancelled
|
||||
completionHandler (NSUrlSessionAuthChallengeDisposition.CancelAuthenticationChallenge, null!);
|
||||
return;
|
||||
}
|
||||
|
||||
// ToCToU for the callback
|
||||
var trustCallbackForUrl = sessionHandler.TrustOverrideForUrl;
|
||||
|
@ -1130,11 +1165,11 @@ namespace Foundation {
|
|||
}
|
||||
}
|
||||
|
||||
class InflightData : IDisposable {
|
||||
class InflightData {
|
||||
public readonly object Lock = new object ();
|
||||
public string RequestUrl { get; set; }
|
||||
|
||||
public TaskCompletionSource<HttpResponseMessage> CompletionSource { get; } = new TaskCompletionSource<HttpResponseMessage> ();
|
||||
public TaskCompletionSource<HttpResponseMessage> CompletionSource { get; } = new TaskCompletionSource<HttpResponseMessage> (TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
public CancellationToken CancellationToken { get; set; }
|
||||
public CancellationTokenSource CancellationTokenSource { get; } = new CancellationTokenSource ();
|
||||
public NSUrlSessionDataTaskStream Stream { get; } = new NSUrlSessionDataTaskStream ();
|
||||
|
@ -1154,21 +1189,6 @@ namespace Foundation {
|
|||
CancellationToken = cancellationToken;
|
||||
Request = request;
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
// The bulk of the clean-up code is implemented in Dispose(bool)
|
||||
protected virtual void Dispose (bool disposing)
|
||||
{
|
||||
if (disposing) {
|
||||
CancellationTokenSource.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class NSUrlSessionDataTaskStreamContent : MonoStreamContent {
|
||||
|
|
|
@ -98,6 +98,7 @@ public partial class Generator {
|
|||
// skip value__ field
|
||||
if (f.IsSpecialName)
|
||||
continue;
|
||||
WriteDocumentation (f);
|
||||
PrintPlatformAttributes (f);
|
||||
PrintObsoleteAttributes (f);
|
||||
print ("{0} = {1},", f.Name, f.GetRawConstantValue ());
|
||||
|
|
|
@ -64,18 +64,9 @@ namespace Cecil.Tests {
|
|||
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSend(System.IntPtr,System.IntPtr)",
|
||||
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper_stret(System.IntPtr,System.IntPtr)",
|
||||
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper(System.IntPtr,System.IntPtr)",
|
||||
"CoreGraphics.CGRect CoreMedia.CMFormatDescription::CMVideoFormatDescriptionGetCleanAperture(System.IntPtr,System.Boolean)",
|
||||
"CoreGraphics.CGSize CoreMedia.CMFormatDescription::CMVideoFormatDescriptionGetPresentationDimensions(System.IntPtr,System.Boolean,System.Boolean)",
|
||||
"CoreGraphics.CGSize CoreText.CTFramesetter::CTFramesetterSuggestFrameSizeWithConstraints(System.IntPtr,Foundation.NSRange,System.IntPtr,CoreGraphics.CGSize,Foundation.NSRange&)",
|
||||
"CoreMedia.CMClockError CoreMedia.CMClock::CMAudioClockCreate(System.IntPtr,System.IntPtr&)",
|
||||
"CoreMedia.CMClockError CoreMedia.CMClock::CMClockGetAnchorTime(System.IntPtr,CoreMedia.CMTime&,CoreMedia.CMTime&)",
|
||||
"CoreMedia.CMFormatDescriptionError CoreMedia.CMFormatDescription::CMFormatDescriptionCreate(System.IntPtr,CoreMedia.CMMediaType,System.UInt32,System.IntPtr,System.IntPtr&)",
|
||||
"CoreMedia.CMFormatDescriptionError CoreMedia.CMVideoFormatDescription::CMVideoFormatDescriptionCreate(System.IntPtr,CoreMedia.CMVideoCodecType,System.Int32,System.Int32,System.IntPtr,System.IntPtr&)",
|
||||
"CoreMedia.CMFormatDescriptionError CoreMedia.CMVideoFormatDescription::CMVideoFormatDescriptionCreateForImageBuffer(System.IntPtr,System.IntPtr,System.IntPtr&)",
|
||||
"CoreMedia.CMFormatDescriptionError CoreMedia.CMVideoFormatDescription::CMVideoFormatDescriptionCreateFromH264ParameterSets(System.IntPtr,System.UIntPtr,System.IntPtr[],System.UIntPtr[],System.Int32,System.IntPtr&)",
|
||||
"CoreMedia.CMFormatDescriptionError CoreMedia.CMVideoFormatDescription::CMVideoFormatDescriptionCreateFromHEVCParameterSets(System.IntPtr,System.UIntPtr,System.IntPtr[],System.UIntPtr[],System.Int32,System.IntPtr,System.IntPtr&)",
|
||||
"CoreMedia.CMFormatDescriptionError CoreMedia.CMVideoFormatDescription::CMVideoFormatDescriptionGetH264ParameterSetAtIndex(System.IntPtr,System.UIntPtr,System.IntPtr&,System.UIntPtr&,System.UIntPtr&,System.Int32&)",
|
||||
"CoreMedia.CMFormatDescriptionError CoreMedia.CMVideoFormatDescription::CMVideoFormatDescriptionGetHEVCParameterSetAtIndex(System.IntPtr,System.UIntPtr,System.IntPtr&,System.UIntPtr&,System.UIntPtr&,System.Int32&)",
|
||||
"CoreMedia.CMSampleBufferError CoreMedia.CMSampleBuffer::CMAudioSampleBufferCreateReadyWithPacketDescriptions(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,CoreMedia.CMTime,AudioToolbox.AudioStreamPacketDescription[],System.IntPtr&)",
|
||||
"CoreMedia.CMSampleBufferError CoreMedia.CMSampleBuffer::CMAudioSampleBufferCreateWithPacketDescriptions(System.IntPtr,System.IntPtr,System.Boolean,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,CoreMedia.CMTime,AudioToolbox.AudioStreamPacketDescription[],System.IntPtr&)",
|
||||
"CoreMedia.CMSampleBufferError CoreMedia.CMSampleBuffer::CMSampleBufferCreateForImageBuffer(System.IntPtr,System.IntPtr,System.Boolean,System.IntPtr,System.IntPtr,System.IntPtr,CoreMedia.CMSampleTimingInfo&,System.IntPtr&)",
|
||||
|
@ -184,7 +175,6 @@ namespace Cecil.Tests {
|
|||
"Security.SslStatus Security.SslContext::SSLWrite(System.IntPtr,System.Byte*,System.IntPtr,System.IntPtr&)",
|
||||
"System.Boolean CoreMedia.CMClock::CMClockMightDrift(System.IntPtr,System.IntPtr)",
|
||||
"System.Boolean CoreMedia.CMClockOrTimebase::CMSyncMightDrift(System.IntPtr,System.IntPtr)",
|
||||
"System.Boolean CoreMedia.CMFormatDescription::CMVideoFormatDescriptionMatchesImageBuffer(System.IntPtr,System.IntPtr)",
|
||||
"System.Boolean CoreMedia.CMSampleBuffer::CMSampleBufferDataIsReady(System.IntPtr)",
|
||||
"System.Boolean CoreMedia.CMSampleBuffer::CMSampleBufferIsValid(System.IntPtr)",
|
||||
"System.Boolean CoreServices.FSEvent::FSEventsPurgeEventsForDeviceUpToEventId(System.UInt64,System.UInt64)",
|
||||
|
@ -311,9 +301,6 @@ namespace Cecil.Tests {
|
|||
"System.Int32 Security.SslContext::SSLSetSessionTicketsEnabled(System.IntPtr,System.Boolean)",
|
||||
"System.Int32 SystemConfiguration.NetworkReachability::SCNetworkReachabilityGetFlags(System.IntPtr,SystemConfiguration.NetworkReachabilityFlags&)",
|
||||
"System.IntPtr CoreMedia.CMAttachmentBearer::CMGetAttachment(System.IntPtr,System.IntPtr,CoreMedia.CMAttachmentMode&)",
|
||||
"System.IntPtr CoreMedia.CMFormatDescription::CMAudioFormatDescriptionGetChannelLayout(System.IntPtr,System.IntPtr&)",
|
||||
"System.IntPtr CoreMedia.CMFormatDescription::CMAudioFormatDescriptionGetFormatList(System.IntPtr,System.IntPtr&)",
|
||||
"System.IntPtr CoreMedia.CMFormatDescription::CMAudioFormatDescriptionGetMagicCookie(System.IntPtr,System.IntPtr&)",
|
||||
"System.IntPtr CoreMedia.CMSampleBuffer::CMSampleBufferCreateCopyWithNewTiming(System.IntPtr,System.IntPtr,System.IntPtr,CoreMedia.CMSampleTimingInfo*,System.IntPtr&)",
|
||||
"System.IntPtr CoreMedia.CMSampleBuffer::CMSampleBufferGetSampleAttachmentsArray(System.IntPtr,System.Boolean)",
|
||||
"System.IntPtr CoreMedia.CMSampleBuffer::CMSampleBufferGetSampleTimingInfoArray(System.IntPtr,System.IntPtr,CoreMedia.CMSampleTimingInfo*,System.IntPtr&)",
|
||||
|
|
|
@ -1269,12 +1269,6 @@ F:AppKit.NSCellType.Image
|
|||
F:AppKit.NSCellType.Null
|
||||
F:AppKit.NSCellType.Text
|
||||
F:AppKit.NSCellType.value__
|
||||
F:AppKit.NSCharacterCollection.AdobeCns1
|
||||
F:AppKit.NSCharacterCollection.AdobeGb1
|
||||
F:AppKit.NSCharacterCollection.AdobeJapan1
|
||||
F:AppKit.NSCharacterCollection.AdobeJapan2
|
||||
F:AppKit.NSCharacterCollection.AdobeKorea1
|
||||
F:AppKit.NSCharacterCollection.IdentityMapping
|
||||
F:AppKit.NSCharacterCollection.value__
|
||||
F:AppKit.NSCloudKitSharingServiceOptions.AllowPrivate
|
||||
F:AppKit.NSCloudKitSharingServiceOptions.AllowPublic
|
||||
|
@ -14723,7 +14717,6 @@ F:LocalAuthentication.LARightState.NotAuthorized
|
|||
F:LocalAuthentication.LARightState.Unknown
|
||||
F:LocalAuthentication.LARightState.value__
|
||||
F:LocalAuthentication.LAStatus.AppCancel
|
||||
F:LocalAuthentication.LAStatus.AuthenticationFailed
|
||||
F:LocalAuthentication.LAStatus.BiometryDisconnected
|
||||
F:LocalAuthentication.LAStatus.BiometryLockout
|
||||
F:LocalAuthentication.LAStatus.BiometryNotAvailable
|
||||
|
@ -14732,11 +14725,7 @@ F:LocalAuthentication.LAStatus.BiometryNotPaired
|
|||
F:LocalAuthentication.LAStatus.InvalidContext
|
||||
F:LocalAuthentication.LAStatus.InvalidDimension
|
||||
F:LocalAuthentication.LAStatus.NotInteractive
|
||||
F:LocalAuthentication.LAStatus.PasscodeNotSet
|
||||
F:LocalAuthentication.LAStatus.Success
|
||||
F:LocalAuthentication.LAStatus.SystemCancel
|
||||
F:LocalAuthentication.LAStatus.UserCancel
|
||||
F:LocalAuthentication.LAStatus.UserFallback
|
||||
F:LocalAuthentication.LAStatus.value__
|
||||
F:LocalAuthentication.LAStatus.WatchNotAvailable
|
||||
F:MailKit.MEComposeSessionErrorCode.Body
|
||||
|
|
|
@ -1437,7 +1437,7 @@ namespace GeneratorTests {
|
|||
[Test]
|
||||
public void XmlDocs ()
|
||||
{
|
||||
var bgen = BuildFile (Profile.iOS, "tests/xmldocs.cs");
|
||||
var bgen = BuildFile (Profile.iOS, false, true, "tests/xmldocs.cs");
|
||||
Assert.That (bgen.XmlDocumentation, Does.Exist);
|
||||
var contents = File.ReadAllText (bgen.XmlDocumentation);
|
||||
var expectedContents =
|
||||
|
@ -1447,6 +1447,16 @@ namespace GeneratorTests {
|
|||
<name>api0</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name=""T:XmlDocumentation.E1"">
|
||||
<summary>
|
||||
Summary for E1
|
||||
</summary>
|
||||
</member>
|
||||
<member name=""F:XmlDocumentation.E1.Value1"">
|
||||
<summary>
|
||||
Summary for E1.Value1
|
||||
</summary>
|
||||
</member>
|
||||
<member name=""T:XmlDocumentation.IP1"">
|
||||
<summary>
|
||||
Summary for P1
|
||||
|
|
|
@ -77,4 +77,14 @@ namespace XmlDocumentation {
|
|||
[Export ("method2:")]
|
||||
void TGMethod2 (TG1<T, U> value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Summary for E1
|
||||
/// </summary>
|
||||
public enum E1 {
|
||||
/// <summary>
|
||||
/// Summary for E1.Value1
|
||||
/// </summary>
|
||||
Value1,
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче