source: titan/titan/skinfunc.h @ 38478

Last change on this file since 38478 was 35595, checked in by gost, 9 years ago

[titan] fix3 setblink option

File size: 35.6 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        if(chnode != NULL)
803        {
804                epgnode = getepgakt(chnode);
805
806                if(akt == 2)
807                {
808                        if(epgnode != NULL)
809                                epgnode = epgnode->next;
810                }
811
812                if(epgnode != NULL)
813                {
814                        if(type == 0)
815                                loctime = olocaltime(&epgnode->starttime);
816                        else if(type == 1)
817                                loctime = olocaltime(&epgnode->endtime);
818                        else if(type == 2)
819                        {
820                                if(akt == 1)
821                                        min = ((epgnode->endtime - (epgnode->endtime % 60)) - (time(NULL) - (time(NULL) % 60))) / 60;
822                                else if(akt == 2)
823                                        min = ((epgnode->endtime - (epgnode->endtime % 60)) - (epgnode->starttime - (epgnode->starttime % 60))) / 60;
824                                if(min < 0) min = 0;
825                        }
826
827                        buf = malloc(MINMALLOC);
828                        if(buf == NULL)
829                        {
830                                free(loctime);
831                                err("no memory");
832                                return NULL;
833                        }
834
835                        if(type == 2)
836                                snprintf(buf, MINMALLOC, format, min);
837                        else if(loctime != NULL)
838                                ostrftime(buf, MINMALLOC, format, loctime);
839                        buf1 = ostrcat(buf, NULL, 1, 0);
840
841                        buf1 = translate_time(buf1, 0);
842
843                        free(loctime); loctime = NULL;
844                        return buf1;
845                }
846        }
847        return NULL;
848}
849
850char* getepgakttimeremaining(struct skin* node, char* format)
851{
852        return getepgtime(node, format, 1, 2);
853}
854
855char* getepgnexttimeremaining(struct skin* node, char* format)
856{
857        return getepgtime(node, format, 2, 2);
858}
859
860char* getepgmarkedstart(struct skin* node, char* format)
861{
862        return getepgtime(node, format, 0, 0);
863}
864
865char* getepgmarkedend(struct skin* node, char* format)
866{
867        return getepgtime(node, format, 0, 1);
868}
869
870char* getepgaktstart(struct skin* node, char* format)
871{
872        return getepgtime(node, format, 1, 0);
873}
874
875char* getepgaktend(struct skin* node, char* format)
876{
877        return getepgtime(node, format, 1, 1);
878}
879
880char* getepgnextstart(struct skin* node, char* format)
881{
882        return getepgtime(node, format, 2, 0);
883}
884
885char* getepgnextend(struct skin* node, char* format)
886{
887        return getepgtime(node, format, 2, 1);
888}
889
890char* getepgaktsubtitle(struct skin* node)
891{
892        struct epg* epgnode = NULL;
893        char* tmpstr = NULL;
894
895        epgnode = getepgakt(status.aktservice->channel);
896        if(epgnode != NULL)
897        {
898                tmpstr = ostrcat(tmpstr, epgnode->subtitle, 1, 0);
899                return tmpstr;
900        }
901
902        return NULL;
903}
904
905char* getepgakttitle(struct skin* node)
906{
907        struct epg* epgnode = NULL;
908        char* tmpstr = NULL;
909
910        if(status.aktservice->type == HDMIIN)
911        {
912                tmpstr = ostrcat(tmpstr, "HDMI-in", 1, 0);
913                return tmpstr;
914        }
915
916        epgnode = getepgakt(status.aktservice->channel);
917        if(epgnode != NULL)
918        {
919                tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
920                return tmpstr;
921        }
922
923        return NULL;
924}
925
926char* getepgnexttitle(struct skin* node)
927{
928        struct epg* epgnode = NULL;
929        char* tmpstr = NULL;
930
931        epgnode = getepgakt(status.aktservice->channel);
932        if(epgnode != NULL)
933        {
934                epgnode = epgnode->next;
935                if(epgnode != NULL)
936                {
937                        tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
938                        return tmpstr;
939                }
940        }
941
942        return NULL;
943}
944
945char* getepgaktdesc(struct skin* node)
946{
947        struct epg* epgnode = NULL;
948
949        if(status.aktservice->channel != NULL)
950        {
951                epgnode = getepgakt(status.aktservice->channel);
952                if(epgnode != NULL)
953                        return epgdescunzip(epgnode);
954        }
955
956        return NULL;
957}
958
959char* getepgnextdesc(struct skin* node)
960{
961        struct epg* epgnode = NULL;
962
963        if(status.aktservice->channel != NULL)
964        {
965                epgnode = getepgakt(status.aktservice->channel);
966                if(epgnode != NULL)
967                {
968                        epgnode = epgnode->next;
969                        if(epgnode != NULL)
970                                return epgdescunzip(epgnode);
971                }
972        }
973
974        return NULL;
975}
976
977char* getepgmarkeddesc(struct skin* node)
978{
979        struct epg* epgnode = NULL;
980
981        if(status.markedchannel != NULL)
982        {
983                epgnode = getepgakt(status.markedchannel);
984                if(epgnode != NULL)
985                        return epgdescunzip(epgnode);
986        }
987
988        return NULL;
989}
990
991char* getepgmarkedtitle(struct skin* node)
992{
993        struct epg* epgnode = NULL;
994        char* tmpstr = NULL;
995
996        if(status.markedchannel != NULL)
997        {
998                epgnode = getepgakt(status.markedchannel);
999                if(epgnode != NULL)
1000                {
1001                        tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
1002                        return tmpstr;
1003                }
1004        }
1005
1006        return NULL;
1007}
1008
1009char* getepgmarkedlist(struct skin* node, char* ccount)
1010{
1011        struct epg* epgnode = NULL;
1012        char* tmpstr = NULL, *buf = NULL;
1013        int count = atoi(ccount);
1014        struct tm* loctime = NULL;
1015
1016        buf = malloc(MINMALLOC);
1017        if(buf == NULL)
1018        {
1019                err("no memory");
1020                return NULL;
1021        }
1022
1023        if(status.markedchannel != NULL)
1024        {
1025                epgnode = getepgakt(status.markedchannel);
1026                while(epgnode != NULL)
1027                {
1028                        epgnode = epgnode->next;
1029                        if(epgnode != NULL)
1030                        {
1031                                loctime = olocaltime(&epgnode->starttime);
1032                                if(loctime != NULL)
1033                                        strftime(buf, MINMALLOC, "%H:%M", loctime);
1034                                free(loctime); loctime = NULL;
1035                                tmpstr = ostrcat(tmpstr, buf, 1, 0);
1036                                tmpstr = ostrcat(tmpstr, " ", 1, 0);
1037                                tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
1038                                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
1039                                count--;
1040                        }
1041                        if(count < 1) break;
1042                }
1043        }
1044
1045        free(buf);
1046        return tmpstr;
1047}
1048
1049char* getepgpicon(struct skin* node)
1050{
1051        char* tmpstr = NULL;
1052       
1053        if(status.epgchannel != NULL)
1054                tmpstr = createpiconpath(status.epgchannel, 0);
1055        return tmpstr;
1056}
1057
1058char* getepgalternatepicon(struct skin* node)
1059{
1060        char* tmpstr = NULL;
1061       
1062        if(status.epgchannel != NULL)
1063                tmpstr = createpiconpath(status.epgchannel, 1);
1064        return tmpstr;
1065}
1066
1067char* getmarkedpicon(struct skin* node)
1068{
1069        char* tmpstr = NULL;
1070       
1071        if(status.markedchannel != NULL)
1072                tmpstr = createpiconpath(status.markedchannel, 0);
1073        return tmpstr;
1074}
1075
1076char* getmarkedalternatepicon(struct skin* node)
1077{
1078        char* tmpstr = NULL;
1079       
1080        if(status.markedchannel != NULL)
1081                tmpstr = createpiconpath(status.markedchannel, 1);
1082        return tmpstr;
1083}
1084
1085char* getpicon(struct skin* node)
1086{
1087        char* tmpstr = NULL;
1088        tmpstr = createpiconpath(status.aktservice->channel, 0);
1089        return tmpstr;
1090}
1091
1092char* getalternatepicon(struct skin* node)
1093{
1094        char* tmpstr = NULL;
1095        tmpstr = createpiconpath(status.aktservice->channel, 1);
1096        return tmpstr;
1097}
1098
1099char* gettime(struct skin* node, char* format)
1100{
1101        time_t sec;
1102        struct tm *loctime = NULL;
1103        char *buf = NULL, *buf1 = NULL;
1104
1105        if(format == NULL)
1106        {
1107                err("NULL detect");
1108                return NULL;
1109        }
1110
1111        buf = malloc(MINMALLOC);
1112        if(buf == NULL)
1113        {
1114                err("no memory");
1115                return NULL;
1116        }
1117
1118        sec = time(NULL);
1119        loctime = olocaltime(&sec);
1120
1121        if(loctime != NULL)
1122        {
1123                ostrftime(buf, MINMALLOC, format, loctime);
1124                buf1 = ostrcat(buf, NULL, 1, 0);
1125        }
1126
1127        if(ostrstr(format, "%a") != NULL)
1128                buf1 = translate_time(buf1, 1);
1129        else if(ostrstr(format, "%A") != NULL)
1130                buf1 = translate_time(buf1, 2);
1131        else if(ostrstr(format, "%B") != NULL)
1132                buf1 = translate_time(buf1, 3);
1133        else
1134                buf1 = translate_time(buf1, 1);
1135
1136        free(loctime);
1137        return buf1;
1138}
1139
1140char* getchannelnr(struct skin* node, struct channel* chnode)
1141{
1142        char *tmpstr = NULL, *tmpnr = NULL;
1143
1144        if(chnode == NULL) chnode = status.aktservice->channel;
1145
1146        if(status.servicetype == 0)
1147                tmpstr = getconfig("channellist", NULL);
1148        else
1149                tmpstr = getconfig("rchannellist", NULL);
1150        if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10)
1151        {
1152                struct mainbouquet* mainbouquetnode = NULL;
1153                int count = 0;
1154
1155                mainbouquetnode = getmainbouquet(tmpstr + 10);
1156                if(mainbouquetnode != NULL && mainbouquetnode->bouquet != NULL)
1157                {
1158                        struct bouquet* bnode = mainbouquetnode->bouquet;
1159
1160                        while(bnode != NULL)
1161                        {
1162                                if(bnode->channel == chnode)
1163                                {
1164                                        tmpnr = oitoa(mainbouquetnode->bouquet->nr + count);
1165                                        return tmpnr;
1166                                }
1167                                count++;
1168                                bnode = bnode->next;
1169                        }
1170                }
1171                return tmpnr;
1172        }
1173        else
1174                return tmpnr;
1175}
1176
1177char* getakttuner(struct skin* node)
1178{
1179        char* tmpstr = NULL;
1180
1181        if(status.aktservice->fedev != NULL)
1182        {
1183                tmpstr = oitoa(status.aktservice->fedev->devnr);
1184                return tmpstr;
1185        }
1186
1187        return NULL;
1188}
1189
1190char* getchannellistname(struct skin* node)
1191{
1192        char* tmpstr = NULL, *tmpstr1 = NULL;
1193
1194        if(status.servicetype == 0)
1195                tmpstr = getconfig("channellist", NULL);
1196        else
1197                tmpstr = getconfig("rchannellist", NULL);
1198
1199        if(tmpstr != NULL)
1200        {
1201                if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10)
1202                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 10, 1, 0);
1203
1204                else if(ostrncmp("(A-Z)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6)
1205                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0);
1206
1207                else if(ostrncmp("(SAT)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6)
1208                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0);
1209
1210                else if(ostrncmp("(PROVIDER)-", tmpstr, 11) == 0 && strlen(tmpstr) > 6)
1211                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 11, 1, 0);
1212        }
1213
1214        return tmpstr1;
1215}
1216
1217char* getpowerofftime(struct skin* node, char* format)
1218{
1219        char* buf = NULL, *buf1 = NULL;
1220        int resttime = 0;
1221
1222        if(format == NULL) return NULL;
1223
1224        if(status.sd_timer != NULL && status.sd_timer->active)
1225        {
1226                buf = malloc(MINMALLOC);
1227                if(buf == NULL)
1228                {
1229                        err("no mem");
1230                        return NULL;
1231                }
1232
1233                resttime = (status.sd_timer->shutdown_time - time(NULL)) / 60;
1234                if(resttime < 0) resttime = 0;
1235                snprintf(buf, MINMALLOC, format, resttime);
1236                buf1 = ostrcat(buf, NULL, 1, 0);
1237        }
1238
1239        return buf1;
1240}
1241
1242char* gettvpic(struct skin* node, char* pos)
1243{
1244        struct splitstr* ret = NULL;
1245        char* tmpstr = NULL;
1246        int count = 0, left = 0, top = 0, width = 0;
1247
1248        if(pos != NULL)
1249        {
1250                tmpstr = ostrcat(pos, NULL, 0, 0);
1251                ret = strsplit(tmpstr, ":", &count);
1252                if(count == 3)
1253                {
1254                        if((&ret[0])->part != NULL)
1255                                left = atoi((&ret[0])->part);
1256                        if((&ret[1])->part != NULL)
1257                                top = atoi((&ret[1])->part);
1258                        if((&ret[2])->part != NULL)
1259                                width = atoi((&ret[2])->part);
1260                       
1261                        setvmpegrect(status.aktservice->videodev, left, top, width, 0);
1262                }
1263                free(tmpstr); tmpstr = NULL;
1264        }
1265
1266        free(ret); ret = NULL;
1267        return NULL;
1268}
1269
1270char* getrecfreesize(struct skin* node)
1271{
1272        int ret = 0;
1273
1274        if(status.showrecfreesize > 0)
1275        {
1276                unsigned long long full = getfullspace(getconfig("rec_path", NULL)) / (1024 * 1024 * 1024);
1277                unsigned long long free = getfreespace(getconfig("rec_path", NULL)) / (1024 * 1024 * 1024);
1278
1279                if(full > 0 && full >= free) ret = ((full - free) * 100) / full;
1280
1281                if(ret < 0) ret = 0;
1282                if(ret > 100) ret = 100;
1283        }
1284
1285        return oitoa(ret);
1286}
1287
1288char* getrecfreesizetext(struct skin* node)
1289{
1290        int ret = 0;
1291        char* tmpstr = NULL;
1292
1293        if(status.showrecfreesize > 0)
1294        {
1295                unsigned long long full = getfullspace(getconfig("rec_path", NULL)) / (1024 * 1024 * 1024);
1296                unsigned long long free = getfreespace(getconfig("rec_path", NULL)) / (1024 * 1024 * 1024);
1297
1298                if(full > 0 && full >= free) ret = ((full - free) * 100) / full;
1299
1300                if(ret < 0) ret = 0;
1301                if(ret > 100) ret = 100;
1302               
1303                if(status.showrecfreesize == 1)
1304                        tmpstr = ostrcat(oitoa(ret), " %", 1, 0);
1305                else
1306                        tmpstr = ostrcat(ollutoa(free), " GB", 1, 0);
1307        }
1308
1309        return tmpstr;
1310}
1311
1312char* gethbbtv(struct skin* node, char* path)
1313{
1314        char* tmpstr = NULL;
1315
1316        if(status.aktservice->channel != NULL)
1317        {
1318    if(status.aktservice->channel->hbbtvurl != NULL)
1319      tmpstr = ostrcat("hbbtv_on.png", "", 0, 0);
1320    else
1321      tmpstr = ostrcat("hbbtv_off.png", "", 0, 0);
1322
1323                if(path != NULL)
1324                        tmpstr = ostrcat("/", tmpstr, 0, 1);
1325                tmpstr = ostrcat(path, tmpstr, 0, 1);
1326        }
1327       
1328        return tmpstr;
1329}
1330
1331char* getimgname(struct skin* node)
1332{
1333        return getimgnamereal();
1334}
1335
1336char* getoscamcaid(struct skin* node)
1337{
1338        char* buf = NULL, *tmpstr = NULL;
1339
1340        buf = readfiletomem("/tmp/ecm.info", 1);
1341        tmpstr = ostrstr(buf, "caid:");
1342        if(tmpstr != NULL)
1343        {
1344                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1345                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1346        }
1347        free(buf); buf = NULL;
1348
1349        return tmpstr;
1350}
1351
1352char* getoscampid(struct skin* node)
1353{
1354        char* buf = NULL, *tmpstr = NULL;
1355
1356        buf = readfiletomem("/tmp/ecm.info", 1);
1357        tmpstr = ostrstr(buf, "pid:");
1358        if(tmpstr != NULL)
1359        {
1360                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1361                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1362        }
1363        free(buf); buf = NULL;
1364
1365        return tmpstr;
1366}
1367
1368char* getoscamprov(struct skin* node)
1369{
1370        char* buf = NULL, *tmpstr = NULL;
1371
1372        buf = readfiletomem("/tmp/ecm.info", 1);
1373        tmpstr = ostrstr(buf, "prov:");
1374        if(tmpstr != NULL)
1375        {
1376                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1377                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1378        }
1379        free(buf); buf = NULL;
1380
1381        return tmpstr;
1382}
1383
1384char* getoscamreader(struct skin* node)
1385{
1386        char* buf = NULL, *tmpstr = NULL;
1387
1388        buf = readfiletomem("/tmp/ecm.info", 1);
1389        tmpstr = ostrstr(buf, "reader:");
1390        if(tmpstr != NULL)
1391        {
1392                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1393                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1394        }
1395        free(buf); buf = NULL;
1396
1397        return tmpstr;
1398}
1399
1400char* getoscamfrom(struct skin* node)
1401{
1402        char* buf = NULL, *tmpstr = NULL;
1403
1404        buf = readfiletomem("/tmp/ecm.info", 1);
1405        tmpstr = ostrstr(buf, "from:");
1406        if(tmpstr != NULL)
1407        {
1408                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1409                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1410        }
1411        free(buf); buf = NULL;
1412
1413        return tmpstr;
1414}
1415
1416char* getoscamprotocol(struct skin* node)
1417{
1418        char* buf = NULL, *tmpstr = NULL;
1419
1420        buf = readfiletomem("/tmp/ecm.info", 1);
1421        tmpstr = ostrstr(buf, "protocol:");
1422        if(tmpstr != NULL)
1423        {
1424                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1425                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1426        }
1427        free(buf); buf = NULL;
1428
1429        return tmpstr;
1430}
1431
1432char* getoscamhops(struct skin* node)
1433{
1434        char* buf = NULL, *tmpstr = NULL;
1435
1436        buf = readfiletomem("/tmp/ecm.info", 1);
1437        tmpstr = ostrstr(buf, "hops:");
1438        if(tmpstr != NULL)
1439        {
1440                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1441                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1442        }
1443        free(buf); buf = NULL;
1444
1445        return tmpstr;
1446}
1447
1448char* getoscamecmtime(struct skin* node)
1449{
1450        char* buf = NULL, *tmpstr = NULL;
1451
1452        buf = readfiletomem("/tmp/ecm.info", 1);
1453        tmpstr = ostrstr(buf, "ecm time:");
1454        if(tmpstr != NULL)
1455        {
1456                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1457                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1458        }
1459        free(buf); buf = NULL;
1460
1461        return tmpstr;
1462}
1463
1464char* getoscamcw0(struct skin* node)
1465{
1466        char* buf = NULL, *tmpstr = NULL;
1467
1468        buf = readfiletomem("/tmp/ecm.info", 1);
1469        tmpstr = ostrstr(buf, "cw0:");
1470        if(tmpstr != NULL)
1471        {
1472                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1473                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1474        }
1475        free(buf); buf = NULL;
1476
1477        return tmpstr;
1478}
1479
1480char* getoscamcw1(struct skin* node)
1481{
1482        char* buf = NULL, *tmpstr = NULL;
1483
1484        buf = readfiletomem("/tmp/ecm.info", 1);
1485        tmpstr = ostrstr(buf, "cw1:");
1486        if(tmpstr != NULL)
1487        {
1488                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1489                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1490        }
1491        free(buf); buf = NULL;
1492
1493        return tmpstr;
1494}
1495
1496char* getoscamsystem(struct skin* node)
1497{
1498        char* buf = NULL, *tmpstr = NULL;
1499
1500        buf = readfiletomem("/tmp/ecm.info", 1);
1501        tmpstr = ostrstr(buf, "system:");
1502        if(tmpstr != NULL)
1503        {
1504                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1505                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1506        }
1507        free(buf); buf = NULL;
1508
1509        return tmpstr;
1510}
1511
1512char* getoscamsource(struct skin* node)
1513{
1514        char* buf = NULL, *tmpstr = NULL;
1515
1516        buf = readfiletomem("/tmp/ecm.info", 1);
1517        tmpstr = ostrstr(buf, "source:");
1518        if(tmpstr != NULL)
1519        {
1520                tmpstr = stringreplacecharonce(tmpstr, '\n', '\0');
1521                tmpstr = ostrcat(tmpstr, NULL, 0, 0);
1522        }
1523        free(buf); buf = NULL;
1524
1525        return tmpstr;
1526}
1527
1528char* getemu(struct skin* node)
1529{
1530        char* tmpstr = NULL;
1531        char* tmpstr1 = NULL;
1532        tmpstr = string_newline(command("emu.sh infoname"));
1533
1534        if(ostrstr(tmpstr, "not found") != NULL)
1535        {
1536                free(tmpstr);
1537                tmpstr = NULL;
1538        }
1539        else
1540        {
1541                        tmpstr1 = ostrcat(tmpstr, NULL, 0, 0);
1542                        free(tmpstr),tmpstr = NULL;                     
1543                        tmpstr = ostrcat("emu: ", tmpstr1, 0, 0);                       
1544                        free(tmpstr1),tmpstr1 = NULL;
1545        }
1546        return tmpstr;
1547}
1548
1549char* getbufferstatus(struct skin* node)
1550{
1551        int ret = 0;
1552
1553#ifdef EPLAYER4
1554/*
1555        GstMessage *msg = NULL;
1556        gint percent = 0;
1557        gst_message_parse_buffering (msg, &percent);
1558        g_print ("Buffering (%3d%%)\r", percent);
1559        ret = (int)percent;
1560*/
1561        ret = status.bufferpercent;
1562#else
1563        int size = 0, status = 0;
1564        size = playergetbuffersize();
1565        if(size > 0)
1566                status = playergetbufferstatus();
1567
1568        if(size > 0 && size >= status) ret = 100 - (((size - status) * 100) / size);
1569#endif         
1570               
1571        if(ret < 0) ret = 0;
1572        if(ret > 100) ret = 100;
1573
1574        return oitoa(ret);
1575}
1576
1577char* getwlanlinkquality(struct skin* node)
1578{
1579        int quality = 0;
1580
1581        quality = wlanlinkquality();
1582
1583        if(quality < 0) quality = 0;
1584        if(quality > 100) quality = 100;
1585
1586        return oitoa(quality);
1587}
1588
1589char* getwlanlinkqualitytext(struct skin* node)
1590{
1591        int quality = 0;
1592        char* tmpstr = NULL;
1593
1594        quality = wlanlinkquality();
1595
1596        if(quality < 0) quality = 0;
1597        if(quality > 100) quality = 100;
1598
1599        tmpstr = ostrcat(oitoa(quality), " %", 1, 0);
1600
1601        return tmpstr;
1602}
1603
1604char* getredbutton(struct skin* node)
1605{
1606        char* tmpstr = ostrcat(getconfig("redkey", NULL), NULL, 0, 0);
1607        if(tmpstr == NULL) tmpstr = ostrcat(tmpstr, "Extensions List", 1, 0);
1608        return tmpstr;
1609}
1610
1611char* getbluebutton(struct skin* node)
1612{
1613        char* tmpstr = ostrcat(getconfig("bluekey", NULL), NULL, 0, 0);
1614        if(tmpstr == NULL) tmpstr = ostrcat(tmpstr, "TV/Radio", 1, 0);
1615        return tmpstr;
1616}
1617
1618char* setblink(struct skin* node)
1619{
1620        if(status.skinblink == 0)
1621                node->hidden = YES;
1622        else
1623                node->hidden = NO;
1624        return NULL;
1625}
1626
1627char* gettunerlockpic(struct skin* node, char* path, char* tuner)
1628{
1629        char* tmpstr = NULL;
1630        int tunernr = 0;
1631        int tunerlock = 0;
1632        if(tuner != NULL)
1633                tunernr = atoi(tuner);
1634        tunerlock = fegetlock(tunernr);
1635       
1636        if(tunerlock > 0 || (tunerlock != -1 && status.aktservice->fedev != NULL && status.aktservice->fedev->devnr == tunernr && status.standby == 0 && status.playing == 0))
1637        {
1638                if(node->nodestyle != 1)
1639                        node->hidden = NO;     
1640                if(node->picmem == 1)
1641                        return tmpstr;
1642                //tuner?act.png
1643                if(tuner != NULL)
1644                        tmpstr = ostrcat("tuner",tuner, 0, 0);
1645                else
1646                        tmpstr = ostrcat("tuner","0", 0, 0);
1647                tmpstr = ostrcat(tmpstr,"act.png", 1, 0);
1648                if(path != NULL)
1649        tmpstr = ostrcat("/", tmpstr, 0, 1);
1650    tmpstr = ostrcat(path, tmpstr, 0, 1);
1651        }
1652  else
1653                node->hidden = YES;     
1654        return tmpstr;
1655}   
1656
1657char* gettunerlocktext(struct skin* node, char* onlyhidden, char* tuner)
1658{
1659        char* tmpstr = NULL;
1660        int tunernr = 0;
1661        int tunerlock = 0;
1662        if(tuner != NULL)
1663                tunernr = atoi(tuner);
1664        tunerlock = fegetlock(tunernr);
1665        debug(100, "tunernr:%i tunerlock:%i", tunernr, tunerlock);
1666       
1667        if(tunerlock > 0 || (tunerlock != -1 && status.aktservice->fedev != NULL && status.aktservice->fedev->devnr == tunernr && status.standby == 0 && status.playing == 0))
1668        {
1669                if(node->nodestyle != 1)
1670                        node->hidden = NO;
1671                if(onlyhidden == NULL)
1672                {
1673                        if(tunernr == 0)
1674                                tmpstr = ostrcat("A",NULL, 0, 0);
1675                        if(tunernr == 1)
1676                                tmpstr = ostrcat("B",NULL, 0, 0);
1677                        if(tunernr == 2)
1678                                tmpstr = ostrcat("C",NULL, 0, 0);               
1679                        if(tunernr == 3)
1680                                tmpstr = ostrcat("D",NULL, 0, 0);       
1681                }
1682                else
1683                        tmpstr = ostrcat(node->text,NULL, 0, 0);
1684        }
1685  else
1686                node->hidden = YES;     
1687        return tmpstr;
1688}   
1689                       
1690#endif
Note: See TracBrowser for help on using the repository browser.