source: titan/titan/skinfunc.h @ 39164

Last change on this file since 39164 was 38615, checked in by gost, 8 years ago

getalternate... fallback default

File size: 39.1 KB
Line 
1#ifndef SKINFUNC_H
2#define SKINFUNC_H
3
4char* getplaytext(struct skin* node, char* path)
5{
6        char* tmpstr = NULL;
7
8        if(status.pause > 0 && status.slowspeed == 0)
9                tmpstr = ostrcat("Pause", NULL, 0, 0);
10        else if(status.play > 0)
11                tmpstr = ostrcat("Play", NULL, 0, 0);
12        else if(status.playspeed == 1)
13                tmpstr = ostrcat(">> 2x", NULL, 0, 0);
14        else if(status.playspeed == 2)
15                tmpstr = ostrcat(">> 4x", NULL, 0, 0);
16        else if(status.playspeed == 3)
17                tmpstr = ostrcat(">> 8x", NULL, 0, 0);
18        else if(status.playspeed == 4)
19                tmpstr = ostrcat(">> 16x", NULL, 0, 0);
20        else if(status.playspeed == 5)
21                tmpstr = ostrcat(">> 32x", NULL, 0, 0);
22        else if(status.playspeed == 6)
23                tmpstr = ostrcat(">> 64x", NULL, 0, 0);
24        else if(status.playspeed == 7)
25                tmpstr = ostrcat(">> 128x", NULL, 0, 0);
26        else if(status.playspeed == -1)
27                tmpstr = ostrcat("<< 2x", NULL, 0, 0);
28        else if(status.playspeed == -2)
29                tmpstr = ostrcat("<< 4x", NULL, 0, 0);
30        else if(status.playspeed == -3)
31                tmpstr = ostrcat("<< 8x", NULL, 0, 0);
32        else if(status.playspeed == -4)
33                tmpstr = ostrcat("<< 16x", NULL, 0, 0);
34        else if(status.playspeed == -5)
35                tmpstr = ostrcat("<< 32x", NULL, 0, 0);
36        else if(status.playspeed == -6)
37                tmpstr = ostrcat("<< 64x", NULL, 0, 0);
38        else if(status.playspeed == -7)
39                tmpstr = ostrcat("<< 128x", NULL, 0, 0);
40        else if(status.slowspeed == 1)
41                tmpstr = ostrcat("|| 2x", NULL, 0, 0);
42        else if(status.slowspeed == 2)
43                tmpstr = ostrcat("|| 4x", NULL, 0, 0);
44        else if(status.slowspeed == 3)
45                tmpstr = ostrcat("|| 8x", NULL, 0, 0);
46        else if(status.slowspeed == 4)
47                tmpstr = ostrcat("|| 16x", NULL, 0, 0);
48        else if(status.slowspeed == 5)
49                tmpstr = ostrcat("|| 32x", NULL, 0, 0);
50        else if(status.slowspeed == 6)
51                tmpstr = ostrcat("|| 64x", NULL, 0, 0);
52        else if(status.slowspeed == 7)
53                tmpstr = ostrcat("|| 128x", NULL, 0, 0);
54
55        return tmpstr;
56}
57
58char* getplaypic(struct skin* node, char* path)
59{
60        char* tmpstr = NULL;
61
62        if(status.pause > 0 && status.slowspeed == 0)
63                tmpstr = ostrcat("pause.png", NULL, 0, 0);
64        else if(status.play > 0)
65                tmpstr = ostrcat("play.png", NULL, 0, 0);
66        else if(status.playspeed == 1)
67                tmpstr = ostrcat("forward1.png", NULL, 0, 0);
68        else if(status.playspeed == 2)
69                tmpstr = ostrcat("forward1.png", NULL, 0, 0);
70        else if(status.playspeed == 3)
71                tmpstr = ostrcat("forward1.png", NULL, 0, 0);
72        else if(status.playspeed == 4)
73                tmpstr = ostrcat("forward1.png", NULL, 0, 0);
74        else if(status.playspeed == 5)
75                tmpstr = ostrcat("forward1.png", NULL, 0, 0);
76        else if(status.playspeed == 6)
77                tmpstr = ostrcat("forward1.png", NULL, 0, 0);
78        else if(status.playspeed == 7)
79                tmpstr = ostrcat("forward1.png", NULL, 0, 0);
80        else if(status.playspeed == -1)
81                tmpstr = ostrcat("rewind1.png", NULL, 0, 0);
82        else if(status.playspeed == -2)
83                tmpstr = ostrcat("rewind1.png", NULL, 0, 0);
84        else if(status.playspeed == -3)
85                tmpstr = ostrcat("rewind1.png", NULL, 0, 0);
86        else if(status.playspeed == -4)
87                tmpstr = ostrcat("rewind1.png", NULL, 0, 0);
88        else if(status.playspeed == -5)
89                tmpstr = ostrcat("rewind1.png", NULL, 0, 0);
90        else if(status.playspeed == -6)
91                tmpstr = ostrcat("rewind1.png", NULL, 0, 0);
92        else if(status.playspeed == -7)
93                tmpstr = ostrcat("rewind1.png", NULL, 0, 0);
94        else if(status.slowspeed == 1)
95                tmpstr = ostrcat("slow1.png", NULL, 0, 0);
96        else if(status.slowspeed == 2)
97                tmpstr = ostrcat("slow1.png", NULL, 0, 0);
98        else if(status.slowspeed == 3)
99                tmpstr = ostrcat("slow1.png", NULL, 0, 0);
100        else if(status.slowspeed == 4)
101                tmpstr = ostrcat("slow1.png", NULL, 0, 0);
102        else if(status.slowspeed == 5)
103                tmpstr = ostrcat("slow1.png", NULL, 0, 0);
104        else if(status.slowspeed == 6)
105                tmpstr = ostrcat("slow1.png", NULL, 0, 0);
106        else if(status.slowspeed == 7)
107                tmpstr = ostrcat("slow1.png", NULL, 0, 0);
108
109        if(tmpstr != NULL)
110        {
111                if(path != NULL && tmpstr != NULL)
112                        tmpstr = ostrcat("/", tmpstr, 0, 1);
113                tmpstr = ostrcat(path, tmpstr, 0, 1);
114        }
115       
116        return tmpstr;
117}
118
119char* getreccount(struct skin* node)
120{
121        char* tmpstr = NULL;
122
123        if(status.recording > 0)
124                tmpstr = oitoa(status.recording);
125
126        return tmpstr;
127}
128
129char* getrec(struct skin* node, char* path)
130{
131        char* tmpstr = NULL;
132
133        if(status.recording > 0)
134        {
135                tmpstr = ostrcat("rec.png", NULL, 0, 0);
136
137                if(path != NULL)
138                        tmpstr = ostrcat("/", tmpstr, 0, 1);
139                tmpstr = ostrcat(path, tmpstr, 0, 1);
140        }
141       
142        return tmpstr;
143}
144
145#ifdef MIPSEL
146//oled indicators for Nemesis
147//rec png
148        char* getoledrec(struct skin* node, char* path)
149        {
150                char* tmpstr = NULL;
151
152                if(status.recording > 0)
153                {
154                        if(node->nodestyle != 1)
155                                node->hidden = NO;
156                        if(node->picmem == 1)
157                                return tmpstr;
158                        tmpstr = ostrcat("oled_rec.png", NULL, 0, 0);
159
160                        if(path != NULL)
161                                tmpstr = ostrcat("/", tmpstr, 0, 1);
162                        tmpstr = ostrcat(path, tmpstr, 0, 1);
163                }
164                else
165                        node->hidden = YES;
166       
167                return tmpstr;
168        }
169//mute png
170        char* getoledmute(struct skin* node, char* path)
171        {
172                char* tmpstr = NULL;
173
174                if(status.mute > 0)
175                {
176                        if(node->nodestyle != 1)
177                                node->hidden = NO;
178                        if(node->picmem == 1)
179                                return tmpstr;
180                        tmpstr = ostrcat("oled_mute.png", NULL, 0, 0);
181                        if(path != NULL)
182                                tmpstr = ostrcat("/", tmpstr, 0, 1);
183                        tmpstr = ostrcat(path, tmpstr, 0, 1);
184                }
185                else
186                        node->hidden = YES;
187               
188                return tmpstr;
189        }
190
191//timeshift png
192        char* getoledtimeshift(struct skin* node, char* path)
193        {
194                char* tmpstr = NULL;
195
196                if(status.timeshift > 0)
197                {
198                        if(node->nodestyle != 1)
199                                node->hidden = NO;
200                        if(node->picmem == 1)
201                                return tmpstr;
202                        tmpstr = ostrcat("oled_timeshift.png", NULL, 0, 0);
203
204                        if(path != NULL)
205                tmpstr = ostrcat("/", tmpstr, 0, 1);
206                        tmpstr = ostrcat(path, tmpstr, 0, 1);
207                }
208                else
209                        node->hidden = YES;
210               
211                return tmpstr;
212        }
213
214//streaming png
215        char* getoledstreaming(struct skin* node, char* path)
216        {
217                char* tmpstr = NULL;
218
219                if(status.streaming > 0)
220                {
221                        if(node->nodestyle != 1)
222                                node->hidden = NO;
223                        if(node->picmem == 1)
224                                return tmpstr;
225                        tmpstr = ostrcat("oled_streaming.png", NULL, 0, 0);
226
227                        if(path != NULL)
228                tmpstr = ostrcat("/", tmpstr, 0, 1);
229                        tmpstr = ostrcat(path, tmpstr, 0, 1);
230                }
231                else
232                        node->hidden = YES;
233               
234                return tmpstr;
235        }
236
237//crypt png
238    char* getoledcrypt(struct skin* node, char* path)
239    {
240            char* tmpstr = NULL;
241
242            if(status.aktservice->channel != NULL)
243            {
244                    if(status.aktservice->channel->crypt > 0)
245                          {
246                                if(node->nodestyle != 1)
247                                                node->hidden = NO;
248                                        if(node->picmem == 1)
249                                                return tmpstr; 
250                            tmpstr = ostrcat("oled_crypt.png", NULL, 0, 0);
251                          }
252                          else
253                                node->hidden = YES;
254                    if(path != NULL)
255                            tmpstr = ostrcat("/", tmpstr, 0, 1);
256                    tmpstr = ostrcat(path, tmpstr, 0, 1);
257            }
258                        else
259                                node->hidden = YES;
260            return tmpstr;
261    }
262
263//real aspect 16:9 png
264    char* getoledchannelaspect(struct skin* node, char* path)
265    {
266            char* tmpstr = NULL;
267       
268            videoreadqwidth(status.aktservice->videodev);
269            if(status.videosize.aspect_ratio == 3 || status.videosize.aspect_ratio == 11)
270                {
271                        if(node->nodestyle != 1)
272                                node->hidden = NO;
273                        if(node->picmem == 1)
274                                return tmpstr;
275                    tmpstr = ostrcat("oled_16_9.png", NULL, 0, 0);
276                }
277
278                else
279                        node->hidden = YES;
280            if(path != NULL)
281                    tmpstr = ostrcat("/", tmpstr, 0, 1);
282                        tmpstr = ostrcat(path, tmpstr, 0, 1);
283
284            return tmpstr;
285    }
286
287//real resolution 576 png
288    char* getoledchannelresolution576(struct skin* node, char* path)
289    {
290            char* tmpstr = NULL;
291
292            videoreadqwidth(status.aktservice->videodev);
293        if(status.videosize.h == 576)
294                {
295                        if(node->nodestyle != 1)
296                                node->hidden = NO;
297                        if(node->picmem == 1)
298                                return tmpstr; 
299                    tmpstr = ostrcat("oled_576.png", NULL, 0, 0);
300                }
301                else
302                        node->hidden = YES;
303            if(path != NULL)
304                    tmpstr = ostrcat("/", tmpstr, 0, 1);
305                        tmpstr = ostrcat(path, tmpstr, 0, 1);
306
307            return tmpstr;
308    }
309   
310//real resolution 720 png
311    char* getoledchannelresolution720(struct skin* node, char* path)
312    {
313            char* tmpstr = NULL;
314
315            videoreadqwidth(status.aktservice->videodev);
316        if(status.videosize.h == 720)
317                {
318                        if(node->nodestyle != 1)
319                                node->hidden = NO;
320                        if(node->picmem == 1)
321                                return tmpstr; 
322                    tmpstr = ostrcat("oled_720.png", NULL, 0, 0);
323                }
324                else
325                        node->hidden = YES;
326            if(path != NULL)
327                    tmpstr = ostrcat("/", tmpstr, 0, 1);
328                        tmpstr = ostrcat(path, tmpstr, 0, 1);
329
330            return tmpstr;
331    }
332   
333//real resolution 1080 png
334    char* getoledchannelresolution1080(struct skin* node, char* path)
335    {
336            char* tmpstr = NULL;
337
338            videoreadqwidth(status.aktservice->videodev);
339        if(status.videosize.h == 1080)
340                {
341                        if(node->nodestyle != 1)
342                                node->hidden = NO;
343                        if(node->picmem == 1)
344                                return tmpstr; 
345                    tmpstr = ostrcat("oled_1080.png", NULL, 0, 0);
346                }
347                else
348                        node->hidden = YES;
349            if(path != NULL)
350                    tmpstr = ostrcat("/", tmpstr, 0, 1);
351                        tmpstr = ostrcat(path, tmpstr, 0, 1);
352
353            return tmpstr;
354    }
355
356//hd png
357    char* getoledhd(struct skin* node, char* path)
358    {
359            char* tmpstr = NULL;
360
361            videoreadqwidth(status.aktservice->videodev);
362            if(status.videosize.h == 720 || status.videosize.h == 1080)
363            {
364                        if(node->nodestyle != 1)
365                                node->hidden = NO;
366                        if(node->picmem == 1)
367                                return tmpstr; 
368                    tmpstr = ostrcat("oled_hd.png", NULL, 0, 0);
369                }
370
371                else
372                        node->hidden = YES;
373                if(path != NULL)
374                    tmpstr = ostrcat("/", tmpstr, 0, 1);
375                        tmpstr = ostrcat(path, tmpstr, 0, 1);   
376
377                return tmpstr;
378    }
379   
380//dolby png
381    char* getoleddolby(struct skin* node, char* path)
382    {
383            char* tmpstr = NULL;
384
385            if(status.aktservice->channel->audiocodec == AC3 || status.aktservice->channel->audiocodec == DTS)
386            {
387                        if(node->nodestyle != 1)
388                                node->hidden = NO;
389                        if(node->picmem == 1)
390                                return tmpstr; 
391                    //tmpstr = ostrcat("oled_dolby.png", NULL, 0, 0);
392                }
393
394                else
395                        node->hidden = YES;
396                if(path != NULL)
397                    tmpstr = ostrcat("/", tmpstr, 0, 1);
398                        tmpstr = ostrcat(path, tmpstr, 0, 1);   
399
400                return tmpstr;
401    }
402       
403#endif
404
405
406char* getcrypt(struct skin* node, char* path)
407{
408        char* tmpstr = NULL;
409
410        if(status.aktservice->channel != NULL)
411        {
412                if(status.aktservice->channel->crypt > 0)
413                        tmpstr = ostrcat("crypt.png", NULL, 0, 0);
414                else
415                        tmpstr = ostrcat("nocrypt.png", NULL, 0, 0);
416
417                if(path != NULL)
418                        tmpstr = ostrcat("/", tmpstr, 0, 1);
419                tmpstr = ostrcat(path, tmpstr, 0, 1);
420        }
421       
422        return tmpstr;
423}
424
425char* getaspectmode(struct skin* node, char* path)
426{
427        char* tmpstr = NULL;
428
429        tmpstr = getaspect();
430
431#ifdef MIPSEL   
432    if(ostrcmp(tmpstr, "4:3") == 1)
433        {
434                free(tmpstr); tmpstr = NULL;
435                tmpstr = ostrcat(tmpstr, "4_3.png", 1, 0);
436        }
437        if(ostrcmp(tmpstr, "16:9") == 3 || ostrcmp(tmpstr, "16:9") == 11)
438        {
439                free(tmpstr); tmpstr = NULL;
440                tmpstr = ostrcat(tmpstr, "16_9.png", 1, 0);
441        }
442#else
443    if(ostrcmp(tmpstr, "4:3") == 0)
444        {
445                free(tmpstr); tmpstr = NULL;
446                tmpstr = ostrcat(tmpstr, "4_3.png", 1, 0);
447        }
448        if(ostrcmp(tmpstr, "16:9") == 1)
449        {
450                free(tmpstr); tmpstr = NULL;
451                tmpstr = ostrcat(tmpstr, "16_9.png", 1, 0);
452        }
453#endif
454        if(path != NULL)
455                tmpstr = ostrcat("/", tmpstr, 0, 1);
456        tmpstr = ostrcat(path, tmpstr, 0, 1);
457
458        return tmpstr;
459}
460
461char* getsdhd(struct skin* node, char* path)
462{
463        char* tmpstr = NULL;
464
465        videoreadqwidth(status.aktservice->videodev);
466
467//      if(getaktvideosize() == 0) //videosize is ok
468//      {
469                if(status.videosize.h == 576)
470                        tmpstr = ostrcat("sd.png", NULL, 0, 0);
471                else if(status.videosize.h == 720)
472                        tmpstr = ostrcat("hdready.png", NULL, 0, 0);
473                else if(status.videosize.h == 1080)
474                        tmpstr = ostrcat("hd.png", NULL, 0, 0);
475//      }
476       
477        if(tmpstr == NULL) tmpstr = ostrcat("novideo.png", NULL, 0, 0);
478
479        if(path != NULL)
480                tmpstr = ostrcat("/", tmpstr, 0, 1);
481        tmpstr = ostrcat(path, tmpstr, 0, 1);
482
483        return tmpstr;
484}
485       
486char* getresolution(struct skin* node, char* path)
487{
488        char* tmpstr = NULL;
489
490        if(fb->width == 720 && fb->height == 576)
491                tmpstr = ostrcat("576.png", NULL, 0, 0);
492        else if(fb->width == 1280 && fb->height == 720)
493                tmpstr = ostrcat("720.png", NULL, 0, 0);
494        else if(fb->width == 1920 && fb->height == 1080)
495                tmpstr = ostrcat("1080.png", NULL, 0, 0);
496
497        if(path != NULL)
498                tmpstr = ostrcat("/", tmpstr, 0, 1);
499        tmpstr = ostrcat(path, tmpstr, 0, 1);
500       
501        return tmpstr;
502}
503
504char* getchannelresolution(struct skin* node, char* path)
505{
506        char* tmpstr = NULL;
507
508        videoreadqwidth(status.aktservice->videodev);
509
510//      if(getaktvideosize() == 0) //videosize is ok
511//      {
512                if(status.videosize.h == 576)
513                        tmpstr = ostrcat("576.png", NULL, 0, 0);
514                else if(status.videosize.h == 720)
515                        tmpstr = ostrcat("720.png", NULL, 0, 0);
516                else if(status.videosize.h == 1080)
517                        tmpstr = ostrcat("1080.png", NULL, 0, 0);
518//      }
519       
520        if(tmpstr == NULL) tmpstr = ostrcat("novideores.png", NULL, 0, 0);
521
522        if(path != NULL)
523                tmpstr = ostrcat("/", tmpstr, 0, 1);
524        tmpstr = ostrcat(path, tmpstr, 0, 1);
525
526        return tmpstr;
527}
528
529char* getchannelaspect(struct skin* node, char* path)
530{
531        char* tmpstr = NULL;
532       
533        videoreadqwidth(status.aktservice->videodev);
534
535#ifdef MIPSEL
536//      if(getaktvideosize() == 0) //videosize is ok
537//      {
538                if(status.videosize.aspect_ratio == 1)
539                        tmpstr = ostrcat("4_3.png", NULL, 0, 0);
540                else if(status.videosize.aspect_ratio == 3 || status.videosize.aspect_ratio == 11)
541                        tmpstr = ostrcat("16_9.png", NULL, 0, 0);
542//      }
543
544#else
545//      if(getaktvideosize() == 0) //videosize is ok
546//      {
547                if(status.videosize.aspect_ratio == 0)
548                        tmpstr = ostrcat("4_3.png", NULL, 0, 0);
549                else if(status.videosize.aspect_ratio == 1)
550                        tmpstr = ostrcat("16_9.png", NULL, 0, 0);
551//      }
552#endif
553       
554        if(tmpstr == NULL) tmpstr = ostrcat("novideoasp.png", NULL, 0, 0);
555
556        if(path != NULL)
557                tmpstr = ostrcat("/", tmpstr, 0, 1);
558        tmpstr = ostrcat(path, tmpstr, 0, 1);
559
560        return tmpstr;
561}
562
563char* getteletext(struct skin* node, char* path)
564{
565        char* tmpstr = NULL;
566
567        if(status.aktservice->channel != NULL)
568        {
569                if(status.aktservice->channel->txtpid > 0)
570                        tmpstr = ostrcat("teletext.png", NULL, 0, 0);
571                else
572                        tmpstr = ostrcat("noteletext.png", NULL, 0, 0);
573
574                if(path != NULL)
575                        tmpstr = ostrcat("/", tmpstr, 0, 1);
576                tmpstr = ostrcat(path, tmpstr, 0, 1);
577        }
578       
579        return tmpstr;
580}
581
582char* getsoundtype(struct skin* node, char* path)
583{
584        char* tmpstr = NULL;
585
586        if(status.aktservice->channel != NULL)
587        {
588                switch(status.aktservice->channel->audiocodec)
589                {
590                        case AC3:
591                                tmpstr = ostrcat("ac3.png", NULL, 0, 0);
592                                break;
593                        case MPEGA:
594                                tmpstr = ostrcat("mpega.png", NULL, 0, 0);
595                                break;
596                        case DTS:
597                                tmpstr = ostrcat("dts.png", NULL, 0, 0);
598                                break;
599                        case LPCM:
600                                tmpstr = ostrcat("lpcm.png", NULL, 0, 0);
601                                break;
602                        case AAC:
603                                tmpstr = ostrcat("aac.png", NULL, 0, 0);
604                                break;
605                        case AACHE:
606                                tmpstr = ostrcat("aache.png", NULL, 0, 0);
607                                break;
608                }
609                if(path != NULL)
610                        tmpstr = ostrcat("/", tmpstr, 0, 1);
611                tmpstr = ostrcat(path, tmpstr, 0, 1);
612        }
613       
614        return tmpstr;
615}
616
617char* getprovidername(struct skin* node)
618{
619        char* tmpstr = NULL;
620
621        if(status.aktservice->channel != NULL && status.aktservice->channel->provider != NULL)
622                tmpstr = ostrcat(status.aktservice->channel->provider->name, NULL, 0, 0);
623
624        return tmpstr;
625}
626
627char* getsatname(struct skin* node)
628{
629        struct sat* satnode = NULL;
630        char* tmpstr = NULL;
631
632        if(status.aktservice->channel != NULL && status.aktservice->channel->transponder != NULL)
633        {
634                satnode = getsatbyorbitalpos(status.aktservice->channel->transponder->orbitalpos);
635                if(satnode != NULL)
636                        tmpstr = ostrcat(satnode->name, NULL, 0, 0);
637        }
638
639        return tmpstr;
640}
641
642char* getber(struct skin* node, char* format)
643{
644        uint32_t ber = 0;
645        char* buf = NULL, *buf1 = NULL;
646
647        ber = fereadber(status.aktservice->fedev);
648
649        buf = malloc(MINMALLOC);
650        if(buf == NULL)
651        {
652                err("no mem");
653                return NULL;
654        }
655       
656        snprintf(buf, MINMALLOC, format, ber);
657        buf1 = ostrcat(buf, NULL, 1, 0);
658
659        return buf1;
660}
661
662char* getsignal(struct skin* node, char* format)
663{
664        uint16_t signal = 0;
665        char* buf = NULL, *buf1 = NULL;
666
667        signal = fereadsignalstrength(status.aktservice->fedev);
668        signal = (signal * 100) / 0xffff;
669
670        buf = malloc(MINMALLOC);
671        if(buf == NULL)
672        {
673                err("no mem");
674                return NULL;
675        }
676       
677        snprintf(buf, MINMALLOC, format, signal);
678        buf1 = ostrcat(buf, NULL, 1, 0);
679
680        return buf1;
681}
682
683char* getunc(struct skin* node, char* format)
684{
685        uint32_t unc = 0;
686        char* buf = NULL, *buf1 = NULL;
687
688        unc = fereaduncorrectedblocks(status.aktservice->fedev);
689
690        buf = malloc(MINMALLOC);
691        if(buf == NULL)
692        {
693                err("no mem");
694                return NULL;
695        }
696       
697        snprintf(buf, MINMALLOC, format, unc);
698        buf1 = ostrcat(buf, NULL, 1, 0);
699
700        return buf1;
701}
702
703char* getsnr(struct skin* node, char* format)
704{
705        uint16_t snr = 0;
706        char* buf = NULL, *buf1 = NULL;
707
708       
709        snr = fereadsnr(status.aktservice->fedev);
710        snr = (snr * 100) / 0xffff;
711       
712        buf = malloc(MINMALLOC);
713        if(buf == NULL)
714        {
715                err("no mem");
716                return NULL;
717        }
718       
719        snprintf(buf, MINMALLOC, format, snr);
720        buf1 = ostrcat(buf, NULL, 1, 0);
721
722        return buf1;
723}
724
725char* getepgtimeline(struct skin* node, int akt)
726{       
727        struct epg* epgnode = NULL;
728        struct channel* chnode = NULL;
729        char* tmpstr = NULL, *tmpnr = NULL;
730        int proz = 0;
731
732        if(akt == 0) chnode = status.markedchannel;
733        if(akt == 1) chnode = status.aktservice->channel;
734        if(akt == 2 && node != NULL) chnode = (struct channel*)node->handle;
735
736        if(chnode != NULL)
737        {
738                epgnode = getepgakt(chnode);
739                if(epgnode != NULL)
740                {
741                        proz = (time(NULL) - epgnode->starttime) * 100 / (epgnode->endtime - epgnode->starttime);
742                        tmpnr = oitoa(proz);
743                        tmpstr = ostrcat(tmpstr, tmpnr, 1, 1);
744                        return tmpstr;
745                }
746        }
747        return NULL;
748}
749
750char* getepgmarkedtimeline(struct skin* node)
751{
752        return getepgtimeline(node, 0);
753}
754
755char* getepgakttimeline(struct skin* node)
756{
757        return getepgtimeline(node, 1);
758}
759
760char* getepgchanneltimeline(struct skin* node)
761{
762        return getepgtimeline(node, 2);
763}
764
765char* getaktchannelname(struct skin* node)
766{
767        char* tmpstr = NULL;
768
769        if(status.aktservice->channel != NULL)
770        {
771                tmpstr = ostrcat(tmpstr, status.aktservice->channel->name, 1, 0);
772                return tmpstr;
773        }
774        return NULL;
775}
776
777char* getepgtime(struct skin* node, char* format, int akt, int type)
778{
779        // akt 0 = marked channel
780        // akt 1 = akt channel now
781        // akt 2 = akt channel next
782
783        // type 0 = starttime
784        // type 1 = endtime
785        // type 2 = remainingtime
786
787        struct epg* epgnode = NULL;
788        struct tm *loctime = NULL;
789        struct channel* chnode = NULL;
790        char *buf = NULL, *buf1 = NULL;
791        time_t min = 0;
792       
793        if(format == NULL)
794        {
795                err("NULL detect");
796                return NULL;
797        }
798
799        if(akt == 0) chnode = status.markedchannel;
800        if(akt == 1 || akt == 2) chnode = status.aktservice->channel;
801
802// dynamic default skin infobar start
803        if(status.fontsizeadjust > 0 && status.getepgaktstart == 0 && ostrcmp(node->name, "infobar_getepgaktstart") == 0)
804        {
805                status.getepgaktstart++;
806                node->height += status.fontsizeadjust;
807                node->width += (status.fontsizeadjust * 2);
808        }
809        else if(status.fontsizeadjust > 0 && status.getepgnextstart == 0 && ostrcmp(node->name, "infobar_getepgnextstart") == 0)
810        {
811                status.getepgnextstart++;
812                node->height += status.fontsizeadjust;
813                node->posy += status.fontsizeadjust;
814                node->width += (status.fontsizeadjust * 2);
815        }
816        else if(status.fontsizeadjust > 0 && status.getepgaktend == 0 && ostrcmp(node->name, "infobar_getepgaktend") == 0)
817        {
818                status.getepgaktend++;
819                node->height += status.fontsizeadjust;
820                node->posx += (status.fontsizeadjust * 2.4);
821                node->width += (status.fontsizeadjust * 2);
822        }
823        else if(status.fontsizeadjust > 0 && status.getepgnextend == 0 && ostrcmp(node->name, "infobar_getepgnextend") == 0)
824        {
825                status.getepgnextend++;
826                node->height += status.fontsizeadjust;
827                node->posx += (status.fontsizeadjust * 2.4);
828                node->posy += status.fontsizeadjust;
829                node->width += (status.fontsizeadjust * 2);
830        }
831        else if(status.fontsizeadjust > 0 && status.getepgakttimeremaining == 0 && ostrcmp(node->name, "infobar_getepgakttimeremaining") == 0)
832        {
833                status.getepgakttimeremaining++;
834                node->height += status.fontsizeadjust;
835                node->posx -= (status.fontsizeadjust * 4);
836                node->width += (status.fontsizeadjust * 4);
837        }
838        else if(status.fontsizeadjust > 0 && status.getepgnexttimeremaining == 0 && ostrcmp(node->name, "infobar_getepgnexttimeremaining") == 0)
839        {
840                status.getepgnexttimeremaining++;
841                node->height += status.fontsizeadjust;
842                node->posx -= (status.fontsizeadjust * 4);
843                node->posy += status.fontsizeadjust;
844                node->width += (status.fontsizeadjust * 4);
845        }
846// dynamic default skin infobar end
847
848        if(chnode != NULL)
849        {
850                epgnode = getepgakt(chnode);
851
852                if(akt == 2)
853                {
854                        if(epgnode != NULL)
855                                epgnode = epgnode->next;
856                }
857
858                if(epgnode != NULL)
859                {
860                        if(type == 0)
861                                loctime = olocaltime(&epgnode->starttime);
862                        else if(type == 1)
863                                loctime = olocaltime(&epgnode->endtime);
864                        else if(type == 2)
865                        {
866                                if(akt == 1)
867                                        min = ((epgnode->endtime - (epgnode->endtime % 60)) - (time(NULL) - (time(NULL) % 60))) / 60;
868                                else if(akt == 2)
869                                        min = ((epgnode->endtime - (epgnode->endtime % 60)) - (epgnode->starttime - (epgnode->starttime % 60))) / 60;
870                                if(min < 0) min = 0;
871                        }
872
873                        buf = malloc(MINMALLOC);
874                        if(buf == NULL)
875                        {
876                                free(loctime);
877                                err("no memory");
878                                return NULL;
879                        }
880
881                        if(type == 2)
882                                snprintf(buf, MINMALLOC, format, min);
883                        else if(loctime != NULL)
884                                ostrftime(buf, MINMALLOC, format, loctime);
885                        buf1 = ostrcat(buf, NULL, 1, 0);
886
887                        buf1 = translate_time(buf1, 0);
888
889                        free(loctime); loctime = NULL;
890                        return buf1;
891                }
892        }
893        return NULL;
894}
895
896char* getepgakttimeremaining(struct skin* node, char* format)
897{
898        return getepgtime(node, format, 1, 2);
899}
900
901char* getepgnexttimeremaining(struct skin* node, char* format)
902{
903        return getepgtime(node, format, 2, 2);
904}
905
906char* getepgmarkedstart(struct skin* node, char* format)
907{
908        return getepgtime(node, format, 0, 0);
909}
910
911char* getepgmarkedend(struct skin* node, char* format)
912{
913        return getepgtime(node, format, 0, 1);
914}
915
916char* getepgaktstart(struct skin* node, char* format)
917{
918        return getepgtime(node, format, 1, 0);
919}
920
921char* getepgaktend(struct skin* node, char* format)
922{
923        return getepgtime(node, format, 1, 1);
924}
925
926char* getepgnextstart(struct skin* node, char* format)
927{
928        return getepgtime(node, format, 2, 0);
929}
930
931char* getepgnextend(struct skin* node, char* format)
932{
933        return getepgtime(node, format, 2, 1);
934}
935
936char* getepgaktsubtitle(struct skin* node)
937{
938        struct epg* epgnode = NULL;
939        char* tmpstr = NULL;
940
941        epgnode = getepgakt(status.aktservice->channel);
942        if(epgnode != NULL)
943        {
944                tmpstr = ostrcat(tmpstr, epgnode->subtitle, 1, 0);
945                return tmpstr;
946        }
947
948        return NULL;
949}
950
951char* getepgakttitle(struct skin* node)
952{
953        struct epg* epgnode = NULL;
954        char* tmpstr = NULL;
955
956// dynamic default skin infobar start
957        if(status.fontsizeadjust > 0 && status.getepgakttitle == 0 && ostrcmp(node->name,"infobar_getepgakttitle") == 0)
958        {
959                status.getepgakttitle++;
960                node->height += status.fontsizeadjust;
961                node->posx += (status.fontsizeadjust * 4.8);
962                node->width -= (status.fontsizeadjust * 6);
963                printf("set fontsize on name=%s\n", node->name);
964        }
965// dynamic default skin infobar end
966               
967        if(status.aktservice->type == HDMIIN)
968        {
969                tmpstr = ostrcat(tmpstr, "HDMI-in", 1, 0);
970                return tmpstr;
971        }
972
973        epgnode = getepgakt(status.aktservice->channel);
974        if(epgnode != NULL)
975        {
976                tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
977                return tmpstr;
978        }
979
980        return NULL;
981}
982
983char* getepgnexttitle(struct skin* node)
984{
985        struct epg* epgnode = NULL;
986        char* tmpstr = NULL;
987
988// dynamic default skin infobar start
989        if(status.fontsizeadjust > 0 && status.getepgnexttitle == 0 && ostrcmp(node->name,"infobar_getepgnexttitle") == 0)
990        {
991                status.getepgnexttitle++;
992                node->height += status.fontsizeadjust;
993                node->posx += (status.fontsizeadjust * 4.8);
994                node->posy += status.fontsizeadjust;
995                node->width -= (status.fontsizeadjust * 6);
996                printf("set fontsize on name=%s\n", node->name);
997        }
998// dynamic default skin infobar end
999
1000        epgnode = getepgakt(status.aktservice->channel);
1001        if(epgnode != NULL)
1002        {
1003                epgnode = epgnode->next;
1004                if(epgnode != NULL)
1005                {
1006                        tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
1007                        return tmpstr;
1008                }
1009        }
1010
1011        return NULL;
1012}
1013
1014char* getepgaktdesc(struct skin* node)
1015{
1016        struct epg* epgnode = NULL;
1017
1018        if(status.aktservice->channel != NULL)
1019        {
1020                epgnode = getepgakt(status.aktservice->channel);
1021                if(epgnode != NULL)
1022                        return epgdescunzip(epgnode);
1023        }
1024
1025        return NULL;
1026}
1027
1028char* getepgnextdesc(struct skin* node)
1029{
1030        struct epg* epgnode = NULL;
1031
1032        if(status.aktservice->channel != NULL)
1033        {
1034                epgnode = getepgakt(status.aktservice->channel);
1035                if(epgnode != NULL)
1036                {
1037                        epgnode = epgnode->next;
1038                        if(epgnode != NULL)
1039                                return epgdescunzip(epgnode);
1040                }
1041        }
1042
1043        return NULL;
1044}
1045
1046char* getepgmarkeddesc(struct skin* node)
1047{
1048        struct epg* epgnode = NULL;
1049
1050        if(status.markedchannel != NULL)
1051        {
1052                epgnode = getepgakt(status.markedchannel);
1053                if(epgnode != NULL)
1054                        return epgdescunzip(epgnode);
1055        }
1056
1057        return NULL;
1058}
1059
1060char* getepgmarkedtitle(struct skin* node)
1061{
1062        struct epg* epgnode = NULL;
1063        char* tmpstr = NULL;
1064
1065        if(status.markedchannel != NULL)
1066        {
1067                epgnode = getepgakt(status.markedchannel);
1068                if(epgnode != NULL)
1069                {
1070                        tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
1071                        return tmpstr;
1072                }
1073        }
1074
1075        return NULL;
1076}
1077
1078char* getepgmarkedlist(struct skin* node, char* ccount)
1079{
1080        struct epg* epgnode = NULL;
1081        char* tmpstr = NULL, *buf = NULL;
1082        int count = atoi(ccount);
1083        struct tm* loctime = NULL;
1084
1085        buf = malloc(MINMALLOC);
1086        if(buf == NULL)
1087        {
1088                err("no memory");
1089                return NULL;
1090        }
1091
1092        if(status.markedchannel != NULL)
1093        {
1094                epgnode = getepgakt(status.markedchannel);
1095                while(epgnode != NULL)
1096                {
1097                        epgnode = epgnode->next;
1098                        if(epgnode != NULL)
1099                        {
1100                                loctime = olocaltime(&epgnode->starttime);
1101                                if(loctime != NULL)
1102                                        strftime(buf, MINMALLOC, "%H:%M", loctime);
1103                                free(loctime); loctime = NULL;
1104                                tmpstr = ostrcat(tmpstr, buf, 1, 0);
1105                                tmpstr = ostrcat(tmpstr, " ", 1, 0);
1106                                tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
1107                                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
1108                                count--;
1109                        }
1110                        if(count < 1) break;
1111                }
1112        }
1113
1114        free(buf);
1115        return tmpstr;
1116}
1117
1118char* getepgpicon(struct skin* node)
1119{
1120        char* tmpstr = NULL;
1121       
1122        if(status.epgchannel != NULL)
1123                tmpstr = createpiconpath(status.epgchannel, 0);
1124        return tmpstr;
1125}
1126
1127char* getepgalternatepicon(struct skin* node)
1128{
1129        char* tmpstr = NULL;
1130       
1131        if(status.epgchannel != NULL)
1132        {
1133                tmpstr = createpiconpath(status.epgchannel, 1);
1134                if(ostrstr(tmpstr, "defpicon.png") != NULL)
1135                {
1136                        free(tmpstr); tmpstr=NULL;
1137                        tmpstr = createpiconpath(status.epgchannel, 0);
1138                }
1139        }
1140       
1141        return tmpstr;
1142}
1143
1144char* getmarkedpicon(struct skin* node)
1145{
1146        char* tmpstr = NULL;
1147       
1148        if(status.markedchannel != NULL)
1149                tmpstr = createpiconpath(status.markedchannel, 0);
1150        return tmpstr;
1151}
1152
1153char* getmarkedalternatepicon(struct skin* node)
1154{
1155        char* tmpstr = NULL;
1156       
1157        if(status.markedchannel != NULL)
1158        {
1159                tmpstr = createpiconpath(status.markedchannel, 1);
1160                if(ostrstr(tmpstr, "defpicon.png") != NULL)
1161                {
1162                        free(tmpstr); tmpstr=NULL;
1163                        tmpstr = createpiconpath(status.markedchannel, 0);
1164                }
1165        }       
1166       
1167        return tmpstr;
1168}
1169
1170char* getpicon(struct skin* node)
1171{
1172        char* tmpstr = NULL;
1173        tmpstr = createpiconpath(status.aktservice->channel, 0);
1174        return tmpstr;
1175}
1176
1177char* getalternatepicon(struct skin* node)
1178{
1179        char* tmpstr = NULL;
1180        tmpstr = createpiconpath(status.aktservice->channel, 1);
1181        if(ostrstr(tmpstr, "defpicon.png") != NULL)
1182        {
1183                free(tmpstr); tmpstr=NULL;
1184                tmpstr = createpiconpath(status.aktservice->channel, 0);
1185        }
1186        return tmpstr;
1187}
1188
1189char* getallpicon(struct skin* node, char* firstpath)
1190{
1191        char* tmpstr = NULL;
1192        int p1 = 0;
1193        int p2 = 1;
1194       
1195        if(firstpath != NULL)
1196        {
1197                if(ostrcmp("alternate", firstpath) == 0)
1198                {
1199                        p1 = 1;
1200                        p2 = 0;
1201                }
1202        }
1203       
1204        tmpstr = createpiconpath(status.aktservice->channel, p1);
1205        if(ostrstr(tmpstr, "defpicon.png") != NULL)
1206        {
1207                free(tmpstr); tmpstr=NULL;
1208                tmpstr = createpiconpath(status.aktservice->channel, p2);
1209        }
1210        return tmpstr;
1211}
1212
1213char* gettime(struct skin* node, char* format)
1214{
1215        time_t sec;
1216        struct tm *loctime = NULL;
1217        char *buf = NULL, *buf1 = NULL;
1218
1219        if(format == NULL)
1220        {
1221                err("NULL detect");
1222                return NULL;
1223        }
1224
1225        buf = malloc(MINMALLOC);
1226        if(buf == NULL)
1227        {
1228                err("no memory");
1229                return NULL;
1230        }
1231
1232        sec = time(NULL);
1233        loctime = olocaltime(&sec);
1234
1235        if(loctime != NULL)
1236        {
1237                ostrftime(buf, MINMALLOC, format, loctime);
1238                buf1 = ostrcat(buf, NULL, 1, 0);
1239        }
1240
1241        if(ostrstr(format, "%a") != NULL)
1242                buf1 = translate_time(buf1, 1);
1243        else if(ostrstr(format, "%A") != NULL)
1244                buf1 = translate_time(buf1, 2);
1245        else if(ostrstr(format, "%B") != NULL)
1246                buf1 = translate_time(buf1, 3);
1247        else
1248                buf1 = translate_time(buf1, 1);
1249
1250        free(loctime);
1251        return buf1;
1252}
1253
1254char* getchannelnr(struct skin* node, struct channel* chnode)
1255{
1256        char *tmpstr = NULL, *tmpnr = NULL;
1257
1258        if(chnode == NULL) chnode = status.aktservice->channel;
1259
1260        if(status.servicetype == 0)
1261                tmpstr = getconfig("channellist", NULL);
1262        else
1263                tmpstr = getconfig("rchannellist", NULL);
1264        if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10)
1265        {
1266                struct mainbouquet* mainbouquetnode = NULL;
1267                int count = 0;
1268
1269                mainbouquetnode = getmainbouquet(tmpstr + 10);
1270                if(mainbouquetnode != NULL && mainbouquetnode->bouquet != NULL)
1271                {
1272                        struct bouquet* bnode = mainbouquetnode->bouquet;
1273
1274                        while(bnode != NULL)
1275                        {
1276                                if(bnode->channel == chnode)
1277                                {
1278                                        tmpnr = oitoa(mainbouquetnode->bouquet->nr + count);
1279                                        return tmpnr;
1280                                }
1281                                count++;
1282                                bnode = bnode->next;
1283                        }
1284                }
1285                return tmpnr;
1286        }
1287        else
1288                return tmpnr;
1289}
1290
1291char* getakttuner(struct skin* node)
1292{
1293        char* tmpstr = NULL;
1294
1295        if(status.aktservice->fedev != NULL)
1296        {
1297                tmpstr = oitoa(status.aktservice->fedev->devnr);
1298                return tmpstr;
1299        }
1300
1301        return NULL;
1302}
1303
1304char* getchannellistname(struct skin* node)
1305{
1306        char* tmpstr = NULL, *tmpstr1 = NULL;
1307
1308        if(status.servicetype == 0)
1309                tmpstr = getconfig("channellist", NULL);
1310        else
1311                tmpstr = getconfig("rchannellist", NULL);
1312
1313        if(tmpstr != NULL)
1314        {
1315                if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10)
1316                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 10, 1, 0);
1317
1318                else if(ostrncmp("(A-Z)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6)
1319                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0);
1320
1321                else if(ostrncmp("(SAT)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6)
1322                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0);
1323
1324                else if(ostrncmp("(PROVIDER)-", tmpstr, 11) == 0 && strlen(tmpstr) > 6)
1325                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 11, 1, 0);
1326        }
1327
1328        return tmpstr1;
1329}
1330
1331char* getpowerofftime(struct skin* node, char* format)
1332{
1333        char* buf = NULL, *buf1 = NULL;
1334        int resttime = 0;
1335
1336        if(format == NULL) return NULL;
1337
1338        if(status.sd_timer != NULL && status.sd_timer->active)
1339        {
1340                buf = malloc(MINMALLOC);
1341                if(buf == NULL)
1342                {
1343                        err("no mem");
1344                        return NULL;
1345                }
1346
1347                resttime = (status.sd_timer->shutdown_time - time(NULL)) / 60;
1348                if(resttime < 0) resttime = 0;
1349                snprintf(buf, MINMALLOC, format, resttime);
1350                buf1 = ostrcat(buf, NULL, 1, 0);
1351        }
1352
1353        return buf1;
1354}
1355
1356char* gettvpic(struct skin* node, char* pos)
1357{
1358        struct splitstr* ret = NULL;
1359        char* tmpstr = NULL;
1360        int count = 0, left = 0, top = 0, width = 0;
1361
1362        if(pos != NULL)
1363        {
1364                tmpstr = ostrcat(pos, NULL, 0, 0);
1365                ret = strsplit(tmpstr, ":", &count);
1366                if(count == 3)
1367                {
1368                        if((&ret[0])->part != NULL)
1369                                left = atoi((&ret[0])->part);
1370                        if((&ret[1])->part != NULL)
1371                                top = atoi((&ret[1])->part);
1372                        if((&ret[2])->part != NULL)
1373                                width = atoi((&ret[2])->part);
1374                       
1375                        setvmpegrect(status.aktservice->videodev, left, top, width, 0);
1376                }
1377                free(tmpstr); tmpstr = NULL;
1378        }
1379
1380        free(ret); ret = NULL;
1381        return NULL;
1382}
1383
1384char* getrecfreesize(struct skin* node)
1385{
1386        int ret = 0;
1387
1388        if(status.showrecfreesize > 0)
1389        {
1390                unsigned long long full = getfullspace(getconfig("rec_path", NULL)) / (1024 * 1024 * 1024);
1391                unsigned long long free = getfreespace(getconfig("rec_path", NULL)) / (1024 * 1024 * 1024);
1392
1393                if(full > 0 && full >= free) ret = ((full - free) * 100) / full;
1394
1395                if(ret < 0) ret = 0;
1396                if(ret > 100) ret = 100;
1397        }
1398
1399        return oitoa(ret);
1400}
1401
1402char* getrecfreesizetext(struct skin* node)
1403{
1404        int ret = 0;
1405        char* tmpstr = NULL;
1406
1407        if(status.showrecfreesize > 0)
1408        {
1409                unsigned long long full = getfullspace(getconfig("rec_path", NULL)) / (1024 * 1024 * 1024);
1410                unsigned long long free = getfreespace(getconfig("rec_path", NULL)) / (1024 * 1024 * 1024);
1411
1412                if(full > 0 && full >= free) ret = ((full - free) * 100) / full;
1413
1414                if(ret < 0) ret = 0;
1415                if(ret > 100) ret = 100;
1416               
1417                if(status.showrecfreesize == 1)
1418                        tmpstr = ostrcat(oitoa(ret), " %", 1, 0);
1419                else
1420                        tmpstr = ostrcat(ollutoa(free), " GB", 1, 0);
1421        }
1422
1423        return tmpstr;
1424}
1425
1426char* gethbbtv(struct skin* node, char* path)
1427{
1428        char* tmpstr = NULL;
1429
1430        if(status.aktservice->channel != NULL)
1431        {
1432    if(status.aktservice->channel->hbbtvurl != NULL)
1433      tmpstr = ostrcat("hbbtv_on.png", "", 0, 0);
1434    else
1435      tmpstr = ostrcat("hbbtv_off.png", "", 0, 0);
1436
1437                if(path != NULL)
1438                        tmpstr = ostrcat("/", tmpstr, 0, 1);
1439                tmpstr = ostrcat(path, tmpstr, 0, 1);
1440        }
1441       
1442        return tmpstr;
1443}
1444
1445char* getimgname(struct skin* node)
1446{
1447        return getimgnamereal();
1448}
1449
1450char* getoscamcaid(struct skin* node)
1451{
1452        char* buf = NULL, *tmpstr = NULL;
1453
1454        buf = readfiletomem("/tmp/ecm.info", 1);
1455        tmpstr = ostrstr(buf, "caid:");
1456        if(tmpstr != NULL)
1457        {
1458                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1459                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1460        }
1461        free(buf); buf = NULL;
1462
1463        return tmpstr;
1464}
1465
1466char* getoscampid(struct skin* node)
1467{
1468        char* buf = NULL, *tmpstr = NULL;
1469
1470        buf = readfiletomem("/tmp/ecm.info", 1);
1471        tmpstr = ostrstr(buf, "pid:");
1472        if(tmpstr != NULL)
1473        {
1474                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1475                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1476        }
1477        free(buf); buf = NULL;
1478
1479        return tmpstr;
1480}
1481
1482char* getoscamprov(struct skin* node)
1483{
1484        char* buf = NULL, *tmpstr = NULL;
1485
1486        buf = readfiletomem("/tmp/ecm.info", 1);
1487        tmpstr = ostrstr(buf, "prov:");
1488        if(tmpstr != NULL)
1489        {
1490                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1491                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1492        }
1493        free(buf); buf = NULL;
1494
1495        return tmpstr;
1496}
1497
1498char* getoscamreader(struct skin* node)
1499{
1500        char* buf = NULL, *tmpstr = NULL;
1501
1502        buf = readfiletomem("/tmp/ecm.info", 1);
1503        tmpstr = ostrstr(buf, "reader:");
1504        if(tmpstr != NULL)
1505        {
1506                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1507                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1508        }
1509        free(buf); buf = NULL;
1510
1511        return tmpstr;
1512}
1513
1514char* getoscamfrom(struct skin* node)
1515{
1516        char* buf = NULL, *tmpstr = NULL;
1517
1518        buf = readfiletomem("/tmp/ecm.info", 1);
1519        tmpstr = ostrstr(buf, "from:");
1520        if(tmpstr != NULL)
1521        {
1522                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1523                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1524        }
1525        free(buf); buf = NULL;
1526
1527        return tmpstr;
1528}
1529
1530char* getoscamprotocol(struct skin* node)
1531{
1532        char* buf = NULL, *tmpstr = NULL;
1533
1534        buf = readfiletomem("/tmp/ecm.info", 1);
1535        tmpstr = ostrstr(buf, "protocol:");
1536        if(tmpstr != NULL)
1537        {
1538                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1539                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1540        }
1541        free(buf); buf = NULL;
1542
1543        return tmpstr;
1544}
1545
1546char* getoscamhops(struct skin* node)
1547{
1548        char* buf = NULL, *tmpstr = NULL;
1549
1550        buf = readfiletomem("/tmp/ecm.info", 1);
1551        tmpstr = ostrstr(buf, "hops:");
1552        if(tmpstr != NULL)
1553        {
1554                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1555                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1556        }
1557        free(buf); buf = NULL;
1558
1559        return tmpstr;
1560}
1561
1562char* getoscamecmtime(struct skin* node)
1563{
1564        char* buf = NULL, *tmpstr = NULL;
1565
1566        buf = readfiletomem("/tmp/ecm.info", 1);
1567        tmpstr = ostrstr(buf, "ecm time:");
1568        if(tmpstr != NULL)
1569        {
1570                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1571                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1572        }
1573        free(buf); buf = NULL;
1574
1575        return tmpstr;
1576}
1577
1578char* getoscamcw0(struct skin* node)
1579{
1580        char* buf = NULL, *tmpstr = NULL;
1581
1582        buf = readfiletomem("/tmp/ecm.info", 1);
1583        tmpstr = ostrstr(buf, "cw0:");
1584        if(tmpstr != NULL)
1585        {
1586                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1587                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1588        }
1589        free(buf); buf = NULL;
1590
1591        return tmpstr;
1592}
1593
1594char* getoscamcw1(struct skin* node)
1595{
1596        char* buf = NULL, *tmpstr = NULL;
1597
1598        buf = readfiletomem("/tmp/ecm.info", 1);
1599        tmpstr = ostrstr(buf, "cw1:");
1600        if(tmpstr != NULL)
1601        {
1602                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1603                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1604        }
1605        free(buf); buf = NULL;
1606
1607        return tmpstr;
1608}
1609
1610char* getoscamsystem(struct skin* node)
1611{
1612        char* buf = NULL, *tmpstr = NULL;
1613
1614        buf = readfiletomem("/tmp/ecm.info", 1);
1615        tmpstr = ostrstr(buf, "system:");
1616        if(tmpstr != NULL)
1617        {
1618                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1619                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1620        }
1621        free(buf); buf = NULL;
1622
1623        return tmpstr;
1624}
1625
1626char* getoscamsource(struct skin* node)
1627{
1628        char* buf = NULL, *tmpstr = NULL;
1629
1630        buf = readfiletomem("/tmp/ecm.info", 1);
1631        tmpstr = ostrstr(buf, "source:");
1632        if(tmpstr != NULL)
1633        {
1634                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1635                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1636        }
1637        free(buf); buf = NULL;
1638
1639        return tmpstr;
1640}
1641
1642char* getemu(struct skin* node)
1643{
1644        char* tmpstr = NULL;
1645        char* tmpstr1 = NULL;
1646        tmpstr = string_newline(command("emu.sh infoname"));
1647
1648        if(ostrstr(tmpstr, "not found") != NULL)
1649        {
1650                free(tmpstr);
1651                tmpstr = NULL;
1652        }
1653        else
1654        {
1655                        tmpstr1 = ostrcat(tmpstr, NULL, 0, 0);
1656                        free(tmpstr),tmpstr = NULL;                     
1657                        tmpstr = ostrcat("emu: ", tmpstr1, 0, 0);                       
1658                        free(tmpstr1),tmpstr1 = NULL;
1659        }
1660        return tmpstr;
1661}
1662
1663char* getbufferstatus(struct skin* node)
1664{
1665        int ret = 0;
1666
1667#ifdef EPLAYER4
1668/*
1669        GstMessage *msg = NULL;
1670        gint percent = 0;
1671        gst_message_parse_buffering (msg, &percent);
1672        g_print ("Buffering (%3d%%)\r", percent);
1673        ret = (int)percent;
1674*/
1675        ret = status.bufferpercent;
1676#else
1677        int size = 0, status = 0;
1678        size = playergetbuffersize();
1679        if(size > 0)
1680                status = playergetbufferstatus();
1681
1682        if(size > 0 && size >= status) ret = 100 - (((size - status) * 100) / size);
1683#endif         
1684               
1685        if(ret < 0) ret = 0;
1686        if(ret > 100) ret = 100;
1687
1688        return oitoa(ret);
1689}
1690
1691char* getwlanlinkquality(struct skin* node)
1692{
1693        int quality = 0;
1694
1695        quality = wlanlinkquality();
1696
1697        if(quality < 0) quality = 0;
1698        if(quality > 100) quality = 100;
1699
1700        return oitoa(quality);
1701}
1702
1703char* getwlanlinkqualitytext(struct skin* node)
1704{
1705        int quality = 0;
1706        char* tmpstr = NULL;
1707
1708        quality = wlanlinkquality();
1709
1710        if(quality < 0) quality = 0;
1711        if(quality > 100) quality = 100;
1712
1713        tmpstr = ostrcat(oitoa(quality), " %", 1, 0);
1714
1715        return tmpstr;
1716}
1717
1718char* getredbutton(struct skin* node)
1719{
1720        char* tmpstr = ostrcat(getconfig("redkey", NULL), NULL, 0, 0);
1721        if(tmpstr == NULL) tmpstr = ostrcat(tmpstr, "Extensions List", 1, 0);
1722        return tmpstr;
1723}
1724
1725char* getbluebutton(struct skin* node)
1726{
1727        char* tmpstr = ostrcat(getconfig("bluekey", NULL), NULL, 0, 0);
1728        if(tmpstr == NULL) tmpstr = ostrcat(tmpstr, "TV/Radio", 1, 0);
1729        return tmpstr;
1730}
1731
1732char* setblink(struct skin* node)
1733{
1734        if(status.skinblink == 0)
1735                node->hidden = YES;
1736        else
1737                node->hidden = NO;
1738        return NULL;
1739}
1740
1741char* gettunerlockpic(struct skin* node, char* path, char* tuner)
1742{
1743        char* tmpstr = NULL;
1744        int tunernr = 0;
1745        int tunerlock = 0;
1746        if(tuner != NULL)
1747                tunernr = atoi(tuner);
1748        tunerlock = fegetlock(tunernr);
1749       
1750        if(tunerlock > 0 || (tunerlock != -1 && status.aktservice->fedev != NULL && status.aktservice->fedev->devnr == tunernr && status.standby == 0 && status.playing == 0))
1751        {
1752                if(node->nodestyle != 1)
1753                        node->hidden = NO;     
1754                if(node->picmem == 1)
1755                        return tmpstr;
1756                //tuner?act.png
1757                if(tuner != NULL)
1758                        tmpstr = ostrcat("tuner",tuner, 0, 0);
1759                else
1760                        tmpstr = ostrcat("tuner","0", 0, 0);
1761                tmpstr = ostrcat(tmpstr,"act.png", 1, 0);
1762                if(path != NULL)
1763        tmpstr = ostrcat("/", tmpstr, 0, 1);
1764    tmpstr = ostrcat(path, tmpstr, 0, 1);
1765        }
1766  else
1767                node->hidden = YES;     
1768        return tmpstr;
1769}   
1770
1771char* gettunerlocktext(struct skin* node, char* onlyhidden, char* tuner)
1772{
1773        char* tmpstr = NULL;
1774        int tunernr = 0;
1775        int tunerlock = 0;
1776        if(tuner != NULL)
1777                tunernr = atoi(tuner);
1778        tunerlock = fegetlock(tunernr);
1779        debug(100, "tunernr:%i tunerlock:%i", tunernr, tunerlock);
1780       
1781        if(tunerlock > 0 || (tunerlock != -1 && status.aktservice->fedev != NULL && status.aktservice->fedev->devnr == tunernr && status.standby == 0 && status.playing == 0))
1782        {
1783                if(node->nodestyle != 1)
1784                        node->hidden = NO;
1785                if(onlyhidden == NULL)
1786                {
1787                        if(tunernr == 0)
1788                                tmpstr = ostrcat("A",NULL, 0, 0);
1789                        if(tunernr == 1)
1790                                tmpstr = ostrcat("B",NULL, 0, 0);
1791                        if(tunernr == 2)
1792                                tmpstr = ostrcat("C",NULL, 0, 0);               
1793                        if(tunernr == 3)
1794                                tmpstr = ostrcat("D",NULL, 0, 0);       
1795                }
1796                else
1797                        tmpstr = ostrcat(node->text,NULL, 0, 0);
1798        }
1799  else
1800                node->hidden = YES;     
1801        return tmpstr;
1802}   
1803                       
1804#endif
Note: See TracBrowser for help on using the repository browser.