00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00027 #ifndef __context_h__
00028 #define __context_h__
00029
00030 #include <inttypes.h>
00031 #include <unistd.h>
00032 #include <stdlib.h>
00033
00034
00035
00036
00037 #include <SDL/SDL.h>
00038
00039
00040 #include <layer.h>
00041
00042
00043 #include <plugger.h>
00044 #include <screen.h>
00045 #include <shouter.h>
00046
00047 #include <factory.h>
00048 #include <config.h>
00049 #include <string>
00050
00051 class Controller;
00052
00053 class JsParser;
00054 class AudioCollector;
00055 class VideoEncoder;
00056
00057
00058 class FreejDaemon;
00059
00060 template <class T> class Linklist;
00061
00062
00063 #define MAX_HEIGHT 1024
00064 #define MAX_WIDTH 768
00065
00066 class Context {
00067 private:
00068 static bool factory_initialized;
00069
00070 uint64_t **doubletab;
00071 Uint8 *doublebuf;
00072 int dcy, cy, cx;
00073 uint64_t eax;
00074
00075
00076
00077 void handle_resize();
00078 void handle_controllers();
00079
00080 pthread_t cafudda_thread;
00081 bool running;
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 public:
00101
00102 Context();
00103 ~Context();
00104
00105 bool init();
00106
00107
00108 void cafudda(double secs);
00109
00110 void start();
00111 void start_threaded();
00112
00113 bool register_controller(Controller *ctrl);
00114 bool rem_controller(Controller *ctrl);
00115
00116 bool add_layer(Layer *lay);
00117 void rem_layer(Layer *lay);
00118
00119 bool add_encoder(VideoEncoder *enc);
00120
00121 void *coords(int x, int y);
00122
00123 int parse_js_cmd(const char *cmd);
00124
00125 int open_script(char *filename);
00126
00127 int reset();
00128
00129 bool config_check(const char *filename);
00130
00131 void resize(int w, int h);
00132
00133 bool quit;
00134
00135 bool pause;
00136
00137 bool save_to_file;
00138
00139 bool interactive;
00140
00141
00142
00143 SDL_Event event;
00144 bool poll_events;
00145
00146 bool add_screen(ViewPort *scr);
00147 Linklist<ViewPort> screens;
00148 ViewPort *screen;
00149
00150 Linklist<Controller> controllers;
00151
00152 Linklist<Filter> filters;
00153
00154 Linklist<Filter> generators;
00155
00156
00157
00158 Plugger plugger;
00159
00160 JsParser *js;
00161
00162 char main_javascript[512];
00163
00164
00165
00166 FPS fps;
00167 int fps_speed;
00168
00169 bool clear_all;
00170 bool start_running;
00171
00172 char *layers_description;
00173 char *screens_description;
00174
00175 Layer *open(char *file, int w = 0, int h = 0);
00176
00177 };
00178
00179 #endif