mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-08-17 00:46:13 +00:00
Fix several build warnings and minor bugs
This commit is contained in:
parent
56f84ab662
commit
098f53cd0b
@ -5,6 +5,8 @@ SET(CMAKE_C_STANDARD 99)
|
|||||||
include(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake)
|
include(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/generate_version_header.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/generate_version_header.cmake)
|
||||||
|
|
||||||
|
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-pointer-sign -Wno-sign-compare -Wno-switch)
|
||||||
|
|
||||||
aux_source_directory(./src SRC_LIST)
|
aux_source_directory(./src SRC_LIST)
|
||||||
list(APPEND SRC_LIST ./src/input/evdev.c ./src/input/mapping.c ./src/input/udev.c)
|
list(APPEND SRC_LIST ./src/input/evdev.c ./src/input/mapping.c ./src/input/udev.c)
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ int gs_unpair(PSERVER_DATA server) {
|
|||||||
int gs_pair(PSERVER_DATA server, char* pin) {
|
int gs_pair(PSERVER_DATA server, char* pin) {
|
||||||
int ret = GS_OK;
|
int ret = GS_OK;
|
||||||
char* result = NULL;
|
char* result = NULL;
|
||||||
char url[4096];
|
char url[5120];
|
||||||
uuid_t uuid;
|
uuid_t uuid;
|
||||||
char uuid_str[UUID_STRLEN];
|
char uuid_str[UUID_STRLEN];
|
||||||
|
|
||||||
@ -701,10 +701,8 @@ int gs_start_app(PSERVER_DATA server, STREAM_CONFIGURATION *config, int appId, b
|
|||||||
|
|
||||||
PDISPLAY_MODE mode = server->modes;
|
PDISPLAY_MODE mode = server->modes;
|
||||||
bool correct_mode = false;
|
bool correct_mode = false;
|
||||||
bool supported_resolution = false;
|
|
||||||
while (mode != NULL) {
|
while (mode != NULL) {
|
||||||
if (mode->width == config->width && mode->height == config->height) {
|
if (mode->width == config->width && mode->height == config->height) {
|
||||||
supported_resolution = true;
|
|
||||||
if (mode->refresh == config->fps)
|
if (mode->refresh == config->fps)
|
||||||
correct_mode = true;
|
correct_mode = true;
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,6 @@
|
|||||||
|
|
||||||
static CURL *curl;
|
static CURL *curl;
|
||||||
|
|
||||||
static const char *pCertFile = "./client.pem";
|
|
||||||
static const char *pKeyFile = "./key.pem";
|
|
||||||
|
|
||||||
static bool debug;
|
static bool debug;
|
||||||
|
|
||||||
static size_t _write_curl(void *contents, size_t size, size_t nmemb, void *userp)
|
static size_t _write_curl(void *contents, size_t size, size_t nmemb, void *userp)
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#define STATUS_OK 200
|
#define STATUS_OK 200
|
||||||
|
|
||||||
static XML_Parser parser;
|
|
||||||
|
|
||||||
struct xml_query {
|
struct xml_query {
|
||||||
char *memory;
|
char *memory;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -240,12 +240,14 @@ void *HandleMouseEmulation(void* param)
|
|||||||
deltaY = pow((float)rawY / 32767.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3);
|
deltaY = pow((float)rawY / 32767.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3);
|
||||||
|
|
||||||
// Enforce deadzones
|
// Enforce deadzones
|
||||||
deltaX = abs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0;
|
deltaX = fabs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0;
|
||||||
deltaY = abs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0;
|
deltaY = fabs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0;
|
||||||
|
|
||||||
if (deltaX != 0 || deltaY != 0)
|
if (deltaX != 0 || deltaY != 0)
|
||||||
LiSendMouseMoveEvent(deltaX, -deltaY);
|
LiSendMouseMoveEvent(deltaX, -deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool evdev_handle_event(struct input_event *ev, struct input_device *dev) {
|
static bool evdev_handle_event(struct input_event *ev, struct input_device *dev) {
|
||||||
@ -923,7 +925,7 @@ void evdev_map(char* device) {
|
|||||||
buf += sprintf(buf, "%02x", ((unsigned char*) guid)[i]);
|
buf += sprintf(buf, "%02x", ((unsigned char*) guid)[i]);
|
||||||
|
|
||||||
struct mapping map;
|
struct mapping map;
|
||||||
strncpy(map.name, libevdev_get_name(evdev), sizeof(map.name));
|
strncpy(map.name, name, sizeof(map.name));
|
||||||
strncpy(map.guid, str_guid, sizeof(map.guid));
|
strncpy(map.guid, str_guid, sizeof(map.guid));
|
||||||
|
|
||||||
libevdev_free(evdev);
|
libevdev_free(evdev);
|
||||||
|
@ -36,7 +36,6 @@ static struct mapping* defaultMappings;
|
|||||||
|
|
||||||
static struct udev *udev;
|
static struct udev *udev;
|
||||||
static struct udev_monitor *udev_mon;
|
static struct udev_monitor *udev_mon;
|
||||||
static int udev_fd;
|
|
||||||
static int inputRotate;
|
static int inputRotate;
|
||||||
|
|
||||||
static int udev_handle(int fd) {
|
static int udev_handle(int fd) {
|
||||||
|
@ -381,7 +381,7 @@ int main(int argc, char* argv[]) {
|
|||||||
if (config.pin > 0 && config.pin <= 9999) {
|
if (config.pin > 0 && config.pin <= 9999) {
|
||||||
sprintf(pin, "%04d", config.pin);
|
sprintf(pin, "%04d", config.pin);
|
||||||
} else {
|
} else {
|
||||||
sprintf(pin, "%d%d%d%d", (int)random() % 10, (int)random() % 10, (int)random() % 10, (int)random() % 10);
|
sprintf(pin, "%d%d%d%d", (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10);
|
||||||
}
|
}
|
||||||
printf("Please enter the following PIN on the target PC: %s\n", pin);
|
printf("Please enter the following PIN on the target PC: %s\n", pin);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -82,6 +82,7 @@ void sdl_loop() {
|
|||||||
case SDL_TOGGLE_FULLSCREEN:
|
case SDL_TOGGLE_FULLSCREEN:
|
||||||
fullscreen_flags ^= SDL_WINDOW_FULLSCREEN;
|
fullscreen_flags ^= SDL_WINDOW_FULLSCREEN;
|
||||||
SDL_SetWindowFullscreen(window, fullscreen_flags);
|
SDL_SetWindowFullscreen(window, fullscreen_flags);
|
||||||
|
break;
|
||||||
case SDL_MOUSE_GRAB:
|
case SDL_MOUSE_GRAB:
|
||||||
SDL_ShowCursor(SDL_ENABLE);
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||||
|
@ -143,7 +143,6 @@ void egl_init(EGLNativeDisplayType native_display, NativeWindowType native_windo
|
|||||||
GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
||||||
glShaderSource(vertex_shader, 1, &vertex_source, NULL);
|
glShaderSource(vertex_shader, 1, &vertex_source, NULL);
|
||||||
glCompileShader(vertex_shader);
|
glCompileShader(vertex_shader);
|
||||||
GLint maxLength = 0;
|
|
||||||
|
|
||||||
GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
|
GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
glShaderSource(fragment_shader, 1, &fragment_source, NULL);
|
glShaderSource(fragment_shader, 1, &fragment_source, NULL);
|
||||||
|
@ -65,6 +65,7 @@ int vaapi_init_lib() {
|
|||||||
int vaapi_init(AVCodecContext* decoder_ctx) {
|
int vaapi_init(AVCodecContext* decoder_ctx) {
|
||||||
decoder_ctx->get_format = va_get_format;
|
decoder_ctx->get_format = va_get_format;
|
||||||
decoder_ctx->get_buffer2 = va_get_buffer;
|
decoder_ctx->get_buffer2 = va_get_buffer;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vaapi_queue(AVFrame* dec_frame, Window win, int width, int height) {
|
void vaapi_queue(AVFrame* dec_frame, Window win, int width, int height) {
|
||||||
|
9
third_party/h264bitstream/h264_stream.c
vendored
9
third_party/h264bitstream/h264_stream.c
vendored
@ -32,7 +32,8 @@
|
|||||||
|
|
||||||
FILE* h264_dbgfile = NULL;
|
FILE* h264_dbgfile = NULL;
|
||||||
|
|
||||||
#define printf(...) fprintf((h264_dbgfile == NULL ? stdout : h264_dbgfile), __VA_ARGS__)
|
void fake_printf(int, ...) {}
|
||||||
|
#define printf(...) fake_printf(0, __VA_ARGS__)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Calculate the log base 2 of the argument, rounded up.
|
Calculate the log base 2 of the argument, rounded up.
|
||||||
@ -554,7 +555,7 @@ void read_pic_parameter_set_rbsp(h264_stream_t* h, bs_t* b)
|
|||||||
if( 1 ) { have_more_data = more_rbsp_data(h, b); }
|
if( 1 ) { have_more_data = more_rbsp_data(h, b); }
|
||||||
if( 0 )
|
if( 0 )
|
||||||
{
|
{
|
||||||
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | pps->second_chroma_qp_index_offset != 0;
|
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | (pps->second_chroma_qp_index_offset != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( have_more_data )
|
if( have_more_data )
|
||||||
@ -1441,7 +1442,7 @@ void write_pic_parameter_set_rbsp(h264_stream_t* h, bs_t* b)
|
|||||||
if( 0 ) { have_more_data = more_rbsp_data(h, b); }
|
if( 0 ) { have_more_data = more_rbsp_data(h, b); }
|
||||||
if( 1 )
|
if( 1 )
|
||||||
{
|
{
|
||||||
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | pps->second_chroma_qp_index_offset != 0;
|
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | (pps->second_chroma_qp_index_offset != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( have_more_data )
|
if( have_more_data )
|
||||||
@ -2328,7 +2329,7 @@ void read_debug_pic_parameter_set_rbsp(h264_stream_t* h, bs_t* b)
|
|||||||
if( 1 ) { have_more_data = more_rbsp_data(h, b); }
|
if( 1 ) { have_more_data = more_rbsp_data(h, b); }
|
||||||
if( 0 )
|
if( 0 )
|
||||||
{
|
{
|
||||||
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | pps->second_chroma_qp_index_offset != 0;
|
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | (pps->second_chroma_qp_index_offset != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( have_more_data )
|
if( have_more_data )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user