mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-04 00:36:01 +00:00
Add hardware acceleration force option
This commit is contained in:
parent
d582e2fa07
commit
72e649a66d
@ -62,6 +62,7 @@ static struct option long_options[] = {
|
||||
{"windowed", no_argument, NULL, 't'},
|
||||
{"surround", no_argument, NULL, 'u'},
|
||||
{"fps", required_argument, NULL, 'v'},
|
||||
{"forcehw", no_argument, NULL, 'w'},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
@ -196,6 +197,8 @@ static void parse_argument(int c, char* value, PCONFIGURATION config) {
|
||||
case 'v':
|
||||
config->stream.fps = atoi(value);
|
||||
break;
|
||||
case 'w':
|
||||
config->forcehw = true;
|
||||
case 1:
|
||||
if (config->action == NULL)
|
||||
config->action = value;
|
||||
@ -303,7 +306,7 @@ void config_parse(int argc, char* argv[], PCONFIGURATION config) {
|
||||
} else {
|
||||
int option_index = 0;
|
||||
int c;
|
||||
while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:no:p:q:r:s", long_options, &option_index)) != -1) {
|
||||
while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:no:p:q:r:stuv:w", long_options, &option_index)) != -1) {
|
||||
parse_argument(c, optarg, config);
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ typedef struct _CONFIGURATION {
|
||||
bool sops;
|
||||
bool localaudio;
|
||||
bool fullscreen;
|
||||
bool forcehw;
|
||||
struct input_config inputs[MAX_INPUTS];
|
||||
int inputsCount;
|
||||
} CONFIGURATION, *PCONFIGURATION;
|
||||
|
@ -89,6 +89,9 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys
|
||||
if (config->fullscreen)
|
||||
drFlags |= DISPLAY_FULLSCREEN;
|
||||
|
||||
if (config->forcehw)
|
||||
drFlags |= FORCE_HARDWARE_ACCELERATION;
|
||||
|
||||
printf("Stream %d x %d, %d fps, %d kbps\n", config->stream.width, config->stream.height, config->stream.fps, config->stream.bitrate);
|
||||
LiStartConnection(server->address, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), NULL, drFlags, server->serverMajorVersion);
|
||||
|
||||
@ -142,6 +145,7 @@ static void help() {
|
||||
printf("\t-mapping <file>\t\tUse <file> as gamepad mapping configuration file (use before -input)\n");
|
||||
printf("\t-input <device>\t\tUse <device> as input. Can be used multiple times\n");
|
||||
printf("\t-audio <device>\t\tUse <device> as ALSA audio output device (default sysdefault)\n");
|
||||
printf("\t-forcehw \t\tTry to use video hardware acceleration\n");
|
||||
#endif
|
||||
printf("\nUse Ctrl+Alt+Shift+Q to exit streaming session\n\n");
|
||||
exit(0);
|
||||
|
@ -18,3 +18,4 @@
|
||||
*/
|
||||
|
||||
#define DISPLAY_FULLSCREEN 1
|
||||
#define FORCE_HARDWARE_ACCELERATION 2
|
||||
|
@ -51,9 +51,11 @@ int ffmpeg_init(int width, int height, int perf_lvl, int thread_count) {
|
||||
av_init_packet(&pkt);
|
||||
|
||||
#ifdef HAVE_VDPAU
|
||||
if (perf_lvl & HARDWARE_ACCELERATION) {
|
||||
decoder = avcodec_find_decoder_by_name("h264_vdpau");
|
||||
if (decoder != NULL)
|
||||
decoder_system = VDPAU;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (decoder == NULL) {
|
||||
|
@ -31,6 +31,8 @@
|
||||
#define BILINEAR_FILTERING 0x10
|
||||
// Uses a faster bilinear filtering with lower image quality
|
||||
#define FAST_BILINEAR_FILTERING 0x20
|
||||
// Uses hardware acceleration
|
||||
#define HARDWARE_ACCELERATION 0x40
|
||||
|
||||
int ffmpeg_init(int width, int height, int perf_lvl, int thread_count);
|
||||
void ffmpeg_destroy(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user