Skip to content

Cinematic macOS xcode15.0 b1

Manuel de la Pena edited this page Aug 17, 2023 · 3 revisions

#Cinematic.framework https://github.com/xamarin/xamarin-macios/pull/18686

diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNAssetInfo.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNAssetInfo.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNAssetInfo.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNAssetInfo.h	2023-05-26 21:34:22
@@ -0,0 +1,94 @@
+//
+//  CNAssetInfo.h
+//  Cinematic
+//
+//  Copyright © 2022-2023 Apple Inc. All rights reserved.
+//
+
+/* WARNING: Preliminary API — subject to change without notice */
+
+#import <Foundation/Foundation.h>
+#import <AVFoundation/AVFoundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Information associated with an AVAsset for a cinematic video.
+@interface CNAssetInfo : NSObject
+
+/// Check if asset is cinematic asynchronously.
++ (void)checkIfCinematic:(AVAsset *)asset completionHandler:(void (^)(BOOL result))completionHandler;
+
+/// Load cinematic asset information asynchronously.
++ (void)loadFromAsset:(AVAsset *)asset
+        completionHandler:(void (^)(CNAssetInfo * _Nullable cinematicAssetInfo,
+                                    NSError * _Nullable error))completionHandler;
+
+@property (strong, readonly) AVAsset *asset;
+
+@property (strong, readonly) NSArray<AVAssetTrack *> *allCinematicTracks;
+
+@property (strong, readonly) AVAssetTrack *cinematicVideoTrack;
+@property (strong, readonly) AVAssetTrack *cinematicDisparityTrack;
+@property (strong, readonly) AVAssetTrack *cinematicMetadataTrack;
+
+/// Time range over which all cinematic tracks are valid.
+@property (readonly) CMTimeRange timeRange;
+
+/// Natural size at which cinematic video would be rendered
+@property (readonly) CGSize naturalSize;
+
+/// Natural size at which cinematic video would be displayed.
+/// Same as naturalSize with preferredTransform applied.
+@property (readonly) CGSize preferredSize;
+
+/// The preferred transform of the rendered image for display purposes.
+/// Always the identity transform or a multiple of a 90º rotation with no scaling.
+@property (readonly) CGAffineTransform preferredTransform;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+/// Use of these properties where appropriate is preferred to help maintain future compatibility
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+@interface CNAssetInfo (AbstractTracks)
+
+/// Track to be used for frame timing
+@property (strong, readonly) AVAssetTrack *frameTimingTrack;
+
+/// Tracks required to construct AVAssetReaderVideoCompositionOutput.
+@property (strong, readonly) NSArray<AVAssetTrack *> *videoCompositionTracks;
+
+/// Source video track IDs required to implement AVVideoCompositionInstruction protocol
+@property (strong, readonly) NSArray<NSNumber *> *videoCompositionTrackIDs;
+
+/// Source metadata track IDs required to implement AVVideoCompositionInstruction protocol
+@property (strong, readonly) NSArray<NSNumber *> *sampleDataTrackIDs;
+
+@end
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Information about composition tracks added to an AVComposition for a cinematic asset.
+@interface CNCompositionInfo : CNAssetInfo
+
+/// Inserts a timeRange of a cinematic source asset into the corresponding tracks of a composition
+- (BOOL)insertTimeRange:(CMTimeRange)timeRange ofCinematicAssetInfo:(CNAssetInfo *)assetInfo atTime:(CMTime)startTime error:(NSError * _Nullable * _Nullable)outError;
+
+@end
+
+
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+@interface AVMutableComposition (CNComposition)
+
+/// Adds a group of empty tracks associated with a cinematic asset to a mutable composition.
+/// - Returns: Information about the composition tracks added to the mutable composition.
+/// Be sure to call insertTimeRange on the result to specify at least one time range of cinematic asset you'd like in the composition.
+- (CNCompositionInfo *)addTracksForCinematicAssetInfo:(CNAssetInfo *)assetInfo preferredStartingTrackID:(CMPersistentTrackID)preferredStartingTrackID NS_REFINED_FOR_SWIFT;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDecision.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDecision.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDecision.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDecision.h	2023-05-26 21:34:22
@@ -0,0 +1,62 @@
+//
+//  CNDecision.h
+//  Cinematic
+//
+//  Copyright © 2022-2023 Apple Inc. All rights reserved.
+//
+
+/* WARNING: Preliminary API — subject to change without notice */
+
+#import <Foundation/Foundation.h>
+#import <CoreMedia/CoreMedia.h>
+
+#import <Cinematic/CNDetection.h>
+
+NS_HEADER_AUDIT_BEGIN(nullability, sendability)
+
+NS_REFINED_FOR_SWIFT NS_SWIFT_SENDABLE
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Represents a decision to focus on a specific detectionID or detectionGroupID; optionally strong.
+///
+/// A strong decision keeps focus for as long as possible.
+///
+@interface CNDecision : NSObject <NSCopying>
+
+/// Make a decision to focus on the detection with the given detectionID.
+/// A strong decision keeps focus for as long as possible.
+- (instancetype)initWithTime:(CMTime)time
+                 detectionID:(CNDetectionID)detectionID
+                      strong:(BOOL)isStrong;
+
+/// Make a decision to focus on the best among those detections with the same detectionGroupID.
+/// A strong decision keeps focus for as long as possible.
+- (instancetype)initWithTime:(CMTime)time
+            detectionGroupID:(CNDetectionGroupID)detectionGroupID
+                      strong:(BOOL)isStrong;
+
+/// The first presentation time at which the subject should be in focus.
+/// The rack focus transition to the subject occurs prior to this time.
+@property (readonly) CMTime time;
+
+/// The detectionID of the detection to focus on if this is not a group decision.
+@property (readonly) CNDetectionID detectionID;
+
+/// The detectionGroupID of the detection to focus on if this is a group decision.
+@property (readonly) CNDetectionGroupID detectionGroupID;
+
+/// Whether this is a user-created decision, or a base decision.
+@property (readonly, getter=isUserDecision) BOOL userDecision;
+
+/// Whether this is a group decision or not.
+@property (readonly, getter=isGroupDecision) BOOL groupDecision;
+
+/// Whether this is a strong decision or not.
+/// A strong decision keeps focus for as long as possible.
+@property (readonly, getter=isStrongDecision) BOOL strongDecision;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+NS_HEADER_AUDIT_END(nullability, sendability)
diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDetection.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDetection.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDetection.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDetection.h	2023-05-26 21:34:22
@@ -0,0 +1,120 @@
+//
+//  CNDetection.h
+//  Cinematic
+//
+//  Copyright © 2022-2023 Apple Inc. All rights reserved.
+//
+
+/* WARNING: Preliminary API — subject to change without notice */
+
+#import <Foundation/Foundation.h>
+#import <CoreMedia/CoreMedia.h>
+
+NS_HEADER_AUDIT_BEGIN(nullability, sendability)
+
+typedef int64_t CNDetectionID NS_TYPED_EXTENSIBLE_ENUM;
+typedef int64_t CNDetectionGroupID NS_TYPED_EXTENSIBLE_ENUM;
+
+/// The type of object that was detected.
+///
+/// Special detection types include:
+/// - autoFocus: from the autofocus system of the camera
+/// - fixedFocus: an explicit request to focus at a fixed disparity
+/// - custom: an object tracked via a custom tracker
+///
+typedef NS_ENUM(NSInteger, CNDetectionType) {
+    CNDetectionTypeUnknown = 0,
+
+    CNDetectionTypeHumanFace = 1,
+    CNDetectionTypeHumanHead = 2,
+    CNDetectionTypeHumanTorso = 3,
+
+    CNDetectionTypeCatBody = 4,
+    CNDetectionTypeDogBody = 5,
+
+    CNDetectionTypeCatHead = 9,
+    CNDetectionTypeDogHead = 10,
+
+    CNDetectionTypeSportsBall = 11,
+
+    CNDetectionTypeAutoFocus = 100,
+    CNDetectionTypeFixedFocus = 101,
+    CNDetectionTypeCustom = 102,
+} API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos);
+
+NS_REFINED_FOR_SWIFT
+/// A cinematic detection of a subject.
+///
+/// Specifies the type, distance (as disparity), bounds (as a normalized rectangle), and time (as CMTime) of the detection.
+/// Detections obtained from the cinematic script include a detectionID that can be used to track the detection over time.
+/// Some types of detections also include a detectionGroupID that associates related detections (e.g. the face and torso of the same person).
+///
+NS_SWIFT_SENDABLE
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+@interface CNDetection : NSObject <NSCopying>
+
+/// Initialize a cinematic detection.
+///
+/// For playback and edit, most detections are obtained by from the cinematic script rather than being created.
+/// However, if you need to add a custom track, you can build an array of detections to create one.
+/// Any detections you create will not have a valid detectionID until the custom track is added to the cinematic script.
+/// Doing so will return the assigned detectionID. Any detections newly obtained from the cinematic script will have their assigned detectionID.
+///
+/// - Parameters:
+///   - time: the presentation time of the frame in which the detection occurred
+///   - detectionType: the type of object that was detected (face, torso, cat, dog, etc.)
+///   - normalizedRect: the rectangle within the image where the object occurs, normalized such that (0.0, 0.0) is the top-left and (1.0, 1.0) is the bottom-right
+///   - focusDisparity: the disparity to use in order to focus on the object (use the static `disparity` method to compute if unknown)
+///
+- (instancetype)initWithTime:(CMTime)time
+               detectionType:(CNDetectionType)detectionType
+              normalizedRect:(CGRect)normalizedRect
+              focusDisparity:(float)focusDisparity;
+
+/// The presentation time of the frame in which the detection occurred.
+@property (readonly) CMTime time;
+
+/// The type of object that was detected (face, torso, cat, dog, etc.)
+@property (readonly) CNDetectionType detectionType;
+
+/// The rectangle within the image where the object occurs, normalized such that (0.0, 0.0) is the top-left and (1.0, 1.0) is the bottom-right.
+@property (readonly) CGRect normalizedRect;
+
+/// The disparity to use in order to focus on the object.
+/// If the disparity is unknown, use the class method to find it: `disparityInNormalizedRect:sourceDisparity:detectionType:priorDisparity:`.
+@property (readonly) float focusDisparity;
+
+/// An unique identifier assigned by the cinematic script to all detections of the same subject and detection type across time.
+/// If you build a custom detection track, the detectionID will be assigned when you add it to the script.
+@property (readonly) CNDetectionID detectionID;
+
+/// An unique identifier assigned by the cinematic script to all detections of the same subject and related detection types across time.
+/// For example, the face/torso detections of the same person are assigned the same detectionGroupID.
+@property (readonly) CNDetectionGroupID detectionGroupID;
+
+/// Determine whether a given detectionID is valid
++ (BOOL)isValidDetectionID:(CNDetectionID)detectionID;
+
+/// Determine whether a given detectionGroupID is valid
++ (BOOL)isValidDetectionGroupID:(CNDetectionGroupID)detectionGroupID;
+
+/// A localized accessibility label converting a specific detection type into a broad category (person, pet, etc.).
++ (NSString *)accessibilityLabelForDetectionType:(CNDetectionType)detectionType;
+
+/// Determine the disparity to use to focus on the object in the rectangle.
+/// - Parameters:
+///   - disparityBuffer: A pixel buffer from the cinematic disparity track for the frame in which the object occurs.
+///   - normalizedRect: The rectangle within the disparity buffer where the object occurs, normalized such that (0.0, 0.0) is the top-left and (1.0, 1.0) is the bottom-right of the disparity buffer.
+///   - detectionType: The type of object expected within the rectangle. Pass `CNDetectionTypeUnknown` if unknown.
+///   - priorDisparity: The disparity of the object in the prior frame. This helps ensure the object is not mistaken for another that enters the same rectangle. Pass `NAN` if there is no known prior, such as in the first frame in which the object is being tracked.
++ (float)disparityInNormalizedRect:(CGRect)normalizedRect
+                   sourceDisparity:(CVPixelBufferRef)sourceDisparity
+                     detectionType:(CNDetectionType)detectionType
+                    priorDisparity:(float)priorDisparity;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+NS_HEADER_AUDIT_END(nullability, sendability)
diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDetectionTrack.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDetectionTrack.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDetectionTrack.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNDetectionTrack.h	2023-05-26 21:34:22
@@ -0,0 +1,96 @@
+//
+//  CNDetectionTrack.h
+//  Cinematic
+//
+//  Copyright © 2022-2023 Apple Inc. All rights reserved.
+//
+
+/* WARNING: Preliminary API — subject to change without notice */
+
+#import <Foundation/Foundation.h>
+
+#import <Cinematic/CNDetection.h>
+
+NS_HEADER_AUDIT_BEGIN(nullability, sendability)
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Abstract class representing a series of detections of the same subject over time.
+@interface CNDetectionTrack : NSObject <NSCopying>
+
+/// The type of subject detected by this detection track.
+@property (readonly) CNDetectionType detectionType;
+
+/// The detectionID of the subject detected during this track; unique within a cinematic script.
+@property (readonly) CNDetectionID detectionID;
+
+/// The detectionGroupID of the subject detected by the track.
+///
+/// The detectionGroupID can be used to associate related detections such as the face and torso of the same person.
+///
+@property (readonly) CNDetectionGroupID detectionGroupID;
+
+/// Whether this detection track was created by the client.
+@property (getter=isUserCreated, readonly) BOOL userCreated;
+
+/// Whether this detection track has discrete detections (otherwise continuous).
+///
+/// A discrete detection track will return detections only at the specific times a detection occurs.
+/// A continuous detection track will return a detection for any requested time and an empty array for time ranges.
+///
+@property (getter=isDiscrete, readonly) BOOL discrete;
+
+#pragma mark - Detections
+
+- (nullable CNDetection *)detectionAtOrBeforeTime:(CMTime)time;
+- (nullable CNDetection *)detectionNearestTime:(CMTime)time;
+
+/// Gets the array of detections in the detection track within the given time range. Makes sense for discrete detection tracks only.
+- (NSArray <CNDetection *> *)detectionsInTimeRange:(CMTimeRange)timeRange;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// A continuous detection track representing focus at a fixed disparity.
+@interface CNFixedDetectionTrack : CNDetectionTrack
+
+/// Create a detection track with fixed focus at the given disparity.
+- (instancetype)initWithFocusDisparity:(float)focusDisparity;
+
+/// Create a detection track with fixed focus at the disparity of an existing detection.
+- (instancetype)initWithOriginalDetection:(CNDetection *)originalDetection;
+
+@property (readonly) float focusDisparity;
+
+/// The original detection upon which this fixed detection track was based, if any.
+///
+/// This is the way to determine the time and rect from which fixed focus originated, if any.
+/// This detection is not part of the detection track and has a different detectionID or none.
+///
+/// - Important: To get a detection from the fixed detection track, use detectionAtOrBeforeTime: instead, which will return a properly time-stamped detection.
+///
+@property (readonly, nullable, strong) CNDetection *originalDetection;
+
+@end
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// A discrete detection track composed of individual detections.
+@interface CNCustomDetectionTrack : CNDetectionTrack
+
+/// Initialize a custom detection track with an array of detections, optionally applying smoothing.
+///
+/// The smoothing algorithm used is the same one that is used for built-in detections during recording.
+/// It compensates for some amount of jitter in the disparity measure by smoothing out variability.
+///
+- (instancetype)initWithDetections:(NSArray<CNDetection *> *)detections smooth:(BOOL)applySmoothing;
+
+@property (readonly, strong) NSArray<CNDetection *> *allDetections;
+
+@end
+
+NS_HEADER_AUDIT_END(nullability, sendability)
diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNObjectTracker.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNObjectTracker.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNObjectTracker.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNObjectTracker.h	2023-05-26 21:34:22
@@ -0,0 +1,79 @@
+//
+//  CNObjectTracker.h
+//  Cinematic
+//
+//  Copyright © 2022-2023 Apple Inc. All rights reserved.
+//
+
+/* WARNING: Preliminary API — subject to change without notice */
+
+#import <Foundation/Foundation.h>
+#import <CoreMedia/CoreMedia.h>
+#import <Metal/Metal.h>
+
+#import <Cinematic/CNDetectionTrack.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+@interface CNBoundsPrediction : NSObject <NSCopying, NSMutableCopying>
+
+/// bounds of the detected object in normalized coordinates where (0.0, 0.0) is the upper left corner, and (1.0, 1.0) is the lower right
+@property CGRect normalizedBounds;
+
+/// the probability that a well-defined object is within the bounds — a number between 0.0 and 1.0.
+@property float confidence;
+
+@end
+
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Converts a normalized point or rectangle into a detection track that tracks an object over time.
+@interface CNObjectTracker : NSObject
+
+/// Indicates whether the current device supports object detection and tracking.
+@property (class, readonly) BOOL isSupported;
+
+/// Create a new detection track builder.
+/// - Parameters:
+///   - commandQueue: the command queue of a metal device to which commands should be submitted to perform work
+- (instancetype)initWithCommandQueue:(id<MTLCommandQueue>)commandQueue;
+
+/// Find the bounds of an object at the given point. Can be used to convert a normalized point in an image to a rectangle that can be used to start tracking.
+/// - Parameters:
+///   - point: location of object in image in normalized coordinates where (0.0, 0.0) is the upper left corner, and (1.0, 1.0) is the lower right
+///   - sourceImage: pixel buffer containing the image
+/// - Returns: A prediction, which includes bounds that can be used to start tracking, or `nil` if no discernible object is detected.
+- (nullable CNBoundsPrediction *)findObjectAtPoint:(CGPoint)point sourceImage:(CVPixelBufferRef)sourceImage;
+
+/// Start creating a detection track to track an object within the given bounds.
+/// - Parameters:
+///   - time: the presentation time of the first frame in the detection track
+///   - normalizedBounds: the bounds of the object to track in normalized coordinates where (0.0, 0.0) is the upper left corner, and (1.0, 1.0) is the lower right
+///   - sourceImage: image buffer containing the image
+///   - sourceDisparity: disparity buffer containing depth information
+/// - Returns: whether the object can be tracked
+/// - Note: if the object can be tracked, a detection is added to the detection track being built
+- (BOOL)startTrackingAt:(CMTime)time within:(CGRect)normalizedBounds sourceImage:(CVPixelBufferRef)sourceImage sourceDisparity:(CVPixelBufferRef)sourceDisparity;
+
+/// Continue tracking an object for which tracking has started, and add a new detection to the detection track being built.
+/// - Parameters:
+///   - time: the presentation time of the frame to be added to the detection track
+/// - Returns: a prediction of where the object is in the source image
+- (nullable CNBoundsPrediction *)continueTrackingAt:(CMTime)time sourceImage:(CVPixelBufferRef)sourceImage sourceDisparity:(CVPixelBufferRef)sourceDisparity;
+
+/// Finish constructing the detection track and return it.
+/// - Returns: a detection track which tracks the object
+- (CNDetectionTrack *)finishDetectionTrack;
+
+/// Reset the builder to construct a new detection track.
+- (void)resetDetectionTrack;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNRenderingSession.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNRenderingSession.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNRenderingSession.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNRenderingSession.h	2023-05-26 21:36:56
@@ -0,0 +1,154 @@
+//
+//  CNRenderingSession.h
+//  Cinematic
+//
+//  Copyright © 2022-2023 Apple Inc. All rights reserved.
+//
+
+/* WARNING: Preliminary API — subject to change without notice */
+
+#import <AVFoundation/AVFoundation.h>
+#import <Metal/Metal.h>
+
+@class CNRenderingSessionFrameAttributes;
+@class CNRenderingSessionAttributes;
+
+NS_ASSUME_NONNULL_BEGIN
+
+typedef NS_ENUM(NSInteger, CNRenderingQuality) {
+    CNRenderingQualityThumbnail,
+    CNRenderingQualityPreview,
+    CNRenderingQualityExport,
+    CNRenderingQualityExportHigh,
+} API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos);
+
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Movie-wide information required by the rendering session.
+@interface CNRenderingSessionAttributes : NSObject
+
+/// Load rendering session attributes from an asset asynchronously.
++ (void)loadFromAsset:(AVAsset *)asset
+    completionHandler:(void (^)(CNRenderingSessionAttributes * _Nullable sessionAttributes,
+                                NSError * _Nullable error))completionHandler;
+
+/// Rendering version used to render the original.
+@property (readonly) NSInteger renderingVersion;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Frame-specific information required to render a frame in a rendering session.
+@interface CNRenderingSessionFrameAttributes : NSObject <NSCopying, NSMutableCopying>
+
+/// Initialize rendering frame attributes from a sample buffer read from a cinematic metadata track.
+/// - Parameters:
+///   - sampleBuffer: A sample buffer read from the timed cinematic metadata track of a cinematic asset.
+///   - sessionAttributes: Rendering session attributes loaded from a cinematic asset.
+- (nullable instancetype)initWithSampleBuffer:(CMSampleBufferRef)sampleBuffer
+                   sessionAttributes:(CNRenderingSessionAttributes *)sessionAttributes;
+
+/// Initialize rendering frame attributes from a timed metadata group read from a cinematic metadata track.
+/// - Parameters:
+///   - metadataGroup: An AVTimedMetadataGroup read from the timed cinematic metadata track of a cinematic asset.
+///   - sessionAttributes: Rendering session attributes loaded from a cinematic asset.
+- (nullable instancetype)initWithTimedMetadataGroup:(AVTimedMetadataGroup *)metadataGroup
+                         sessionAttributes:(CNRenderingSessionAttributes *)sessionAttributes;
+
+/// The disparity value which represents the focus plane at which the rendered image should be in focus.
+///
+/// A larger disparity results in the focus plane being closer to the camera. The scale and offset of disparity is not defined.
+/// It is best practice to obtain disparity values from detections or by interpolation between known disparity values.
+@property float focusDisparity;
+
+/// The f-stop value which inversely affects the aperture used to render the image.
+///
+/// A smaller f/ number results in larger bokeh and a shallower depth of field in the rendered image.
+@property float fNumber;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+@interface CNRenderingSession : NSObject
+
+-(instancetype)initWithCommandQueue:(id<MTLCommandQueue>)commandQueue
+                  sessionAttributes:(CNRenderingSessionAttributes *)sessionAttributes
+                 preferredTransform:(CGAffineTransform)preferredTransform
+                            quality:(CNRenderingQuality)quality;
+
+@property (readonly, strong) id<MTLCommandQueue> commandQueue;
+@property (readonly, strong) CNRenderingSessionAttributes *sessionAttributes;
+@property (readonly) CGAffineTransform preferredTransform;
+@property (readonly) CNRenderingQuality quality;
+
+
+/// Encode a command to render a shallow depth of field (SDoF) image to a pixel buffer.
+/// - Parameters:
+///   - commandBuffer: the metal command buffer on which to encode the command
+///   - frameAttributes: controls the focus distance and aperture of the rendering
+///   - sourceImage: a pixel buffer read from the cinematicVideoTrack
+///   - sourceDisparity: a pixel buffer read from the cinematicDisparityTrack
+///   - destinationImage: the pixel buffer to which the SDoF image is rendered
+- (void)encodeRenderToCommandBuffer:(id<MTLCommandBuffer>)commandBuffer
+                    frameAttributes:(CNRenderingSessionFrameAttributes *)frameAttributes
+                        sourceImage:(CVPixelBufferRef)sourceImage
+                    sourceDisparity:(CVPixelBufferRef)sourceDisparity
+                   destinationImage:(CVPixelBufferRef)destinationImage;
+
+/// Encode a command to render a shallow depth of field (SDoF) image to a metal texture as RGBA.
+/// - Parameters:
+///   - commandBuffer: the metal command buffer on which to encode the command
+///   - frameAttributes: controls the focus distance and aperture of the rendering
+///   - sourceImage: a pixel buffer read from the cinematicVideoTrack
+///   - sourceDisparity: a pixel buffer read from the cinematicDisparityTrack
+///   - destinationRGBA: a metal texture to which the SDoF image is rendered in RGBA format
+- (void)encodeRenderToCommandBuffer:(id<MTLCommandBuffer>)commandBuffer
+                    frameAttributes:(CNRenderingSessionFrameAttributes *)frameAttributes
+                        sourceImage:(CVPixelBufferRef)sourceImage
+                    sourceDisparity:(CVPixelBufferRef)sourceDisparity
+                    destinationRGBA:(id<MTLTexture>)destinationRGBA;
+
+/// Encode a command to render a shallow depth of field (SDoF) image to two metal textures as luma and chroma.
+/// - Parameters:
+///   - commandBuffer: the metal command buffer on which to encode the command
+///   - frameAttributes: controls the focus distance and aperture of the rendering
+///   - sourceImage: a pixel buffer read from the cinematicVideoTrack
+///   - sourceDisparity: a pixel buffer read from the cinematicDisparityTrack
+///   - destinationLuma: a metal texture to which the luma of the SDoF image is rendered
+///   - destinationChroma: a metal texture to which the chroma of the SDoF image is rendered
+- (void)encodeRenderToCommandBuffer:(id<MTLCommandBuffer>)commandBuffer
+                    frameAttributes:(CNRenderingSessionFrameAttributes *)frameAttributes
+                        sourceImage:(CVPixelBufferRef)sourceImage
+                    sourceDisparity:(CVPixelBufferRef)sourceDisparity
+                    destinationLuma:(id<MTLTexture>)destinationLuma
+                  destinationChroma:(id<MTLTexture>)destinationChroma;
+
+/// The pixel format types supported for the input source.
+///
+/// Use with kCVPixelBufferPixelFormatTypeKey in the video compositor's sourcePixelBufferAttributes dictionary when implementing AVVideoCompositing.
+///
+@property (class, readonly, strong) NSArray<NSNumber *> *sourcePixelFormatTypes;
+
+/// The pixel format types supported for the output destination.
+///
+/// Use with kCVPixelBufferPixelFormatTypeKey in the video compositor's requiredPixelBufferAttributesForRenderContext dictionary when implementing AVVideoCompositing.
+///
+@property (class, readonly, strong) NSArray<NSNumber *> *destinationPixelFormatTypes;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNScript.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNScript.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNScript.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/CNScript.h	2023-05-26 21:36:55
@@ -0,0 +1,250 @@
+//
+//  CNScript.h
+//  Cinematic
+//
+//  Copyright © 2022-2023 Apple Inc. All rights reserved.
+//
+
+/* WARNING: Preliminary API — subject to change without notice */
+
+#import <Foundation/Foundation.h>
+#import <Cinematic/Cinematic.h>
+
+NS_HEADER_AUDIT_BEGIN(nullability, sendability)
+
+@class CNScriptChanges;
+@class CNScriptFrame;
+
+NS_REFINED_FOR_SWIFT NS_SWIFT_SENDABLE
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Database of focus decisions with methods to change them.
+/// Knows what has been detected in each frame and which detection is being focused on.
+/// All operations are executed in a thread-safe manner, but that also means that a long-running update can stall a lookup.
+/// Best practice is to lookup what you need up front (outside your critical code) and pass the immutable results to where it's needed.
+/// That way, you're not blocked when you access the information, say inside the rendering portion of your code.
+///
+@interface CNScript : NSObject
+
+#pragma mark - load
+
+/// Load cinematic script asynchronously from a cinematic asset.
+/// - Parameters:
+///   - asset: the cinematic asset to be loaded.
+///   - changes: optional changes since asset was recorded. Can be obtained from a previous editing session. If `nil`, the asset is loaded as originally recorded.
+///   - progress: optional progress object to track progress or cancel loading. Represents just the loading of this asset. Create with desired total unit count or use zero to have the unit count filled in automatically.  If `nil`, no progress is reported.
+///   - completionHandler: called with the loaded cinematic script when done, or with with an error if it fails. If progress is canceled before it completes, the completion handler is called with an error.
+///
++ (void)loadFromAsset:(AVAsset *)asset
+              changes:(nullable CNScriptChanges *)changes
+             progress:(nullable NSProgress *)progress
+    completionHandler:(void (^)(CNScript * _Nullable script,
+                                NSError * _Nullable error))completionHandler;
+
+/// Reload the cinematic script with optional changes applied, removing any previous changes made.
+/// This can be more efficient than loading the asset from scratch.
+/// - Parameters:
+///   - changes: optional changes since asset was recorded. Can be obtained from a previous editing session. If `nil`, the asset is reloaded as originally recorded.
+- (void)reloadWithChanges:(nullable CNScriptChanges *)changes;
+
+#pragma mark - changes
+
+/// Changes made since cinematic asset was recorded. Can be used to checkpoint and later restore changes made so far.
+- (CNScriptChanges *)changes;
+
+/// Changes trimmed and time range shifted to start at zero — for use with a similarly trimmed cinematic asset.
+- (CNScriptChanges *)changesTrimmedByTimeRange:(CMTimeRange)timeRange;
+
+#pragma mark - frames
+
+/// The time range of the cinematic asset. All frames, decisions, and detections are within this time range.
+@property (readonly) CMTimeRange timeRange;
+
+/// The closest frame to the given time within the given tolerance. Returns `nil` if there are none.
+- (nullable CNScriptFrame *)frameAtTime:(CMTime)time tolerance:(CMTime)tolerance;
+
+/// All frames within the given time range.
+- (NSArray<CNScriptFrame *> *)framesInTimeRange:(CMTimeRange)timeRange;
+
+#pragma mark - effective decisions
+
+/// The closest decision to the given time within the given tolerance. Returns `nil` if there are none.
+- (nullable CNDecision *)decisionAtTime:(CMTime)time tolerance:(CMTime)tolerance;
+
+/// All decisions within the given time range.
+- (NSArray<CNDecision *> *)decisionsInTimeRange:(CMTimeRange)timeRange;
+
+/// The decision that occurs after the given time. Pass the time of an existing decision to find the next one.
+- (nullable CNDecision *)decisionAfterTime:(CMTime)time;
+
+/// The decision that occurs before the given time. Pass the time of an existing decisions to find the previous one.
+- (nullable CNDecision *)decisionBeforeTime:(CMTime)time;
+
+#pragma mark - transitions
+
+/// The primary decision that is in effect at the specified time, unless if it's outside the time range of the cinematic script.
+/// Also represents the decision that is being transitioned away from if the given time is during a focus transition.
+- (nullable CNDecision *)primaryDecisionAtTime:(CMTime)time;
+
+/// The secondary decision that is being transitioned towards if the given time is during a focus transition.
+- (nullable CNDecision *)secondaryDecisionAtTime:(CMTime)time;
+
+/// The time range during which the focus transition away from the given decision occurs.
+- (CMTimeRange)timeRangeOfTransitionAfterDecision:(CNDecision *)decision;
+
+/// The time range during which the focus transition towards the given decision occurs.
+- (CMTimeRange)timeRangeOfTransitionBeforeDecision:(CNDecision *)decision;
+
+#pragma mark - decision layers
+
+/// All user decisions in the given time range. Includes user decisions made during recording or added to the script.
+- (NSArray<CNDecision *> *)userDecisionsInTimeRange:(CMTimeRange)timeRange;
+
+/// All base decisions made automatically during recording in the given time range. These apply if no user decision overrides them.
+- (NSArray<CNDecision *> *)baseDecisionsInTimeRange:(CMTimeRange)timeRange;
+
+#pragma mark - detection tracks
+
+/// A detection track representing all detections with the given detectionID over the entire cinematic script.
+- (nullable CNDetectionTrack *)detectionTrackForID:(CNDetectionID)detectionID;
+
+/// A detection track representing all detections that would be chosen by a given decision.
+- (nullable CNDetectionTrack *)detectionTrackForDecision:(CNDecision *)decision;
+
+#pragma mark - fNumber
+
+/// The f/number to apply to the entire movie, initially set to that of the recorded movie.
+///
+/// Pass this to the rendering session in the rendering frame attributes to match the selected aperture.
+/// Change this property when the user selects a different aperture for the edited movie.
+/// Changes to this property are reflected in the script changes for later restoration.
+///
+@property float fNumber;
+
+#pragma mark - add/remove decisions
+
+/// Add a new user decision. Replaces an existing user decision if the times are identical.
+///
+/// Adding a decision can fail if the decision focuses on an detection or group that does not exist or if its time is not within the time range of the cinematic script.
+///
+/// - Returns: whether adding was successful
+///
+- (BOOL)addUserDecision:(CNDecision *)decision;
+
+/// Remove an existing user decision.
+///
+/// User decisions added to the script or those made at recording time (by tapping during recording) can be removed.
+/// Decisions that are not user decisions cannot be removed.
+///
+/// - Returns: whether removal was successful
+///
+- (BOOL)removeUserDecision:(CNDecision *)decision;
+
+/// Remove all user decisions and revert to base decisions only.
+///
+- (void)removeAllUserDecisions;
+
+#pragma mark - add/remove detection tracks
+
+/// Add user created detection track.
+///
+/// - Returns: the detectionID assigned to the added track, which can be used for later lookup or decision creation.
+///
+- (CNDetectionID)addDetectionTrack:(CNDetectionTrack *)detectionTrack;
+
+/// Remove user created detection track.
+///
+/// Tracks created at recording time cannot be removed.
+///
+/// - Returns: whether removal was successful
+///
+- (BOOL)removeDetectionTrack:(CNDetectionTrack *)detectionTrack;
+
+/// All detection tracks that have been added since recording.
+///
+@property (readonly, strong) NSArray<CNDetectionTrack *> *addedDetectionTracks;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+NS_REFINED_FOR_SWIFT
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Represents a snapshot of changes made to the cinematic script since recording.
+/// Can be used as a snapshot to quickly revert to previously saved edits via `-[CNScript reloadWithChanges:]`
+///
+@interface CNScriptChanges : NSObject
+
+/// Create from previously saved data representation
+- (nullable instancetype)initWithDataRepresentation:(NSData *)dataRepresentation;
+
+/// Get persistent data representation of these changes for later restoration.
+///
+/// The changes can only be used with the original cinematic asset from which the CNScript was created.
+///
+@property (readonly) NSData *dataRepresentation;
+
+/// The f/number to apply to the entire movie.
+@property (readonly) float fNumber;
+
+/// All active user decisions, including those made at recording time, unless they have been removed.
+@property (readonly) NSArray<CNDecision *> *userDecisions;
+
+/// All detection tracks that have been added. Does not include those created at recording time.
+@property (readonly) NSArray<CNDetectionTrack *> *addedDetectionTracks;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+NS_REFINED_FOR_SWIFT NS_SWIFT_SENDABLE
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+/// Represents focus & detection information at a particular time.
+///
+/// Indicates where to focus (disparity) and what to focus on (detection) at a particular time in the movie.
+/// It also provides access to all known detections that can be focused on at that time.
+/// Utility methods support looking up a detection by detectionID or detectionGroupID.
+///
+/// Frames are obtained from the cinematic script using `frame(at:tolerance:)` or `frames(in:)`.
+///
+@interface CNScriptFrame : NSObject <NSCopying>
+
+/// The presentation time associated with the remaining properties.
+@property (readonly) CMTime time;
+
+/// The disparity value representing the focus plane at which the script is focused in this frame.
+///
+/// A larger disparity results in the focus plane being closer to the camera. The scale and offset of disparity is not defined.
+///
+/// Pass this to the rendering session when rendering the corresponding frame of the movie to focus at the recommended depth.
+///
+@property (readonly) float focusDisparity;
+
+/// The detection on which the script is focused in this frame.
+///
+/// The focusDisparity of the focusDetection can be different from that of the frame such as when a rack focus is in progress.
+///
+@property (readonly, strong) CNDetection *focusDetection;
+
+/// All detected objects in this frame.
+@property (readonly, strong) NSArray<CNDetection *> *allDetections;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+API_AVAILABLE(macos(14.0), ios(17.0), tvos(17.0)) API_UNAVAILABLE(watchos)
+@interface CNScriptFrame (CNExtensions)
+
+/// The detection in this frame with the given detection ID, if any.
+- (nullable CNDetection *)detectionForID:(CNDetectionID)detectionID;
+
+/// The best detection to focus on in this frame among those with the given detectionGroupID.
+/// For example, a face is preferred to the corresponding torso, even though both have the same detectionGroupID.
+- (nullable CNDetection *)bestDetectionForGroupID:(CNDetectionGroupID)detectionGroupID;
+
+@end
+
+NS_HEADER_AUDIT_END(nullability, sendability)
diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/Cinematic.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/Cinematic.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/Cinematic.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cinematic.framework/Headers/Cinematic.h	2023-05-26 21:34:22
@@ -0,0 +1,21 @@
+//
+//  Cinematic.h
+//  Cinematic
+//
+//  Copyright © 2022-2023 Apple Inc. All rights reserved.
+//
+
+/* WARNING: Preliminary API — subject to change without notice */
+
+#import <Foundation/Foundation.h>
+
+#import <Cinematic/CNAssetInfo.h>
+
+#import <Cinematic/CNRenderingSession.h>
+
+#import <Cinematic/CNDecision.h>
+#import <Cinematic/CNDetection.h>
+#import <Cinematic/CNDetectionTrack.h>
+#import <Cinematic/CNScript.h>
+
+#import <Cinematic/CNObjectTracker.h>
Clone this wiki locally