From 0b7c2f62a7e2a078d21b14611f6016cac08d9cad Mon Sep 17 00:00:00 2001 From: Iwan Timmer Date: Fri, 9 Jun 2017 22:50:48 +0200 Subject: [PATCH] Replace seperate codec options with single option --- docs/README.pod | 12 +++++------- moonlight.conf | 8 ++++---- src/config.c | 13 +++++++------ src/main.c | 3 +-- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/docs/README.pod b/docs/README.pod index a62c0d4..7387cd4 100644 --- a/docs/README.pod +++ b/docs/README.pod @@ -93,14 +93,12 @@ The packetsize should the smaller than the MTU of the network. This value must be a multiply of 16. By default a safe value of 1024 is used. -=item B<-hevc> +=item B<-codec> [I] -Request a h265/HEVC from the server. -Will still use h264 if server doesn't support HEVC. - -=item B<-h264> - -Request a h264 from the server even if server and video decoder supports HEVC. +Select codec to use. +Can be 'auto', 'h264', 'h265' or 'hevc'. +Not all video decoders do support H.265/HEVC. +Will still use H.264 if server doesn't support HEVC. =item B<-remote> diff --git a/moonlight.conf b/moonlight.conf index ebdc59e..f3311c5 100644 --- a/moonlight.conf +++ b/moonlight.conf @@ -17,8 +17,8 @@ ## Size of network packets should be lower than MTU #packetsize = 1024 -## Use of h265/HEVC video codec -#hevc = false +## Select video codec (auto/h264/h265) +#codec = auto ## Default started application on host #app = Steam @@ -34,8 +34,8 @@ ## To use a different mapping then default another mapping should be declared above the input #input = /dev/input/event1 -## Stop GFE from changing graphical game settings for optimal performance and quality -#nosops = false +## Enable GFE for changing graphical game settings for optimal performance and quality +#sops = true ## Play audio on host instead of streaming to client #localaudio = false diff --git a/src/config.c b/src/config.c index 2d57250..9843375 100644 --- a/src/config.c +++ b/src/config.c @@ -62,8 +62,7 @@ static struct option long_options[] = { {"surround", no_argument, NULL, 'u'}, {"fps", required_argument, NULL, 'v'}, {"forcehw", no_argument, NULL, 'w'}, - {"hevc", no_argument, NULL, 'x'}, - {"h264", no_argument, NULL, 'z'}, + {"codec", required_argument, NULL, 'x'}, {"unsupported", no_argument, NULL, 'y'}, {0, 0, 0, 0}, }; @@ -198,10 +197,12 @@ static void parse_argument(int c, char* value, PCONFIGURATION config) { config->forcehw = true; break; case 'x': - config->codec = CODEC_HEVC; - break; - case 'z': - config->codec = CODEC_H264; + if (strcasecmp(value, "auto") == 0) + config->codec = CODEC_UNSPECIFIED; + else if (strcasecmp(value, "h264") == 0) + config->codec = CODEC_H264; + if (strcasecmp(value, "h265") == 0 || strcasecmp(value, "hevc") == 0) + config->codec = CODEC_HEVC; break; case 'y': config->unsupported_version = true; diff --git a/src/main.c b/src/main.c index 275e7b7..1881718 100644 --- a/src/main.c +++ b/src/main.c @@ -148,8 +148,7 @@ static void help() { printf("\t-height \tVertical resolution (default 720)\n"); printf("\t-bitrate \tSpecify the bitrate in Kbps\n"); printf("\t-packetsize \tSpecify the maximum packetsize in bytes\n"); - printf("\t-hevc\t\t\tUse the high efficiency video coding (HEVC)\n"); - printf("\t-h264\t\t\tUse the advanced video coding (H264)\n"); + printf("\t-codec \t\tSelect used codec auto/h264/h265 (default auto)\n"); printf("\t-remote\t\t\tEnable remote optimizations\n"); printf("\t-app \t\tName of app to stream\n"); printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n");