source: titan/titan/skinfunc.h @ 41161

Last change on this file since 41161 was 41161, checked in by gost, 6 years ago

[titan] workaround for signal = 0

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