source: titan/titan/skinfunc.h @ 41330

Last change on this file since 41330 was 41330, checked in by gost, 5 years ago

[titan] fix hybrid tuner... I hope

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