diff --git a/docs/README.pod b/docs/README.pod index 2a9f5aa..8491a35 100644 --- a/docs/README.pod +++ b/docs/README.pod @@ -137,6 +137,14 @@ By default the gamecontrollerdb.txt provided by Moonlight Embedded is used. Select platform for audio and video output and input. can be pi, imx, aml, x11, x11_vdpau, sdl or fake. +=item B<-unsupported> + +Try streaming if GFE version is unsupported + +=item B<-verbose> + +Enable verbose output + =item B<-input> [I] Enable the I device. diff --git a/src/config.c b/src/config.c index 5908a18..545fcf9 100644 --- a/src/config.c +++ b/src/config.c @@ -63,6 +63,7 @@ static struct option long_options[] = { {"fps", required_argument, NULL, 'v'}, {"codec", required_argument, NULL, 'x'}, {"unsupported", no_argument, NULL, 'y'}, + {"verbose", no_argument, NULL, 'z'}, {0, 0, 0, 0}, }; @@ -203,6 +204,9 @@ static void parse_argument(int c, char* value, PCONFIGURATION config) { case 'y': config->unsupported_version = true; break; + case 'z': + config->debug_level = 1; + break; case 1: if (config->action == NULL) config->action = value; @@ -289,6 +293,7 @@ void config_parse(int argc, char* argv[], PCONFIGURATION config) { config->stream.audioConfiguration = AUDIO_CONFIGURATION_STEREO; config->stream.supportsHevc = false; + config->debug_level = 0; config->platform = "auto"; config->app = "Steam"; config->action = NULL; diff --git a/src/config.h b/src/config.h index 0976e7d..f6271bf 100644 --- a/src/config.h +++ b/src/config.h @@ -27,6 +27,7 @@ enum codecs { CODEC_UNSPECIFIED, CODEC_H264, CODEC_HEVC }; typedef struct _CONFIGURATION { STREAM_CONFIGURATION stream; + int debug_level; char* app; char* action; char* address; diff --git a/src/connection.c b/src/connection.c index 9838350..abf42c4 100644 --- a/src/connection.c +++ b/src/connection.c @@ -20,9 +20,11 @@ #include "connection.h" #include +#include #include pthread_t main_thread_id = 0; +bool connection_debug; static void connection_terminated() { if (main_thread_id != 0) @@ -37,6 +39,13 @@ static void connection_display_transient_message(const char *msg) { printf("%s\n", msg); } +static void connection_log_message(const char* format, ...) { + va_list arglist; + va_start(arglist, format); + vprintf(format, arglist); + va_end(arglist); +} + CONNECTION_LISTENER_CALLBACKS connection_callbacks = { .stageStarting = NULL, .stageComplete = NULL, @@ -45,4 +54,5 @@ CONNECTION_LISTENER_CALLBACKS connection_callbacks = { .connectionTerminated = connection_terminated, .displayMessage = connection_display_message, .displayTransientMessage = connection_display_transient_message, + .logMessage = connection_log_message, }; diff --git a/src/connection.h b/src/connection.h index 009e787..a8a9ea6 100644 --- a/src/connection.h +++ b/src/connection.h @@ -20,6 +20,8 @@ #include #include +#include extern CONNECTION_LISTENER_CALLBACKS connection_callbacks; extern pthread_t main_thread_id; +extern bool connection_debug; diff --git a/src/main.c b/src/main.c index 6a9f4fb..4c4f443 100644 --- a/src/main.c +++ b/src/main.c @@ -105,7 +105,10 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys if (config->fullscreen) drFlags |= DISPLAY_FULLSCREEN; - printf("Stream %d x %d, %d fps, %d kbps\n", config->stream.width, config->stream.height, config->stream.fps, config->stream.bitrate); + if (config->debug_level > 0) { + printf("Stream %d x %d, %d fps, %d kbps\n", config->stream.width, config->stream.height, config->stream.fps, config->stream.bitrate); + connection_debug = true; + } platform_start(system); LiStartConnection(&server->serverInfo, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system, config->audio_device), NULL, drFlags, config->audio_device, 0); @@ -125,6 +128,7 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys } static void help() { + printf("Moonlight Embedded %d.%d.%d\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); printf("Usage: moonlight [action] (options) [host]\n"); printf(" moonlight [configfile]\n"); printf("\n Actions\n\n"); @@ -137,6 +141,7 @@ static void help() { printf("\n Global Options\n\n"); printf("\t-config \tLoad configuration file\n"); printf("\t-save \t\tSave configuration file\n"); + printf("\t-verbose\t\tEnable verbose output\n"); printf("\n Streaming options\n\n"); printf("\t-720\t\t\tUse 1280x720 resolution [default]\n"); printf("\t-1080\t\t\tUse 1920x1080 resolution\n"); @@ -177,14 +182,15 @@ static void pair_check(PSERVER_DATA server) { } int main(int argc, char* argv[]) { - printf("Moonlight Embedded %d.%d.%d (%s)\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, COMPILE_OPTIONS); - CONFIGURATION config; config_parse(argc, argv, &config); if (config.action == NULL || strcmp("help", config.action) == 0) help(); + if (config.debug_level > 0) + printf("Moonlight Embedded %d.%d.%d (%s)\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, COMPILE_OPTIONS); + if (config.address == NULL) { config.address = malloc(MAX_ADDRESS_SIZE); if (config.address == NULL) { @@ -225,7 +231,8 @@ int main(int argc, char* argv[]) { exit(-1); } - printf("NVIDIA %s, GFE %s (%s, %s)\n", server.gpuType, server.serverInfo.serverInfoGfeVersion, server.gsVersion, server.serverInfo.serverInfoAppVersion); + if (config.debug_level > 0) + printf("NVIDIA %s, GFE %s (%s, %s)\n", server.gpuType, server.serverInfo.serverInfoGfeVersion, server.gsVersion, server.serverInfo.serverInfoAppVersion); if (strcmp("list", config.action) == 0) { pair_check(&server); @@ -251,7 +258,9 @@ int main(int argc, char* argv[]) { struct mapping* mappings = mapping_load(config.mapping); for (int i=0;i 0) + printf("Add input %s...\n", config.inputs[i]); + evdev_create(config.inputs[i], mappings); } diff --git a/third_party/moonlight-common-c b/third_party/moonlight-common-c index a38af3e..a1bdb36 160000 --- a/third_party/moonlight-common-c +++ b/third_party/moonlight-common-c @@ -1 +1 @@ -Subproject commit a38af3e80ad6da52422a9deb2cfb657719d8a982 +Subproject commit a1bdb36766f8db5dc9cc0694c9a376f0dca3ab59