1 | #ifndef STRUCT_H |
---|
2 | #define STRUCT_H |
---|
3 | |
---|
4 | #define _GNU_SOURCE |
---|
5 | |
---|
6 | #ifdef SIMULATE |
---|
7 | #include <mcheck.h> |
---|
8 | #endif |
---|
9 | |
---|
10 | #include <stdio.h> |
---|
11 | #include <stdlib.h> |
---|
12 | #include <stdint.h> |
---|
13 | #include <string.h> |
---|
14 | #include <libgen.h> |
---|
15 | #include <fcntl.h> |
---|
16 | #include <ctype.h> |
---|
17 | #include <linux/fb.h> |
---|
18 | #include <sys/ioctl.h> |
---|
19 | #include <sys/mman.h> |
---|
20 | #include <bpamem.h> |
---|
21 | #include <png.h> |
---|
22 | #include <jpeglib.h> |
---|
23 | #include <libmmeimage.h> |
---|
24 | #include <libintl.h> |
---|
25 | #include <locale.h> |
---|
26 | #include <math.h> |
---|
27 | #include <linux/input.h> |
---|
28 | #include <sys/wait.h> |
---|
29 | #include <time.h> |
---|
30 | #include <dirent.h> |
---|
31 | #include <fnmatch.h> |
---|
32 | #include <dlfcn.h> |
---|
33 | #include <pthread.h> |
---|
34 | #include <linux/dvb/frontend.h> |
---|
35 | #include <linux/dvb/dmx.h> |
---|
36 | #include <linux/dvb/audio.h> |
---|
37 | #include <linux/dvb/video.h> |
---|
38 | #include <sys/vfs.h> |
---|
39 | #include <inttypes.h> |
---|
40 | #include <sys/socket.h> |
---|
41 | #include <sys/un.h> |
---|
42 | #include <unistd.h> |
---|
43 | #include <zlib.h> |
---|
44 | #include <net/if.h> |
---|
45 | #include <netinet/in.h> |
---|
46 | #include <arpa/inet.h> |
---|
47 | #include <netdb.h> |
---|
48 | #include <errno.h> |
---|
49 | #include <linux/dvb/version.h> |
---|
50 | #include <setjmp.h> |
---|
51 | #include <sys/mount.h> |
---|
52 | #include <execinfo.h> |
---|
53 | #include <ifaddrs.h> |
---|
54 | #include <linux/dvb/ca.h> |
---|
55 | #include <poll.h> |
---|
56 | |
---|
57 | #ifndef SIMULATE |
---|
58 | #include <linux/stmfb.h> |
---|
59 | #endif |
---|
60 | |
---|
61 | //for freetype |
---|
62 | #include <ft2build.h> |
---|
63 | #include FT_FREETYPE_H |
---|
64 | #include FT_CACHE_H |
---|
65 | |
---|
66 | //for eplayer |
---|
67 | #ifdef EPLAYER3 |
---|
68 | #include <common.h> |
---|
69 | #endif |
---|
70 | |
---|
71 | #ifdef EPLAYER4 |
---|
72 | #include <gst/gst.h> |
---|
73 | #include <gst/pbutils/missing-plugins.h> |
---|
74 | #endif |
---|
75 | |
---|
76 | #define VERSION "1.2" |
---|
77 | #define PROGNAME "titan" |
---|
78 | #define COPYRIGHT "NIT" |
---|
79 | #define CRONTRIBUT "obi, black, dvboxer, oxygen, gost" |
---|
80 | |
---|
81 | #define _(x) gettext(x) |
---|
82 | #define MINMALLOC 4096 |
---|
83 | #define SCROLLBARWIDTH 15 |
---|
84 | #define SCROLLBARBORDERSIZE 1 |
---|
85 | #define FONTPOSYOFFSET -3 |
---|
86 | #define FB "fb0" |
---|
87 | #define FB1 "fb1" |
---|
88 | #define SKINFB "skinfb" |
---|
89 | #define ACCELFB "accelfb" |
---|
90 | #define CONFIGFILE PROGNAME".cfg" |
---|
91 | #define KILLPROG "killall -9 "PROGNAME |
---|
92 | #define REBOOT "init 6" |
---|
93 | #define FILELISTDELMARK 255 |
---|
94 | #define PLUGINDELMARK 254 |
---|
95 | #define MAXDVBADAPTER 2 |
---|
96 | #define MAXFRONTENDDEV 4 |
---|
97 | #define MAXDEMUXDEV 4 |
---|
98 | #define MAXDEMUXDEVOPEN 10 |
---|
99 | #define MAXAUDIODEV 4 |
---|
100 | #define MAXVIDEODEV 4 |
---|
101 | #define MAXCIDEV 4 |
---|
102 | #define MAXCADEV 4 |
---|
103 | #define MAXDVRDEV 4 |
---|
104 | #define RCTIMEOUT 999999 |
---|
105 | #define RCTHREADSTANDBY 999998 |
---|
106 | #define MAXSERVICETYPE 10 |
---|
107 | #define TSSIZE 188 |
---|
108 | #define CHANNELCACHEMAX 1000 |
---|
109 | #define MAXHTTPDCONN 20 |
---|
110 | #define MAXHTMLLINE 300 |
---|
111 | #define LISTHASHSIZE 27 |
---|
112 | #define MAXCASESSION 16 |
---|
113 | |
---|
114 | //CA Defines |
---|
115 | #define T_SB 0x80 //sb (h<--m) |
---|
116 | #define T_RCV 0x81 //receive (h-->m) |
---|
117 | #define T_CREATE_T_C 0x82 //create transport connection (h-->m) |
---|
118 | #define T_C_T_C_REPLY 0x83 //ctc reply (h<--m) |
---|
119 | #define T_DELETE_T_C 0x84 //delete tc (h<->m) |
---|
120 | #define T_D_T_C_REPLY 0x85 //dtc reply (h<->m) |
---|
121 | #define T_REQUEST_T_C 0x86 //request transport connection (h<--m) |
---|
122 | #define T_NEW_T_C 0x87 //new tc - reply to t_request (h-->m) |
---|
123 | #define T_T_C_ERROR 0x77 //error creating tc (h-->m) |
---|
124 | #define T_DATA_LAST 0xA0 //convey data from higher (h<->m) |
---|
125 | #define T_DATA_MORE 0xA1 //convey data from higher (h<->m) |
---|
126 | |
---|
127 | // VFD icons supported (more or less) on all boxes: |
---|
128 | typedef enum { VFD_USB = 0x10, VFD_HD, VFD_HDD, VFD_LOCK, VFD_BT, VFD_MP3, VFD_MUSIC, VFD_DD, VFD_MAIL, VFD_MUTE, VFD_PLAY, VFD_PAUSE, VFD_FF, VFD_FR, VFD_REC, VFD_CLOCK } vfdicons; |
---|
129 | |
---|
130 | #define MIN(a,b) (a < b ? a : b) |
---|
131 | #define MAX(a,b) (a > b ? a : b) |
---|
132 | |
---|
133 | #define bcdtoint(i) ((((i & 0xf0) >> 4) * 10) + (i & 0x0f)) |
---|
134 | |
---|
135 | #define alpha_composite(composite, fg, alpha, bg) { \ |
---|
136 | unsigned short temp = ((unsigned short)(fg)*(unsigned short)(alpha) + \ |
---|
137 | (unsigned short)(bg)*(unsigned short)(255 - (unsigned short)(alpha)) + \ |
---|
138 | (unsigned short)128); \ |
---|
139 | (composite) = (unsigned char)((temp + (temp >> 8)) >> 8); } |
---|
140 | |
---|
141 | enum {LEFT=20000, CENTER, RIGHT}; |
---|
142 | enum {TOP=20000, MIDDLE, BOTTOM}; |
---|
143 | enum {BOTTOMLEFT, BOTTOMRIGHT, TOPLEFT, TOPRIGHT}; |
---|
144 | enum {LEFTRIGHT=1, TOPBOTTOM, LEFTMIDDLE, TOPMIDDLE}; |
---|
145 | enum {NO, YES, AUTONO, AUTOYES}; |
---|
146 | enum {UNDEF, LISTBOX, TEXTBOX, CHOICEBOX, INPUTBOX, INPUTBOXNUM, FILELIST, PROGRESSBAR, MENU, MULTIPROGRESSBAR, GRID, GRIDBR, TEXTBOXGRIDBR}; |
---|
147 | enum {FRONTENDDEV, DEMUXDEV, VIDEODEV, AUDIODEV, CADEV, CIDEV, FRONTENDDEVDUMMY, DVRDEV}; |
---|
148 | enum {TV, RADIO}; |
---|
149 | enum {RECDIRECT, RECTIMER, RECTIMESHIFT, RECSTREAM, RECPLAY}; |
---|
150 | enum {AC3 = 0, MPEGA = 1, DTS = 2, LPCM = 6, AAC = 8, AACHE = 9}; |
---|
151 | enum {MPEGV = 0, MPEG4V = 4, H264 = 1}; |
---|
152 | enum {ALLCHANNEL, SATCHANNEL, PROVIDERCHANNEL, AZCHANNEL, BOUQUETCHANNEL, SATLIST, PROVIDERLIST, AZLIST, MAINBOUQUETLIST}; |
---|
153 | enum {NOMODE, MVMODE, RMMODE, CPMODE, PROTECTMODE}; |
---|
154 | enum {NOTHING, CHANNEL, STILLPIC, RECORDDIRECT, RECORDTIMER, RECORDTIMESHIFT, RECORDSTREAM, TMPOTHER, RECORDPLAY}; |
---|
155 | enum {START, PAUSE, STOP}; |
---|
156 | enum {DEACTIVE, ACTIVE, INPAUSE, ERROR}; |
---|
157 | enum {FUNCTEXT, FUNCPIC, FUNCPROGRESS}; |
---|
158 | enum {CASESSIONCREATE, CASESSIONBUSY, CASESSIONDEL, CASESSIONSTART, CASESSIONFINAL, CARESFIRSTENQUIRY, CARESCHANGE, CARESENQUIRY, CADATETIMESEND, CAMMIIDLE, CAMMIDISPLAYREPLAY, CAMMIFAKEOK}; |
---|
159 | |
---|
160 | struct queue |
---|
161 | { |
---|
162 | //0-99 for ca module |
---|
163 | int type; |
---|
164 | int flag; |
---|
165 | int len; |
---|
166 | void* data; |
---|
167 | struct queue* prev; |
---|
168 | struct queue* next; |
---|
169 | }; |
---|
170 | |
---|
171 | struct casession |
---|
172 | { |
---|
173 | int inuse; |
---|
174 | int sessionnr; |
---|
175 | int action; |
---|
176 | int state; |
---|
177 | }; |
---|
178 | |
---|
179 | struct caslot |
---|
180 | { |
---|
181 | struct casession casession[MAXCASESSION]; |
---|
182 | int connid; |
---|
183 | int poll; |
---|
184 | int status; |
---|
185 | int rlen; |
---|
186 | unsigned char* rbuf; |
---|
187 | char* name; |
---|
188 | int fastrun; |
---|
189 | int mmimanager; |
---|
190 | int mmiopen; |
---|
191 | int camanager; |
---|
192 | int datetimemanager; |
---|
193 | int appmanager; |
---|
194 | int resmanager; |
---|
195 | char* caids; |
---|
196 | }; |
---|
197 | |
---|
198 | struct hdd |
---|
199 | { |
---|
200 | char* device; |
---|
201 | int partition; |
---|
202 | unsigned long size; |
---|
203 | char* filesystem; |
---|
204 | char* label; |
---|
205 | char* uuid; |
---|
206 | char* vendor; |
---|
207 | char* model; |
---|
208 | int removable; |
---|
209 | struct hdd* prev; |
---|
210 | struct hdd* next; |
---|
211 | }; |
---|
212 | |
---|
213 | struct scaninfo |
---|
214 | { |
---|
215 | struct dvbdev* fenode; |
---|
216 | struct transponder* tpnode; |
---|
217 | struct skin* scanscreen; |
---|
218 | struct skin* listbox; |
---|
219 | int threadend; |
---|
220 | int scantype; |
---|
221 | int fetype; |
---|
222 | int orbitalpos; |
---|
223 | int timeout; |
---|
224 | int onlyfree; |
---|
225 | int clear; |
---|
226 | char* satname; |
---|
227 | int tpcount; |
---|
228 | int tvcount; |
---|
229 | int newtvcount; |
---|
230 | int radiocount; |
---|
231 | int newradiocount; |
---|
232 | int datacount; |
---|
233 | int newdatacount; |
---|
234 | } scaninfo; |
---|
235 | |
---|
236 | struct screensaver |
---|
237 | { |
---|
238 | int type; |
---|
239 | int speed; |
---|
240 | int newposx; |
---|
241 | int newposy; |
---|
242 | struct skin* screen; |
---|
243 | struct skin* screennode; |
---|
244 | struct skin* filelist; |
---|
245 | struct skin* aktnode; |
---|
246 | struct pic* pic; |
---|
247 | char* value; |
---|
248 | }; |
---|
249 | |
---|
250 | struct playlist |
---|
251 | { |
---|
252 | char* file; |
---|
253 | struct playlist* prev; |
---|
254 | struct playlist* next; |
---|
255 | }; |
---|
256 | |
---|
257 | struct mainplaylist |
---|
258 | { |
---|
259 | char* name; |
---|
260 | char* filename; |
---|
261 | struct playlist* playlist; |
---|
262 | struct mainplaylist* prev; |
---|
263 | struct mainplaylist* next; |
---|
264 | }; |
---|
265 | |
---|
266 | struct epgrecord |
---|
267 | { |
---|
268 | time_t begin; |
---|
269 | time_t end; |
---|
270 | int posx; |
---|
271 | int size; |
---|
272 | struct epgrecord* prev; |
---|
273 | struct epgrecord* next; |
---|
274 | }; |
---|
275 | |
---|
276 | struct download |
---|
277 | { |
---|
278 | char* host; |
---|
279 | char* page; |
---|
280 | int port; |
---|
281 | char* filename; |
---|
282 | int connfd; |
---|
283 | int proz; |
---|
284 | unsigned int maxkb; |
---|
285 | unsigned int aktkb; |
---|
286 | int ret; |
---|
287 | }; |
---|
288 | |
---|
289 | struct epgscanlist |
---|
290 | { |
---|
291 | int serviceid; |
---|
292 | unsigned long transponderid; |
---|
293 | time_t scantime; |
---|
294 | struct epgscanlist* prev; |
---|
295 | struct epgscanlist* next; |
---|
296 | }; |
---|
297 | |
---|
298 | struct rgba |
---|
299 | { |
---|
300 | char r; |
---|
301 | char g; |
---|
302 | char b; |
---|
303 | char a; |
---|
304 | }; |
---|
305 | |
---|
306 | struct subclutentry |
---|
307 | { |
---|
308 | unsigned char Y, Cr, Cb, T; |
---|
309 | unsigned char valid; |
---|
310 | }; |
---|
311 | |
---|
312 | struct subclut |
---|
313 | { |
---|
314 | unsigned char clutid; |
---|
315 | unsigned char clutversionnumber; |
---|
316 | struct subclutentry entries2bit[4]; |
---|
317 | struct subclutentry entries4bit[16]; |
---|
318 | struct subclutentry entries8bit[256]; |
---|
319 | struct subclut *next; |
---|
320 | }; |
---|
321 | |
---|
322 | struct subpagereg |
---|
323 | { |
---|
324 | int regid; |
---|
325 | int reghorizontaladdress; |
---|
326 | int regverticaladdress; |
---|
327 | int scaleposx, scaleposy; |
---|
328 | struct subpagereg *next; |
---|
329 | }; |
---|
330 | |
---|
331 | struct subregobj |
---|
332 | { |
---|
333 | int objid; |
---|
334 | int objtype; |
---|
335 | int objproviderflag; |
---|
336 | int objhorizontalpos; |
---|
337 | int objverticalpos; |
---|
338 | // not supported right now... |
---|
339 | int foregroundpixel; |
---|
340 | int backgroundpixel; |
---|
341 | struct subregobj *next; |
---|
342 | }; |
---|
343 | |
---|
344 | struct subreg |
---|
345 | { |
---|
346 | int regid; |
---|
347 | int versionnumber; |
---|
348 | int height, width; |
---|
349 | int scaleheight, scalewidth; |
---|
350 | int depth; |
---|
351 | unsigned char *buf; |
---|
352 | struct rgba *palette; |
---|
353 | int clutid; |
---|
354 | int committed; |
---|
355 | struct subregobj *objects; |
---|
356 | struct subreg *next; |
---|
357 | }; |
---|
358 | |
---|
359 | struct subpage |
---|
360 | { |
---|
361 | int pageid; |
---|
362 | time_t pagetimeout; |
---|
363 | int pageversionnumber; |
---|
364 | int state; |
---|
365 | int pcssize; |
---|
366 | struct subpagereg *pageregions; |
---|
367 | struct subreg *regions; |
---|
368 | struct subclut *cluts; |
---|
369 | struct subpage *next; |
---|
370 | }; |
---|
371 | |
---|
372 | struct bitstream |
---|
373 | { |
---|
374 | unsigned char *data; |
---|
375 | int size; |
---|
376 | int avail; |
---|
377 | int consumed; |
---|
378 | }; |
---|
379 | |
---|
380 | //there are a copyrectimer function |
---|
381 | //if you change the struct you must change this funktion |
---|
382 | struct rectimer |
---|
383 | { |
---|
384 | char* name; |
---|
385 | time_t begin; |
---|
386 | time_t end; |
---|
387 | int repeate; |
---|
388 | int afterevent; |
---|
389 | char* pincode; |
---|
390 | int disabled; |
---|
391 | int justplay; |
---|
392 | char* recpath; |
---|
393 | int servicetype; |
---|
394 | char* channellist; |
---|
395 | int serviceid; |
---|
396 | //0 = nothing |
---|
397 | //1 = running |
---|
398 | //2 = end |
---|
399 | //3 = error |
---|
400 | int status; |
---|
401 | char* errstr; |
---|
402 | struct service* servicenode; |
---|
403 | unsigned long transponderid; |
---|
404 | struct rectimer *prev; |
---|
405 | struct rectimer *next; |
---|
406 | }; |
---|
407 | |
---|
408 | struct inetwork |
---|
409 | { |
---|
410 | int id; |
---|
411 | char* device; |
---|
412 | char* ip; |
---|
413 | char* netmask; |
---|
414 | char* mac; |
---|
415 | char* broadcast; |
---|
416 | int dhcp; |
---|
417 | struct inetwork *prev; |
---|
418 | struct inetwork *next; |
---|
419 | }; |
---|
420 | |
---|
421 | struct rcmap |
---|
422 | { |
---|
423 | char* name; |
---|
424 | int key; |
---|
425 | int newkey; |
---|
426 | struct rcmap* next; |
---|
427 | }; |
---|
428 | |
---|
429 | struct splitstr |
---|
430 | { |
---|
431 | char* part; |
---|
432 | }; |
---|
433 | |
---|
434 | struct channelcache |
---|
435 | { |
---|
436 | int serviceid; |
---|
437 | unsigned long transponderid; |
---|
438 | struct channel* chnode; |
---|
439 | struct channelcache* next; |
---|
440 | }; |
---|
441 | |
---|
442 | struct filelist |
---|
443 | { |
---|
444 | int type; |
---|
445 | char* name; |
---|
446 | char* shortname; |
---|
447 | char* path; |
---|
448 | char* imdbpath; |
---|
449 | off64_t size; |
---|
450 | time_t date; |
---|
451 | }; |
---|
452 | |
---|
453 | struct skin |
---|
454 | { |
---|
455 | char* name; |
---|
456 | uint8_t type; |
---|
457 | uint8_t wrap; |
---|
458 | uint8_t bordersize; |
---|
459 | uint8_t scrollbar; |
---|
460 | uint16_t halign; |
---|
461 | uint16_t valign; |
---|
462 | int16_t posx; |
---|
463 | int16_t posy; |
---|
464 | int16_t width; |
---|
465 | int16_t height; |
---|
466 | long bordercol; |
---|
467 | long deaktivcol; |
---|
468 | long shadowcol; |
---|
469 | uint8_t shadowsize; |
---|
470 | uint8_t shadowpos; |
---|
471 | uint8_t fontsize; |
---|
472 | uint8_t fontsize2; |
---|
473 | long fontcol; |
---|
474 | long fontcol2; |
---|
475 | char* font; |
---|
476 | int16_t zorder; |
---|
477 | int16_t titlealign; |
---|
478 | char* title; |
---|
479 | char* text; |
---|
480 | char* text2; |
---|
481 | long bgcol; |
---|
482 | long bgcol2; |
---|
483 | long titlebgcol; |
---|
484 | long titlebgcol2; |
---|
485 | long progresscol; |
---|
486 | char* pic; |
---|
487 | int16_t picwidth; |
---|
488 | int16_t picheight; |
---|
489 | uint16_t hspace; |
---|
490 | uint16_t vspace; |
---|
491 | char* (*skinfunc)(void*, void*); |
---|
492 | char* param1; |
---|
493 | char* param2; |
---|
494 | char* parent; |
---|
495 | char* input; |
---|
496 | char* mask; |
---|
497 | uint16_t textposx; |
---|
498 | uint16_t textposx2; |
---|
499 | int16_t gradient; |
---|
500 | int16_t titlegradient; |
---|
501 | uint8_t transparent; |
---|
502 | uint8_t hidden; |
---|
503 | uint8_t funcrettype; |
---|
504 | int8_t charspace; |
---|
505 | int8_t bordertype; |
---|
506 | int16_t borderradius; |
---|
507 | uint16_t bgspace; |
---|
508 | |
---|
509 | uint8_t titlesize; |
---|
510 | struct filelist* filelist; |
---|
511 | struct skin* parentpointer; |
---|
512 | char* ret; |
---|
513 | char* choiceboxvalue; |
---|
514 | unsigned int linecount; |
---|
515 | unsigned int pagecount; |
---|
516 | unsigned int poscount; |
---|
517 | unsigned int gridcol; |
---|
518 | int aktpage; |
---|
519 | int aktline; |
---|
520 | uint8_t scrollbarbordersize; |
---|
521 | uint8_t prozposx; |
---|
522 | uint8_t prozposy; |
---|
523 | uint8_t prozwidth; |
---|
524 | uint8_t prozheight; |
---|
525 | uint8_t picprozwidth; |
---|
526 | uint8_t del; |
---|
527 | uint8_t picprozheight; |
---|
528 | int16_t scrollbarheight; |
---|
529 | int16_t progresssize; |
---|
530 | int16_t scrollbarwidth; |
---|
531 | int16_t scrollbarpos; |
---|
532 | int16_t rposx; |
---|
533 | int16_t rposy; |
---|
534 | int16_t rwidth; |
---|
535 | int16_t rheight; |
---|
536 | int16_t rpicwidth; |
---|
537 | int16_t rpicheight; |
---|
538 | int16_t iposx; |
---|
539 | int16_t iposy; |
---|
540 | int16_t iwidth; |
---|
541 | int16_t iheight; |
---|
542 | char* handle; |
---|
543 | char* handle1; |
---|
544 | struct epgrecord* epgrecord; |
---|
545 | char* pluginhandle; |
---|
546 | struct skin *select; |
---|
547 | struct skin *child; |
---|
548 | struct skin *prev; |
---|
549 | struct skin *next; |
---|
550 | }; |
---|
551 | |
---|
552 | struct epg |
---|
553 | { |
---|
554 | int eventid; |
---|
555 | int version; |
---|
556 | time_t starttime; |
---|
557 | time_t endtime; |
---|
558 | char* title; |
---|
559 | char* subtitle; |
---|
560 | char* desc; |
---|
561 | int desclen; |
---|
562 | int desccomplen; |
---|
563 | int parentalrating; |
---|
564 | struct epg* prev; |
---|
565 | struct epg* next; |
---|
566 | }; |
---|
567 | |
---|
568 | struct shutdowntimer |
---|
569 | { |
---|
570 | int active,type; //type: 0=DeepStandby, 1=Standby |
---|
571 | long long shutdown_time; |
---|
572 | }; |
---|
573 | |
---|
574 | struct dvbdev |
---|
575 | { |
---|
576 | char* dev; |
---|
577 | int fd; |
---|
578 | uint8_t type; |
---|
579 | uint8_t adapter; |
---|
580 | uint8_t devnr; |
---|
581 | uint8_t felock; |
---|
582 | struct transponder* felasttransponder; |
---|
583 | struct transponder* feakttransponder; |
---|
584 | int feloffrequency; |
---|
585 | int feaktband; |
---|
586 | int feaktpolarization; |
---|
587 | int fedmxsource; |
---|
588 | char* feaktlnb; |
---|
589 | char* feaktdiseqc; |
---|
590 | char* feshortname; |
---|
591 | struct dvb_frontend_info* feinfo; |
---|
592 | struct caslot* caslot; |
---|
593 | struct dvbdev *next; |
---|
594 | }; |
---|
595 | |
---|
596 | //there are a copytransponder and createtransponder function |
---|
597 | //if you change this struct you must change the function |
---|
598 | struct transponder |
---|
599 | { |
---|
600 | unsigned long id; |
---|
601 | uint8_t fetype; |
---|
602 | uint8_t polarization; |
---|
603 | uint8_t modulation; |
---|
604 | uint8_t fec; |
---|
605 | uint8_t pilot; |
---|
606 | uint8_t rolloff; |
---|
607 | uint8_t inversion; |
---|
608 | uint8_t system; |
---|
609 | uint8_t flag; |
---|
610 | // 0 = unknown |
---|
611 | // 1 = tunable |
---|
612 | // 2 = not tunable |
---|
613 | uint8_t tunablestatus; |
---|
614 | int orbitalpos; |
---|
615 | unsigned int frequency; |
---|
616 | int symbolrate; |
---|
617 | struct transponder *next; |
---|
618 | }; |
---|
619 | |
---|
620 | struct provider |
---|
621 | { |
---|
622 | int providerid; |
---|
623 | char* name; |
---|
624 | int flag; |
---|
625 | struct provider *prev; |
---|
626 | struct provider *next; |
---|
627 | }; |
---|
628 | |
---|
629 | struct subtitle |
---|
630 | { |
---|
631 | char* name; |
---|
632 | int16_t pid; |
---|
633 | int16_t type; |
---|
634 | int16_t id1; |
---|
635 | int16_t id2; |
---|
636 | struct subtitle* next; |
---|
637 | }; |
---|
638 | |
---|
639 | struct esinfo |
---|
640 | { |
---|
641 | int streamtype; |
---|
642 | int reserved1; |
---|
643 | int pid; |
---|
644 | int reserved2; |
---|
645 | struct esinfo* next; |
---|
646 | }; |
---|
647 | |
---|
648 | struct cadesc |
---|
649 | { |
---|
650 | int len; |
---|
651 | int systemid; |
---|
652 | int reserved; |
---|
653 | int pid; |
---|
654 | char* privat; |
---|
655 | struct cadesc* next; |
---|
656 | }; |
---|
657 | |
---|
658 | struct pmt |
---|
659 | { |
---|
660 | int programnumber; |
---|
661 | int reserved1; |
---|
662 | int versionnumber; |
---|
663 | int currentnextindicator; |
---|
664 | int reserved2; |
---|
665 | }; |
---|
666 | |
---|
667 | struct audiotrack |
---|
668 | { |
---|
669 | char* name; |
---|
670 | uint8_t audiocodec; |
---|
671 | int16_t audiopid; |
---|
672 | struct audiotrack* next; |
---|
673 | }; |
---|
674 | |
---|
675 | //there are a createchannel function |
---|
676 | //if you change this struct you must change the function |
---|
677 | struct channel |
---|
678 | { |
---|
679 | char* name; |
---|
680 | unsigned long transponderid; |
---|
681 | int providerid; |
---|
682 | int serviceid; |
---|
683 | int servicetype; |
---|
684 | uint8_t flag; |
---|
685 | uint8_t crypt; |
---|
686 | int8_t videocodec; |
---|
687 | int8_t audiocodec; |
---|
688 | int16_t videopid; |
---|
689 | int16_t audiopid; |
---|
690 | int16_t ac3audiopid; |
---|
691 | int16_t txtpid; |
---|
692 | int16_t pcrpid; |
---|
693 | int16_t pmtpid; |
---|
694 | uint8_t protect; |
---|
695 | struct transponder *transponder; |
---|
696 | struct provider *provider; |
---|
697 | struct audiotrack *audiotrack; |
---|
698 | struct subtitle *subtitle; |
---|
699 | struct pmt *pmt; |
---|
700 | struct cadesc *cadesc; |
---|
701 | struct esinfo *esinfo; |
---|
702 | struct epg *epg; |
---|
703 | struct channel *prev; |
---|
704 | struct channel *next; |
---|
705 | }; |
---|
706 | |
---|
707 | struct sat |
---|
708 | { |
---|
709 | char* name; |
---|
710 | int orbitalpos; |
---|
711 | int flag; |
---|
712 | int fetype; |
---|
713 | int scan; |
---|
714 | struct sat *prev; |
---|
715 | struct sat *next; |
---|
716 | }; |
---|
717 | |
---|
718 | struct service |
---|
719 | { |
---|
720 | int type; |
---|
721 | char* channellist; |
---|
722 | struct dvbdev *fedev; |
---|
723 | struct dvbdev *dmxaudiodev; |
---|
724 | struct dvbdev *dmxvideodev; |
---|
725 | struct dvbdev *dmxpcrdev; |
---|
726 | struct dvbdev *dmxsubtitledev; |
---|
727 | struct dvbdev *audiodev; |
---|
728 | struct dvbdev *videodev; |
---|
729 | struct transponder *transponder; |
---|
730 | struct channel *channel; |
---|
731 | unsigned char *pmtbuf; |
---|
732 | int pmtlen; |
---|
733 | int recdmxstart; |
---|
734 | int recdstfd; |
---|
735 | int recsrcfd; |
---|
736 | int camsockfd; |
---|
737 | //ca is send to module |
---|
738 | int capmtsend; |
---|
739 | time_t recendtime; |
---|
740 | size_t reclastsync; |
---|
741 | off64_t rectotal; |
---|
742 | int reccount; |
---|
743 | char* recname; |
---|
744 | struct service *next; |
---|
745 | }; |
---|
746 | |
---|
747 | struct stimerthread |
---|
748 | { |
---|
749 | int delay; |
---|
750 | int count; |
---|
751 | int notfirst; |
---|
752 | pthread_attr_t attr; |
---|
753 | pthread_t thread; |
---|
754 | int status; |
---|
755 | int aktion; |
---|
756 | void* param1; |
---|
757 | void* param2; |
---|
758 | void* (*func)(struct stimerthread*, void*, void*); |
---|
759 | struct stimerthread* next; |
---|
760 | }; |
---|
761 | |
---|
762 | struct hddparm |
---|
763 | { |
---|
764 | char* device; |
---|
765 | int read; |
---|
766 | int write; |
---|
767 | int sleeptime; |
---|
768 | int notchanged; |
---|
769 | }; |
---|
770 | |
---|
771 | struct status |
---|
772 | { |
---|
773 | //set to 1 if channellist or channelnr open |
---|
774 | int channelswitch; |
---|
775 | //deaktivates child protect if greater then akttime |
---|
776 | time_t protecttime; |
---|
777 | char* boxtype; |
---|
778 | pthread_t mainthread; |
---|
779 | //videosize from stream |
---|
780 | video_size_t videosize; |
---|
781 | time_t videosizevalid; |
---|
782 | //radius for rounded border |
---|
783 | int borderradius; |
---|
784 | int picbordersize; |
---|
785 | int titlelinesize; |
---|
786 | //0 border |
---|
787 | //1 fullbar |
---|
788 | int listboxselecttype; |
---|
789 | //0 camd.socket |
---|
790 | //1 pmt.tmp |
---|
791 | int pmtmode; |
---|
792 | //timer for del old epg entrys |
---|
793 | time_t deloldepg; |
---|
794 | //0 dektiv |
---|
795 | //1 only scan |
---|
796 | //2 only whitlist |
---|
797 | //3 scan and whitelist |
---|
798 | int epglistmode; |
---|
799 | // 1 manual |
---|
800 | // 2 from standby |
---|
801 | int startmode; |
---|
802 | jmp_buf longjumpbuf; |
---|
803 | pthread_mutex_t drawingmutex; |
---|
804 | pthread_mutex_t rectimermutex; |
---|
805 | pthread_mutex_t servicemutex; |
---|
806 | pthread_mutex_t epgmutex; |
---|
807 | pthread_mutex_t channelmutex; |
---|
808 | pthread_mutex_t timerthreadmutex; |
---|
809 | pthread_mutex_t audiotrackmutex; |
---|
810 | pthread_mutex_t subtitlemutex; |
---|
811 | pthread_mutex_t dmxdevmutex; |
---|
812 | pthread_mutex_t rcmutex; |
---|
813 | pthread_mutex_t queuemutex; |
---|
814 | pthread_mutex_t clistmutex; |
---|
815 | pthread_mutex_t hddmutex; |
---|
816 | // mutex for VFD handling |
---|
817 | pthread_mutex_t vfdmutex; |
---|
818 | off64_t recsplitsize; |
---|
819 | char* gateway; |
---|
820 | char* dnsserver1; |
---|
821 | char* dnsserver2; |
---|
822 | int fasttextrender; |
---|
823 | // 1 release all menus |
---|
824 | int menurelease; |
---|
825 | int play; |
---|
826 | int pause; |
---|
827 | int playspeed; |
---|
828 | int random; |
---|
829 | int repeat; |
---|
830 | int epgdays; |
---|
831 | int spinnertime; |
---|
832 | int spinnerspeed; |
---|
833 | int hangtime; |
---|
834 | int timeupdatecount; |
---|
835 | int maxsat; |
---|
836 | int markmodus; |
---|
837 | // 1 from main prog |
---|
838 | // 2 from a thread |
---|
839 | int standby; |
---|
840 | char* tmp; |
---|
841 | // rc filedescriptor |
---|
842 | int fdrc; |
---|
843 | // rc filedescriptor for simulating keypress (fifo) |
---|
844 | int fdrcsim; |
---|
845 | int writeconfig; |
---|
846 | int writeownconfig; |
---|
847 | int writercconfig; |
---|
848 | int writeskinconfig; |
---|
849 | int writechannel; |
---|
850 | int writetransponder; |
---|
851 | int writeprovider; |
---|
852 | int writemainbouquet; |
---|
853 | int writebouquet; |
---|
854 | int writemainplaylist; |
---|
855 | int writeplaylist; |
---|
856 | int writesat; |
---|
857 | int writerectimer; |
---|
858 | int writeepgscanlist; |
---|
859 | // 1 mute is aktiv |
---|
860 | int mute; |
---|
861 | // 1 spinner is aktiv |
---|
862 | int spinner; |
---|
863 | // 1 infobar is aktiv |
---|
864 | // 2 infobar is aktiv (with wait befor show) |
---|
865 | // 3 infobar is aktiv (no autohide) |
---|
866 | int infobar; |
---|
867 | // with infobar to display |
---|
868 | int infobarnr; |
---|
869 | // 0 is for mute screen |
---|
870 | struct skin *drawallways[1]; |
---|
871 | char* drawallwaysbg[1]; |
---|
872 | int usedirectfb; |
---|
873 | // count how long last rcwait (shows spinner if to long) |
---|
874 | time_t sec; |
---|
875 | // if set to a value != 0, rcwait returns this number |
---|
876 | int rckey; |
---|
877 | struct skin* skinerr; |
---|
878 | // 0 calc and draw |
---|
879 | // 1 calc only without hidden nodes |
---|
880 | // 2 calc only with hidden nodes |
---|
881 | int screencalc; |
---|
882 | // 0 deaktiv |
---|
883 | // 1 struct filelist filled |
---|
884 | // 2 struct filelist and show filesize |
---|
885 | // 3 struct filelist and show filedate |
---|
886 | int filelistextend; |
---|
887 | pthread_attr_t timerthreadattr; |
---|
888 | pthread_t timerthread; |
---|
889 | int timerthreadstatus; |
---|
890 | int timerthreadaktion; |
---|
891 | pthread_attr_t subthreadattr; |
---|
892 | pthread_t subthread; |
---|
893 | int subthreadstatus; |
---|
894 | int subthreadaktion; |
---|
895 | int subthreadpid; |
---|
896 | // epg thread pointer |
---|
897 | struct stimerthread* epgthread; |
---|
898 | // epgscanlist thread pointer |
---|
899 | struct stimerthread* epgscanlistthread; |
---|
900 | // httpd thread pointer |
---|
901 | struct stimerthread* httpthread; |
---|
902 | struct service* aktservice; |
---|
903 | struct service* lastservice; |
---|
904 | struct channel* markedchannel; |
---|
905 | char* configfile; |
---|
906 | // for bouquet channel numbering |
---|
907 | int bouquetnr[MAXSERVICETYPE]; |
---|
908 | int servicetype; |
---|
909 | struct shutdowntimer *sd_timer; |
---|
910 | // akt pos in channel cache |
---|
911 | int channelcachepos; |
---|
912 | // aktivate/deaktivate auto updatevfd |
---|
913 | int updatevfd; |
---|
914 | // count for recording |
---|
915 | int recording; |
---|
916 | // count for streaming |
---|
917 | int streaming; |
---|
918 | // timeshift running = 1 |
---|
919 | int timeshift; |
---|
920 | // ts playing running = 1 |
---|
921 | int playing; |
---|
922 | // if set to a skin (screenpointer) only this screen has rc |
---|
923 | struct skin* rcowner; |
---|
924 | // timerstuktur fuer autores |
---|
925 | struct stimerthread* restimer; |
---|
926 | //spindown USB/HDD |
---|
927 | struct hddparm hdd[3]; |
---|
928 | struct stimerthread* hddsleeptimer; |
---|
929 | |
---|
930 | } status; |
---|
931 | |
---|
932 | struct fb |
---|
933 | { |
---|
934 | int dev; |
---|
935 | char *name; |
---|
936 | int fd; |
---|
937 | unsigned char *fb; |
---|
938 | unsigned long *fblong; |
---|
939 | int width; |
---|
940 | int height; |
---|
941 | int pitch; |
---|
942 | unsigned long fixfbsize; |
---|
943 | unsigned long varfbsize; |
---|
944 | int colbytes; |
---|
945 | struct fb *next; |
---|
946 | }; |
---|
947 | |
---|
948 | struct rc |
---|
949 | { |
---|
950 | int key; |
---|
951 | void (*rcfunc)(struct skin*, struct skin*); |
---|
952 | struct skin *screen; |
---|
953 | struct skin *screennode; |
---|
954 | struct skin *owner; |
---|
955 | struct rc *next; |
---|
956 | }; |
---|
957 | |
---|
958 | struct clist |
---|
959 | { |
---|
960 | char *key; |
---|
961 | char *value; |
---|
962 | char *def; |
---|
963 | char *tmp; |
---|
964 | struct clist *next; |
---|
965 | }; |
---|
966 | |
---|
967 | struct bouquet |
---|
968 | { |
---|
969 | int nr; |
---|
970 | int serviceid; |
---|
971 | unsigned long transponderid; |
---|
972 | struct channel *channel; |
---|
973 | struct bouquet *prev; |
---|
974 | struct bouquet *next; |
---|
975 | }; |
---|
976 | |
---|
977 | struct mainbouquet |
---|
978 | { |
---|
979 | char *name; |
---|
980 | int type; |
---|
981 | char *filename; |
---|
982 | struct bouquet *bouquet; |
---|
983 | struct mainbouquet *prev; |
---|
984 | struct mainbouquet *next; |
---|
985 | }; |
---|
986 | |
---|
987 | struct pic |
---|
988 | { |
---|
989 | char* name; |
---|
990 | unsigned char* picbuf; |
---|
991 | // < 0 when picbuf is normal mem (hw jpg) |
---|
992 | int memfd; |
---|
993 | unsigned long width; |
---|
994 | unsigned long height; |
---|
995 | unsigned long rowbytes; |
---|
996 | int channels; |
---|
997 | int del; |
---|
998 | struct pic* next; |
---|
999 | }; |
---|
1000 | |
---|
1001 | struct font |
---|
1002 | { |
---|
1003 | char *name; |
---|
1004 | FT_Error error; |
---|
1005 | FTC_Manager manager; |
---|
1006 | FTC_SBitCache cache; |
---|
1007 | FTC_ImageTypeRec desc; |
---|
1008 | FT_Face face; |
---|
1009 | FT_UInt prev_glyphindex; |
---|
1010 | FT_Bool use_kerning; |
---|
1011 | struct font *next; |
---|
1012 | }; |
---|
1013 | |
---|
1014 | #define HILO(x) (x##_hi << 8 | x##_lo) |
---|
1015 | |
---|
1016 | /* |
---|
1017 | #define HILO2(x) (x##1 << 8 | x##2) |
---|
1018 | #define HILO3(x) (x##1 << 16 | x##2 << 8 | x##3) |
---|
1019 | #define HILO4(x) (x##4 << 24 | x##2 << 16 | x##3 << 8 | x##4) |
---|
1020 | |
---|
1021 | #define MjdToEpochTime(x) ((HILO(x)-40587)*86400) |
---|
1022 | #define BcdTimeToSeconds(x) ((3600 * ((10*((x##_h & 0xF0)>>4)) + (x##_h & 0xF))) + \ |
---|
1023 | (60 * ((10*((x##_m & 0xF0)>>4)) + (x##_m & 0xF))) + \ |
---|
1024 | ((10*((x##_s & 0xF0)>>4)) + (x##_s & 0xF))) |
---|
1025 | #define BcdTimeToMinutes(x) ((60 * ((10*((x##_h & 0xF0)>>4)) + (x##_h & 0xF))) + \ |
---|
1026 | (((10*((x##_m & 0xF0)>>4)) + (x##_m & 0xF)))) |
---|
1027 | #define BcdCharToInt(x) (10*((x & 0xF0)>>4) + (x & 0xF)) |
---|
1028 | #define CheckBcdChar(x) ((((x & 0xF0)>>4) <= 9) && \ |
---|
1029 | ((x & 0x0F) <= 9)) |
---|
1030 | #define CheckBcdSignedChar(x) ((((x & 0xF0)>>4) >= 0) && (((x & 0xF0)>>4) <= 9) && \ |
---|
1031 | ((x & 0x0F) >= 0) && ((x & 0x0F) <= 9)) |
---|
1032 | |
---|
1033 | #define GetSectionLength(x) HILO(((si_tab_t *)(x))->section_length) |
---|
1034 | #define GetServiceId(x) HILO(((eit_t *)(x))->service_id) |
---|
1035 | #define GetLastTableId(x) ((eit_t *)(x))->segment_last_table_id |
---|
1036 | #define GetSegmentLastSectionNumber(x) ((eit_t *)(x))->segment_last_section_number |
---|
1037 | #define GetPrivateDataSpecifier(x) HILO4(((descr_private_data_specifier_t *)x)->private_data_specifier) |
---|
1038 | */ |
---|
1039 | |
---|
1040 | struct eit |
---|
1041 | { |
---|
1042 | u_char table_id /*:8*/; |
---|
1043 | u_char section_length_hi :4; |
---|
1044 | u_char :3; |
---|
1045 | u_char section_syntax_indicator :1; |
---|
1046 | u_char section_length_lo /*:8*/; |
---|
1047 | u_char service_id_hi /*:8*/; |
---|
1048 | u_char service_id_lo /*:8*/; |
---|
1049 | u_char current_next_indicator :1; |
---|
1050 | u_char version_number :5; |
---|
1051 | u_char :2; |
---|
1052 | u_char section_number /*:8*/; |
---|
1053 | u_char last_section_number /*:8*/; |
---|
1054 | u_char transport_stream_id_hi /*:8*/; |
---|
1055 | u_char transport_stream_id_lo /*:8*/; |
---|
1056 | u_char original_network_id_hi /*:8*/; |
---|
1057 | u_char original_network_id_lo /*:8*/; |
---|
1058 | u_char segment_last_section_number /*:8*/; |
---|
1059 | u_char segment_last_table_id /*:8*/; |
---|
1060 | u_char data[]; /* struct eitevent */ |
---|
1061 | }; |
---|
1062 | #define EITLEN sizeof(struct eit) |
---|
1063 | #define GETEITSECLEN(x) HILO(((struct eit*)(x))->section_length) |
---|
1064 | |
---|
1065 | struct eitevent |
---|
1066 | { |
---|
1067 | u_char event_id_hi /*:8*/; |
---|
1068 | u_char event_id_lo /*:8*/; |
---|
1069 | u_char mjd_hi /*:8*/; |
---|
1070 | u_char mjd_lo /*:8*/; |
---|
1071 | u_char start_time_h /*:8*/; |
---|
1072 | u_char start_time_m /*:8*/; |
---|
1073 | u_char start_time_s /*:8*/; |
---|
1074 | u_char duration_h /*:8*/; |
---|
1075 | u_char duration_m /*:8*/; |
---|
1076 | u_char duration_s /*:8*/; |
---|
1077 | u_char descriptors_loop_length_hi :4; |
---|
1078 | u_char free_ca_mode :1; |
---|
1079 | u_char running_status :3; |
---|
1080 | u_char descriptors_loop_length_lo /*:8*/; |
---|
1081 | u_char data[]; |
---|
1082 | }; |
---|
1083 | #define EITEVENTLEN sizeof(struct eitevent) |
---|
1084 | #define GETEITDESCLEN(x) HILO(((struct eitevent *)x)->descriptors_loop_length) |
---|
1085 | |
---|
1086 | struct eitshortevent |
---|
1087 | { |
---|
1088 | u_char descriptor_tag /*:8*/; |
---|
1089 | u_char descriptor_length /*:8*/; |
---|
1090 | u_char lang_code1 /*:8*/; |
---|
1091 | u_char lang_code2 /*:8*/; |
---|
1092 | u_char lang_code3 /*:8*/; |
---|
1093 | u_char event_name_length /*:8*/; |
---|
1094 | u_char data[]; |
---|
1095 | }; |
---|
1096 | #define EITSHORTEVENTLEN sizeof(struct eitshortevent) |
---|
1097 | |
---|
1098 | struct eitlongevent |
---|
1099 | { |
---|
1100 | u_char descriptor_tag /*:8*/; |
---|
1101 | u_char descriptor_length /*:8*/; |
---|
1102 | u_char last_descriptor_number :4; |
---|
1103 | u_char descriptor_number :4; |
---|
1104 | u_char lang_code1 /*:8*/; |
---|
1105 | u_char lang_code2 /*:8*/; |
---|
1106 | u_char lang_code3 /*:8*/; |
---|
1107 | u_char length_of_items /*:8*/; |
---|
1108 | u_char data[]; /* struct eitlongeventitem */ |
---|
1109 | }; |
---|
1110 | #define EITLONGEVENTLEN sizeof(struct eitlongevent) |
---|
1111 | |
---|
1112 | struct eitlongeventitem |
---|
1113 | { |
---|
1114 | u_char item_description_length /*:8*/; |
---|
1115 | u_char data[]; |
---|
1116 | }; |
---|
1117 | #define EITLONGEVENTITEMLEN sizeof(struct eitlongeventitem) |
---|
1118 | |
---|
1119 | struct eitlinkage |
---|
1120 | { |
---|
1121 | u_char descriptor_tag /*:8*/; |
---|
1122 | u_char descriptor_length /*:8*/; |
---|
1123 | u_char transport_stream_id_hi /*:8*/; |
---|
1124 | u_char transport_stream_id_lo /*:8*/; |
---|
1125 | u_char original_network_id_hi /*:8*/; |
---|
1126 | u_char original_network_id_lo /*:8*/; |
---|
1127 | u_char service_id_hi /*:8*/; |
---|
1128 | u_char service_id_lo /*:8*/; |
---|
1129 | u_char linkage_type /*:8*/; |
---|
1130 | }; |
---|
1131 | #define EITLLINKAGELEN sizeof(struct eitlinkage) |
---|
1132 | |
---|
1133 | struct parentalrating |
---|
1134 | { |
---|
1135 | u_char descriptor_tag /*:8*/; |
---|
1136 | u_char descriptor_length /*:8*/; |
---|
1137 | u_char data[]; //struct parental_rating_item |
---|
1138 | }; |
---|
1139 | #define PARENTALRATINGLEN sizeof(struct parentalrating) |
---|
1140 | |
---|
1141 | struct parentalratingitem |
---|
1142 | { |
---|
1143 | u_char lang_code1 /*:8*/; |
---|
1144 | u_char lang_code2 /*:8*/; |
---|
1145 | u_char lang_code3 /*:8*/; |
---|
1146 | u_char rating /*:8*/; |
---|
1147 | }; |
---|
1148 | #define PARENTALRATINGITEMLEN sizeof(struct parentalratingitem) |
---|
1149 | |
---|
1150 | #endif |
---|