mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-14 20:06:23 +00:00
Port for macOS (#311)
* merged moonlight-mac with moonlight-ios * reverted to the original project.pbxproj * cleaned up the code, fixed lots of unnecessary code duplications * multicontroller support (not tested) * new class that can be used for further modularization of the MainFrameViewController
This commit is contained in:
committed by
Cameron Gutman
parent
1c86c4485d
commit
6cc165b589
@@ -26,6 +26,7 @@
|
||||
#import "ComputerScrollView.h"
|
||||
#import "TemporaryApp.h"
|
||||
#import "IdManager.h"
|
||||
#import "ConnectionHelper.h"
|
||||
|
||||
@implementation MainFrameViewController {
|
||||
NSOperationQueue* _opQueue;
|
||||
@@ -115,27 +116,10 @@ static NSMutableSet* hostList;
|
||||
}
|
||||
Log(LOG_I, @"Using cached app list: %d", usingCachedAppList);
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
HttpManager* hMan = [[HttpManager alloc] initWithHost:host.activeAddress uniqueId:_uniqueId deviceName:deviceName cert:_cert];
|
||||
|
||||
// Exempt this host from discovery while handling the applist query
|
||||
[_discMan removeHostFromDiscovery:host];
|
||||
|
||||
// Try up to 5 times to get the app list
|
||||
AppListResponse* appListResp;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
appListResp = [[AppListResponse alloc] init];
|
||||
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:appListResp withUrlRequest:[hMan newAppListRequest]]];
|
||||
if (appListResp == nil || ![appListResp isStatusOk] || [appListResp getAppList] == nil) {
|
||||
Log(LOG_W, @"Failed to get applist on try %d: %@", i, appListResp.statusMessage);
|
||||
|
||||
// Wait for one second then retry
|
||||
[NSThread sleepForTimeInterval:1];
|
||||
}
|
||||
else {
|
||||
Log(LOG_I, @"App list successfully retreived - took %d tries", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
AppListResponse* appListResp = [ConnectionHelper getAppListForHostWithHostIP:host.activeAddress deviceName:deviceName cert:_cert uniqueID:_uniqueId];
|
||||
|
||||
[_discMan addHostToDiscovery:host];
|
||||
|
||||
@@ -409,6 +393,7 @@ static NSMutableSet* hostList;
|
||||
_streamConfig.height = [streamSettings.height intValue];
|
||||
_streamConfig.width = [streamSettings.width intValue];
|
||||
_streamConfig.gamepadMask = [ControllerSupport getConnectedGamepadMask];
|
||||
_streamConfig.streamingRemotely = [streamSettings.streamingRemotely intValue];
|
||||
|
||||
[_appManager stopRetrieving];
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *framerateSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *resolutionSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *onscreenControlSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *remoteSelector;
|
||||
|
||||
- (void) saveSettings;
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@ static NSString* bitrateFormat = @"Bitrate: %.1f Mbps";
|
||||
resolution = 0;
|
||||
}
|
||||
NSInteger onscreenControls = [currentSettings.onscreenControls integerValue];
|
||||
|
||||
NSInteger streamingRemotely = [currentSettings.streamingRemotely integerValue];
|
||||
[self.remoteSelector setSelectedSegmentIndex:streamingRemotely];
|
||||
[self.resolutionSelector setSelectedSegmentIndex:resolution];
|
||||
[self.resolutionSelector addTarget:self action:@selector(newResolutionFpsChosen) forControlEvents:UIControlEventValueChanged];
|
||||
[self.framerateSelector setSelectedSegmentIndex:framerate];
|
||||
@@ -66,6 +67,11 @@ static NSString* bitrateFormat = @"Bitrate: %.1f Mbps";
|
||||
[self.bitrateSlider setValue:(_bitrate / BITRATE_INTERVAL) animated:YES];
|
||||
[self.bitrateSlider addTarget:self action:@selector(bitrateSliderMoved) forControlEvents:UIControlEventValueChanged];
|
||||
[self updateBitrateText];
|
||||
[self.remoteSelector addTarget:self action:@selector(remoteStreamingChanged) forControlEvents:UIControlEventValueChanged];
|
||||
}
|
||||
|
||||
- (void) remoteStreamingChanged {
|
||||
// This function can be used to reconfigure the settings view to offer more remote streaming options (i.e. reduce the audio frequency to 24kHz, enable/disable the HEVC bitrate multiplier, ...)
|
||||
}
|
||||
|
||||
- (void) newResolutionFpsChosen {
|
||||
@@ -102,6 +108,10 @@ static NSString* bitrateFormat = @"Bitrate: %.1f Mbps";
|
||||
[self.bitrateLabel setText:[NSString stringWithFormat:bitrateFormat, _bitrate / 1000.]];
|
||||
}
|
||||
|
||||
- (NSInteger) getRemoteOptions {
|
||||
return [self.remoteSelector selectedSegmentIndex];
|
||||
}
|
||||
|
||||
- (NSInteger) getChosenFrameRate {
|
||||
return [self.framerateSelector selectedSegmentIndex] == 0 ? 30 : 60;
|
||||
}
|
||||
@@ -120,7 +130,9 @@ static NSString* bitrateFormat = @"Bitrate: %.1f Mbps";
|
||||
NSInteger height = [self getChosenStreamHeight];
|
||||
NSInteger width = [self getChosenStreamWidth];
|
||||
NSInteger onscreenControls = [self.onscreenControlSelector selectedSegmentIndex];
|
||||
[dataMan saveSettingsWithBitrate:_bitrate framerate:framerate height:height width:width onscreenControls:onscreenControls];
|
||||
NSInteger streamingRemotely = [self.remoteSelector selectedSegmentIndex];
|
||||
[dataMan saveSettingsWithBitrate:_bitrate framerate:framerate height:height width:width onscreenControls:onscreenControls
|
||||
remote: streamingRemotely];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
|
||||
Reference in New Issue
Block a user