Make OMX optional

This commit is contained in:
Iwan Timmer
2015-05-10 18:32:06 +02:00
parent 59d710c95f
commit 93ec5c2df2
3 changed files with 94 additions and 20 deletions

View File

@@ -3,30 +3,38 @@ cmake_minimum_required(VERSION 3.2)
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
aux_source_directory(./common/limelight-common SRC_LIST)
aux_source_directory(./common/limelight-common/OpenAES SRC_LIST)
aux_source_directory(./ilclient SRC_LIST)
aux_source_directory(./h264bitstream SRC_LIST)
aux_source_directory(./src SRC_LIST)
aux_source_directory(./common/limelight-common SRC_LIST)
aux_source_directory(./common/limelight-common/OpenAES SRC_LIST)
include_directories(./common)
include_directories(./ilclient ./h264bitstream)
find_package(Threads REQUIRED)
find_package(CURL REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(EXPAT REQUIRED)
find_package(ALSA REQUIRED)
find_package(Opus REQUIRED)
find_package(Broadcom)
find_package(PkgConfig REQUIRED)
pkg_check_modules(EVDEV REQUIRED libevdev)
if(Broadcom_FOUND)
aux_source_directory(./ilclient SRC_LIST)
aux_source_directory(./h264bitstream SRC_LIST)
include_directories(./ilclient ./h264bitstream ${BROADCOM_INCLUDE_DIRS})
target_link_libraries (moonlight PUBLIC ${BROADCOM_LIBRARIES})
set_property(TARGET moonlight PROPERTY COMPILE_DEFINITIONS ${BROADCOM_DEFINITIONS})
list(APPEND SRC_LIST ./src/video/omx.c)
else()
list(APPEND SRC_LIST ./src/video/fake.c)
endif()
add_executable(moonlight ${SRC_LIST})
set_property(TARGET moonlight PROPERTY C_STANDARD 11)
find_package(Threads)
find_package(CURL)
find_package(OpenSSL)
find_package(EXPAT)
find_package(ALSA)
find_package(Opus)
find_package(Broadcom)
find_package(PkgConfig REQUIRED)
pkg_check_modules(EVDEV libevdev)
include_directories(./moonlight-common-c ${OPUS_INCLUDE_DIRS} ${EVDEV_INCLUDE_DIRS} ${BROADCOM_INCLUDE_DIRS})
target_link_libraries (moonlight PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXPAT_LIBRARIES} ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY} ${BROADCOM_LIBRARIES})
set_property(TARGET moonlight PROPERTY COMPILE_DEFINITIONS ${BROADCOM_DEFINITIONS})
include_directories(./moonlight-common-c ${OPUS_INCLUDE_DIRS} ${EVDEV_INCLUDE_DIRS})
target_link_libraries (moonlight PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXPAT_LIBRARIES} ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY})

66
src/video/fake.c Normal file
View File

@@ -0,0 +1,66 @@
/*
* 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/>.
*/
#include "../video.h"
#include <stdio.h>
static FILE* fd;
static const char* fileName = "fake.h264";
static h264_stream_t* stream;
void decoder_renderer_setup(int width, int height, int redrawRate, void* context, int drFlags) {
printf("decoder_renderer_setup %dx%d %dfps\n", width, height, redrawRate);
fd = fopen(fileName, "w");
stream = h264_new();
if (stream == NULL) {
fprintf(stderr, "Not enough memory\n");
exit(EXIT_FAILURE);
}
}
void decoder_renderer_start() {
printf("decoder_renderer_start\n");
}
void decoder_renderer_stop() {
printf("decoder_renderer_stop\n");
}
void decoder_renderer_release() {
printf("decoder_renderer_release\n");
fclose(fd);
}
int decoder_renderer_submit_decode_unit(PDECODE_UNIT decodeUnit) {
while (entry != NULL) {
fwrite(entry->data, entry->length, 1, fd);
entry = entry->next;
}
return DR_OK;
}
DECODER_RENDERER_CALLBACKS decoder_callbacks = {
.setup = decoder_renderer_setup,
.start = decoder_renderer_start,
.stop = decoder_renderer_stop,
.release = decoder_renderer_release,
.submitDecodeUnit = decoder_renderer_submit_decode_unit,
};