mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-15 21:21:45 +00:00
Use API 1.1 common in preparation for IPv6 requirement
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
#include "opus.h"
|
#include "opus.h"
|
||||||
|
|
||||||
@implementation Connection {
|
@implementation Connection {
|
||||||
IP_ADDRESS _host;
|
char* _host;
|
||||||
STREAM_CONFIGURATION _streamConfig;
|
STREAM_CONFIGURATION _streamConfig;
|
||||||
CONNECTION_LISTENER_CALLBACKS _clCallbacks;
|
CONNECTION_LISTENER_CALLBACKS _clCallbacks;
|
||||||
DECODER_RENDERER_CALLBACKS _drCallbacks;
|
DECODER_RENDERER_CALLBACKS _drCallbacks;
|
||||||
@@ -137,16 +137,26 @@ void ArInit(void)
|
|||||||
if (status) {
|
if (status) {
|
||||||
Log(LOG_E, @"Unable to initialize audioUnit: %d", (int32_t)status);
|
Log(LOG_E, @"Unable to initialize audioUnit: %d", (int32_t)status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status = AudioOutputUnitStart(audioUnit);
|
||||||
|
if (status) {
|
||||||
|
Log(LOG_E, @"Unable to start audioUnit: %d", (int32_t)status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArRelease(void)
|
void ArCleanup(void)
|
||||||
{
|
{
|
||||||
if (opusDecoder != NULL) {
|
if (opusDecoder != NULL) {
|
||||||
opus_decoder_destroy(opusDecoder);
|
opus_decoder_destroy(opusDecoder);
|
||||||
opusDecoder = NULL;
|
opusDecoder = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus status = AudioUnitUninitialize(audioUnit);
|
OSStatus status = AudioOutputUnitStop(audioUnit);
|
||||||
|
if (status) {
|
||||||
|
Log(LOG_E, @"Unable to stop audioUnit: %d", (int32_t)status);
|
||||||
|
}
|
||||||
|
|
||||||
|
status = AudioUnitUninitialize(audioUnit);
|
||||||
if (status) {
|
if (status) {
|
||||||
Log(LOG_E, @"Unable to uninitialize audioUnit: %d", (int32_t)status);
|
Log(LOG_E, @"Unable to uninitialize audioUnit: %d", (int32_t)status);
|
||||||
}
|
}
|
||||||
@@ -166,22 +176,6 @@ void ArRelease(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArStart(void)
|
|
||||||
{
|
|
||||||
OSStatus status = AudioOutputUnitStart(audioUnit);
|
|
||||||
if (status) {
|
|
||||||
Log(LOG_E, @"Unable to start audioUnit: %d", (int32_t)status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArStop(void)
|
|
||||||
{
|
|
||||||
OSStatus status = AudioOutputUnitStop(audioUnit);
|
|
||||||
if (status) {
|
|
||||||
Log(LOG_E, @"Unable to stop audioUnit: %d", (int32_t)status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArDecodeAndPlaySample(char* sampleData, int sampleLength)
|
void ArDecodeAndPlaySample(char* sampleData, int sampleLength)
|
||||||
{
|
{
|
||||||
int decodedLength = opus_decode(opusDecoder, (unsigned char*)sampleData, sampleLength, decodedPcmBuffer, PCM_BUFFER_SIZE / 2, 0);
|
int decodedLength = opus_decode(opusDecoder, (unsigned char*)sampleData, sampleLength, decodedPcmBuffer, PCM_BUFFER_SIZE / 2, 0);
|
||||||
@@ -282,7 +276,7 @@ void ClDisplayTransientMessage(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 serverMajorVersion:(int)serverMajorVersion
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
_host = config.hostAddr;
|
_host = [config.host cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
renderer = myRenderer;
|
renderer = myRenderer;
|
||||||
_callbacks = callbacks;
|
_callbacks = callbacks;
|
||||||
_serverMajorVersion = serverMajorVersion;
|
_serverMajorVersion = serverMajorVersion;
|
||||||
@@ -299,16 +293,11 @@ void ClDisplayTransientMessage(char* message)
|
|||||||
int riKeyId = htonl(config.riKeyId);
|
int riKeyId = htonl(config.riKeyId);
|
||||||
memcpy(_streamConfig.remoteInputAesIv, &riKeyId, sizeof(riKeyId));
|
memcpy(_streamConfig.remoteInputAesIv, &riKeyId, sizeof(riKeyId));
|
||||||
|
|
||||||
_drCallbacks.setup = NULL;
|
memset(&_drCallbacks, 0, sizeof(_drCallbacks));
|
||||||
_drCallbacks.start = NULL;
|
|
||||||
_drCallbacks.stop = NULL;
|
|
||||||
_drCallbacks.release = NULL;
|
|
||||||
_drCallbacks.submitDecodeUnit = DrSubmitDecodeUnit;
|
_drCallbacks.submitDecodeUnit = DrSubmitDecodeUnit;
|
||||||
|
|
||||||
_arCallbacks.init = ArInit;
|
_arCallbacks.init = ArInit;
|
||||||
_arCallbacks.start = ArStart;
|
_arCallbacks.cleanup = ArCleanup;
|
||||||
_arCallbacks.stop = ArStop;
|
|
||||||
_arCallbacks.release = ArRelease;
|
|
||||||
_arCallbacks.decodeAndPlaySample = ArDecodeAndPlaySample;
|
_arCallbacks.decodeAndPlaySample = ArDecodeAndPlaySample;
|
||||||
|
|
||||||
_clCallbacks.stageStarting = ClStageStarting;
|
_clCallbacks.stageStarting = ClStageStarting;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
@property NSString* host;
|
@property NSString* host;
|
||||||
@property NSString* appID;
|
@property NSString* appID;
|
||||||
@property int hostAddr;
|
|
||||||
@property int width;
|
@property int width;
|
||||||
@property int height;
|
@property int height;
|
||||||
@property int frameRate;
|
@property int frameRate;
|
||||||
|
|||||||
@@ -9,5 +9,5 @@
|
|||||||
#import "StreamConfiguration.h"
|
#import "StreamConfiguration.h"
|
||||||
|
|
||||||
@implementation StreamConfiguration
|
@implementation StreamConfiguration
|
||||||
@synthesize host, appID, hostAddr, width, height, frameRate, bitRate, riKeyId, riKey;
|
@synthesize host, appID, width, height, frameRate, bitRate, riKeyId, riKey;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -226,12 +226,7 @@ static NSArray* appList;
|
|||||||
Log(LOG_D, @"Clicked app: %@", app.appName);
|
Log(LOG_D, @"Clicked app: %@", app.appName);
|
||||||
_streamConfig = [[StreamConfiguration alloc] init];
|
_streamConfig = [[StreamConfiguration alloc] init];
|
||||||
_streamConfig.host = _selectedHost.address;
|
_streamConfig.host = _selectedHost.address;
|
||||||
_streamConfig.hostAddr = [Utils resolveHost:_selectedHost.address];
|
|
||||||
_streamConfig.appID = app.appId;
|
_streamConfig.appID = app.appId;
|
||||||
if (_streamConfig.hostAddr == 0) {
|
|
||||||
[self displayDnsFailedDialog];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataManager* dataMan = [[DataManager alloc] init];
|
DataManager* dataMan = [[DataManager alloc] init];
|
||||||
Settings* streamSettings = [dataMan retrieveSettings];
|
Settings* streamSettings = [dataMan retrieveSettings];
|
||||||
|
|||||||
+1
-1
Submodule limelight-common-c updated: 43e6d35b8f...789eac8e6a
Reference in New Issue
Block a user