mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-03 16:25:31 +00:00
Seperate main loop for SDL
This commit is contained in:
parent
2945c13181
commit
676f39e197
26
src/main.c
26
src/main.c
@ -24,6 +24,7 @@
|
||||
#include "audio.h"
|
||||
#include "discover.h"
|
||||
#include "platform.h"
|
||||
#include "sdl.h"
|
||||
|
||||
#include "input/evdev.h"
|
||||
#include "input/udev.h"
|
||||
@ -71,14 +72,14 @@ static void stream(STREAM_CONFIGURATION* config, const char* address, const char
|
||||
|
||||
client_start_app(config, address, appId, sops, localaudio);
|
||||
|
||||
evdev_init();
|
||||
#ifdef HAVE_LIBCEC
|
||||
cec_init();
|
||||
#endif /* HAVE_LIBCEC */
|
||||
|
||||
LiStartConnection(address, config, &connection_callbacks, platform_get_video(system), &audio_callbacks, NULL, NULL, 0, client_get_server_version());
|
||||
|
||||
loop_main();
|
||||
if (IS_EMBEDDED(system))
|
||||
loop_main();
|
||||
#ifdef HAVE_SDL
|
||||
else if (system == SDL)
|
||||
sdl_loop();
|
||||
#endif
|
||||
|
||||
LiStopConnection();
|
||||
}
|
||||
@ -303,10 +304,17 @@ int main(int argc, char* argv[]) {
|
||||
pair_check();
|
||||
applist(address);
|
||||
} else if (strcmp("stream", action) == 0) {
|
||||
udev_init(autoadd, mapping);
|
||||
pair_check();
|
||||
for (int i=0;i<inputsCount;i++)
|
||||
evdev_create(inputs[i].path, inputs[i].mapping);
|
||||
if (IS_EMBEDDED(system)) {
|
||||
for (int i=0;i<inputsCount;i++)
|
||||
evdev_create(inputs[i].path, inputs[i].mapping);
|
||||
|
||||
udev_init(autoadd, mapping);
|
||||
evdev_init();
|
||||
#ifdef HAVE_LIBCEC
|
||||
cec_init();
|
||||
#endif /* HAVE_LIBCEC */
|
||||
}
|
||||
|
||||
stream(&config, address, app, sops, localaudio, system);
|
||||
} else if (strcmp("pair", action) == 0)
|
||||
|
@ -19,7 +19,13 @@
|
||||
|
||||
#include "limelight-common/Limelight.h"
|
||||
|
||||
#define IS_EMBEDDED(SYSTEM) SYSTEM != SDL
|
||||
|
||||
enum platform { SDL, OMX, IMX, FAKE };
|
||||
|
||||
enum platform platform_check(char*);
|
||||
DECODER_RENDERER_CALLBACKS* platform_get_video(enum platform system);
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
void sdl_loop();
|
||||
#endif
|
||||
|
38
src/sdl.c
Normal file
38
src/sdl.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <SDL.h>
|
||||
|
||||
static bool done;
|
||||
|
||||
void sdl_loop() {
|
||||
SDL_Event event;
|
||||
|
||||
while(!done && SDL_WaitEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_QUIT:
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_SDL */
|
24
src/sdl.h
Normal file
24
src/sdl.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
void sdl_loop();
|
||||
|
||||
#endif /* HAVE_SDL */
|
Loading…
x
Reference in New Issue
Block a user