mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-08-18 01:15:59 +00:00
Add beter video output detection
This commit is contained in:
parent
09461caaf9
commit
70764b6c51
19
src/video.c
19
src/video.c
@ -27,28 +27,19 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
DECODER_RENDERER_CALLBACKS *decoder_callbacks;
|
||||
char* decoder_output_name;
|
||||
|
||||
static int decoder_level;
|
||||
|
||||
void video_init() {
|
||||
decoder_callbacks = &decoder_callbacks_fake;
|
||||
#ifdef HAVE_IMX
|
||||
if (dlsym(RTLD_DEFAULT, "vpu_Init") != NULL && video_imx_init()) {
|
||||
decoder_callbacks = &decoder_callbacks_imx;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_OMX
|
||||
if (dlsym(RTLD_DEFAULT, "bcm_host_init") != NULL) {
|
||||
decoder_callbacks = &decoder_callbacks_omx;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_IMX
|
||||
if (dlsym(RTLD_DEFAULT, "vpu_Init") != NULL) {
|
||||
decoder_callbacks = &decoder_callbacks_imx;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int video_add_output(int level, char* name, DECODER_RENDERER_CALLBACKS *callbacks) {
|
||||
if (level > decoder_level) {
|
||||
decoder_output_name = name;
|
||||
decoder_level = level;
|
||||
decoder_callbacks = callbacks;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "limelight-common/Limelight.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
extern DECODER_RENDERER_CALLBACKS *decoder_callbacks;
|
||||
|
||||
void video_init();
|
||||
@ -29,4 +31,5 @@ extern DECODER_RENDERER_CALLBACKS decoder_callbacks_omx;
|
||||
#endif
|
||||
#ifdef HAVE_IMX
|
||||
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_imx;
|
||||
bool video_imx_init();
|
||||
#endif
|
||||
|
@ -72,6 +72,10 @@ static int disp_clr_index = 0;
|
||||
static FrameBuffer *fb;
|
||||
static struct v4l2_buffer dbuf;
|
||||
|
||||
bool video_imx_init() {
|
||||
return vpu_Init(NULL) == RETCODE_SUCCESS;
|
||||
}
|
||||
|
||||
static void decoder_renderer_setup(int width, int height, int redrawRate, void* context, int drFlags) {
|
||||
struct mxcfb_gbl_alpha alpha;
|
||||
|
||||
@ -94,11 +98,6 @@ static void decoder_renderer_setup(int width, int height, int redrawRate, void*
|
||||
|
||||
close(fd_fb);
|
||||
|
||||
if (vpu_Init(NULL) != RETCODE_SUCCESS){
|
||||
fprintf(stderr, "Can't intialize VPU\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
mem_desc.size = STREAM_BUF_SIZE;
|
||||
if (IOGetPhyMem(&mem_desc)){
|
||||
fprintf(stderr, "Can't get physical memory address\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user