diff --git a/Limelight/Input/OnScreenControls.h b/Limelight/Input/OnScreenControls.h index 29997de34..ab65d917a 100644 --- a/Limelight/Input/OnScreenControls.h +++ b/Limelight/Input/OnScreenControls.h @@ -31,6 +31,7 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) { - (BOOL) handleTouchMovedEvent:(NSSet*)touches; - (void) setLevel:(OnScreenControlsLevel)level; - (OnScreenControlsLevel) getLevel; +- (void) transitionStreamViewSize; - (void) show; @end diff --git a/Limelight/Input/OnScreenControls.m b/Limelight/Input/OnScreenControls.m index 846492a1c..e303841fe 100644 --- a/Limelight/Input/OnScreenControls.m +++ b/Limelight/Input/OnScreenControls.m @@ -178,6 +178,22 @@ - (OnScreenControlsLevel) getLevel { return _level; } +- (void)transitionStreamViewSize { + _controlArea = CGRectMake(0, 0, _view.frame.size.width, _view.frame.size.height); + if (_iPad) + { + // Cut down the control area on an iPad so the controls are more reachable + _controlArea.size.height = _view.frame.size.height / 2.0; + _controlArea.origin.y = _view.frame.size.height - _controlArea.size.height; + } + else + { + _controlArea.origin.x = _controlArea.size.width * EDGE_WIDTH; + _controlArea.size.width -= _controlArea.origin.x * 2; + } + [self updateControls]; +} + - (void) updateControls { switch (_level) { case OnScreenControlsLevelOff: diff --git a/Limelight/Input/StreamView.h b/Limelight/Input/StreamView.h index 9f500101a..9ec55798a 100644 --- a/Limelight/Input/StreamView.h +++ b/Limelight/Input/StreamView.h @@ -28,6 +28,7 @@ interactionDelegate:(id)interactionDelegate config:(StreamConfiguration*)streamConfig; - (void) showOnScreenControls; +- (void) refreshOnScreenControls; - (OnScreenControlsLevel) getCurrentOscState; #if !TARGET_OS_TV diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 7dedeb35e..827c3ebfd 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -167,6 +167,12 @@ - (void) showOnScreenControls { #endif } +- (void) refreshOnScreenControls { +#if !TARGET_OS_TV + [onScreenControls transitionStreamViewSize]; +#endif +} + - (OnScreenControlsLevel) getCurrentOscState { if (onScreenControls == nil) { return OnScreenControlsLevelOff; diff --git a/Limelight/Limelight-Info.plist b/Limelight/Limelight-Info.plist index 7d95d89bd..62ff63dac 100644 --- a/Limelight/Limelight-Info.plist +++ b/Limelight/Limelight-Info.plist @@ -68,8 +68,6 @@ armv7 - UIRequiresFullScreen - UIStatusBarHidden UISupportedInterfaceOrientations @@ -81,6 +79,8 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown UIViewControllerBasedStatusBarAppearance diff --git a/Limelight/Stream/StreamManager.h b/Limelight/Stream/StreamManager.h index 277d6fe43..dbf8fa160 100644 --- a/Limelight/Stream/StreamManager.h +++ b/Limelight/Stream/StreamManager.h @@ -15,6 +15,8 @@ - (void) stopStream; +- (void) transitionStreamViewSize; + - (NSString*) getStatsOverlayText; @end diff --git a/Limelight/Stream/StreamManager.m b/Limelight/Stream/StreamManager.m index e776feef0..6bd29a2b4 100644 --- a/Limelight/Stream/StreamManager.m +++ b/Limelight/Stream/StreamManager.m @@ -23,6 +23,7 @@ @implementation StreamManager { StreamConfiguration* _config; UIView* _renderView; + VideoDecoderRenderer* _renderer; id _callbacks; Connection* _connection; } @@ -99,8 +100,8 @@ - (void)main { // Initializing the renderer must be done on the main thread dispatch_async(dispatch_get_main_queue(), ^{ - VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc] initWithView:self->_renderView callbacks:self->_callbacks streamAspectRatio:(float)self->_config.width / (float)self->_config.height useFramePacing:self->_config.useFramePacing]; - self->_connection = [[Connection alloc] initWithConfig:self->_config renderer:renderer connectionCallbacks:self->_callbacks]; + self->_renderer = [[VideoDecoderRenderer alloc] initWithView:self->_renderView callbacks:self->_callbacks streamAspectRatio:(float)self->_config.width / (float)self->_config.height useFramePacing:self->_config.useFramePacing]; + self->_connection = [[Connection alloc] initWithConfig:self->_config renderer:self->_renderer connectionCallbacks:self->_callbacks]; NSOperationQueue* opQueue = [[NSOperationQueue alloc] init]; [opQueue addOperation:self->_connection]; }); @@ -111,6 +112,12 @@ - (void) stopStream [_connection terminate]; } +- (void) transitionStreamViewSize { + dispatch_async(dispatch_get_main_queue(), ^{ + [self->_renderer reinitializeDisplayLayer]; + }); +} + - (BOOL) launchApp:(HttpManager*)hMan receiveSessionUrl:(NSString**)sessionUrl { HttpResponse* launchResp = [[HttpResponse alloc] init]; [hMan executeRequestSynchronously:[HttpRequest requestForResponse:launchResp withUrlRequest:[hMan newLaunchOrResumeRequest:@"launch" config:_config]]]; diff --git a/Limelight/Stream/VideoDecoderRenderer.h b/Limelight/Stream/VideoDecoderRenderer.h index 0513374b0..43b31bf35 100644 --- a/Limelight/Stream/VideoDecoderRenderer.h +++ b/Limelight/Stream/VideoDecoderRenderer.h @@ -20,6 +20,7 @@ - (void)start; - (void)stop; - (void)setHdrMode:(BOOL)enabled; +- (void)reinitializeDisplayLayer; - (int)submitDecodeBuffer:(unsigned char *)data length:(int)length bufferType:(int)bufferType decodeUnit:(PDECODE_UNIT)du; diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m index 169bb13ba..f7cf0ef84 100644 --- a/Limelight/ViewControllers/MainFrameViewController.m +++ b/Limelight/ViewControllers/MainFrameViewController.m @@ -919,6 +919,13 @@ - (void)viewSafeAreaInsetsDidChange { [self adjustScrollViewForSafeArea:self->hostScrollView]; } +- (void) viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + NSLog(@"transitioning from %f to %f", hostScrollView.frame.size.height, size.height / 2); + hostScrollView.frame = CGRectMake(0, self.navigationController.navigationBar.frame.origin.y + self.navigationController.navigationBar.frame.size.height, size.width, size.height / 2); + [self updateHosts]; +} + - (void)viewDidLoad { [super viewDidLoad]; diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index a4c8f3448..46e1a500c 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -647,6 +647,13 @@ - (void)mousePresenceChanged { #endif } +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + _streamView.frame = CGRectMake(_streamView.frame.origin.x, _streamView.frame.origin.y, size.width, size.height); + [_streamView refreshOnScreenControls]; + [_streamMan transitionStreamViewSize]; +} + - (void) streamExitRequested { Log(LOG_I, @"Gamepad combo requested stream exit");