Check for 4K support

This commit is contained in:
Iwan Timmer
2016-02-01 14:04:49 +01:00
parent bb8ddb8ebe
commit 88b9b2ec90
4 changed files with 28 additions and 1 deletions

View File

@@ -170,6 +170,8 @@ static int load_server_status(PSERVER_DATA server) {
char *currentGameText = NULL; char *currentGameText = NULL;
char *versionText = NULL; char *versionText = NULL;
char *stateText = NULL; char *stateText = NULL;
char *heightText = NULL;
char *serverCodecModeSupportText = NULL;
uuid_t uuid; uuid_t uuid;
char uuid_str[37]; char uuid_str[37];
@@ -203,8 +205,15 @@ static int load_server_status(PSERVER_DATA server) {
if (xml_search(data->memory, data->size, "state", &stateText) != GS_OK) if (xml_search(data->memory, data->size, "state", &stateText) != GS_OK)
goto cleanup; goto cleanup;
if (xml_search(data->memory, data->size, "Height", &heightText) != GS_OK)
goto cleanup;
if (xml_search(data->memory, data->size, "ServerCodecModeSupport", &serverCodecModeSupportText) != GS_OK)
goto cleanup;
server->paired = pairedText != NULL && strcmp(pairedText, "1") == 0; server->paired = pairedText != NULL && strcmp(pairedText, "1") == 0;
server->currentGame = currentGameText == NULL ? 0 : atoi(currentGameText); server->currentGame = currentGameText == NULL ? 0 : atoi(currentGameText);
server->supports4K = heightText != NULL && serverCodecModeSupportText != NULL && atoi(heightText) >= 2160;
char *versionSep = strstr(versionText, "."); char *versionSep = strstr(versionText, ".");
if (versionSep != NULL) { if (versionSep != NULL) {
*versionSep = 0; *versionSep = 0;
@@ -231,6 +240,12 @@ static int load_server_status(PSERVER_DATA server) {
if (versionText != NULL) if (versionText != NULL)
free(versionText); free(versionText);
if (heightText != NULL)
free(heightText);
if (serverCodecModeSupportText != NULL)
free(serverCodecModeSupportText);
return ret; return ret;
} }
@@ -445,6 +460,9 @@ int gs_start_app(PSERVER_DATA server, STREAM_CONFIGURATION *config, int appId, b
uuid_t uuid; uuid_t uuid;
char uuid_str[37]; char uuid_str[37];
if (config->height >= 2160 && !server->supports4K)
return GS_NOT_SUPPORTED_4K;
RAND_bytes(config->remoteInputAesKey, 16); RAND_bytes(config->remoteInputAesKey, 16);
memset(config->remoteInputAesIv, 0, 16); memset(config->remoteInputAesIv, 0, 16);

View File

@@ -28,6 +28,7 @@
typedef struct _SERVER_DATA { typedef struct _SERVER_DATA {
const char* address; const char* address;
bool paired; bool paired;
bool supports4K;
int currentGame; int currentGame;
int serverMajorVersion; int serverMajorVersion;
} SERVER_DATA, *PSERVER_DATA; } SERVER_DATA, *PSERVER_DATA;

View File

@@ -25,5 +25,6 @@
#define GS_INVALID -3 #define GS_INVALID -3
#define GS_WRONG_STATE -4 #define GS_WRONG_STATE -4
#define GS_IO_ERROR -5 #define GS_IO_ERROR -5
#define GS_NOT_SUPPORTED_4K -6
const char* gs_error; const char* gs_error;

View File

@@ -83,7 +83,14 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys
exit(-1); exit(-1);
} }
gs_start_app(server, &config->stream, appId, config->sops, config->localaudio); int ret = gs_start_app(server, &config->stream, appId, config->sops, config->localaudio);
if (ret < 0) {
if (ret == GS_NOT_SUPPORTED_4K)
fprintf(stderr, "Server doesn't support 4K\n");
else
fprintf(stderr, "Errorcode starting app: %d\n", ret);
exit(-1);
}
int drFlags = 0; int drFlags = 0;
if (config->fullscreen) if (config->fullscreen)