Allow specifying which codec to use

This commit is contained in:
Iwan Timmer 2016-04-08 13:23:05 +02:00
parent 9cd90276cb
commit e9811d8505
4 changed files with 18 additions and 5 deletions

View File

@ -99,11 +99,15 @@ Change the network packetsize to I<PACKETSIZE>.
The packetsize should the smaller than the MTU of the network. The packetsize should the smaller than the MTU of the network.
By default a safe value of 1024 is used. By default a safe value of 1024 is used.
=item B<-forcehevc> =item B<-hevc>
Request a h265/HEVC from the server. Request a h265/HEVC from the server.
Will still use h264 if server doesn't support HEVC. 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.
=item B<-remote> =item B<-remote>
Enable the optimizations for remote connections in GFE. Enable the optimizations for remote connections in GFE.

View File

@ -64,7 +64,8 @@ static struct option long_options[] = {
{"surround", no_argument, NULL, 'u'}, {"surround", no_argument, NULL, 'u'},
{"fps", required_argument, NULL, 'v'}, {"fps", required_argument, NULL, 'v'},
{"forcehw", no_argument, NULL, 'w'}, {"forcehw", no_argument, NULL, 'w'},
{"forcehevc", no_argument, NULL, 'x'}, {"hevc", no_argument, NULL, 'x'},
{"h264", no_argument, NULL, 'z'},
{"unsupported", no_argument, NULL, 'y'}, {"unsupported", no_argument, NULL, 'y'},
{0, 0, 0, 0}, {0, 0, 0, 0},
}; };
@ -204,7 +205,10 @@ static void parse_argument(int c, char* value, PCONFIGURATION config) {
config->forcehw = true; config->forcehw = true;
break; break;
case 'x': case 'x':
config->stream.supportsHevc = true; config->codec = CODEC_HEVC;
break;
case 'z':
config->codec = CODEC_H264;
break; break;
case 'y': case 'y':
config->unsupported_version = true; config->unsupported_version = true;
@ -302,6 +306,7 @@ void config_parse(int argc, char* argv[], PCONFIGURATION config) {
config->fullscreen = true; config->fullscreen = true;
config->unsupported_version = false; config->unsupported_version = false;
config->forcehw = false; config->forcehw = false;
config->codec = CODEC_UNSPECIFIED;
config->inputsCount = 0; config->inputsCount = 0;
config->mapping = get_path("mappings/default.conf", getenv("XDG_DATA_DIRS")); config->mapping = get_path("mappings/default.conf", getenv("XDG_DATA_DIRS"));

View File

@ -23,6 +23,8 @@
#define MAX_INPUTS 6 #define MAX_INPUTS 6
enum codecs { CODEC_UNSPECIFIED, CODEC_H264, CODEC_HEVC };
struct input_config { struct input_config {
char* path; char* path;
char* mapping; char* mapping;
@ -44,6 +46,7 @@ typedef struct _CONFIGURATION {
bool unsupported_version; bool unsupported_version;
struct input_config inputs[MAX_INPUTS]; struct input_config inputs[MAX_INPUTS];
int inputsCount; int inputsCount;
enum codecs codec;
} CONFIGURATION, *PCONFIGURATION; } CONFIGURATION, *PCONFIGURATION;
bool inputAdded; bool inputAdded;

View File

@ -138,7 +138,8 @@ static void help() {
printf("\t-60fps\t\t\tUse 60fps [default]\n"); printf("\t-60fps\t\t\tUse 60fps [default]\n");
printf("\t-bitrate <bitrate>\tSpecify the bitrate in Kbps\n"); printf("\t-bitrate <bitrate>\tSpecify the bitrate in Kbps\n");
printf("\t-packetsize <size>\tSpecify the maximum packetsize in bytes\n"); printf("\t-packetsize <size>\tSpecify the maximum packetsize in bytes\n");
printf("\t-forcehevc\t\tUse high efficiency video decoding (HEVC)\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-remote\t\t\tEnable remote optimizations\n"); printf("\t-remote\t\t\tEnable remote optimizations\n");
printf("\t-app <app>\t\tName of app to stream\n"); printf("\t-app <app>\t\tName of app to stream\n");
printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n"); printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n");
@ -181,7 +182,7 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "Platform '%s' not found\n", config.platform); fprintf(stderr, "Platform '%s' not found\n", config.platform);
exit(-1); exit(-1);
} }
config.stream.supportsHevc = config.stream.supportsHevc || platform_supports_hevc(system); config.stream.supportsHevc = config.codec != CODEC_H264 && (config.codec == CODEC_HEVC || platform_supports_hevc(system));
if (strcmp("map", config.action) == 0) { if (strcmp("map", config.action) == 0) {
if (config.address == NULL) { if (config.address == NULL) {