mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-22 20:26:41 +00:00
Merge branch 'master' of github.com:limelight-stream/limelight-ios
Conflicts: Limelight/StreamFrameViewController.m
This commit is contained in:
commit
613f82b0ac
@ -14,5 +14,6 @@
|
||||
@property BOOL paired;
|
||||
|
||||
- (id) initWithHost:(NSNetService*)host;
|
||||
- (id) initWithIp:(NSString*)host;
|
||||
|
||||
@end
|
||||
|
@ -19,4 +19,13 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithIp:(NSString*)host {
|
||||
self = [super init];
|
||||
|
||||
self.hostName = host;
|
||||
self.displayName = host;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -196,7 +196,7 @@ void ClDisplayTransientMessage(char* message)
|
||||
-(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer
|
||||
{
|
||||
self = [super init];
|
||||
host = config.host;
|
||||
host = config.hostAddr;
|
||||
renderer = myRenderer;
|
||||
|
||||
streamConfig.width = config.width;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MDNSManager.h"
|
||||
#import "PairManager.h"
|
||||
#import "StreamConfiguration.h"
|
||||
|
||||
@interface MainFrameViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate, MDNSCallback, NSURLConnectionDelegate, PairCallback>
|
||||
@property (strong, nonatomic) IBOutlet UIPickerView *HostPicker;
|
||||
@ -18,9 +19,8 @@
|
||||
@property (strong, nonatomic) IBOutlet UIPickerView *StreamConfigs;
|
||||
@property (strong, nonatomic) NSArray* streamConfigVals;
|
||||
@property (strong, nonatomic) NSArray* hostPickerVals;
|
||||
@property (strong, nonatomic) IBOutlet UITextField *hostTextField;
|
||||
|
||||
- (void) segueIntoStream;
|
||||
|
||||
+ (NSString*) getHost;
|
||||
+ (StreamConfiguration*) getStreamConfiguration;
|
||||
|
||||
@end
|
||||
|
@ -13,6 +13,7 @@
|
||||
#import "Connection.h"
|
||||
#import "VideoDecoderRenderer.h"
|
||||
#import "StreamManager.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation MainFrameViewController {
|
||||
NSOperationQueue* _opQueue;
|
||||
@ -20,15 +21,19 @@
|
||||
Computer* _selectedHost;
|
||||
UIAlertView* _pairAlert;
|
||||
}
|
||||
static NSString* host;
|
||||
static StreamConfiguration* streamConfig;
|
||||
|
||||
+ (NSString*) getHost {
|
||||
return host;
|
||||
+ (StreamConfiguration*) getStreamConfiguration {
|
||||
return streamConfig;
|
||||
}
|
||||
|
||||
- (void)PairButton:(UIButton *)sender
|
||||
{
|
||||
NSLog(@"Pair Button Pressed!");
|
||||
if ([self.hostTextField.text length] > 0) {
|
||||
_selectedHost = [[Computer alloc] initWithIp:self.hostTextField.text];
|
||||
NSLog(@"Using custom host: %@", self.hostTextField.text);
|
||||
}
|
||||
[CryptoManager generateKeyPairUsingSSl];
|
||||
NSString* uniqueId = [CryptoManager getUniqueID];
|
||||
NSData* cert = [CryptoManager readCertFromFile];
|
||||
@ -65,7 +70,44 @@ static NSString* host;
|
||||
- (void)StreamButton:(UIButton *)sender
|
||||
{
|
||||
NSLog(@"Stream Button Pressed!");
|
||||
host = _selectedHost.hostName;
|
||||
if ([self.hostTextField.text length] > 0) {
|
||||
_selectedHost = [[Computer alloc] initWithIp:self.hostTextField.text];
|
||||
NSLog(@"Using custom host: %@", self.hostTextField.text);
|
||||
}
|
||||
streamConfig = [[StreamConfiguration alloc] init];
|
||||
streamConfig.host = _selectedHost.hostName;
|
||||
streamConfig.hostAddr = [Utils resolveHost:_selectedHost.hostName];
|
||||
|
||||
int selectedConf = [self.StreamConfigs selectedRowInComponent:0];
|
||||
NSLog(@"selectedConf: %d", selectedConf);
|
||||
switch (selectedConf) {
|
||||
case 0:
|
||||
streamConfig.width = 1280;
|
||||
streamConfig.height = 720;
|
||||
streamConfig.frameRate = 30;
|
||||
break;
|
||||
case 1:
|
||||
streamConfig.width = 1280;
|
||||
streamConfig.height = 720;
|
||||
streamConfig.frameRate = 60;
|
||||
break;
|
||||
case 2:
|
||||
streamConfig.width = 1920;
|
||||
streamConfig.height = 720;
|
||||
streamConfig.frameRate = 30;
|
||||
break;
|
||||
case 3:
|
||||
streamConfig.width = 1920;
|
||||
streamConfig.height = 1080;
|
||||
streamConfig.frameRate = 60;
|
||||
break;
|
||||
default:
|
||||
streamConfig.width = 1280;
|
||||
streamConfig.height = 720;
|
||||
streamConfig.frameRate = 60;
|
||||
break;
|
||||
}
|
||||
NSLog(@"StreamConfig: %@, %d, %dx%dx%d", streamConfig.host, streamConfig.hostAddr, streamConfig.width, streamConfig.height, streamConfig.frameRate);
|
||||
[self performSegueWithIdentifier:@"createStreamFrame" sender:self];
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,8 @@
|
||||
|
||||
@interface StreamConfiguration : NSObject
|
||||
|
||||
@property int host;
|
||||
@property NSString* host;
|
||||
@property int hostAddr;
|
||||
@property int width;
|
||||
@property int height;
|
||||
@property int frameRate;
|
||||
|
@ -9,5 +9,5 @@
|
||||
#import "StreamConfiguration.h"
|
||||
|
||||
@implementation StreamConfiguration
|
||||
@synthesize host, width, height, frameRate, bitRate, riKeyId, riKey;
|
||||
@synthesize host, hostAddr, width, height, frameRate, bitRate, riKeyId, riKey;
|
||||
@end
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
_controllerSupport = [[ControllerSupport alloc] init];
|
||||
|
||||
StreamManager* streamMan = [[StreamManager alloc] initWithHost:[MainFrameViewController getHost] renderView:self.view];
|
||||
StreamManager* streamMan = [[StreamManager alloc] initWithConfig:[MainFrameViewController getStreamConfiguration] renderView:self.view];
|
||||
NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];
|
||||
[opQueue addOperation:streamMan];
|
||||
}
|
||||
|
@ -7,9 +7,10 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "StreamConfiguration.h"
|
||||
|
||||
@interface StreamManager : NSOperation
|
||||
|
||||
- (id) initWithHost:(NSString*)host renderView:(UIView*)view;
|
||||
- (id) initWithConfig:(StreamConfiguration*)config renderView:(UIView*)view;
|
||||
|
||||
@end
|
||||
|
@ -11,44 +11,39 @@
|
||||
#import "HttpManager.h"
|
||||
#import "Utils.h"
|
||||
#import "Connection.h"
|
||||
#import "StreamConfiguration.h"
|
||||
|
||||
@implementation StreamManager {
|
||||
NSString* _host;
|
||||
StreamConfiguration* _config;
|
||||
UIView* _renderView;
|
||||
}
|
||||
|
||||
- (id) initWithHost:(NSString*)host renderView:(UIView*)view {
|
||||
- (id) initWithConfig:(StreamConfiguration*)config renderView:(UIView*)view {
|
||||
self = [super init];
|
||||
_host = host;
|
||||
_config = config;
|
||||
_renderView = view;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)main {
|
||||
[CryptoManager generateKeyPairUsingSSl];
|
||||
NSString* uniqueId = [CryptoManager getUniqueID];
|
||||
NSData* cert = [CryptoManager readCertFromFile];
|
||||
|
||||
HttpManager* hMan = [[HttpManager alloc] initWithHost:_host uniqueId:uniqueId deviceName:@"roth" cert:cert];
|
||||
HttpManager* hMan = [[HttpManager alloc] initWithHost:_config.host uniqueId:uniqueId deviceName:@"roth" cert:cert];
|
||||
NSData* riKey = [Utils randomBytes:16];
|
||||
int riKeyId = arc4random();
|
||||
|
||||
NSData* launchResp = [hMan executeRequestSynchronously:[hMan newLaunchRequest:@"67339056" width:1920 height:1080 refreshRate:30 rikey:[Utils bytesToHex:riKey] rikeyid:riKeyId]];
|
||||
NSData* launchResp = [hMan executeRequestSynchronously:[hMan newLaunchRequest:@"67339056" width:_config.width height:_config.height refreshRate:_config.frameRate rikey:[Utils bytesToHex:riKey] rikeyid:riKeyId]];
|
||||
[HttpManager getStringFromXML:launchResp tag:@"gamesession"];
|
||||
|
||||
VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc]initWithView:_renderView];
|
||||
|
||||
StreamConfiguration* config = [[StreamConfiguration alloc] init];
|
||||
config.host = [Utils resolveHost:_host];
|
||||
config.width = 1920;
|
||||
config.height = 1080;
|
||||
config.frameRate = 30;
|
||||
config.bitRate = 10000;
|
||||
config.riKey = riKey;
|
||||
config.riKeyId = riKeyId;
|
||||
_config.bitRate = 10000;
|
||||
_config.riKey = riKey;
|
||||
_config.riKeyId = riKeyId;
|
||||
|
||||
Connection* conn = [[Connection alloc] initWithConfig:config renderer:renderer];
|
||||
Connection* conn = [[Connection alloc] initWithConfig:_config renderer:renderer];
|
||||
|
||||
NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];
|
||||
[opQueue addOperation:conn];
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="14A389" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="wb7-af-jn8">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14A388a" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="wb7-af-jn8">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Main Frame View Controller-->
|
||||
@ -50,6 +50,11 @@
|
||||
<action selector="PairButton:" destination="wb7-af-jn8" eventType="touchUpInside" id="Ct1-6m-aYg"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Geforce Host" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="OCq-Pr-kFE">
|
||||
<rect key="frame" x="374" y="235" width="276" height="30"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
@ -57,6 +62,7 @@
|
||||
<connections>
|
||||
<outlet property="HostPicker" destination="bJR-sz-8uh" id="pWB-P3-ZJ2"/>
|
||||
<outlet property="StreamConfigs" destination="rnA-uG-hAA" id="LPP-jQ-5eW"/>
|
||||
<outlet property="hostTextField" destination="OCq-Pr-kFE" id="HS2-KF-inc"/>
|
||||
<segue destination="OIm-0n-i9v" kind="modal" identifier="createStreamFrame" modalPresentationStyle="fullScreen" id="MOD-9A-3Sk"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
|
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="dgh-JZ-Q7z">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14A388a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="dgh-JZ-Q7z">
|
||||
<dependencies>
|
||||
<deployment defaultVersion="2048" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Main Frame View Controller-->
|
||||
@ -17,7 +16,7 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="J5M-pv-UHA">
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="J5M-pv-UHA">
|
||||
<rect key="frame" x="82" y="231" width="156" height="30"/>
|
||||
<state key="normal" title="Start Streaming Steam">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
@ -26,7 +25,7 @@
|
||||
<action selector="StreamButton:" destination="dgh-JZ-Q7z" eventType="touchUpInside" id="3Bj-I0-bKs"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ATh-Tf-xRL">
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ATh-Tf-xRL">
|
||||
<rect key="frame" x="137" y="269" width="46" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="46" id="mm8-gm-flQ"/>
|
||||
@ -38,33 +37,42 @@
|
||||
<action selector="PairButton:" destination="dgh-JZ-Q7z" eventType="touchUpInside" id="jHN-B5-hsw"/>
|
||||
</connections>
|
||||
</button>
|
||||
<pickerView contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0xb-lk-PHK">
|
||||
<rect key="frame" x="0.0" y="286" width="320" height="162"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="dgh-JZ-Q7z" id="R0Y-EX-neJ"/>
|
||||
<outlet property="delegate" destination="dgh-JZ-Q7z" id="mkk-oI-y7K"/>
|
||||
</connections>
|
||||
</pickerView>
|
||||
<pickerView contentMode="scaleToFill" verticalHuggingPriority="249" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nFR-to-qQs">
|
||||
<pickerView contentMode="scaleToFill" verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="nFR-to-qQs">
|
||||
<rect key="frame" x="0.0" y="20" width="320" height="216"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="dgh-JZ-Q7z" id="C28-Eh-A6L"/>
|
||||
<outlet property="delegate" destination="dgh-JZ-Q7z" id="dTy-8g-aj1"/>
|
||||
</connections>
|
||||
</pickerView>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Geforce Host" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="unc-nO-WPH">
|
||||
<rect key="frame" x="82" y="179" width="156" height="30"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0xb-lk-PHK">
|
||||
<rect key="frame" x="0.0" y="269" width="320" height="162"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="dgh-JZ-Q7z" id="R0Y-EX-neJ"/>
|
||||
<outlet property="delegate" destination="dgh-JZ-Q7z" id="mkk-oI-y7K"/>
|
||||
</connections>
|
||||
</pickerView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="0xb-lk-PHK" firstAttribute="leading" secondItem="2rs-P3-zn7" secondAttribute="leading" id="350-bN-0q6"/>
|
||||
<constraint firstAttribute="centerX" secondItem="J5M-pv-UHA" secondAttribute="centerX" id="5jf-C1-faJ"/>
|
||||
<constraint firstItem="unc-nO-WPH" firstAttribute="top" secondItem="0HR-9w-kvY" secondAttribute="bottom" constant="159" id="A1r-Mh-dg7"/>
|
||||
<constraint firstAttribute="centerX" secondItem="0xb-lk-PHK" secondAttribute="centerX" id="By0-u3-3MA"/>
|
||||
<constraint firstItem="0xb-lk-PHK" firstAttribute="centerX" secondItem="J5M-pv-UHA" secondAttribute="centerX" id="Gab-EA-Il5"/>
|
||||
<constraint firstItem="0xb-lk-PHK" firstAttribute="top" secondItem="J5M-pv-UHA" secondAttribute="bottom" constant="25" id="RNw-zD-7u7"/>
|
||||
<constraint firstItem="0xb-lk-PHK" firstAttribute="top" secondItem="ATh-Tf-xRL" secondAttribute="bottom" constant="-13" id="TN4-kv-Yli"/>
|
||||
<constraint firstItem="unc-nO-WPH" firstAttribute="leading" secondItem="J5M-pv-UHA" secondAttribute="leading" id="Qk0-0J-79M"/>
|
||||
<constraint firstItem="0xb-lk-PHK" firstAttribute="top" secondItem="J5M-pv-UHA" secondAttribute="bottom" constant="8" id="RNw-zD-7u7"/>
|
||||
<constraint firstItem="0xb-lk-PHK" firstAttribute="top" secondItem="ATh-Tf-xRL" secondAttribute="bottom" constant="-30" id="TN4-kv-Yli"/>
|
||||
<constraint firstItem="J5M-pv-UHA" firstAttribute="top" secondItem="nFR-to-qQs" secondAttribute="bottom" constant="-5" id="Vcz-ix-cdp"/>
|
||||
<constraint firstItem="nFR-to-qQs" firstAttribute="top" secondItem="0HR-9w-kvY" secondAttribute="bottom" id="XWH-Vw-VfH"/>
|
||||
<constraint firstItem="0xb-lk-PHK" firstAttribute="centerX" secondItem="ATh-Tf-xRL" secondAttribute="centerX" id="bEv-zi-oip"/>
|
||||
<constraint firstItem="J5M-pv-UHA" firstAttribute="top" secondItem="unc-nO-WPH" secondAttribute="bottom" constant="22" id="dU2-fJ-SU7"/>
|
||||
<constraint firstItem="ATh-Tf-xRL" firstAttribute="top" secondItem="J5M-pv-UHA" secondAttribute="bottom" constant="8" id="gNc-KC-Q9G"/>
|
||||
<constraint firstItem="unc-nO-WPH" firstAttribute="trailing" secondItem="J5M-pv-UHA" secondAttribute="trailing" id="h4a-vk-mBB"/>
|
||||
<constraint firstAttribute="centerX" secondItem="nFR-to-qQs" secondAttribute="centerX" id="h9S-ek-7bf"/>
|
||||
</constraints>
|
||||
</view>
|
||||
@ -73,6 +81,7 @@
|
||||
<connections>
|
||||
<outlet property="HostPicker" destination="nFR-to-qQs" id="lTE-tT-lYY"/>
|
||||
<outlet property="StreamConfigs" destination="0xb-lk-PHK" id="VxB-Ur-PNy"/>
|
||||
<outlet property="hostTextField" destination="unc-nO-WPH" id="MbD-KQ-MoG"/>
|
||||
<segue destination="mI3-9F-XwU" kind="modal" identifier="createStreamFrame" id="cPc-eP-un1"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
|
Loading…
x
Reference in New Issue
Block a user