[AVFoundation] Add missing categories from Xcode 9 and add new API from Xcode 9.1 - #2919
Conversation
|
Build failure |
| [Export ("preferredPeakBitRate")] | ||
| double PreferredPeakBitRate { get; set; } | ||
|
|
||
| [iOS (11, 0)] |
There was a problem hiding this comment.
since only iOS headers were updated you need to add [NoMac] (XM intro tests are failing) [NoTV] and [NoWatch] attributes.
There was a problem hiding this comment.
Correct, Sorry for thatI forgot theNoMac and NoTV, watch is already ignored since is in the top of the class.
|
|
||
| [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] | ||
| [Field ("AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification")] | ||
| NSString AudioRendererWasFlushedAutomaticallyNotification { get; } |
There was a problem hiding this comment.
the naming makes it sound like a [Notification] attribute is missing (and intro complains about this)
| [Field ("AVCaptureDeviceTypeBuiltInDualCamera")] | ||
| BuiltInDualCamera, | ||
|
|
||
| [iOS (11, 1)] |
There was a problem hiding this comment.
missing NoMac, NoTV and NoWatch
There was a problem hiding this comment.
Those decorators are already present in line 9422 on top of the enum, we have NoTV, NoMac, NoWatch.
| VideoDeviceInUseByAnotherClient = 3, | ||
| VideoDeviceNotAvailableWithMultipleForegroundApps = 4 | ||
| VideoDeviceNotAvailableWithMultipleForegroundApps = 4, | ||
| [iOS (11, 1)] |
There was a problem hiding this comment.
NoMac, NoTV and NoWatch missing
There was a problem hiding this comment.
It already has a [NoTV, NoWatch] in the top of the enum and it is inside a #if !MONOMAC which means that is not necessary, right?
There was a problem hiding this comment.
Yeah technically it is not needed but I think it was the plan that at some point we would get rid of those conditionals if possible so having that metadata there won't hurt I guess, unless @spouliot says otherwise :)
There was a problem hiding this comment.
We'd get rid of #if !MONOMAC, not of availability attributes on the parent (so lack of [NoTV, NoWatch] still valid).
We could just add a [NoMac] to public enum AVCaptureSessionInterruptionReason but that would be just noise in this case, better do it for things we add.
There was a problem hiding this comment.
k, we'll soon have xtro results so it will be easier to spot them :)
There was a problem hiding this comment.
Ok, leaving as it is to reduce noise in the diff. We can do this later for new types or in a pr just to get rid of the #if !MONOMAC
| [Export ("automaticallyConfiguresCaptureDeviceForWideColor")] | ||
| bool AutomaticallyConfiguresCaptureDeviceForWideColor { get; set; } | ||
|
|
||
| [iOS (11, 1)] |
There was a problem hiding this comment.
the #if are not clear in the diff but this cannot be added in Mac, TV or Watch since the headers were not updated
There was a problem hiding this comment.
This is within a #if !MONOMAC in line 8156 to line 8184 that includes the only iOS methods. The class has a NoWatch NoTV already, therefore AFAIK, it is not added in Mac, TV or Watch.
There was a problem hiding this comment.
I agree that because the class has [NoWatch] and [NoTV] we shouldn't add those but I would still add the [NoMac] even though there's a #if !MONOMAC. Remember we're trying to move away from them, it adds clarity.
There was a problem hiding this comment.
even a [NoMac] should be added on the type, so we would not see it in the diff :|
hopefully xtro will make this easier to review (really soon now)
There was a problem hiding this comment.
Adding NoMac and moving out side the #if !MONOMAC.
|
|
||
| [Mac (10, 13), iOS (11, 0), TV (11, 0)] | ||
| [Export ("sourceTrackIDForFrameTiming")] | ||
| int SourceTrackIDForFrameTiming { get; set; } |
There was a problem hiding this comment.
Id - not ID since it's not an acronym
|
|
||
| [iOS (11, 0)] | ||
| [Export ("metadata", ArgumentSemantic.Copy)] | ||
| NSDictionary<NSString, NSObject> Metadata { get; set; } |
There was a problem hiding this comment.
use an NSDictionary so we can use a strong dictionary later
|
|
||
| [iOS (11,0)] | ||
| [Export ("supportedPhotoPixelFormatTypesForFileType:")] | ||
| NSNumber[] SupportedPhotoPixelFormatTypesForFileType (string fileType); |
There was a problem hiding this comment.
-> Get SupportedPhotoPixelFormatTypes
|
|
||
| [iOS (11,0)] | ||
| [Export ("supportedPhotoCodecTypesForFileType:")] | ||
| string[] SupportedPhotoCodecTypesForFileType (string fileType); |
There was a problem hiding this comment.
-> GetSupportedPhotoCodecTypes
|
|
||
| [iOS (11,0)] | ||
| [Export ("supportedRawPhotoPixelFormatTypesForFileType:")] | ||
| NSNumber[] SupportedRawPhotoPixelFormatTypesForFileType (string fileType); |
There was a problem hiding this comment.
-> Get SupportedRawPhotoPixelFormatTypes
| [NullAllowed, Export ("error")] | ||
| NSError Error { get; } | ||
|
|
||
| [NullAllowed, Export ("audioOutputDeviceUniqueID")] |
There was a problem hiding this comment.
I am not familiar with the API so to be honest I am not sure of what the unique id is for, maybe we should keep the full property name AudioOutputDeviceUniqueId
There was a problem hiding this comment.
maybe we should keep the full property name AudioOutputDeviceUniqueId
Yes we should, the class is AVSampleBufferAudioRenderer not AudioOutputDevice so it makes sense to keep the full name, see swift version too: https://developer.apple.com/documentation/avfoundation/avsamplebufferaudiorenderer/2866182-audiooutputdeviceuniqueid
| [iOS (11,0)] | ||
| [Static] | ||
| [Export ("photoSettingsWithRawPixelFormatType:rawFileType:processedFormat:processedFileType:")] | ||
| AVCapturePhotoSettings FromRawPixelFormatType (uint rawPixelFormatType, [NullAllowed] string rawFileType, [NullAllowed] NSDictionary<NSString, NSObject> processedFormat, [NullAllowed] string processedFileType); |
There was a problem hiding this comment.
Do you think we can make a strong dictionary in the future of NSDictionary<NSString, NSObject> processedFormat if so please just do NSDictionary
There was a problem hiding this comment.
Over here I followed the pattern from the other static creators. If you look you will find:
[Static]
[Export ("photoSettingsWithRawPixelFormatType:processedFormat:")]
AVCapturePhotoSettings FromRawPixelFormatType (uint rawPixelFormatType,
[NullAllowed] NSDictionary<NSString, NSObject> processedFormat);
And this new method is an overload with an extra string parameter as a second parameter:
AVCapturePhotoSettings FromRawPixelFormatType (uint rawPixelFormatType, [NullAllowed] string rawFileType, [NullAllowed] NSDictionary<NSString, NSObject> processedFormat, [NullAllowed] string processedFileType);
I don't know if we want to have one (that is already a public API) with the template dir and a new one with a simple NSDictionary, makes the API look funny.
@spouliot comments?
There was a problem hiding this comment.
let's be consistent then
I think we need a something like NSDictionary GetWeakDictionary (); added to NSDictionary<T,V> (and maybe a GetStrongDictionary<T,V> () to NSDictionary too ?
There was a problem hiding this comment.
That would end up with multiple managed objects per native handle.
We should really look into fixing our runtime to make that a supported scenario.
|
|
||
| [iOS (11, 0)] | ||
| [Export ("availableEmbeddedThumbnailPhotoCodecTypes")] | ||
| string[] AvailableEmbeddedThumbnailPhotoCodecTypes { get; } |
There was a problem hiding this comment.
This sounds like it returns a bunch of NSString constants (likely a smart enum) if that is the case please use NSString[] instead of string or better yet, if you have the info return a smart enum ;)
|
|
||
| [iOS (11, 0)] | ||
| [Export ("availablePhotoFileTypes")] | ||
| string[] AvailablePhotoFileTypes { get; } |
There was a problem hiding this comment.
This sounds like it returns a bunch of NSString constants (likely a smart enum) if that is the case please use NSString[] instead of string or better yet, if you have the info return a smart enum ;)
There was a problem hiding this comment.
We can do that since AFAIK it should be a AVVideoCodecType.
|
|
||
| [iOS (11, 0)] | ||
| [Export ("availableRawPhotoFileTypes")] | ||
| string[] AvailableRawPhotoFileTypes { get; } |
There was a problem hiding this comment.
This sounds like it returns a bunch of NSString constants (likely a smart enum) if that is the case please use NSString[] instead of string or better yet, if you have the info return a smart enum ;)
There was a problem hiding this comment.
Yes, will do that with a simple wrap.
| NSString AudioRendererWasFlushedAutomaticallyNotification { get; } | ||
|
|
||
| [TV (11, 0), NoWatch, Mac (10, 13), iOS (11, 0)] | ||
| [Field ("AVSampleBufferAudioRendererFlushTimeKey")] |
There was a problem hiding this comment.
Is this part of the Flushed Automatically Notification payload?
There was a problem hiding this comment.
Yes, it is part of the AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification, as per the headers:
The renderer may flush enqueued media data when the user routes playback to a new destination. The renderer may also flush enqueued media data when the playback rat
e of the attached AVSampleBufferRenderSynchronizer is changed (e.g. 1.0 -> 2.0 or 1.0 -> 0.0 -> 2.0), however no flush will occur for normal pauses (non-zero -> 0.0) and resumes (0.
0 -> same non-zero rate as before).
When an automatic flush occurs, the attached render synchronizer's timebase will remain running at its current rate. It is typically best to respond to this notification by enqueueing media data with timestamps starting at the timebase's current time. To the listener, this will sound similar to muting the audio for a short period of time. If it is more desirable to ensure that all audio is played than to keep the timeline moving, you may also stop the synchronizer, set the synchronizer's current time to the value of AVSampleBufferAudioRendererFlushTimeKey, start reenqueueing sample buffers with timestamps starting at that time, and restart the synchronizer. To the listener, this will sound similar to pausing the audio for a short period of time.
This notification is delivered on an arbitrary thread. If sample buffers are being enqueued with the renderer concurrently with the receipt of this notification, it is possible that one or more sample buffers will remain enqueued in the renderer. This is generally undesirable, because the sample buffers that remain will likely have timestamps far ahead of the timebase's current time and so won't be rendered for some time. The best practice is to invoke the -flush method, in a manner that is serialized with enqueueing sample buffers, after receiving this notification and before resuming the enqueueing of sample buffers.
There was a problem hiding this comment.
Then you need to add it to the Notification attribute as described here https://developer.xamarin.com/guides/cross-platform/macios/binding/binding-types-reference/#NotificationAttribute
look for this
If your notification contains parameters, you should specify a helper EventArgs interface, like this:
…that required them and used smart enums where possible.
|
Build failure |
|
Build success |
| [NullAllowed, Export ("error")] | ||
| NSError Error { get; } | ||
|
|
||
| [NullAllowed, Export ("audioOutputDeviceUniqueID")] |
There was a problem hiding this comment.
maybe we should keep the full property name AudioOutputDeviceUniqueId
Yes we should, the class is AVSampleBufferAudioRenderer not AudioOutputDevice so it makes sense to keep the full name, see swift version too: https://developer.apple.com/documentation/avfoundation/avsamplebufferaudiorenderer/2866182-audiooutputdeviceuniqueid
| [Export ("automaticallyConfiguresCaptureDeviceForWideColor")] | ||
| bool AutomaticallyConfiguresCaptureDeviceForWideColor { get; set; } | ||
|
|
||
| [iOS (11, 1)] |
There was a problem hiding this comment.
I agree that because the class has [NoWatch] and [NoTV] we shouldn't add those but I would still add the [NoMac] even though there's a #if !MONOMAC. Remember we're trying to move away from them, it adds clarity.
|
|
||
| // From @interface AVCapturePhotoBracketedCapture (AVCapturePhoto) | ||
|
|
||
| #if !MONOMAC |
There was a problem hiding this comment.
Could we go [NoMac] here? Are AVCaptureBracketedStillImageSettings and AVCaptureLensStabilizationStatus just not available?
SequenceCount could definitely avoid the #if !MONOMAC
There was a problem hiding this comment.
AVCaptureBracketedStillImageSettings and AVCaptureLensStabilizationStatus is not present in the mac AFAIK. Moving the other ones out.
There was a problem hiding this comment.
Comment is misleading AVCaptureLensStabilizationStatus seems to be present since you did not put it in the #if !MONOMAC and it built just fine (:
@spouliot @mandel-macaque should we take this approach instead? https://github.com/xamarin/xamarin-macios/blob/master/src/scenekit.cs#L76-L97
It's also a comment for the future, I'd like to know the approach we prefer, moving forward.
There was a problem hiding this comment.
Sorry, I meant just one of them. tested the others :)
| NSObject AddPeriodicTimeObserver (CMTime interval, [NullAllowed] DispatchQueue queue, Action<CMTime> handler); | ||
|
|
||
| [Export ("addBoundaryTimeObserverForTimes:queue:usingBlock:")] | ||
| NSObject AddBoundaryTimeObserver (NSValue[] times, [NullAllowed] DispatchQueue queue, Action handler); |
There was a problem hiding this comment.
let's add a comment here and the one above (and remove its [Async])
| [iOS (11,0)] | ||
| [Static] | ||
| [Export ("photoSettingsWithRawPixelFormatType:rawFileType:processedFormat:processedFileType:")] | ||
| AVCapturePhotoSettings FromRawPixelFormatType (uint rawPixelFormatType, [NullAllowed] string rawFileType, [NullAllowed] NSDictionary<NSString, NSObject> processedFormat, [NullAllowed] string processedFileType); |
There was a problem hiding this comment.
let's be consistent then
I think we need a something like NSDictionary GetWeakDictionary (); added to NSDictionary<T,V> (and maybe a GetStrongDictionary<T,V> () to NSDictionary too ?
…added event args for the flush notification. A helper property was added to go from NSValue to CMTime.
|
Build success |
VincentDondain
left a comment
There was a problem hiding this comment.
https://github.com/xamarin/xamarin-macios/pull/2919/files#r147492859 is still unanswered, I think we could avoid #if !MONOMAC completely but that's not really a blocker for the merge (:
|
Merging after talking with Vincent as his comment is not a blocked and we do not want to be waiting for this regarding xcode 9.1 |
No description provided.