From 84da08d7b7fcda12c85caeb5a10b4903770a6f69 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- noatun-plugins/tyler/main.cpp | 100 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 noatun-plugins/tyler/main.cpp (limited to 'noatun-plugins/tyler/main.cpp') diff --git a/noatun-plugins/tyler/main.cpp b/noatun-plugins/tyler/main.cpp new file mode 100644 index 0000000..219c6ed --- /dev/null +++ b/noatun-plugins/tyler/main.cpp @@ -0,0 +1,100 @@ +// Copyright (C) 2000 Julien Carme +// Copyright (C) 2001 Charles Samuels +// Copyright (C) 2001 Neil Stevens +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2, as +// published by the Free Software Foundation. +// +// This program 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 this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +#include + +extern "C" +{ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "renderer.h" +#include "display.h" +} + +// stuff in main.h +extern "C" +{ +typedef struct t_config { + int xres,yres,sres; + int teff,tcol; +} t_config; + +t_config config = {512, 352, 1, 100, 100}; +//t_config config = {640, 480, 1, 100, 100}; + +bool finished; +SDL_Thread *thread; +SDL_mutex *synchro_mutex, *access_mutex; +short pcm_data[2][512]; +SDL_Surface *screen; +} + +int winID(void) +{ + SDL_SysWMinfo info; + info.version.major = SDL_MAJOR_VERSION; + info.subsystem = SDL_SYSWM_X11; + + SDL_GetWMInfo(&info); + return info.info.x11.wmwindow; +} + +int main(int, char **) +{ + fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL) & ~O_NONBLOCK); + + atexit(SDL_Quit); + + KInstance in("noatuntyler"); + + finished = false; + access_mutex = SDL_CreateMutex(); + + init_renderer1(); + printf("%u\n", winID()); + fflush(stdout); + init_renderer2(); + thread = SDL_CreateThread((int (*)(void *))renderer, NULL); + + fd_set set; + struct timeval tv; + while(check_finished() != 1) + { + FD_ZERO(&set); + FD_SET(STDIN_FILENO, &set); + tv.tv_sec = 0; + tv.tv_usec = 250; + if(0 < select(STDIN_FILENO + 1, &set, 0, 0, &tv)) + { + SDL_mutexP(access_mutex); + read(STDIN_FILENO, (void *)pcm_data, sizeof(short) * 2 * 512); + SDL_mutexV(access_mutex); + } + usleep(5); + } + /*fprintf(stderr,"exiting main()\n");*/ + SDL_WaitThread(thread, NULL); +} -- cgit v1.2.3