Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MediaPlayer] Make P/Invokes have blittable signatures. #20012

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/MediaPlayer/MPVolumeSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,29 @@ public static class MPVolumeSettings {
[DllImport (Constants.MediaPlayerLibrary, EntryPoint = "MPVolumeSettingsAlertHide")]
public extern static void AlertHide ();

// note: sizeof (BOOL) is 1 like C, i.e. it's not a Win32 BOOL (4 bytes)
#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[ObsoletedOSPlatform ("ios11.3", "Use 'MPVolumeView' to present volume controls.")]
[ObsoletedOSPlatform ("maccatalyst13.1", "Use 'MPVolumeView' to present volume controls.")]
#else
[Deprecated (PlatformName.iOS, 11, 3, message: "Use 'MPVolumeView' to present volume controls.")]
#endif
[DllImport (Constants.MediaPlayerLibrary, EntryPoint = "MPVolumeSettingsAlertIsVisible")]
[return: MarshalAs (UnmanagedType.I1)]
public extern static /* BOOL */ bool AlertIsVisible ();
[DllImport (Constants.MediaPlayerLibrary)]
extern static /* BOOL */ byte MPVolumeSettingsAlertIsVisible ();

#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[ObsoletedOSPlatform ("ios11.3", "Use 'MPVolumeView' to present volume controls.")]
[ObsoletedOSPlatform ("maccatalyst13.1", "Use 'MPVolumeView' to present volume controls.")]
#else
[Deprecated (PlatformName.iOS, 11, 3, message: "Use 'MPVolumeView' to present volume controls.")]
#endif
public static bool AlertIsVisible ()
{
return MPVolumeSettingsAlertIsVisible () != 0;
}
}
}

Expand Down
1 change: 0 additions & 1 deletion tests/cecil-tests/ApiAvailabilityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ public void FindMissingObsoleteAttributes ()
"Intents.INStartCallIntent..ctor(Intents.INCallAudioRoute, Intents.INCallDestinationType, Intents.INPerson[], Intents.INCallRecordType, Intents.INCallCapability)",
"MapKit.MKOverlayView",
"MediaPlayer.MPVolumeSettings.AlertHide()",
"MediaPlayer.MPVolumeSettings.AlertIsVisible()",
"MediaPlayer.MPVolumeSettings.AlertShow()",
"MetalPerformanceShaders.MPSCnnConvolutionDescriptor.GetConvolutionDescriptor(System.UIntPtr, System.UIntPtr, System.UIntPtr, System.UIntPtr, MetalPerformanceShaders.MPSCnnNeuron)",
"MetalPerformanceShaders.MPSCnnFullyConnected..ctor(Metal.IMTLDevice, MetalPerformanceShaders.MPSCnnConvolutionDescriptor, System.Single[], System.Single[], MetalPerformanceShaders.MPSCnnConvolutionFlags)",
Expand Down
1 change: 0 additions & 1 deletion tests/cecil-tests/BlittablePInvokes.KnownFailures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ public partial class BlittablePInvokes {
"System.Boolean MapKit.MKMapRect::MKMapRectSpans180thMeridian(MapKit.MKMapRect)",
"System.Boolean MediaAccessibility.MACaptionAppearance::MACaptionAppearanceAddSelectedLanguage(System.IntPtr,System.IntPtr)",
"System.Boolean MediaAccessibility.MAImageCaptioning::MAImageCaptioningSetCaption(System.IntPtr,System.IntPtr,System.IntPtr&)",
"System.Boolean MediaPlayer.MPVolumeSettings::AlertIsVisible()",
"System.Boolean MobileCoreServices.UTType::UTTypeConformsTo(System.IntPtr,System.IntPtr)",
"System.Boolean MobileCoreServices.UTType::UTTypeEqual(System.IntPtr,System.IntPtr)",
"System.Boolean MobileCoreServices.UTType::UTTypeIsDeclared(System.IntPtr)",
Expand Down
Loading