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/Enums.cs b/src/AVFoundation/Enums.cs index 0f1900cde407..4ced39721c72 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,15 @@ public enum AVDepthDataQuality : nint { Low = 0, High = 1 } + + [NoWatch, NoTV, NoMac, iOS (11,1)] + [Flags] + [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..d9575b4d06b9 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,127 @@ 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 AudioOutputDeviceUniqueId { 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); + + [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 {} + + [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. + + // 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] -> not added due to comment above + [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 +7878,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] @@ -8060,6 +8196,10 @@ interface AVCaptureSession { bool AutomaticallyConfiguresCaptureDeviceForWideColor { get; set; } #endif + [iOS (11, 1), NoMac] + [Field ("AVCaptureSessionInterruptionSystemPressureStateKey")] + NSString InterruptionSystemPressureStateKey { get; } + [Since (7,0)] [Export ("masterClock")] CMClock MasterClock { get; } @@ -8891,6 +9031,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 +9069,55 @@ 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; } + + [Internal] + [iOS (11, 0)] + [Export ("availableEmbeddedThumbnailPhotoCodecTypes")] + 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)] + NSDictionary EmbeddedThumbnailPhotoFormat { get; set; } } #if !MONOMAC @@ -9104,6 +9298,42 @@ interface AVCapturePhotoOutput [iOS (11,0)] [Export ("depthDataDeliveryEnabled")] bool DepthDataDeliveryEnabled { [Bind ("isDepthDataDeliveryEnabled")] get; set; } + + [Internal] + [iOS (11, 0)] + [Export ("availablePhotoFileTypes")] + NSString[] _GetAvailablePhotoFileTypes { get; } + + [iOS (11, 0)] + [Wrap ("Array.ConvertAll (_GetAvailablePhotoFileTypes, s => AVFileTypesExtensions.GetValue (s))")] + AVFileTypes[] GetAvailablePhotoFileTypes { get; } + + + [Internal] + [iOS (11, 0)] + [Export ("availableRawPhotoFileTypes")] + NSString[] _GetAvailableRawPhotoFileTypes { get; } + + [iOS (11, 0)] + [Wrap ("Array.ConvertAll (_GetAvailableRawPhotoFileTypes, s => AVFileTypesExtensions.GetValue (s))")] + AVFileTypes[] GetAvailableRawPhotoFileTypes { get; } + + [iOS (11,0)] + [Export ("supportedPhotoPixelFormatTypesForFileType:")] + NSNumber[] GetSupportedPhotoPixelFormatTypesForFileType (string fileType); + + [Internal] + [iOS (11,0)] + [Export ("supportedPhotoCodecTypesForFileType:")] + 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[] GetSupportedRawPhotoPixelFormatTypesForFileType (string fileType); } #endif @@ -9247,6 +9477,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 +9957,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 +10070,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 +10682,10 @@ interface AVPlayerItem : NSCopying { [Export ("preferredPeakBitRate")] double PreferredPeakBitRate { get; set; } + [iOS (11, 0), NoMac, NoTV] + [Export ("preferredMaximumResolution", ArgumentSemantic.Assign)] + CGSize PreferredMaximumResolution { get; set; } + #region AVPlayerViewControllerAdditions [NoiOS][NoMac] [TV (9,0)] @@ -10420,6 +10717,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)] @@ -11273,7 +11571,6 @@ interface AVSampleBufferDisplayLayer { [iOS (8, 0), Mac (10,0)] [Field ("AVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey")] NSString FailedToDecodeNotificationErrorKey { get; } - } [NoWatch] @@ -12289,5 +12586,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; } +#endif + + [iOS (11, 0), NoMac] + [Export ("lensStabilizationStatus")] + AVCaptureLensStabilizationStatus LensStabilizationStatus { get; } + + [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