diff --git a/src/client.c b/src/client.c index 8e349e9..30950c7 100644 --- a/src/client.c +++ b/src/client.c @@ -317,7 +317,7 @@ int client_get_app_id(const char *address, char *name) { return -1; } -void client_start_app(STREAM_CONFIGURATION *config, const char *address, int appId, bool sops) { +void client_start_app(STREAM_CONFIGURATION *config, const char *address, int appId, bool sops, bool localaudio) { RAND_bytes(config->remoteInputAesKey, 16); memset(config->remoteInputAesIv, 0, 16); @@ -329,7 +329,7 @@ void client_start_app(STREAM_CONFIGURATION *config, const char *address, int app struct http_data *data = http_create_data(); if (currentGame == 0) - sprintf(url, "https://%s:47984/launch?uniqueid=%s&appid=%d&mode=%dx%dx%d&additionalStates=1&sops=%d&rikey=%s&rikeyid=%d&localAudioPlayMode=0", address, unique_id, appId, config->width, config->height, config->fps, sops, rikey_hex, rikeyid); + sprintf(url, "https://%s:47984/launch?uniqueid=%s&appid=%d&mode=%dx%dx%d&additionalStates=1&sops=%d&rikey=%s&rikeyid=%d&localAudioPlayMode=%d", address, unique_id, appId, config->width, config->height, config->fps, sops, rikey_hex, rikeyid, localaudio); else sprintf(url, "https://%s:47984/resume?uniqueid=%s&rikey=%s&rikeyid=%d", address, unique_id, rikey_hex, rikeyid); diff --git a/src/client.h b/src/client.h index 9364087..01c5e99 100644 --- a/src/client.h +++ b/src/client.h @@ -24,7 +24,7 @@ #include "stdbool.h" void client_init(const char* serverAddress); -void client_start_app(STREAM_CONFIGURATION *config, const char* serverAddress, int appId, bool sops); +void client_start_app(STREAM_CONFIGURATION *config, const char* serverAddress, int appId, bool sops, bool localaudio); struct app_list* client_applist(const char* serverAddress); int client_get_app_id(const char* serverAddress, char* name); void client_pair(const char *address); diff --git a/src/main.c b/src/main.c index 466deda..11ccc98 100644 --- a/src/main.c +++ b/src/main.c @@ -47,14 +47,14 @@ static void applist(const char* address) { } } -static void stream(STREAM_CONFIGURATION* config, const char* address, const char* app, bool sops) { +static void stream(STREAM_CONFIGURATION* config, const char* address, const char* app, bool sops, bool localaudio) { int appId = client_get_app_id(address, app); if (appId<0) { printf("Can't find app %s\n", app); exit(-1); } - client_start_app(config, address, appId, sops); + client_start_app(config, address, appId, sops, localaudio); struct in_addr addr; inet_aton(address, &addr); @@ -86,6 +86,7 @@ static void help() { printf("\t-input \t\tUse as input. Can be used multiple times\n"); printf("\t-mapping \t\tUse as gamepad mapping configuration file (use before -input)\n"); printf("\t-audio \t\tUse as ALSA audio output device (default sysdefault)\n"); + printf("\t-localaudio\t\tPlay audio locally\n"); exit(0); } @@ -111,6 +112,7 @@ int main(int argc, char* argv[]) { {"mapping", required_argument, 0, 'k'}, {"nosops", no_argument, 0, 'l'}, {"audio", required_argument, 0, 'm'}, + {"localaudio", no_argument, 0, 'n'}, {0, 0, 0, 0}, }; @@ -120,8 +122,9 @@ int main(int argc, char* argv[]) { char* mapping = NULL; int option_index = 0; bool sops = true; + bool localaudio = false; int c; - while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:", long_options, &option_index)) != -1) { + while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:n", long_options, &option_index)) != -1) { switch (c) { case 'a': config.width = 720; @@ -164,6 +167,9 @@ int main(int argc, char* argv[]) { case 'm': audio_device = optarg; break; + case 'n': + localaudio = true; + break; case 1: if (action == NULL) action = optarg; @@ -189,7 +195,7 @@ int main(int argc, char* argv[]) { if (strcmp("applist", action) == 0) applist(address); else if (strcmp("stream", action) == 0) - stream(&config, address, app, sops); + stream(&config, address, app, sops, localaudio); else if (strcmp("pair", action) == 0) client_pair(address); else