Optimize RenderLayer::intersectsDamageRect() slightly
[WebKit-https.git] / Source / WebCore / platform / spi / ios / AVKitSPI.h
1 /*
2  * Copyright (C) 2014 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #import <AVKit/AVKit.h>
27 #import <QuartzCore/QuartzCore.h>
28 #import <UIKit/UIKit.h>
29
30 #if USE(APPLE_INTERNAL_SDK)
31
32 #import <AVKit/AVPlayerController.h>
33 #import <AVKit/AVPlayerViewController_Private.h>
34 #import <AVKit/AVPlayerViewController_WebKitOnly.h>
35 #import <AVKit/AVVideoLayer.h>
36
37 #else
38
39 @interface AVPlayerController : UIResponder
40 @end
41
42 @interface AVPlayerController (Details)
43 typedef NS_ENUM(NSInteger, AVPlayerControllerStatus) {
44     AVPlayerControllerStatusReadyToPlay = 2,
45 };
46
47 typedef NS_ENUM(NSInteger, AVPlayerControllerExternalPlaybackType) {
48     AVPlayerControllerExternalPlaybackTypeNone = 0,
49     AVPlayerControllerExternalPlaybackTypeAirPlay = 1,
50     AVPlayerControllerExternalPlaybackTypeTVOut = 2,
51 };
52
53 @property (NS_NONATOMIC_IOSONLY, readonly) AVPlayerControllerStatus status;
54 @end
55
56 @protocol AVVideoLayer
57 typedef NS_ENUM(NSInteger, AVVideoLayerGravity) {
58     AVVideoLayerGravityInvalid = 0,
59     AVVideoLayerGravityResizeAspect = 1,
60     AVVideoLayerGravityResizeAspectFill = 2,
61     AVVideoLayerGravityResize = 3,
62 };
63 - (void)setPlayerController:(AVPlayerController *)playerController;
64 @property (nonatomic) AVVideoLayerGravity videoLayerGravity;
65 @property (nonatomic) CGRect videoRect;
66 @property (nonatomic, readonly, getter=isReadyForDisplay) BOOL readyForDisplay;
67 @end
68
69 @protocol AVPlayerViewControllerDelegate <NSObject>
70 @optional
71 typedef NS_ENUM(NSInteger, AVPlayerViewControllerExitFullScreenReason) {
72     AVPlayerViewControllerExitFullScreenReasonDoneButtonTapped = 0,
73     AVPlayerViewControllerExitFullScreenReasonRemoteControlStopEventReceived = 3,
74 };
75 - (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldExitFullScreenWithReason:(AVPlayerViewControllerExitFullScreenReason)reason;
76 - (void)playerViewController:(AVPlayerViewController *)playerViewController restoreUserInterfaceForOptimizedFullscreenStopWithCompletionHandler:(void (^)(BOOL restored))completionHandler;
77 @end
78
79 typedef NSInteger AVPlayerViewControllerOptimizedFullscreenStopReason;
80
81 @interface AVPlayerViewController (Details)
82 - (instancetype)initWithVideoLayer:(CALayer <AVVideoLayer> *)videoLayer;
83 - (void)enterFullScreenWithCompletionHandler:(void (^)(BOOL success, NSError *))completionHandler;
84 - (void)exitFullScreenAnimated:(BOOL)animated completionHandler:(void (^)(BOOL success, NSError *))completionHandler;
85 - (void)exitFullScreenWithCompletionHandler:(void (^)(BOOL success, NSError *))completionHandler;
86
87 - (void)startOptimizedFullscreenWithStartCompletionHandler:(void (^)(BOOL success, NSError*))startCompletionHandler stopCompletionHandler:(void (^)(AVPlayerViewControllerOptimizedFullscreenStopReason))stopCompletionHandler;
88 - (void)stopOptimizedFullscreen;
89 - (void)cancelOptimizedFullscreen;
90 - (void)setAllowsOptimizedFullscreen:(BOOL)allowsOptimizedFullscreen;
91
92 @property (nonatomic, strong) AVPlayerController *playerController;
93 @property (nonatomic, weak) id <AVPlayerViewControllerDelegate> delegate;
94 @end
95
96 #endif
97
98 #if USE(APPLE_INTERNAL_SDK) && __IPHONE_OS_VERSION_MIN_REQUIRED < 90000
99
100 #import <AVKit/AVValueTiming.h>
101
102 #else
103
104 @interface AVValueTiming : NSObject <NSCoding, NSCopying, NSMutableCopying>
105 @end
106
107 @interface AVValueTiming (Details)
108 + (AVValueTiming *)valueTimingWithAnchorValue:(double)anchorValue anchorTimeStamp:(NSTimeInterval)timeStamp rate:(double)rate;
109 @property (NS_NONATOMIC_IOSONLY, readonly) double currentValue;
110 @end
111
112 #endif