diff options
-rwxr-xr-x | SmartDeviceLink/SDLCarWindow.h | 4 | ||||
-rwxr-xr-x | SmartDeviceLink/SDLCarWindow.m | 6 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLockScreenManager.m | 3 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLockScreenPresenter.h | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLockScreenPresenter.m | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaConfiguration.h | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaConfiguration.m | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaLifecycleManager.h | 5 | ||||
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaLifecycleManager.m | 24 | ||||
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaManager.h | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaManager.m | 8 |
11 files changed, 45 insertions, 19 deletions
diff --git a/SmartDeviceLink/SDLCarWindow.h b/SmartDeviceLink/SDLCarWindow.h index a64747f50..622d7ceea 100755 --- a/SmartDeviceLink/SDLCarWindow.h +++ b/SmartDeviceLink/SDLCarWindow.h @@ -8,10 +8,14 @@ #import <UIKit/UIKit.h> +@class SDLStreamingMediaLifecycleManager; + NS_ASSUME_NONNULL_BEGIN @interface SDLCarWindow : NSObject +- (instancetype)initWithStreamManager:(SDLStreamingMediaLifecycleManager *)streamManager targetFramerate:(NSUInteger)framesPerSecond; + /** * View Controller that will be streamed. */ diff --git a/SmartDeviceLink/SDLCarWindow.m b/SmartDeviceLink/SDLCarWindow.m index 537324ec6..3881f3c28 100755 --- a/SmartDeviceLink/SDLCarWindow.m +++ b/SmartDeviceLink/SDLCarWindow.m @@ -16,8 +16,8 @@ #import "SDLImageResolution.h" #import "SDLLogMacros.h" #import "SDLNotificationConstants.h" -#import "SDLStreamingMediaManager.h" #import "SDLStreamingMediaConfiguration.h" +#import "SDLStreamingMediaLifecycleManager.h" #import "SDLStreamingMediaManagerConstants.h" NS_ASSUME_NONNULL_BEGIN @@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN @property (assign, nonatomic) NSUInteger sameFrameCounter; @property (assign, nonatomic) NSUInteger targetFramerate; -@property (weak, nonatomic, nullable) SDLStreamingMediaManager *streamManager; +@property (weak, nonatomic, nullable) SDLStreamingMediaLifecycleManager *streamManager; @property (assign, nonatomic, getter=isLockScreenMoving) BOOL lockScreenMoving; @@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLCarWindow -- (instancetype)initWithStreamManager:(SDLStreamingMediaManager *)streamManager framesPerSecond:(NSUInteger)framesPerSecond { +- (instancetype)initWithStreamManager:(SDLStreamingMediaLifecycleManager *)streamManager targetFramerate:(NSUInteger)framesPerSecond { self = [super init]; if (!self) { return nil; } diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m index de9d56f0f..49003a675 100644 --- a/SmartDeviceLink/SDLLockScreenManager.m +++ b/SmartDeviceLink/SDLLockScreenManager.m @@ -59,7 +59,8 @@ NS_ASSUME_NONNULL_BEGIN self.presenter.lockViewController = nil; return; } else if (self.config.customViewController != nil) { - self.presenter.lockViewController = self.config.customViewController; + self.e + .lockViewController = self.config.customViewController; } else { SDLLockScreenViewController *viewController = nil; diff --git a/SmartDeviceLink/SDLLockScreenPresenter.h b/SmartDeviceLink/SDLLockScreenPresenter.h index 71d75256d..5e56f2479 100644 --- a/SmartDeviceLink/SDLLockScreenPresenter.h +++ b/SmartDeviceLink/SDLLockScreenPresenter.h @@ -17,8 +17,6 @@ NS_ASSUME_NONNULL_BEGIN */ @interface SDLLockScreenPresenter : NSObject <SDLViewControllerPresentable> -- (instancetype)initWithLockViewController:(UIViewController *)lockViewController; - /** * The view controller to be presented. */ diff --git a/SmartDeviceLink/SDLLockScreenPresenter.m b/SmartDeviceLink/SDLLockScreenPresenter.m index 8f34f0406..bb114f629 100644 --- a/SmartDeviceLink/SDLLockScreenPresenter.m +++ b/SmartDeviceLink/SDLLockScreenPresenter.m @@ -24,12 +24,10 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLLockScreenPresenter -- (instancetype)initWithLockViewController:(UIViewController *)lockViewController { +- (instancetype)init { self = [super init]; if (!self) { return nil; } - _lockViewController = lockViewController; - CGRect screenFrame = [[UIScreen mainScreen] bounds]; _lockWindow = [[UIWindow alloc] initWithFrame:screenFrame]; _screenshotViewController = [[SDLScreenshotViewController alloc] init]; diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.h b/SmartDeviceLink/SDLStreamingMediaConfiguration.h index 3f2f40544..a8eacaaf1 100644 --- a/SmartDeviceLink/SDLStreamingMediaConfiguration.h +++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.h @@ -51,8 +51,6 @@ NS_ASSUME_NONNULL_BEGIN @property (weak, nonatomic, nullable) UIViewController *rootViewController; -@property (assign, nonatomic) BOOL disableAutomaticVideoStream; - /** Create an insecure video streaming configuration. No security managers will be provided and the encryption flag will be set to None. If you'd like custom video encoder settings, you can set the property manually. diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.m b/SmartDeviceLink/SDLStreamingMediaConfiguration.m index 5e42a7f08..14240cfc4 100644 --- a/SmartDeviceLink/SDLStreamingMediaConfiguration.m +++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.m @@ -39,10 +39,6 @@ NS_ASSUME_NONNULL_BEGIN _dataSource = dataSource; _rootViewController = rootViewController; - if (rootViewController == nil) { - _disableAutomaticVideoStream = YES; - } - return self; } diff --git a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.h b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.h index cdd611200..ab49e368a 100644 --- a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.h +++ b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.h @@ -15,6 +15,7 @@ #import "SDLStreamingMediaManagerConstants.h" @class SDLAbstractProtocol; +@class SDLCarWindow; @class SDLImageResolution; @class SDLStateMachine; @class SDLStreamingMediaConfiguration; @@ -64,6 +65,10 @@ extern SDLAudioStreamState *const SDLAudioStreamStateShuttingDown; */ @property (nonatomic, strong, readonly) SDLTouchManager *touchManager; +@property (nonatomic, strong) UIViewController *rootViewController; + +@property (strong, nonatomic, readonly, nullable) SDLCarWindow *carWindow; + /** A haptic interface that can be updated to reparse views within the window you've provided. Send a `SDLDidUpdateProjectionView` notification or call the `updateInterfaceLayout` method to reparse. The "output" of this haptic interface occurs in the `touchManager` property where it will call the delegate. */ diff --git a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m index b80bc4856..95be5636c 100644 --- a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m +++ b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m @@ -9,6 +9,7 @@ #import "SDLStreamingMediaLifecycleManager.h" #import "SDLAbstractProtocol.h" +#import "SDLCarWindow.h" #import "SDLControlFramePayloadAudioStartServiceAck.h" #import "SDLControlFramePayloadConstants.h" #import "SDLControlFramePayloadNak.h" @@ -105,17 +106,22 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N } SDLLogV(@"Creating StreamingLifecycleManager"); + _connectionManager = connectionManager; + _videoEncoderSettings = configuration.customVideoEncoderSettings ?: SDLH264VideoEncoder.defaultVideoEncoderSettings; - if (@available(iOS 9.0, *)) { - if (configuration.rootViewController != nil) { + if (configuration.rootViewController != nil) { + if (@available(iOS 9.0, *)) { _focusableItemManager = [[SDLFocusableItemLocator alloc] initWithViewController:configuration.rootViewController connectionManager:_connectionManager]; } + + NSUInteger framerate = ((NSNumber *)_videoEncoderSettings[(__bridge NSString *)kVTCompressionPropertyKey_ExpectedFrameRate]).unsignedIntegerValue; + _carWindow = [[SDLCarWindow alloc] initWithStreamManager:self targetFramerate:framerate]; + _carWindow.rootViewController = configuration.rootViewController; } _touchManager = [[SDLTouchManager alloc] initWithHitTester:(id)_focusableItemManager]; - _videoEncoderSettings = configuration.customVideoEncoderSettings ?: SDLH264VideoEncoder.defaultVideoEncoderSettings; _requestedEncryptionType = configuration.maximumDesiredEncryption; _dataSource = configuration.dataSource; _screenSize = SDLDefaultScreenSize; @@ -782,7 +788,17 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N } -#pragma mark Getters +#pragma mark Setters / Getters + +- (void)setRootViewController:(UIViewController *)rootViewController { + if (self.focusableItemManager != nil) { + self.focusableItemManager.viewController = rootViewController; + } + + if (self.carWindow != nil) { + self.carWindow.rootViewController = rootViewController; + } +} - (BOOL)isAppStateVideoStreamCapable { return [self.appStateMachine isCurrentState:SDLAppStateActive]; diff --git a/SmartDeviceLink/SDLStreamingMediaManager.h b/SmartDeviceLink/SDLStreamingMediaManager.h index 07d06d1fb..23e56f85b 100644 --- a/SmartDeviceLink/SDLStreamingMediaManager.h +++ b/SmartDeviceLink/SDLStreamingMediaManager.h @@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, strong, readonly) SDLTouchManager *touchManager; +@property (nonatomic, strong) UIViewController *rootViewController; + /** A haptic interface that can be updated to reparse views within the window you've provided. Send a `SDLDidUpdateProjectionView` notification or call the `updateInterfaceLayout` method to reparse. The "output" of this haptic interface occurs in the `touchManager` property where it will call the delegate. */ diff --git a/SmartDeviceLink/SDLStreamingMediaManager.m b/SmartDeviceLink/SDLStreamingMediaManager.m index c9688ea8a..f439ebd0f 100644 --- a/SmartDeviceLink/SDLStreamingMediaManager.m +++ b/SmartDeviceLink/SDLStreamingMediaManager.m @@ -67,6 +67,10 @@ NS_ASSUME_NONNULL_BEGIN return self.lifecycleManager.touchManager; } +- (UIViewController *)rootViewController { + return self.lifecycleManager.rootViewController; +} + - (nullable id<SDLFocusableItemLocatorType>)focusableItemManager { return self.lifecycleManager.focusableItemManager; } @@ -116,6 +120,10 @@ NS_ASSUME_NONNULL_BEGIN } #pragma mark - Setters +- (void)setRootViewController:(UIViewController *)rootViewController { + self.lifecycleManager.rootViewController = rootViewController; +} + - (void)setRequestedEncryptionType:(SDLStreamingEncryptionFlag)requestedEncryptionType { self.lifecycleManager.requestedEncryptionType = requestedEncryptionType; } |