diff --git a/src/main.c b/src/main.c index 912978e..0dd46ff 100644 --- a/src/main.c +++ b/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. + */ + +#ifdef HAVE_SDL + +#include +#include + +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 */ diff --git a/src/sdl.h b/src/sdl.h new file mode 100644 index 0000000..477bacf --- /dev/null +++ b/src/sdl.h @@ -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 . + */ + +#ifdef HAVE_SDL + +void sdl_loop(); + +#endif /* HAVE_SDL */