Multiple video backend in single executable

This commit is contained in:
Iwan Timmer
2015-05-14 14:36:58 +02:00
parent 5982631e07
commit c052190c2f
10 changed files with 95 additions and 21 deletions

View File

@@ -283,7 +283,7 @@ void client_pair(const char *address) {
http_request(url, data);
xml_search(data->memory, data->size, "pairingsecret", &result);
char *signature = NULL;
unsigned char *signature = NULL;
size_t s_len;
if (!sign_it(client_secret_data, 16, &signature, &s_len, privateKey)) {
fprintf(stderr, "Failed to sign data\n");

View File

@@ -64,6 +64,8 @@ static void stream(STREAM_CONFIGURATION* config, const char* address, const char
client_start_app(config, address, appId, sops, localaudio);
video_init();
struct addrinfo hints, *res;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;

54
src/video.c Normal file
View File

@@ -0,0 +1,54 @@
/*
* This file is part of Moonlight Embedded.
*
* Copyright (C) 2015 Iwan Timmer
*
* Moonlight is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Moonlight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Moonlight; if not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE
#include "video.h"
#include "limelight-common/Limelight.h"
#include <dlfcn.h>
#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_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;
}
}

View File

@@ -19,4 +19,14 @@
#include "limelight-common/Limelight.h"
extern DECODER_RENDERER_CALLBACKS decoder_callbacks;
extern DECODER_RENDERER_CALLBACKS *decoder_callbacks;
void video_init();
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_fake;
#ifdef HAVE_OMX
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_omx;
#endif
#ifdef HAVE_IMX
extern DECODER_RENDERER_CALLBACKS decoder_callbacks_omx;
#endif

View File

@@ -51,7 +51,7 @@ int decoder_renderer_submit_decode_unit(PDECODE_UNIT decodeUnit) {
return DR_OK;
}
DECODER_RENDERER_CALLBACKS decoder_callbacks = {
DECODER_RENDERER_CALLBACKS decoder_callbacks_fake = {
.setup = decoder_renderer_setup,
.start = decoder_renderer_start,
.stop = decoder_renderer_stop,

View File

@@ -430,7 +430,7 @@ static void decoder_renderer_release() {
vpu_UnInit();
}
DECODER_RENDERER_CALLBACKS decoder_callbacks = {
DECODER_RENDERER_CALLBACKS decoder_callbacks_imx = {
.setup = decoder_renderer_setup,
.start = decoder_renderer_start,
.stop = decoder_renderer_stop,

View File

@@ -229,7 +229,7 @@ static int decoder_renderer_submit_decode_unit(PDECODE_UNIT decodeUnit) {
return DR_OK;
}
DECODER_RENDERER_CALLBACKS decoder_callbacks = {
DECODER_RENDERER_CALLBACKS decoder_callbacks_omx = {
.setup = decoder_renderer_setup,
.start = decoder_renderer_start,
.stop = decoder_renderer_stop,