From db7794e829c8e125f01b02921e1c1d289ff006a8 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Tue, 24 Oct 2017 17:35:54 +0200 Subject: [PATCH 1/4] [AVFoundation] Add missing categories from Xcode 9 and add new API from Xcode 9.1 --- src/AVFoundation/Enums.cs | 14 +- src/avfoundation.cs | 283 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 296 insertions(+), 1 deletion(-) diff --git a/src/AVFoundation/Enums.cs b/src/AVFoundation/Enums.cs index 0f1900cde407..17aa284455fd 100644 --- a/src/AVFoundation/Enums.cs +++ b/src/AVFoundation/Enums.cs @@ -643,7 +643,9 @@ public enum AVCaptureSessionInterruptionReason : nint { VideoDeviceNotAvailableInBackground = 1, AudioDeviceInUseByAnotherClient = 2, VideoDeviceInUseByAnotherClient = 3, - VideoDeviceNotAvailableWithMultipleForegroundApps = 4 + VideoDeviceNotAvailableWithMultipleForegroundApps = 4, + [iOS (11, 1)] + VideoDeviceNotAvailableDueToSystemPressure = 5, } [iOS (9,0)] @@ -977,4 +979,14 @@ public enum AVDepthDataQuality : nint { Low = 0, High = 1 } + + [NoWatch, NoTV, NoMac, iOS (11,1)] + [Native] + public enum AVCaptureSystemPressureFactors : nuint + { + None = 0, + SystemTemperature = (1 << 0), + PeakPower = (1 << 1), + DepthModuleTemperature = (1 << 2) + } } diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 40e838868d41..80ffb29c0a9e 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -300,6 +300,9 @@ interface AVDepthData { [NullAllowed, Export ("cameraCalibrationData")] AVCameraCalibrationData CameraCalibrationData { get; } + + [Export ("depthDataQuality")] + AVDepthDataQuality DepthDataQuality { get; } } // values are manually given since not some are platform specific @@ -864,6 +867,14 @@ interface AVAudioCompressedBuffer [NullAllowed, Export ("packetDescriptions")] AudioStreamPacketDescription PacketDescriptions { get; } + + [Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)] + [Export ("byteCapacity")] + uint ByteCapacity { get; } + + [Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)] + [Export ("byteLength")] + uint ByteLength { get; set; } } [Watch (3,0)] @@ -3183,6 +3194,109 @@ interface AVCaptureSynchronizedDepthData AVCaptureOutputDataDroppedReason DroppedReason { get; } } + [TV (11,0), NoWatch, Mac (10,13), iOS (11,0)] + [Protocol] + interface AVQueuedSampleBufferRendering + { + [Abstract] + [Export ("timebase", ArgumentSemantic.Retain)] + CMTimebase Timebase { get; } + + [Abstract] + [Export ("enqueueSampleBuffer:")] + void Enqueue (CMSampleBuffer sampleBuffer); + + [Abstract] + [Export ("flush")] + void Flush (); + + [Abstract] + [Export ("readyForMoreMediaData")] + bool ReadyForMoreMediaData { [Bind ("isReadyForMoreMediaData")] get; } + + [Abstract] + [Export ("requestMediaDataWhenReadyOnQueue:usingBlock:")] + void RequestMediaData (DispatchQueue queue, Action handler); + + [Abstract] + [Export ("stopRequestingMediaData")] + void StopRequestingMediaData (); + } + + [TV (11,0), NoWatch, Mac (10,13), iOS (11,0)] + [BaseType (typeof(NSObject))] + interface AVSampleBufferAudioRenderer : AVQueuedSampleBufferRendering + { + [Export ("status")] + AVQueuedSampleBufferRenderingStatus Status { get; } + + [NullAllowed, Export ("error")] + NSError Error { get; } + + [NullAllowed, Export ("audioOutputDeviceUniqueID")] + string UniqueId { get; set; } + + [Export ("audioTimePitchAlgorithm")] + string PitchAlgorithm { get; set; } + + // AVSampleBufferAudioRenderer_AVSampleBufferAudioRendererVolumeControl + [Export ("volume")] + float Volume { get; set; } + + [Export ("muted")] + bool Muted { [Bind ("isMuted")] get; set; } + + // AVSampleBufferAudioRenderer_AVSampleBufferAudioRendererQueueManagement + + [Async] + [Export ("flushFromSourceTime:completionHandler:")] + void Flush (CMTime time, Action completionHandler); + } + + interface IAVQueuedSampleBufferRendering {} + + [TV (11,0), NoWatch, Mac (10,13), iOS (11,0)] + [BaseType (typeof(NSObject))] + interface AVSampleBufferRenderSynchronizer + { + [Export ("timebase", ArgumentSemantic.Retain)] + CMTimebase Timebase { get; } + + [Export ("rate")] + float Rate { get; set; } + + [Export ("setRate:time:")] + void SetRate (float rate, CMTime time); + + // AVSampleBufferRenderSynchronizer_AVSampleBufferRenderSynchronizerRendererManagement + + [Export ("renderers")] + IAVQueuedSampleBufferRendering[] Renderers { get; } + + [Export ("addRenderer:")] + void Add (IAVQueuedSampleBufferRendering renderer); + + [Async] + [Export ("removeRenderer:atTime:completionHandler:")] + void Remove (IAVQueuedSampleBufferRendering renderer, CMTime time, [NullAllowed] Action completionHandler); + + // AVSampleBufferRenderSynchronizer_AVSampleBufferRenderSynchronizerTimeObservation + + // as per the docs the returned observers are an opaque object that you pass as the argument to + // removeTimeObserver to cancel observation. + + [Async] + [Export ("addPeriodicTimeObserverForInterval:queue:usingBlock:")] + NSObject AddPeriodicTimeObserver (CMTime interval, [NullAllowed] DispatchQueue queue, Action handler); + + [Export ("addBoundaryTimeObserverForTimes:queue:usingBlock:")] + NSObject AddBoundaryTimeObserver (NSValue[] times, [NullAllowed] DispatchQueue queue, Action handler); + + [Export ("removeTimeObserver:")] + void RemoveTimeObserver (NSObject observer); + } + + #if MONOMAC [Mac (10,10)] [BaseType (typeof (NSObject))] @@ -7746,6 +7860,10 @@ interface AVMutableVideoComposition { [iOS (10, 0), TV (10,0), Mac (10,12)] [NullAllowed, Export ("colorTransferFunction")] string ColorTransferFunction { get; set; } + + [Mac (10, 13), iOS (11, 0), TV (11, 0)] + [Export ("sourceTrackIDForFrameTiming")] + int SourceTrackIDForFrameTiming { get; set; } } [NoWatch] @@ -8058,6 +8176,10 @@ interface AVCaptureSession { [iOS (10, 0)] [Export ("automaticallyConfiguresCaptureDeviceForWideColor")] bool AutomaticallyConfiguresCaptureDeviceForWideColor { get; set; } + + [iOS (11, 1)] + [Field ("AVCaptureSessionInterruptionSystemPressureStateKey")] + NSString InterruptionSystemPressureStateKey { get; } #endif [Since (7,0)] @@ -8891,6 +9013,11 @@ interface AVCapturePhotoSettings : NSCopying [Export ("photoSettingsFromPhotoSettings:")] AVCapturePhotoSettings FromPhotoSettings (AVCapturePhotoSettings photoSettings); + [iOS (11,0)] + [Static] + [Export ("photoSettingsWithRawPixelFormatType:rawFileType:processedFormat:processedFileType:")] + AVCapturePhotoSettings FromRawPixelFormatType (uint rawPixelFormatType, [NullAllowed] string rawFileType, [NullAllowed] NSDictionary processedFormat, [NullAllowed] string processedFileType); + [Export ("uniqueID")] long UniqueID { get; } @@ -8924,6 +9051,50 @@ interface AVCapturePhotoSettings : NSCopying [iOS (10, 2)] [Export ("autoDualCameraFusionEnabled")] bool AutoDualCameraFusionEnabled { [Bind ("isAutoDualCameraFusionEnabled")] get; set; } + + [iOS (11, 0)] + [NullAllowed, Export ("processedFileType")] + string ProcessedFileType { get; } + + [iOS (11, 0)] + [NullAllowed, Export ("rawFileType")] + string RawFileType { get; } + + [iOS (11, 0)] + [Export ("dualCameraDualPhotoDeliveryEnabled")] + bool DualCameraDualPhotoDeliveryEnabled { [Bind ("isDualCameraDualPhotoDeliveryEnabled")] get; set; } + + [iOS (11, 0)] + [Export ("depthDataDeliveryEnabled")] + bool DepthDataDeliveryEnabled { [Bind ("isDepthDataDeliveryEnabled")] get; set; } + + [iOS (11, 0)] + [Export ("embedsDepthDataInPhoto")] + bool EmbedsDepthDataInPhoto { get; set; } + + [iOS (11, 0)] + [Export ("depthDataFiltered")] + bool DepthDataFiltered { [Bind ("isDepthDataFiltered")] get; set; } + + [iOS (11, 0)] + [Export ("cameraCalibrationDataDeliveryEnabled")] + bool CameraCalibrationDataDeliveryEnabled { [Bind ("isCameraCalibrationDataDeliveryEnabled")] get; set; } + + [iOS (11, 0)] + [Export ("metadata", ArgumentSemantic.Copy)] + NSDictionary Metadata { get; set; } + + [iOS (11, 0)] + [Export ("livePhotoVideoCodecType")] + string LivePhotoVideoCodecType { get; set; } + + [iOS (11, 0)] + [Export ("availableEmbeddedThumbnailPhotoCodecTypes")] + string[] AvailableEmbeddedThumbnailPhotoCodecTypes { get; } + + [iOS (11, 0)] + [NullAllowed, Export ("embeddedThumbnailPhotoFormat", ArgumentSemantic.Copy)] + NSDictionary EmbeddedThumbnailPhotoFormat { get; set; } } #if !MONOMAC @@ -9104,6 +9275,26 @@ interface AVCapturePhotoOutput [iOS (11,0)] [Export ("depthDataDeliveryEnabled")] bool DepthDataDeliveryEnabled { [Bind ("isDepthDataDeliveryEnabled")] get; set; } + + [iOS (11, 0)] + [Export ("availablePhotoFileTypes")] + string[] AvailablePhotoFileTypes { get; } + + [iOS (11, 0)] + [Export ("availableRawPhotoFileTypes")] + string[] AvailableRawPhotoFileTypes { get; } + + [iOS (11,0)] + [Export ("supportedPhotoPixelFormatTypesForFileType:")] + NSNumber[] SupportedPhotoPixelFormatTypesForFileType (string fileType); + + [iOS (11,0)] + [Export ("supportedPhotoCodecTypesForFileType:")] + string[] SupportedPhotoCodecTypesForFileType (string fileType); + + [iOS (11,0)] + [Export ("supportedRawPhotoPixelFormatTypesForFileType:")] + NSNumber[] SupportedRawPhotoPixelFormatTypesForFileType (string fileType); } #endif @@ -9247,6 +9438,10 @@ enum AVCaptureDeviceType { [iOS (10, 2)] [Field ("AVCaptureDeviceTypeBuiltInDualCamera")] BuiltInDualCamera, + + [iOS (11, 1)] + [Field ("AVCaptureDeviceTypeBuiltInTrueDepthCamera")] + BuiltInTrueDepthCamera, } [NoTV, iOS (7,0), NoMac, NoWatch] // matches API that uses it. @@ -9723,9 +9918,52 @@ interface AVCaptureDevice { [Export ("maxAvailableVideoZoomFactor")] nfloat MaxAvailableVideoZoomFactor { get; } + // From AVCaptureDevice (AVCaptureDeviceSystemPressure) Category + [NoWatch, NoTV, NoMac, iOS (11, 1)] + [Export ("systemPressureState")] + AVCaptureSystemPressureState SystemPressureState { get; } + + [iOS (11, 0)] + [Export ("dualCameraSwitchOverVideoZoomFactor")] + nfloat DualCameraSwitchOverVideoZoomFactor { get; } + #endif } + [NoTV, iOS (11, 1), NoMac, NoWatch] + enum AVCaptureSystemPressureLevel { + [Field ("AVCaptureSystemPressureLevelNominal")] + Nominal, + + [Field ("AVCaptureSystemPressureLevelFair")] + Fair, + + [Field ("AVCaptureSystemPressureLevelSerious")] + Serious, + + [Field ("AVCaptureSystemPressureLevelCritical")] + Critical, + + [Field ("AVCaptureSystemPressureLevelShutdown")] + Shutdown, + } + + [NoWatch, NoTV, NoMac, iOS (11,1)] + [BaseType (typeof(NSObject))] + [DisableDefaultCtor] + interface AVCaptureSystemPressureState + { + [Internal] + [Export ("level")] + NSString _Level { get; } + + [Wrap ("AVCaptureSystemPressureLevelExtensions.GetValue (_Level)")] + AVCaptureSystemPressureLevel Level { get; } + + [Export ("factors")] + AVCaptureSystemPressureFactors Factors { get; } + } + [NoWatch] [NoTV] [Since (7,0), Mac(10,7)] @@ -9793,6 +10031,22 @@ interface AVCaptureDeviceFormat { [iOS (10, 0)] [Export ("supportedColorSpaces")] NSNumber[] SupportedColorSpaces { get; } + + [iOS (11, 0)] + [Export ("videoMinZoomFactorForDepthDataDelivery")] + nfloat VideoMinZoomFactorForDepthDataDelivery { get; } + + [iOS (11, 0)] + [Export ("videoMaxZoomFactorForDepthDataDelivery")] + nfloat VideoMaxZoomFactorForDepthDataDelivery { get; } + + [iOS (11, 0)] + [Export ("supportedDepthDataFormats")] + AVCaptureDeviceFormat[] SupportedDepthDataFormats { get; } + + [iOS (11, 0)] + [Export ("unsupportedCaptureOutputClasses")] + Class[] UnsupportedCaptureOutputClasses { get; } #endif } @@ -10389,6 +10643,10 @@ interface AVPlayerItem : NSCopying { [Export ("preferredPeakBitRate")] double PreferredPeakBitRate { get; set; } + [iOS (11, 0)] + [Export ("preferredMaximumResolution", ArgumentSemantic.Assign)] + CGSize PreferredMaximumResolution { get; set; } + #region AVPlayerViewControllerAdditions [NoiOS][NoMac] [TV (9,0)] @@ -10420,6 +10678,7 @@ interface AVPlayerItem : NSCopying { [TV (9,2)] [Export ("mediaDataCollectors")] AVPlayerItemMediaDataCollector[] MediaDataCollectors { get; } + #if !MONOMAC [NoiOS, TV (10, 0), NoWatch, NoMac] [NullAllowed, Export ("nextContentProposal", ArgumentSemantic.Assign)] @@ -11274,6 +11533,14 @@ interface AVSampleBufferDisplayLayer { [Field ("AVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey")] NSString FailedToDecodeNotificationErrorKey { get; } + [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] + [Field ("AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification")] + NSString AudioRendererWasFlushedAutomaticallyNotification { get; } + + [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] + [Field ("AVSampleBufferAudioRendererFlushTimeKey")] + NSString AudioRendererFlushTimeKey { get; } + } [NoWatch] @@ -12289,5 +12556,21 @@ interface AVCapturePhoto [Wrap ("AVCaptureDeviceTypeExtensions.GetValue (WeakSourceDeviceType)")] AVCaptureDeviceType SourceDeviceType { get; } + + // From @interface AVCapturePhotoBracketedCapture (AVCapturePhoto) + +#if !MONOMAC + [iOS (11, 0)] + [NullAllowed, Export ("bracketSettings")] + AVCaptureBracketedStillImageSettings BracketSettings { get; } + + [iOS (11, 0)] + [Export ("sequenceCount")] + nint SequenceCount { get; } + + [iOS (11, 0)] + [Export ("lensStabilizationStatus")] + AVCaptureLensStabilizationStatus LensStabilizationStatus { get; } +#endif } } From d8bef4e6b1d49c3cfc66b9638e477eb9345fccc7 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 25 Oct 2017 12:43:42 +0200 Subject: [PATCH 2/4] Addresses review comments. Added missinf attr, Get* to those methods that required them and used smart enums where possible. --- src/AVFoundation/Enums.cs | 3 ++- src/avfoundation.cs | 36 +++++++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/AVFoundation/Enums.cs b/src/AVFoundation/Enums.cs index 17aa284455fd..4ced39721c72 100644 --- a/src/AVFoundation/Enums.cs +++ b/src/AVFoundation/Enums.cs @@ -981,7 +981,8 @@ public enum AVDepthDataQuality : nint { } [NoWatch, NoTV, NoMac, iOS (11,1)] - [Native] + [Flags] + [Native] public enum AVCaptureSystemPressureFactors : nuint { None = 0, diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 80ffb29c0a9e..8b15077347c3 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -3289,6 +3289,7 @@ interface AVSampleBufferRenderSynchronizer [Export ("addPeriodicTimeObserverForInterval:queue:usingBlock:")] NSObject AddPeriodicTimeObserver (CMTime interval, [NullAllowed] DispatchQueue queue, Action handler); + [Async] [Export ("addBoundaryTimeObserverForTimes:queue:usingBlock:")] NSObject AddBoundaryTimeObserver (NSValue[] times, [NullAllowed] DispatchQueue queue, Action handler); @@ -7863,7 +7864,7 @@ interface AVMutableVideoComposition { [Mac (10, 13), iOS (11, 0), TV (11, 0)] [Export ("sourceTrackIDForFrameTiming")] - int SourceTrackIDForFrameTiming { get; set; } + int SourceTrackIdForFrameTiming { get; set; } } [NoWatch] @@ -9082,7 +9083,7 @@ interface AVCapturePhotoSettings : NSCopying [iOS (11, 0)] [Export ("metadata", ArgumentSemantic.Copy)] - NSDictionary Metadata { get; set; } + NSDictionary Metadata { get; set; } [iOS (11, 0)] [Export ("livePhotoVideoCodecType")] @@ -9094,7 +9095,7 @@ interface AVCapturePhotoSettings : NSCopying [iOS (11, 0)] [NullAllowed, Export ("embeddedThumbnailPhotoFormat", ArgumentSemantic.Copy)] - NSDictionary EmbeddedThumbnailPhotoFormat { get; set; } + NSDictionary EmbeddedThumbnailPhotoFormat { get; set; } } #if !MONOMAC @@ -9276,25 +9277,41 @@ interface AVCapturePhotoOutput [Export ("depthDataDeliveryEnabled")] bool DepthDataDeliveryEnabled { [Bind ("isDepthDataDeliveryEnabled")] get; set; } + [Internal] [iOS (11, 0)] [Export ("availablePhotoFileTypes")] - string[] AvailablePhotoFileTypes { get; } + NSString[] _GetAvailablePhotoFileTypes { get; } + [iOS (11, 0)] + [Wrap ("Array.ConvertAll (_GetAvailablePhotoFileTypes, s => AVFileTypesExtensions.GetValue (s))")] + AVFileTypes[] GetAvailablePhotoFileTypes { get; } + + + [Internal] [iOS (11, 0)] [Export ("availableRawPhotoFileTypes")] - string[] AvailableRawPhotoFileTypes { get; } + NSString[] _GetAvailableRawPhotoFileTypes { get; } + + [iOS (11, 0)] + [Wrap ("Array.ConvertAll (_GetAvailableRawPhotoFileTypes, s => AVFileTypesExtensions.GetValue (s))")] + AVFileTypes[] GetAvailableRawPhotoFileTypes { get; } [iOS (11,0)] [Export ("supportedPhotoPixelFormatTypesForFileType:")] - NSNumber[] SupportedPhotoPixelFormatTypesForFileType (string fileType); + NSNumber[] GetSupportedPhotoPixelFormatTypesForFileType (string fileType); + [Internal] [iOS (11,0)] [Export ("supportedPhotoCodecTypesForFileType:")] - string[] SupportedPhotoCodecTypesForFileType (string fileType); + NSString[] _GetSupportedPhotoCodecTypesForFileType (string fileType); + + [iOS (11,0)] + [Wrap ("Array.ConvertAll (_GetSupportedPhotoCodecTypesForFileType (fileType), s => AVVideoCodecTypeExtensions.GetValue (s))")] + AVVideoCodecType[] GetSupportedPhotoCodecTypesForFileType (string fileType); [iOS (11,0)] [Export ("supportedRawPhotoPixelFormatTypesForFileType:")] - NSNumber[] SupportedRawPhotoPixelFormatTypesForFileType (string fileType); + NSNumber[] GetSupportedRawPhotoPixelFormatTypesForFileType (string fileType); } #endif @@ -10643,7 +10660,7 @@ interface AVPlayerItem : NSCopying { [Export ("preferredPeakBitRate")] double PreferredPeakBitRate { get; set; } - [iOS (11, 0)] + [iOS (11, 0), NoMac, NoTV] [Export ("preferredMaximumResolution", ArgumentSemantic.Assign)] CGSize PreferredMaximumResolution { get; set; } @@ -11534,6 +11551,7 @@ interface AVSampleBufferDisplayLayer { NSString FailedToDecodeNotificationErrorKey { get; } [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] + [Notification] [Field ("AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification")] NSString AudioRendererWasFlushedAutomaticallyNotification { get; } From ea156ebec95c8d9abe9fe25de9d19a698d40c97c Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 25 Oct 2017 13:26:59 +0200 Subject: [PATCH 3/4] Remove not correct use of async attr. Add missing smart enum property. --- src/avfoundation.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 8b15077347c3..df99c786304e 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -3285,11 +3285,15 @@ interface AVSampleBufferRenderSynchronizer // as per the docs the returned observers are an opaque object that you pass as the argument to // removeTimeObserver to cancel observation. - [Async] + // Regarding async usage: + // The delegate can be called multiple times (once for each value in the times array according to the documentation), + // which makes it a bad fit for [Async] + + // [Async] -> not added due to comment above [Export ("addPeriodicTimeObserverForInterval:queue:usingBlock:")] NSObject AddPeriodicTimeObserver (CMTime interval, [NullAllowed] DispatchQueue queue, Action handler); - [Async] + // [Async] -> not added due to comment above [Export ("addBoundaryTimeObserverForTimes:queue:usingBlock:")] NSObject AddBoundaryTimeObserver (NSValue[] times, [NullAllowed] DispatchQueue queue, Action handler); @@ -9089,9 +9093,14 @@ interface AVCapturePhotoSettings : NSCopying [Export ("livePhotoVideoCodecType")] string LivePhotoVideoCodecType { get; set; } + [Internal] [iOS (11, 0)] [Export ("availableEmbeddedThumbnailPhotoCodecTypes")] - string[] AvailableEmbeddedThumbnailPhotoCodecTypes { get; } + NSString[] _GetAvailableEmbeddedThumbnailPhotoCodecTypes { get; } + + [iOS (11, 0)] + [Wrap ("Array.ConvertAll (_GetAvailableEmbeddedThumbnailPhotoCodecTypes, s => AVVideoCodecTypeExtensions.GetValue (s))")] + AVVideoCodecType[] GetAvailableEmbeddedThumbnailPhotoCodecTypes { get; } [iOS (11, 0)] [NullAllowed, Export ("embeddedThumbnailPhotoFormat", ArgumentSemantic.Copy)] From ab9f2c55a16bbc88f3f27e4734623b8db91ae1e6 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 27 Oct 2017 18:39:11 +0200 Subject: [PATCH 4/4] Updated bidings as per reviews. Mainly added NoMac when possible and added event args for the flush notification. A helper property was added to go from NSValue to CMTime. --- ...endererWasFlushedAutomaticallyEventArgs.cs | 17 ++++++++ src/avfoundation.cs | 41 ++++++++++--------- src/frameworks.sources | 1 + 3 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 src/AVFoundation/AudioRendererWasFlushedAutomaticallyEventArgs.cs diff --git a/src/AVFoundation/AudioRendererWasFlushedAutomaticallyEventArgs.cs b/src/AVFoundation/AudioRendererWasFlushedAutomaticallyEventArgs.cs new file mode 100644 index 000000000000..813a4398cc95 --- /dev/null +++ b/src/AVFoundation/AudioRendererWasFlushedAutomaticallyEventArgs.cs @@ -0,0 +1,17 @@ +#if !WATCH +using XamCore.Foundation; +using XamCore.CoreMedia; +using XamCore.ObjCRuntime; + +namespace XamCore.AVFoundation { + + [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] + public partial class AudioRendererWasFlushedAutomaticallyEventArgs { + public CMTime AudioRendererFlushTime { + get { + return _AudioRendererFlushTime.CMTimeValue; + } + } + } +} +#endif \ No newline at end of file diff --git a/src/avfoundation.cs b/src/avfoundation.cs index df99c786304e..d9575b4d06b9 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -3234,7 +3234,7 @@ interface AVSampleBufferAudioRenderer : AVQueuedSampleBufferRendering NSError Error { get; } [NullAllowed, Export ("audioOutputDeviceUniqueID")] - string UniqueId { get; set; } + string AudioOutputDeviceUniqueId { get; set; } [Export ("audioTimePitchAlgorithm")] string PitchAlgorithm { get; set; } @@ -3251,6 +3251,19 @@ interface AVSampleBufferAudioRenderer : AVQueuedSampleBufferRendering [Async] [Export ("flushFromSourceTime:completionHandler:")] void Flush (CMTime time, Action completionHandler); + + [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] + [Notification (typeof (AudioRendererWasFlushedAutomaticallyEventArgs))] + [Field ("AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification")] + NSString AudioRendererWasFlushedAutomaticallyNotification { get; } + + } + + [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] + interface AudioRendererWasFlushedAutomaticallyEventArgs { + [Internal] + [Export ("AVSampleBufferAudioRendererFlushTimeKey")] + NSValue _AudioRendererFlushTime { get; set; } } interface IAVQueuedSampleBufferRendering {} @@ -8181,11 +8194,11 @@ interface AVCaptureSession { [iOS (10, 0)] [Export ("automaticallyConfiguresCaptureDeviceForWideColor")] bool AutomaticallyConfiguresCaptureDeviceForWideColor { get; set; } +#endif - [iOS (11, 1)] + [iOS (11, 1), NoMac] [Field ("AVCaptureSessionInterruptionSystemPressureStateKey")] NSString InterruptionSystemPressureStateKey { get; } -#endif [Since (7,0)] [Export ("masterClock")] @@ -11558,16 +11571,6 @@ interface AVSampleBufferDisplayLayer { [iOS (8, 0), Mac (10,0)] [Field ("AVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey")] NSString FailedToDecodeNotificationErrorKey { get; } - - [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] - [Notification] - [Field ("AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification")] - NSString AudioRendererWasFlushedAutomaticallyNotification { get; } - - [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] - [Field ("AVSampleBufferAudioRendererFlushTimeKey")] - NSString AudioRendererFlushTimeKey { get; } - } [NoWatch] @@ -12590,14 +12593,14 @@ interface AVCapturePhoto [iOS (11, 0)] [NullAllowed, Export ("bracketSettings")] AVCaptureBracketedStillImageSettings BracketSettings { get; } +#endif - [iOS (11, 0)] - [Export ("sequenceCount")] - nint SequenceCount { get; } - - [iOS (11, 0)] + [iOS (11, 0), NoMac] [Export ("lensStabilizationStatus")] AVCaptureLensStabilizationStatus LensStabilizationStatus { get; } -#endif + + [iOS (11, 0), NoMac] + [Export ("sequenceCount")] + nint SequenceCount { get; } } } diff --git a/src/frameworks.sources b/src/frameworks.sources index f70f520a2932..2dc286f77019 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -265,6 +265,7 @@ AVFOUNDATION_SOURCES = \ AVFoundation/DescriptionHelpers.cs \ AVFoundation/Events.cs \ AVFoundation/AVPlayerLooper.cs \ + AVFoundation/AudioRendererWasFlushedAutomaticallyEventArgs.cs \ # AVKit