diff --git a/src/a.out b/src/a.out deleted file mode 100755 index 1449be5..0000000 Binary files a/src/a.out and /dev/null differ diff --git a/src/sdl/input.h b/src/sdl/input.h deleted file mode 100644 index e2831d4..0000000 --- a/src/sdl/input.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 . - */ - -#include -#include - -static const short keyCodes[] = { - 0x14, //SDLK_CAPSLOCK - 0x70, //SDLK_F1 - 0x71, //SDLK_F2 - 0x72, //SDLK_F3 - 0x73, //SDLK_F4 - 0x74, //SDLK_F5 - 0x75, //SDLK_F6 - 0x76, //SDLK_F7 - 0x77, //SDLK_F8 - 0x78, //SDLK_F9 - 0x79, //SDLK_F10 - 0x7A, //SDLK_F11 - 0x7B, //SDLK_F12 - 0, //SDLK_PRINTSCREEN - 0x91, //SDLK_SCROLLLOCK - 0x13, //SDLK_PAUSE - 0x9B, //SDLK_INSERT - 0x24, //SDLK_HOME - 0x21, //SDLK_PAGEUP - 0, //Not used - 0x23, //SDLK_END - 0x22, //SDLK_PAGEDOWN - 0x27, //SDLK_RIGHT - 0x25, //SDLK_LEFT - 0x28, //SDLK_DOWN - 0x26, //SDLK_UP -}; - -void sdlinput_init(); -int sdlinput_handle_event(SDL_Event* event); diff --git a/src/sdl/platform.c b/src/sdl/platform.c deleted file mode 100644 index 716513f..0000000 --- a/src/sdl/platform.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 . - */ - -#include "sdl.h" -#include "input.h" - -#include "limelight-common/Limelight.h" - -#include - -static bool done; -static int fullscreen_flags; - -SDL_Window *sdl_window; - -void sdl_init(int width, int height) { - if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS)) { - fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError()); - exit(1); - } - - sdl_window = SDL_CreateWindow("Moonlight", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, 0); - if(!sdl_window) { - fprintf(stderr, "SDL: could not create window - exiting\n"); - exit(1); - } - SDL_SetRelativeMouseMode(SDL_TRUE); - sdlinput_init(); -} - -void sdl_loop() { - SDL_Event event; - while(!done && SDL_WaitEvent(&event)) { - switch (sdlinput_handle_event(&event)) { - case SDL_QUIT_APPLICATION: - done = true; - break; - case SDL_TOGGLE_FULLSCREEN: - fullscreen_flags ^= SDL_WINDOW_FULLSCREEN; - SDL_SetWindowFullscreen(sdl_window, fullscreen_flags); - case SDL_MOUSE_GRAB: - SDL_SetRelativeMouseMode(SDL_TRUE); - break; - case SDL_MOUSE_UNGRAB: - SDL_SetRelativeMouseMode(SDL_FALSE); - break; - default: - if (event.type == SDL_QUIT) - done = true; - } - } - - SDL_DestroyWindow(sdl_window); - SDL_Quit(); -} diff --git a/src/sdl/sdl.h b/src/sdl/sdl.h deleted file mode 100644 index 0ec51d1..0000000 --- a/src/sdl/sdl.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 . - */ - -#include - -#define SDL_NOTHING 0 -#define SDL_QUIT_APPLICATION 1 -#define SDL_MOUSE_GRAB 2 -#define SDL_MOUSE_UNGRAB 3 -#define SDL_TOGGLE_FULLSCREEN 4 - -SDL_Window *sdl_window; - -void sdl_init(int width, int height); -void sdl_loop(); diff --git a/src/sdl/video.c b/src/sdl/video.c deleted file mode 100644 index 09e3eac..0000000 --- a/src/sdl/video.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 . - */ - -#include "../video/ffmpeg.h" - -#include "limelight-common/Limelight.h" - -#include -#include - -#define DECODER_BUFFER_SIZE 92*1024 - -static SDL_Window *window; -static SDL_Renderer *renderer; -static SDL_Texture *bmp = NULL; -static int screen_width, screen_height; -static char* ffmpeg_buffer; - -static void sdl_setup(int width, int height, int redrawRate, void* context, int drFlags) { - int avc_flags = FAST_BILINEAR_FILTERING; - if (ffmpeg_init(width, height, 2, avc_flags) < 0) { - fprintf(stderr, "Couldn't initialize video decoding\n"); - exit(1); - } - - ffmpeg_buffer = malloc(DECODER_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); - if (ffmpeg_buffer == NULL) { - fprintf(stderr, "Not enough memory\n"); - exit(1); - } - - SDL_Window *window = (SDL_Window*) context; - renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); - if (!renderer) { - fprintf(stderr, "SDL: could not create renderer - exiting\n"); - exit(1); - } - - bmp = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_TARGET, width, height); - if (!bmp) { - fprintf(stderr, "SDL: could not create texture - exiting\n"); - exit(1); - } -} - -static void sdl_cleanup() { - ffmpeg_destroy(); -} - -static int sdl_submit_decode_unit(PDECODE_UNIT decodeUnit) { - if (decodeUnit->fullLength < DECODER_BUFFER_SIZE) { - PLENTRY entry = decodeUnit->bufferList; - int length = 0; - while (entry != NULL) { - memcpy(ffmpeg_buffer+length, entry->data, entry->length); - length += entry->length; - entry = entry->next; - } - - int ret = ffmpeg_decode(ffmpeg_buffer, length); - if (ret == 1) { - AVFrame* frame = ffmpeg_get_frame(); - - SDL_UpdateYUVTexture(bmp, NULL, frame->data[0], frame->linesize[0], frame->data[1], frame->linesize[1], frame->data[2], frame->linesize[2]); - SDL_RenderClear(renderer); - SDL_RenderCopy(renderer, bmp, NULL, NULL); - SDL_RenderPresent(renderer); - } - } else { - fprintf(stderr, "Video decode buffer too small"); - exit(1); - } - - return DR_OK; -} - -DECODER_RENDERER_CALLBACKS decoder_callbacks_sdl = { - .setup = sdl_setup, - .cleanup = sdl_cleanup, - .submitDecodeUnit = sdl_submit_decode_unit, -};