mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-01 23:35:47 +00:00
Provide seperate platform option to enable VDPAU
This commit is contained in:
parent
819503dd4d
commit
c1b06dca75
@ -32,20 +32,19 @@ pkg_check_modules(CEC libcec>=3.0.0)
|
|||||||
pkg_check_modules(EGL egl)
|
pkg_check_modules(EGL egl)
|
||||||
pkg_check_modules(GLES glesv2)
|
pkg_check_modules(GLES glesv2)
|
||||||
|
|
||||||
|
set(VDPAU_FOUND FALSE)
|
||||||
|
set(SOFTWARE_FOUND FALSE)
|
||||||
|
|
||||||
if(AVCODEC_FOUND AND AVUTIL_FOUND)
|
if(AVCODEC_FOUND AND AVUTIL_FOUND)
|
||||||
if(EGL_FOUND AND GLES_FOUND AND XLIB_FOUND)
|
if(EGL_FOUND AND GLES_FOUND AND XLIB_FOUND)
|
||||||
set(X11_FOUND TRUE)
|
set(X11_FOUND TRUE)
|
||||||
|
if(XLIB_FOUND AND LIBVA_FOUND)
|
||||||
|
set(VDPAU_FOUND TRUE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FOUND OR X11_FOUND)
|
if(SDL_FOUND OR X11_FOUND)
|
||||||
set(SOFTWARE_FOUND TRUE)
|
set(SOFTWARE_FOUND TRUE)
|
||||||
if(XLIB_FOUND AND LIBVA_FOUND)
|
|
||||||
set(VDPAU_FOUND TRUE)
|
|
||||||
else()
|
|
||||||
set(VDPAU_FOUND FALSE)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
set(SOFTWARE_FOUND FALSE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET(MOONLIGHT_COMMON_INCLUDE_DIR ./third_party/moonlight-common-c/src)
|
SET(MOONLIGHT_COMMON_INCLUDE_DIR ./third_party/moonlight-common-c/src)
|
||||||
|
@ -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.
|
Display the stream in a window instead of fullscreen.
|
||||||
Only available when X11 or SDL platform is used.
|
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
|
=back
|
||||||
|
|
||||||
=head1 CONFIG FILE
|
=head1 CONFIG FILE
|
||||||
|
@ -61,7 +61,6 @@ static struct option long_options[] = {
|
|||||||
{"windowed", no_argument, NULL, 't'},
|
{"windowed", no_argument, NULL, 't'},
|
||||||
{"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'},
|
|
||||||
{"codec", required_argument, NULL, 'x'},
|
{"codec", required_argument, NULL, 'x'},
|
||||||
{"unsupported", no_argument, NULL, 'y'},
|
{"unsupported", no_argument, NULL, 'y'},
|
||||||
{0, 0, 0, 0},
|
{0, 0, 0, 0},
|
||||||
@ -193,9 +192,6 @@ static void parse_argument(int c, char* value, PCONFIGURATION config) {
|
|||||||
case 'v':
|
case 'v':
|
||||||
config->stream.fps = atoi(value);
|
config->stream.fps = atoi(value);
|
||||||
break;
|
break;
|
||||||
case 'w':
|
|
||||||
config->forcehw = true;
|
|
||||||
break;
|
|
||||||
case 'x':
|
case 'x':
|
||||||
if (strcasecmp(value, "auto") == 0)
|
if (strcasecmp(value, "auto") == 0)
|
||||||
config->codec = CODEC_UNSPECIFIED;
|
config->codec = CODEC_UNSPECIFIED;
|
||||||
@ -303,7 +299,6 @@ void config_parse(int argc, char* argv[], PCONFIGURATION config) {
|
|||||||
config->localaudio = false;
|
config->localaudio = false;
|
||||||
config->fullscreen = true;
|
config->fullscreen = true;
|
||||||
config->unsupported_version = false;
|
config->unsupported_version = false;
|
||||||
config->forcehw = false;
|
|
||||||
config->codec = CODEC_UNSPECIFIED;
|
config->codec = CODEC_UNSPECIFIED;
|
||||||
|
|
||||||
config->inputsCount = 0;
|
config->inputsCount = 0;
|
||||||
|
@ -38,7 +38,6 @@ typedef struct _CONFIGURATION {
|
|||||||
bool sops;
|
bool sops;
|
||||||
bool localaudio;
|
bool localaudio;
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool forcehw;
|
|
||||||
bool unsupported_version;
|
bool unsupported_version;
|
||||||
char* inputs[MAX_INPUTS];
|
char* inputs[MAX_INPUTS];
|
||||||
int inputsCount;
|
int inputsCount;
|
||||||
|
10
src/main.c
10
src/main.c
@ -105,9 +105,6 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys
|
|||||||
if (config->fullscreen)
|
if (config->fullscreen)
|
||||||
drFlags |= DISPLAY_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);
|
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);
|
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-surround\t\tStream 5.1 surround sound (requires GFE 2.7)\n");
|
||||||
printf("\t-keydir <directory>\tLoad encryption keys from directory\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-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");
|
printf("\t-unsupported\t\tTry streaming if GFE version is unsupported\n");
|
||||||
#if defined(HAVE_SDL) || defined(HAVE_X11)
|
#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-windowed\t\tDisplay screen in a window\n");
|
||||||
printf("\t-forcehw \t\tTry to use video hardware acceleration\n");
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_EMBEDDED
|
#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-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");
|
printf("\t-audio <device>\t\tUse <device> as audio output device\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,6 +62,10 @@ enum platform platform_check(char* name) {
|
|||||||
#ifdef HAVE_X11
|
#ifdef HAVE_X11
|
||||||
if (std || strcmp(name, "x11") == 0)
|
if (std || strcmp(name, "x11") == 0)
|
||||||
return X11;
|
return X11;
|
||||||
|
#ifdef HAVE_VDPAU
|
||||||
|
if (std || strcmp(name, "x11_vdpau") == 0)
|
||||||
|
return X11_VDPAU;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SDL
|
#ifdef HAVE_SDL
|
||||||
if (std || strcmp(name, "sdl") == 0)
|
if (std || strcmp(name, "sdl") == 0)
|
||||||
@ -110,6 +114,10 @@ DECODER_RENDERER_CALLBACKS* platform_get_video(enum platform system) {
|
|||||||
#ifdef HAVE_X11
|
#ifdef HAVE_X11
|
||||||
case X11:
|
case X11:
|
||||||
return &decoder_callbacks_x11;
|
return &decoder_callbacks_x11;
|
||||||
|
#ifdef HAVE_VDPAU
|
||||||
|
case X11_VDPAU:
|
||||||
|
return &decoder_callbacks_x11_vdpau;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SDL
|
#ifdef HAVE_SDL
|
||||||
case SDL:
|
case SDL:
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#define IS_EMBEDDED(SYSTEM) SYSTEM != SDL
|
#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*);
|
enum platform platform_check(char*);
|
||||||
PDECODER_RENDERER_CALLBACKS platform_get_video(enum platform system);
|
PDECODER_RENDERER_CALLBACKS platform_get_video(enum platform system);
|
||||||
|
@ -20,10 +20,13 @@
|
|||||||
#include <Limelight.h>
|
#include <Limelight.h>
|
||||||
|
|
||||||
#define DISPLAY_FULLSCREEN 1
|
#define DISPLAY_FULLSCREEN 1
|
||||||
#define FORCE_HARDWARE_ACCELERATION 2
|
#define ENABLE_HARDWARE_ACCELERATION 2
|
||||||
|
|
||||||
#ifdef HAVE_X11
|
#ifdef HAVE_X11
|
||||||
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_x11;
|
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_x11;
|
||||||
|
#ifdef HAVE_VDPAU
|
||||||
|
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_x11_vdpau;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SDL
|
#ifdef HAVE_SDL
|
||||||
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_sdl;
|
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_sdl;
|
||||||
|
@ -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 x11_setup(int videoFormat, int width, int height, int redrawRate, void* context, int drFlags) {
|
||||||
int avc_flags = SLICE_THREADING;
|
int avc_flags = SLICE_THREADING;
|
||||||
if (drFlags & FORCE_HARDWARE_ACCELERATION)
|
if (drFlags & ENABLE_HARDWARE_ACCELERATION)
|
||||||
avc_flags |= HARDWARE_ACCELERATION;
|
avc_flags |= HARDWARE_ACCELERATION;
|
||||||
|
|
||||||
ffmpeg_buffer = malloc(DECODER_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
|
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;
|
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() {
|
void x11_cleanup() {
|
||||||
ffmpeg_destroy();
|
ffmpeg_destroy();
|
||||||
egl_destroy();
|
egl_destroy();
|
||||||
@ -147,3 +151,10 @@ DECODER_RENDERER_CALLBACKS decoder_callbacks_x11 = {
|
|||||||
.submitDecodeUnit = x11_submit_decode_unit,
|
.submitDecodeUnit = x11_submit_decode_unit,
|
||||||
.capabilities = CAPABILITY_SLICES_PER_FRAME(4) | CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC | CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC | CAPABILITY_DIRECT_SUBMIT,
|
.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,
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user