Provide seperate platform option to enable VDPAU

This commit is contained in:
Iwan Timmer 2017-06-10 15:42:53 +02:00
parent 819503dd4d
commit c1b06dca75
9 changed files with 34 additions and 28 deletions

View File

@ -32,20 +32,19 @@ pkg_check_modules(CEC libcec>=3.0.0)
pkg_check_modules(EGL egl)
pkg_check_modules(GLES glesv2)
set(VDPAU_FOUND FALSE)
set(SOFTWARE_FOUND FALSE)
if(AVCODEC_FOUND AND AVUTIL_FOUND)
if(EGL_FOUND AND GLES_FOUND AND XLIB_FOUND)
set(X11_FOUND TRUE)
if(XLIB_FOUND AND LIBVA_FOUND)
set(VDPAU_FOUND TRUE)
endif()
endif()
if(SDL_FOUND OR X11_FOUND)
set(SOFTWARE_FOUND TRUE)
if(XLIB_FOUND AND LIBVA_FOUND)
set(VDPAU_FOUND TRUE)
else()
set(VDPAU_FOUND FALSE)
endif()
endif()
else()
set(SOFTWARE_FOUND FALSE)
endif()
SET(MOONLIGHT_COMMON_INCLUDE_DIR ./third_party/moonlight-common-c/src)

View File

@ -148,11 +148,6 @@ The default value is 'sysdefault' for ALSA and 'hdmi' for OMX on the Raspberry P
Display the stream in a window instead of fullscreen.
Only available when X11 or SDL platform is used.
=item B<-forcehw>
This will enable unsupported hardware acceleration.
Currently only VDPAU when using X11 or SDL is unsupported.
=back
=head1 CONFIG FILE

View File

@ -61,7 +61,6 @@ 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'},
{"codec", required_argument, NULL, 'x'},
{"unsupported", no_argument, NULL, 'y'},
{0, 0, 0, 0},
@ -193,9 +192,6 @@ static void parse_argument(int c, char* value, PCONFIGURATION config) {
case 'v':
config->stream.fps = atoi(value);
break;
case 'w':
config->forcehw = true;
break;
case 'x':
if (strcasecmp(value, "auto") == 0)
config->codec = CODEC_UNSPECIFIED;
@ -303,7 +299,6 @@ void config_parse(int argc, char* argv[], PCONFIGURATION config) {
config->localaudio = false;
config->fullscreen = true;
config->unsupported_version = false;
config->forcehw = false;
config->codec = CODEC_UNSPECIFIED;
config->inputsCount = 0;

View File

@ -38,7 +38,6 @@ typedef struct _CONFIGURATION {
bool sops;
bool localaudio;
bool fullscreen;
bool forcehw;
bool unsupported_version;
char* inputs[MAX_INPUTS];
int inputsCount;

View File

@ -105,9 +105,6 @@ 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);
platform_start(system);
@ -157,15 +154,14 @@ static void help() {
printf("\t-surround\t\tStream 5.1 surround sound (requires GFE 2.7)\n");
printf("\t-keydir <directory>\tLoad encryption keys from directory\n");
printf("\t-mapping <file>\t\tUse <file> as gamepad mappings configuration file\n");
printf("\t-platform <system>\tSpecify system used for audio, video and input: pi/imx/aml/x11/sdl (default auto)\n");
printf("\t-platform <system>\tSpecify system used for audio, video and input: pi/imx/aml/x11/x11_vdpau/sdl (default auto)\n");
printf("\t-unsupported\t\tTry streaming if GFE version is unsupported\n");
#if defined(HAVE_SDL) || defined(HAVE_X11)
printf("\n Video options (SDL and X11 only)\n\n");
printf("\n WM options (SDL and X11 only)\n\n");
printf("\t-windowed\t\tDisplay screen in a window\n");
printf("\t-forcehw \t\tTry to use video hardware acceleration\n");
#endif
#ifdef HAVE_EMBEDDED
printf("\n I/O options (PI, IMX, AML and X11 only)\n\n");
printf("\n I/O options (Not for SDL)\n\n");
printf("\t-input <device>\t\tUse <device> as input. Can be used multiple times\n");
printf("\t-audio <device>\t\tUse <device> as audio output device\n");
#endif

View File

@ -62,6 +62,10 @@ enum platform platform_check(char* name) {
#ifdef HAVE_X11
if (std || strcmp(name, "x11") == 0)
return X11;
#ifdef HAVE_VDPAU
if (std || strcmp(name, "x11_vdpau") == 0)
return X11_VDPAU;
#endif
#endif
#ifdef HAVE_SDL
if (std || strcmp(name, "sdl") == 0)
@ -110,6 +114,10 @@ DECODER_RENDERER_CALLBACKS* platform_get_video(enum platform system) {
#ifdef HAVE_X11
case X11:
return &decoder_callbacks_x11;
#ifdef HAVE_VDPAU
case X11_VDPAU:
return &decoder_callbacks_x11_vdpau;
#endif
#endif
#ifdef HAVE_SDL
case SDL:

View File

@ -26,7 +26,7 @@
#define IS_EMBEDDED(SYSTEM) SYSTEM != SDL
enum platform { NONE, SDL, X11, PI, IMX, AML, FAKE };
enum platform { NONE, SDL, X11, X11_VDPAU, PI, IMX, AML, FAKE };
enum platform platform_check(char*);
PDECODER_RENDERER_CALLBACKS platform_get_video(enum platform system);

View File

@ -20,10 +20,13 @@
#include <Limelight.h>
#define DISPLAY_FULLSCREEN 1
#define FORCE_HARDWARE_ACCELERATION 2
#define ENABLE_HARDWARE_ACCELERATION 2
#ifdef HAVE_X11
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_x11;
#ifdef HAVE_VDPAU
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_x11_vdpau;
#endif
#endif
#ifdef HAVE_SDL
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_sdl;

View File

@ -52,7 +52,7 @@ static int frame_handle(int pipefd) {
int x11_setup(int videoFormat, int width, int height, int redrawRate, void* context, int drFlags) {
int avc_flags = SLICE_THREADING;
if (drFlags & FORCE_HARDWARE_ACCELERATION)
if (drFlags & ENABLE_HARDWARE_ACCELERATION)
avc_flags |= HARDWARE_ACCELERATION;
ffmpeg_buffer = malloc(DECODER_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
@ -113,6 +113,10 @@ int x11_setup(int videoFormat, int width, int height, int redrawRate, void* cont
return 0;
}
int x11_setup_vdpau(int videoFormat, int width, int height, int redrawRate, void* context, int drFlags) {
x11_setup(videoFormat, width, height, redrawRate, context, drFlags | ENABLE_HARDWARE_ACCELERATION);
}
void x11_cleanup() {
ffmpeg_destroy();
egl_destroy();
@ -147,3 +151,10 @@ DECODER_RENDERER_CALLBACKS decoder_callbacks_x11 = {
.submitDecodeUnit = x11_submit_decode_unit,
.capabilities = CAPABILITY_SLICES_PER_FRAME(4) | CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC | CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC | CAPABILITY_DIRECT_SUBMIT,
};
DECODER_RENDERER_CALLBACKS decoder_callbacks_x11_vdpau = {
.setup = x11_setup_vdpau,
.cleanup = x11_cleanup,
.submitDecodeUnit = x11_submit_decode_unit,
.capabilities = CAPABILITY_DIRECT_SUBMIT,
};