mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-06-17 14:22:00 +00:00
Add beter video output detection
This commit is contained in:
+5
-14
@@ -27,28 +27,19 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
DECODER_RENDERER_CALLBACKS *decoder_callbacks;
|
DECODER_RENDERER_CALLBACKS *decoder_callbacks;
|
||||||
char* decoder_output_name;
|
|
||||||
|
|
||||||
static int decoder_level;
|
static int decoder_level;
|
||||||
|
|
||||||
void video_init() {
|
void video_init() {
|
||||||
decoder_callbacks = &decoder_callbacks_fake;
|
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
|
#ifdef HAVE_OMX
|
||||||
if (dlsym(RTLD_DEFAULT, "bcm_host_init") != NULL) {
|
if (dlsym(RTLD_DEFAULT, "bcm_host_init") != NULL) {
|
||||||
decoder_callbacks = &decoder_callbacks_omx;
|
decoder_callbacks = &decoder_callbacks_omx;
|
||||||
}
|
}
|
||||||
#endif
|
#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 "limelight-common/Limelight.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
extern DECODER_RENDERER_CALLBACKS *decoder_callbacks;
|
extern DECODER_RENDERER_CALLBACKS *decoder_callbacks;
|
||||||
|
|
||||||
void video_init();
|
void video_init();
|
||||||
@@ -29,4 +31,5 @@ extern DECODER_RENDERER_CALLBACKS decoder_callbacks_omx;
|
|||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_IMX
|
#ifdef HAVE_IMX
|
||||||
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_imx;
|
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_imx;
|
||||||
|
bool video_imx_init();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+4
-5
@@ -72,6 +72,10 @@ static int disp_clr_index = 0;
|
|||||||
static FrameBuffer *fb;
|
static FrameBuffer *fb;
|
||||||
static struct v4l2_buffer dbuf;
|
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) {
|
static void decoder_renderer_setup(int width, int height, int redrawRate, void* context, int drFlags) {
|
||||||
struct mxcfb_gbl_alpha alpha;
|
struct mxcfb_gbl_alpha alpha;
|
||||||
|
|
||||||
@@ -94,11 +98,6 @@ static void decoder_renderer_setup(int width, int height, int redrawRate, void*
|
|||||||
|
|
||||||
close(fd_fb);
|
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;
|
mem_desc.size = STREAM_BUF_SIZE;
|
||||||
if (IOGetPhyMem(&mem_desc)){
|
if (IOGetPhyMem(&mem_desc)){
|
||||||
fprintf(stderr, "Can't get physical memory address\n");
|
fprintf(stderr, "Can't get physical memory address\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user