Make Amlogic decoder a plugin

This commit is contained in:
Iwan Timmer 2016-03-14 17:43:29 +01:00
parent 0cab1f890a
commit ecf1c544ec
3 changed files with 14 additions and 19 deletions

View File

@ -52,13 +52,6 @@ elseif(NOT AMLOGIC_FOUND AND NOT BROADCOM_FOUND AND NOT FREESCALE_FOUND AND NOT
message(FATAL_ERROR "No video output available")
endif()
if (AMLOGIC_FOUND)
set(SOFTWARE_FOUND FALSE)
list(APPEND SRC_LIST ./src/video/aml.c)
list(APPEND MOONLIGHT_DEFINITIONS HAVE_AML)
list(APPEND MOONLIGHT_OPTIONS AML)
endif()
if (SOFTWARE_FOUND)
list(APPEND SRC_LIST ./src/video/ffmpeg.c ./src/video/sdl.c ./src/audio/sdl.c)
list(APPEND MOONLIGHT_DEFINITIONS HAVE_SDL)
@ -101,10 +94,11 @@ endif()
if(AMLOGIC_FOUND)
list(APPEND MOONLIGHT_DEFINITIONS HAVE_AML)
list(APPEND MOONLIGHT_OPTIONS AML)
target_include_directories(moonlight PRIVATE ${AMLOGIC_INCLUDE_DIRS} ${GAMESTREAM_INCLUDE_DIR} ${MOONLIGHT_COMMON_INCLUDE_DIR})
target_link_libraries(moonlight gamestream ${AMLOGIC_LIBRARIES})
set_property(TARGET moonlight PROPERTY COMPILE_DEFINITIONS ${AMLOGIC_DEFINITIONS})
install(TARGETS moonlight DESTINATION ${CMAKE_INSTALL_LIBDIR})
add_library(moonlight-aml SHARED ./src/video/aml.c ${ILCLIENT_SRC_LIST})
target_include_directories(moonlight-aml PRIVATE ${AMLOGIC_INCLUDE_DIRS} ${GAMESTREAM_INCLUDE_DIR} ${MOONLIGHT_COMMON_INCLUDE_DIR})
target_link_libraries(moonlight-aml gamestream ${AMLOGIC_LIBRARIES})
set_property(TARGET moonlight-aml PROPERTY COMPILE_DEFINITIONS ${AMLOGIC_DEFINITIONS})
install(TARGETS moonlight-aml DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(BROADCOM_FOUND)

View File

@ -25,6 +25,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dlfcn.h>
typedef bool(*ImxInit)();
@ -48,14 +49,17 @@ enum platform platform_check(char* name) {
return PI;
}
#endif
#ifdef HAVE_AML
if (std || strcmp(name, "aml") == 0) {
void *handle = dlopen("libmoonlight-aml.so", RTLD_NOW | RTLD_GLOBAL);
if (handle != NULL && access("/dev/amvideo", F_OK) != -1)
return AML;
}
#endif
#ifdef HAVE_SDL
if (std || strcmp(name, "sdl") == 0)
return SDL;
#endif
#ifdef HAVE_AML
if (std || strcmp(name, "aml") == 0)
return AML;
#endif
#ifdef HAVE_FAKE
if (std || strcmp(name, "fake") == 0)
return FAKE;
@ -79,7 +83,7 @@ DECODER_RENDERER_CALLBACKS* platform_get_video(enum platform system) {
#endif
#ifdef HAVE_AML
case AML:
return &decoder_callbacks_aml;
return (PDECODER_RENDERER_CALLBACKS) dlsym(RTLD_DEFAULT, "decoder_callbacks_aml");
#endif
#ifdef HAVE_FAKE
case FAKE:

View File

@ -31,9 +31,6 @@ enum platform platform_check(char*);
PDECODER_RENDERER_CALLBACKS platform_get_video(enum platform system);
PAUDIO_RENDERER_CALLBACKS platform_get_audio(enum platform system);
#ifdef HAVE_AML
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_aml;
#endif
#ifdef HAVE_FAKE
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_fake;
#endif