diff --git a/Limelight/ViewControllers/MainFrameViewController.h b/Limelight/ViewControllers/MainFrameViewController.h index cb40f214..560e0070 100644 --- a/Limelight/ViewControllers/MainFrameViewController.h +++ b/Limelight/ViewControllers/MainFrameViewController.h @@ -16,9 +16,8 @@ #import "SWRevealViewController.h" @interface MainFrameViewController : UICollectionViewController + @property (strong, nonatomic) IBOutlet UIButton *limelightLogoButton; @property (weak, nonatomic) IBOutlet UIBarButtonItem *computerNameButton; -+ (StreamConfiguration*) getStreamConfiguration; - @end diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m index 60377642..24ec1807 100644 --- a/Limelight/ViewControllers/MainFrameViewController.m +++ b/Limelight/ViewControllers/MainFrameViewController.m @@ -9,7 +9,6 @@ #import "CryptoManager.h" #import "HttpManager.h" #import "Connection.h" -#import "VideoDecoderRenderer.h" #import "StreamManager.h" #import "Utils.h" #import "UIComputerView.h" @@ -21,6 +20,7 @@ #import "WakeOnLanManager.h" #import "AppListResponse.h" #import "ServerInfoResponse.h" +#import "StreamFrameViewController.h" @implementation MainFrameViewController { NSOperationQueue* _opQueue; @@ -30,17 +30,13 @@ NSString* _currentGame; DiscoveryManager* _discMan; AppAssetManager* _appManager; + StreamConfiguration* _streamConfig; UIAlertView* _pairAlert; UIScrollView* hostScrollView; int currentPosition; } static NSMutableSet* hostList; static NSArray* appList; -static StreamConfiguration* streamConfig; - -+ (StreamConfiguration*) getStreamConfiguration { - return streamConfig; -} - (void)showPIN:(NSString *)PIN { dispatch_sync(dispatch_get_main_queue(), ^{ @@ -219,11 +215,11 @@ static StreamConfiguration* streamConfig; - (void) appClicked:(App *)app { NSLog(@"Clicked app: %@", app.appName); - streamConfig = [[StreamConfiguration alloc] init]; - streamConfig.host = _selectedHost.address; - streamConfig.hostAddr = [Utils resolveHost:_selectedHost.address]; - streamConfig.appID = app.appId; - if (streamConfig.hostAddr == 0) { + _streamConfig = [[StreamConfiguration alloc] init]; + _streamConfig.host = _selectedHost.address; + _streamConfig.hostAddr = [Utils resolveHost:_selectedHost.address]; + _streamConfig.appID = app.appId; + if (_streamConfig.hostAddr == 0) { [self displayDnsFailedDialog]; return; } @@ -231,10 +227,10 @@ static StreamConfiguration* streamConfig; DataManager* dataMan = [[DataManager alloc] init]; Settings* streamSettings = [dataMan retrieveSettings]; - streamConfig.frameRate = [streamSettings.framerate intValue]; - streamConfig.bitRate = [streamSettings.bitrate intValue]; - streamConfig.height = [streamSettings.height intValue]; - streamConfig.width = [streamSettings.width intValue]; + _streamConfig.frameRate = [streamSettings.framerate intValue]; + _streamConfig.bitRate = [streamSettings.bitrate intValue]; + _streamConfig.height = [streamSettings.height intValue]; + _streamConfig.width = [streamSettings.width intValue]; if (currentPosition != FrontViewPositionLeft) { @@ -292,14 +288,21 @@ static StreamConfiguration* streamConfig; currentPosition = position; } +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + if ([segue.destinationViewController isKindOfClass:[StreamFrameViewController class]]) { + StreamFrameViewController* streamFrame = segue.destinationViewController; + streamFrame.streamConfig = _streamConfig; + } +} + - (void)viewDidLoad { [super viewDidLoad]; - // Set the side bar button action. When it's tapped, it'll show up the sidebar. + // Set the side bar button action. When it's tapped, it'll show the sidebar. [_limelightLogoButton addTarget:self.revealViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchDown]; - // Set the host name button action. When it's tapped, it'll show up the host selection view. + // Set the host name button action. When it's tapped, it'll show the host selection view. [_computerNameButton setTarget:self]; [_computerNameButton setAction:@selector(showHostSelectionView)]; @@ -313,12 +316,12 @@ static StreamConfiguration* streamConfig; currentPosition = FrontViewPositionLeft; // Set up crypto - _opQueue = [[NSOperationQueue alloc] init]; [CryptoManager generateKeyPairUsingSSl]; _uniqueId = [CryptoManager getUniqueID]; _cert = [CryptoManager readCertFromFile]; _appManager = [[AppAssetManager alloc] initWithCallback:self]; + _opQueue = [[NSOperationQueue alloc] init]; // Only initialize the host picker list once if (hostList == nil) { @@ -467,4 +470,5 @@ static StreamConfiguration* streamConfig; - (BOOL)shouldAutorotate { return YES; } + @end diff --git a/Limelight/ViewControllers/StreamFrameViewController.h b/Limelight/ViewControllers/StreamFrameViewController.h index 35d0dc43..68cba510 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.h +++ b/Limelight/ViewControllers/StreamFrameViewController.h @@ -7,11 +7,13 @@ // #import "Connection.h" +#import "StreamConfiguration.h" #import @interface StreamFrameViewController : UIViewController @property (strong, nonatomic) IBOutlet UILabel *stageLabel; @property (strong, nonatomic) IBOutlet UIActivityIndicatorView *spinner; +@property (nonatomic) StreamConfiguration* streamConfig; @end diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index c4dd47ad..fbbfcf63 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -36,7 +36,7 @@ _controllerSupport = [[ControllerSupport alloc] init]; - _streamMan = [[StreamManager alloc] initWithConfig:[MainFrameViewController getStreamConfiguration] + _streamMan = [[StreamManager alloc] initWithConfig:self.streamConfig renderView:self.view connectionCallbacks:self]; NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];