summaryrefslogtreecommitdiffstats
path: root/noatun-plugins/tyler/main.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /noatun-plugins/tyler/main.cpp
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
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
Diffstat (limited to 'noatun-plugins/tyler/main.cpp')
-rw-r--r--noatun-plugins/tyler/main.cpp100
1 files changed, 100 insertions, 0 deletions
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 <charles@kde.org>
+// Copyright (C) 2001 Neil Stevens <neil@qualityassistant.com>
+//
+// 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 <kinstance.h>
+
+extern "C"
+{
+#include <SDL.h>
+#include <SDL_syswm.h>
+#include <SDL_thread.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+#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);
+}