mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-03 00:06:06 +00:00
Clear framebuffer for both amlogic and pi
This commit is contained in:
parent
a0462e49b8
commit
c2036acca1
@ -109,6 +109,8 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys
|
|||||||
drFlags |= FORCE_HARDWARE_ACCELERATION;
|
drFlags |= FORCE_HARDWARE_ACCELERATION;
|
||||||
|
|
||||||
printf("Stream %d x %d, %d fps, %d kbps\n", config->stream.width, config->stream.height, config->stream.fps, config->stream.bitrate);
|
printf("Stream %d x %d, %d fps, %d kbps\n", config->stream.width, config->stream.height, config->stream.fps, config->stream.bitrate);
|
||||||
|
|
||||||
|
platform_start(system);
|
||||||
LiStartConnection(&server->serverInfo, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), NULL, drFlags);
|
LiStartConnection(&server->serverInfo, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), NULL, drFlags);
|
||||||
|
|
||||||
if (IS_EMBEDDED(system)) {
|
if (IS_EMBEDDED(system)) {
|
||||||
@ -122,6 +124,7 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
LiStopConnection();
|
LiStopConnection();
|
||||||
|
platform_stop(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void help() {
|
static void help() {
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#include "audio/audio.h"
|
#include "audio/audio.h"
|
||||||
#include "video/video.h"
|
#include "video/video.h"
|
||||||
|
|
||||||
@ -71,6 +73,38 @@ enum platform platform_check(char* name) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void platform_start(enum platform system) {
|
||||||
|
switch (system) {
|
||||||
|
#ifdef HAVE_AML
|
||||||
|
case AML:
|
||||||
|
blank_fb("/sys/class/graphics/fb0/blank", true);
|
||||||
|
blank_fb("/sys/class/graphics/fb1/blank", true);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_PI
|
||||||
|
case PI:
|
||||||
|
blank_fb("/sys/class/graphics/fb0/blank", true);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void platform_stop(enum platform system) {
|
||||||
|
switch (system) {
|
||||||
|
#ifdef HAVE_AML
|
||||||
|
case AML:
|
||||||
|
blank_fb("/sys/class/graphics/fb0/blank", false);
|
||||||
|
blank_fb("/sys/class/graphics/fb1/blank", false);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_PI
|
||||||
|
case PI:
|
||||||
|
blank_fb("/sys/class/graphics/fb0/blank", false);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DECODER_RENDERER_CALLBACKS* platform_get_video(enum platform system) {
|
DECODER_RENDERER_CALLBACKS* platform_get_video(enum platform system) {
|
||||||
switch (system) {
|
switch (system) {
|
||||||
#ifdef HAVE_X11
|
#ifdef HAVE_X11
|
||||||
|
@ -32,3 +32,6 @@ enum platform platform_check(char*);
|
|||||||
PDECODER_RENDERER_CALLBACKS platform_get_video(enum platform system);
|
PDECODER_RENDERER_CALLBACKS platform_get_video(enum platform system);
|
||||||
PAUDIO_RENDERER_CALLBACKS platform_get_audio(enum platform system);
|
PAUDIO_RENDERER_CALLBACKS platform_get_audio(enum platform system);
|
||||||
bool platform_supports_hevc(enum platform system);
|
bool platform_supports_hevc(enum platform system);
|
||||||
|
|
||||||
|
void platform_start(enum platform system);
|
||||||
|
void platform_stop(enum platform system);
|
||||||
|
39
src/util.c
Normal file
39
src/util.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Moonlight Embedded.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 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 "util.h"
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int blank_fb(char *path, bool clear) {
|
||||||
|
int fd = open(path, O_RDWR);
|
||||||
|
|
||||||
|
if(fd >= 0) {
|
||||||
|
int ret = write(fd, clear ? "1" : "0", 1);
|
||||||
|
if (ret < 0)
|
||||||
|
fprintf(stderr, "Failed to clear framebuffer %s: %d\n", path, ret);
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
return 0;
|
||||||
|
} else
|
||||||
|
return -1;
|
||||||
|
}
|
22
src/util.h
Normal file
22
src/util.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Moonlight Embedded.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 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 <stdbool.h>
|
||||||
|
|
||||||
|
int blank_fb(char *path, bool clear);
|
@ -35,29 +35,7 @@
|
|||||||
|
|
||||||
static codec_para_t codecParam = { 0 };
|
static codec_para_t codecParam = { 0 };
|
||||||
|
|
||||||
static int osd_blank(char *path,int cmd) {
|
|
||||||
int fd;
|
|
||||||
char bcmd[16];
|
|
||||||
|
|
||||||
fd = open(path, O_CREAT|O_RDWR | O_TRUNC, 0644);
|
|
||||||
|
|
||||||
if(fd>=0) {
|
|
||||||
sprintf(bcmd,"%d",cmd);
|
|
||||||
int ret = write(fd,bcmd,strlen(bcmd));
|
|
||||||
if (ret < 0) {
|
|
||||||
printf("osd_blank error during write: %x\n", ret);
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int aml_setup(int videoFormat, int width, int height, int redrawRate, void* context, int drFlags) {
|
int aml_setup(int videoFormat, int width, int height, int redrawRate, void* context, int drFlags) {
|
||||||
osd_blank("/sys/class/graphics/fb0/blank",1);
|
|
||||||
osd_blank("/sys/class/graphics/fb1/blank",0);
|
|
||||||
|
|
||||||
codecParam.stream_type = STREAM_TYPE_ES_VIDEO;
|
codecParam.stream_type = STREAM_TYPE_ES_VIDEO;
|
||||||
codecParam.has_video = 1;
|
codecParam.has_video = 1;
|
||||||
codecParam.noblock = 0;
|
codecParam.noblock = 0;
|
||||||
@ -108,9 +86,7 @@ int aml_setup(int videoFormat, int width, int height, int redrawRate, void* cont
|
|||||||
}
|
}
|
||||||
|
|
||||||
void aml_cleanup() {
|
void aml_cleanup() {
|
||||||
int api = codec_close(&codecParam);
|
codec_close(&codecParam);
|
||||||
osd_blank("/sys/class/graphics/fb0/blank",0);
|
|
||||||
osd_blank("/sys/class/graphics/fb1/blank",0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int aml_submit_decode_unit(PDECODE_UNIT decodeUnit) {
|
int aml_submit_decode_unit(PDECODE_UNIT decodeUnit) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user