- Change 'applist' action to 'list' to match the documentation

- Add 'quit' action to quit the app being streamed
- Check if the device is paired before streaming
- Fix a typo that caused a segfault when streaming
This commit is contained in:
Cameron Gutman
2015-05-15 01:05:23 +00:00
parent 15e0048fca
commit 6be4ffef9f
5 changed files with 54 additions and 6 deletions

View File

@@ -77,7 +77,7 @@ static void stream(STREAM_CONFIGURATION* config, const char* address, const char
}
struct sockaddr_in *addr = (struct sockaddr_in*)res->ai_addr;
LiStartConnection(addr->sin_addr.s_addr, config, &connection_callbacks, &decoder_callbacks,
LiStartConnection(addr->sin_addr.s_addr, config, &connection_callbacks, decoder_callbacks,
&audio_callbacks, &platform_callbacks, NULL, 0, client_get_server_version());
freeaddrinfo(res);
@@ -93,6 +93,7 @@ static void help() {
printf("\tpair\t\t\tPair device with computer\n");
printf("\tstream\t\t\tStream computer to device\n");
printf("\tlist\t\t\tList available games and applications\n");
printf("\tquit\t\t\tQuit the application or game being streamed\n");
printf("\thelp\t\t\tShow this help\n\n");
printf(" Streaming options\n\n");
printf("\t-720\t\t\tUse 1280x720 resolution [default]\n");
@@ -149,6 +150,13 @@ char* get_path(char* name) {
return NULL;
}
static void pair_check(void) {
if (!client_is_paired(NULL)) {
printf("You must pair with the PC first\n");
exit(-1);
}
}
int main(int argc, char* argv[]) {
STREAM_CONFIGURATION config;
config.width = 1280;
@@ -270,12 +278,17 @@ int main(int argc, char* argv[]) {
client_init(address);
if (strcmp("applist", action) == 0)
if (strcmp("list", action) == 0) {
pair_check();
applist(address);
else if (strcmp("stream", action) == 0)
} else if (strcmp("stream", action) == 0) {
pair_check();
stream(&config, address, app, sops, localaudio);
else if (strcmp("pair", action) == 0)
} else if (strcmp("pair", action) == 0)
client_pair(address);
else
fprintf(stderr, "%s is not a valid actions\n", action);
else if (strcmp("quit", action) == 0) {
pair_check();
client_quit_app(address);
} else
fprintf(stderr, "%s is not a valid action\n", action);
}