mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Merge branch 'master' of github.com:moonlight-stream/moonlight-ios
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
@interface Connection : NSOperation <NSStreamDelegate>
|
@interface Connection : NSOperation <NSStreamDelegate>
|
||||||
|
|
||||||
-(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer connectionCallbacks:(id<ConnectionCallbacks>)callbacks serverMajorVersion:(int)serverMajorVersion;
|
-(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer connectionCallbacks:(id<ConnectionCallbacks>)callbacks;
|
||||||
-(void) terminate;
|
-(void) terminate;
|
||||||
-(void) main;
|
-(void) main;
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,11 @@
|
|||||||
#include "opus.h"
|
#include "opus.h"
|
||||||
|
|
||||||
@implementation Connection {
|
@implementation Connection {
|
||||||
const char* _host;
|
SERVER_INFORMATION _serverInfo;
|
||||||
STREAM_CONFIGURATION _streamConfig;
|
STREAM_CONFIGURATION _streamConfig;
|
||||||
CONNECTION_LISTENER_CALLBACKS _clCallbacks;
|
CONNECTION_LISTENER_CALLBACKS _clCallbacks;
|
||||||
DECODER_RENDERER_CALLBACKS _drCallbacks;
|
DECODER_RENDERER_CALLBACKS _drCallbacks;
|
||||||
AUDIO_RENDERER_CALLBACKS _arCallbacks;
|
AUDIO_RENDERER_CALLBACKS _arCallbacks;
|
||||||
int _serverMajorVersion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSLock* initLock;
|
static NSLock* initLock;
|
||||||
@@ -274,7 +273,7 @@ void ClDisplayTransientMessage(const char* message)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer connectionCallbacks:(id<ConnectionCallbacks>)callbacks serverMajorVersion:(int)serverMajorVersion
|
-(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer connectionCallbacks:(id<ConnectionCallbacks>)callbacks
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
@@ -284,10 +283,15 @@ void ClDisplayTransientMessage(const char* message)
|
|||||||
initLock = [[NSLock alloc] init];
|
initLock = [[NSLock alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
_host = [config.host cStringUsingEncoding:NSUTF8StringEncoding];
|
LiInitializeServerInformation(&_serverInfo);
|
||||||
|
_serverInfo.address = [config.host cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
_serverInfo.serverInfoAppVersion = [config.appVersion cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
if (config.gfeVersion != nil) {
|
||||||
|
_serverInfo.serverInfoGfeVersion = [config.gfeVersion cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
}
|
||||||
|
|
||||||
renderer = myRenderer;
|
renderer = myRenderer;
|
||||||
_callbacks = callbacks;
|
_callbacks = callbacks;
|
||||||
_serverMajorVersion = serverMajorVersion;
|
|
||||||
|
|
||||||
LiInitializeStreamConfiguration(&_streamConfig);
|
LiInitializeStreamConfiguration(&_streamConfig);
|
||||||
_streamConfig.width = config.width;
|
_streamConfig.width = config.width;
|
||||||
@@ -407,12 +411,12 @@ static OSStatus playbackCallback(void *inRefCon,
|
|||||||
-(void) main
|
-(void) main
|
||||||
{
|
{
|
||||||
[initLock lock];
|
[initLock lock];
|
||||||
LiStartConnection(_host,
|
LiStartConnection(&_serverInfo,
|
||||||
&_streamConfig,
|
&_streamConfig,
|
||||||
&_clCallbacks,
|
&_clCallbacks,
|
||||||
&_drCallbacks,
|
&_drCallbacks,
|
||||||
&_arCallbacks,
|
&_arCallbacks,
|
||||||
NULL, 0, _serverMajorVersion);
|
NULL, 0);
|
||||||
[initLock unlock];
|
[initLock unlock];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
@interface StreamConfiguration : NSObject
|
@interface StreamConfiguration : NSObject
|
||||||
|
|
||||||
@property NSString* host;
|
@property NSString* host;
|
||||||
|
@property NSString* appVersion;
|
||||||
|
@property NSString* gfeVersion;
|
||||||
@property NSString* appID;
|
@property NSString* appID;
|
||||||
@property int width;
|
@property int width;
|
||||||
@property int height;
|
@property int height;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
fallbackError:401 fallbackRequest:[hMan newHttpServerInfoRequest]]];
|
fallbackError:401 fallbackRequest:[hMan newHttpServerInfoRequest]]];
|
||||||
NSString* pairStatus = [serverInfoResp getStringTag:@"PairStatus"];
|
NSString* pairStatus = [serverInfoResp getStringTag:@"PairStatus"];
|
||||||
NSString* appversion = [serverInfoResp getStringTag:@"appversion"];
|
NSString* appversion = [serverInfoResp getStringTag:@"appversion"];
|
||||||
|
NSString* gfeVersion = [serverInfoResp getStringTag:@"GfeVersion"];
|
||||||
NSString* serverState = [serverInfoResp getStringTag:@"state"];
|
NSString* serverState = [serverInfoResp getStringTag:@"state"];
|
||||||
if (![serverInfoResp isStatusOk] || pairStatus == NULL || appversion == NULL || serverState == NULL) {
|
if (![serverInfoResp isStatusOk] || pairStatus == NULL || appversion == NULL || serverState == NULL) {
|
||||||
[_callbacks launchFailed:@"Failed to connect to PC"];
|
[_callbacks launchFailed:@"Failed to connect to PC"];
|
||||||
@@ -82,11 +83,12 @@
|
|||||||
[((StreamView*)_renderView) setMouseDeltaFactors:_config.width / screenSize.width
|
[((StreamView*)_renderView) setMouseDeltaFactors:_config.width / screenSize.width
|
||||||
y:_config.height / screenSize.height];
|
y:_config.height / screenSize.height];
|
||||||
|
|
||||||
int majorVersion = [[appversion substringToIndex:1] intValue];
|
// Populate the config's version fields from serverinfo
|
||||||
Log(LOG_I, @"Server is generation %d", majorVersion);
|
_config.appVersion = appversion;
|
||||||
|
_config.gfeVersion = gfeVersion;
|
||||||
|
|
||||||
VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc]initWithView:_renderView];
|
VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc]initWithView:_renderView];
|
||||||
_connection = [[Connection alloc] initWithConfig:_config renderer:renderer connectionCallbacks:_callbacks serverMajorVersion:majorVersion];
|
_connection = [[Connection alloc] initWithConfig:_config renderer:renderer connectionCallbacks:_callbacks];
|
||||||
NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];
|
NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];
|
||||||
[opQueue addOperation:_connection];
|
[opQueue addOperation:_connection];
|
||||||
}
|
}
|
||||||
|
|||||||
Submodule moonlight-common/moonlight-common-c updated: 293c6a7274...bd825776b3
Reference in New Issue
Block a user