source: titan/plugins/hbbtv_sh4/hbbtv.h @ 43368

Last change on this file since 43368 was 27740, checked in by obi, 10 years ago

update menulistbox with detail text

File size: 17.7 KB
Line 
1#ifndef OPERA_H
2#define OPERA_H
3
4struct hbbtvfav
5{
6        char* name;
7        char* addr;
8        struct hbbtvfav* next;
9};
10
11struct hbbtvfav *hbbtvfav = NULL;
12
13#define NAME "YWNATIVE"
14#define CONTROL_PIPE_W "/tmp/"NAME"_control_w"
15#define CONTROL_PIPE_R "/tmp/"NAME"_control_r"
16#define RC_TITAN "/tmp/rc_enigma2"
17
18extern struct skin* skin;
19
20void operareceivercb(char* cmd);
21
22int operarcsockfd = -1;
23int operarcconnfd = -1;
24int opera_control_r_fd = -1;
25int operarcthread_ok = 0;
26int operareceiverthread_ok = 0;
27//100 = live play
28//0 = pause
29//1 = play
30//2 = stop
31int operaservicestate = 100;
32char* operaplayurl = NULL;
33
34struct hbbtvfav* addhbbtvfav(char *line, int count, struct hbbtvfav* last)
35{
36        //debug(1000, "in");
37        struct hbbtvfav *newnode = NULL, *prev = NULL, *node = hbbtvfav;
38        int ret = 0;
39
40        newnode = (struct hbbtvfav*)calloc(1, sizeof(struct hbbtvfav));
41        if(newnode == NULL)
42        {
43                err("no memory");
44                return NULL;
45        }
46
47        newnode->name = malloc(1024);
48        if(newnode->name == NULL)
49        {
50                err("no mem");
51                free(newnode);
52                return NULL;
53        }
54
55        newnode->addr = malloc(1024);
56        if(newnode->addr == NULL)
57        {
58                err("no mem");
59                free(newnode->name);
60                free(newnode);
61                return NULL;
62        }
63
64        ret = sscanf(line, "%[^#]#%s", newnode->name, newnode->addr);
65        if(ret != 2)
66        {
67                if(count > 0)
68                {
69                        err("hbbtvfav line %d not ok", count);
70                }
71                else
72                {
73                        err("add hbbtvfav");
74                }
75                free(newnode->name);
76                free(newnode->addr);
77                free(newnode);
78                return NULL;
79        }
80
81        newnode->name = ostrshrink(newnode->name);
82        newnode->addr = ostrshrink(newnode->addr);
83
84        if(last == NULL)
85        {
86                while(node != NULL)
87                {
88                        prev = node;
89                        node = node->next;
90                }
91        }
92        else
93        {
94                prev = last;
95                node = last->next;
96        }
97
98        if(prev == NULL)
99                hbbtvfav = newnode;
100        else
101                prev->next = newnode;
102        newnode->next = node;
103
104        //debug(1000, "out");
105        return newnode;
106}
107
108int readhbbtvfav(const char* filename)
109{
110        debug(1000, "in");
111        FILE *fd = NULL;
112        char *fileline = NULL;
113        int linecount = 0, len = 0;
114        struct hbbtvfav* last = NULL, *tmplast = NULL;
115
116        fileline = malloc(MINMALLOC);
117        if(fileline == NULL)
118        {
119                err("no memory");
120                return 1;
121        }
122
123        fd = fopen(filename, "r");
124        if(fd == NULL)
125        {
126                perr("can't open %s", filename);
127                free(fileline);
128                return 1;
129        }
130
131        while(fgets(fileline, MINMALLOC, fd) != NULL)
132        {
133                if(fileline[0] == '#' || fileline[0] == '\n')
134                        continue;
135                len = strlen(fileline) - 1;
136                if(len >= 0 && fileline[len] == '\n')
137                        fileline[len] = '\0';
138                len--;
139                if(len >= 0 && fileline[len] == '\r')
140                        fileline[len] = '\0';
141
142                linecount++;
143
144                if(last == NULL) last = tmplast;
145                last = addhbbtvfav(fileline, linecount, last);
146                if(last != NULL) tmplast = last;
147        }
148
149        free(fileline);
150        fclose(fd);
151        return 0;
152}
153
154int delhbbtvfav(char* name)
155{
156        debug(1000, "in");
157        int ret = 1;
158        struct hbbtvfav *node = hbbtvfav, *prev = hbbtvfav;
159
160        while(node != NULL)
161        {
162                if(ostrcmp(node->name, name) == 0)
163                {
164                        if(node == hbbtvfav)
165                                hbbtvfav = node->next;
166                        else
167                                prev->next = node->next;
168
169                        free(node);
170                        node = NULL;
171                        ret = 0;
172                        break;
173                }
174
175                prev = node;
176                node = node->next;
177        }
178        debug(1000, "out");
179        return ret;
180}
181
182void freehbbtvfav()
183{
184        debug(1000, "in");
185        struct hbbtvfav *node = hbbtvfav, *prev = hbbtvfav;
186
187        while(node != NULL)
188        {
189                prev = node;
190                node = node->next;
191                if(prev != NULL)
192                        delhbbtvfav(prev->name);
193        }
194        debug(1000, "out");
195}
196
197void operarcthread()
198{
199        int ret = 0;
200
201        debug(788, "opera create rc socket");
202
203        ret = sockcreate(&operarcsockfd, RC_TITAN, 1);
204        if(ret != 0) return;
205
206        //closeonexec(operarcsockfd);
207
208        debug(788, "opera wait for rc accept");
209        operarcthread_ok = 1;
210        operarcconnfd = sockaccept(&operarcsockfd, 0);
211        debug(788, "opera got rc accept");
212}
213
214void operareceiverthread(struct stimerthread* self)
215{
216        int ret = 0, control_w_fd = -1;
217        fd_set rfds;
218        struct timeval tv;
219        unsigned char* buf = NULL;
220
221        if(self == NULL) return;
222
223        control_w_fd = open(CONTROL_PIPE_W, O_RDONLY);
224        if(control_w_fd < 0)
225        {
226                perr("open or create %s", CONTROL_PIPE_W);
227                return;
228        }
229
230        fcntl(control_w_fd, F_SETFL, fcntl(control_w_fd, F_GETFL) | O_NONBLOCK);
231        //closeonexec(control_w_fd);
232
233        buf = malloc(MINMALLOC);
234        if(buf == NULL)
235        {
236                close(control_w_fd);
237                err("no mem");
238                return;
239        }
240
241        debug(788, "opera receive thread start");
242
243        operareceiverthread_ok = 1;
244        while(self->aktion != STOP)
245        {
246                tv.tv_sec = 1;
247                tv.tv_usec = 0;
248                FD_ZERO(&rfds);
249                FD_SET(control_w_fd, &rfds);
250
251                ret = TEMP_FAILURE_RETRY(select(control_w_fd + 1, &rfds, NULL, NULL, &tv));
252
253                if(ret > 0)
254                {
255                        memset(buf, 0, MINMALLOC);
256                        unsigned char* pbuf = buf;
257                        while(pbuf - buf < MINMALLOC)
258                        {
259                                unsigned char c;
260
261                                ret = read(control_w_fd, &c, 1);
262                                if(ret == 1)
263                                {
264                                        if(c == '\n') break;
265                                        *pbuf = c;
266                                        pbuf++;
267                                }
268                        }
269                        if(pbuf != buf)
270                                operareceivercb((char*)buf);
271                }
272                else if(ret == 0) //timeout
273                        continue;
274                else //error
275                {
276                        perr("select failed");
277                        usleep(10000);
278                }
279         }
280
281         close(control_w_fd); control_w_fd = -1;
282         free(buf); buf = NULL;
283         debug(788, "opera receive thread end");
284}
285
286void operasendkey(char* rckey)
287{
288        if(operarcconnfd > -1 && rckey != NULL)
289                socksend(&operarcconnfd, (unsigned char*)rckey, strlen(rckey), -1);
290        else
291        {
292                err("no opera rc context sockfd=%d", operarcconnfd);
293        }
294}
295
296//flag 0: stop live tv and start play service
297//flag 1: stop play and start live service
298//flag 2: stop play
299int operaservice(char* url, int flag)
300{
301        char* tmpstr = NULL;
302
303        //stop live tv service and start play
304        if(flag == 0)
305        {
306                if(operaservicestate == 100)
307                {
308                        int ret = servicestop(status.aktservice, 1, 1);
309                        if(ret == 1) return 1;
310                }
311
312                free(operaplayurl); operaplayurl = NULL;
313                operaplayurl = ostrcat(url, NULL, 0, 0);
314                playerstop();
315                playerafterend();
316                playerstart(operaplayurl);
317                operaservicestate = 1;
318        }
319
320        //stop play and start live service
321        if(flag == 1 && operaservicestate != 100)
322        {
323                //stop player if running
324                playerstop();
325                playerafterend();
326                free(operaplayurl); operaplayurl = NULL;
327
328                if(status.aktservice->channel != NULL)
329                {
330                        tmpstr = ostrcat(status.aktservice->channellist, NULL, 0, 0);
331                        servicestart(status.aktservice->channel, tmpstr, NULL, 3);
332                }
333                else
334                {
335                        tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0);
336                        servicestart(status.lastservice->channel, tmpstr, NULL, 0);
337                }
338                free(tmpstr); tmpstr = NULL;
339                operaservicestate = 100;
340        }
341
342        //stop play
343        if(flag == 2 && operaservicestate != 100)
344        {
345                playerstop();
346                playerafterend();
347                free(operaplayurl); operaplayurl = NULL;
348                operaservicestate = 2;
349        }
350
351        return 0;
352}
353
354void screenopera(char* url)
355{
356        int rcret = 0, i = 0;
357        char* tmpstr = NULL, *savedir = NULL, *dirbuf = NULL;;
358        struct stimerthread* operareceiver = NULL;
359        char* opera_root, *opera_bin = NULL, *opera_dir = NULL;
360        char* opera_home = NULL, *opera_fonts = NULL, *opera_widgets = NULL;
361       
362        textbox(_("Message"), _("You can leave HBBTV with Record Key."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 15, 0);
363       
364  if(isdir("/var/usr/local/share/titan/plugins/hbbtv/opera"))
365                opera_root = ostrcat("/var/usr/local/share/titan/plugins/hbbtv/opera", NULL, 0, 0);
366        else if(isdir("/var/swap/usr/local/share/titan/plugins/hbbtv/opera"))
367                opera_root = ostrcat("/var/swap/usr/local/share/titan/plugins/hbbtv/opera", NULL, 0, 0);
368        else
369                opera_root = ostrcat("/mnt/swapextensions/usr/local/share/titan/plugins/hbbtv/opera", NULL, 0, 0);
370
371        opera_bin = ostrcat(opera_root, "/bin/opera", 0, 0);
372        opera_dir = ostrcat(opera_root, "/opera_dir", 0, 0);
373        opera_home = ostrcat(opera_root, "/opera_home/", 0, 0);
374        opera_fonts = ostrcat(opera_root, "/fonts", 0, 0);
375        opera_widgets = ostrcat(opera_root, "/widgets", 0, 0);
376
377        resettvpic();
378        drawscreen(skin, 0, 0);
379
380        debug(788, "step 1, set env");
381        //setenv("DFBARGS", "pixelformat=ARGB,no-cursor,bg-none,no-linux-input-grab,no-vt", 1);
382        setenv("OPERA_MULTITAP", "NO", 1);
383        setenv("OPERA_SHOW_STATUSWINDOW", "NO", 1);
384        setenv("OPERA_FB_BORDERWIDTH", "0", 1);
385        setenv("OPERA_SHOW_IMEWINDOW", "NO", 1);
386        setenv("OPERA_SHOW_NAVIGATIONWINDOW", "NO", 1);
387        setenv("OPERA_SHOW_MOUSEPOINTER", "NO", 1);
388        setenv("OPERA_SHOW_HIGHLIGHT", "NO", 1);
389        setenv("OPERA_ESC_EXIT", "YES", 1);
390        setenv("FREETYPE_FONT_SET", "YES", 1);
391        setenv("OPERA_ROOT", opera_root, 1);
392        setenv("OPERA_FB_SIZE", "1280x720", 1);
393        setenv("OPERA_DIR", opera_dir, 1);
394        setenv("OPERA_HOME", opera_home, 1);
395        setenv("OPERA_FONTS", opera_fonts, 1);
396        setenv("OPERA_WIDGETS", opera_widgets, 1);
397        setenv("LD_LIBRARY_PATH", opera_root, 1); // + ":" + os.environ["LD_LIBRARY_PATH"]
398
399        unlink(CONTROL_PIPE_W);
400        unlink(CONTROL_PIPE_R);
401        unlink(RC_TITAN);
402
403        mkfifo(CONTROL_PIPE_W, 0666);
404        mkfifo(CONTROL_PIPE_R, 0666);
405        //mkfifo(RC_TITAN, 0666);
406
407        debug(788, "step 2, start opera");
408        //writesys("/proc/cpu/alignment", "0", 0);
409
410        operarcthread_ok = 0;
411        operareceiverthread_ok = 0;
412        addtimer(&operarcthread, START, 10, 1, NULL, NULL, NULL);
413        operareceiver = addtimer(&operareceiverthread, START, 10, 1, NULL, NULL, NULL);
414
415        //wait for threads
416        int count = 0;
417        while(operarcthread_ok == 0 || operareceiverthread_ok == 0)
418        {
419                usleep(100000);
420                count++;
421                if(count > 20) break;
422        }
423
424        //save working dir
425        dirbuf = malloc(PATH_MAX);
426        if(dirbuf != NULL)
427        {
428                savedir = getcwd(dirbuf, PATH_MAX);
429                chdir(opera_root);
430        }
431
432        fbsave();
433
434        tmpstr = ostrcat(tmpstr, opera_bin, 1, 0);
435        tmpstr = ostrcat(tmpstr, " -u ", 1, 0);
436        tmpstr = ostrcat(tmpstr, url, 1, 0);
437        tmpstr = ostrcat(tmpstr, " --dfb:mode=1280x720,no-debug,no-vt,no-vt-switch &", 1, 0);
438        system(tmpstr);
439        free(tmpstr); tmpstr = NULL;
440
441        //free all opera vars
442        free(opera_root); opera_root = NULL;
443        free(opera_bin); opera_bin = NULL;
444        free(opera_dir); opera_dir = NULL;
445        free(opera_home); opera_home = NULL;
446        free(opera_fonts); opera_fonts = NULL;
447        free(opera_widgets); opera_widgets = NULL;
448
449        //reset working dir
450        if(savedir != NULL)
451                chdir(dirbuf);
452        free(dirbuf); dirbuf = NULL;
453
454        while(1)
455        {
456                rcret = waitrc(NULL, 1000, 0);
457
458                //check for player EOF
459                if(operaservicestate < 2 && !playerisplaying())
460                        operaservice(NULL, 1);
461
462                if(rcret == getrcconfigint("rchbbtv", NULL) || rcret == getrcconfigint("rcrecord", NULL))
463                {
464                        //operasendkey("ESC\n");
465                        break;
466                }
467                else if(rcret == getrcconfigint("rcexit", NULL))
468                        operasendkey("BACK\n");
469                else if(rcret == getrcconfigint("rcred", NULL))
470                        operasendkey("RED\n");
471                else if(rcret == getrcconfigint("rcgreen", NULL))
472                        operasendkey("GREEN\n");
473                else if(rcret == getrcconfigint("rcyellow", NULL))
474                        operasendkey("YELLOW\n");
475                else if(rcret == getrcconfigint("rcblue", NULL))
476                        operasendkey("BLUE\n");
477                else if(rcret == getrcconfigint("rcok", NULL))
478                {
479                        operasendkey("OK\n");
480                        operasendkey("ENTER\n");
481                }
482                else if(rcret == getrcconfigint("rcup", NULL))
483                        operasendkey("UP\n");
484                else if(rcret == getrcconfigint("rcdown", NULL))
485                        operasendkey("DOWN\n");
486                else if(rcret == getrcconfigint("rcleft", NULL))
487                        operasendkey("LEFT\n");
488                else if(rcret == getrcconfigint("rcright", NULL))
489                        operasendkey("RIGHT\n");
490                else if(rcret == getrcconfigint("rc1", NULL))
491                        operasendkey("1\n");
492                else if(rcret == getrcconfigint("rc2", NULL))
493                        operasendkey("2\n");
494                else if(rcret == getrcconfigint("rc3", NULL))
495                        operasendkey("3\n");
496                else if(rcret == getrcconfigint("rc4", NULL))
497                        operasendkey("4\n");
498                else if(rcret == getrcconfigint("rc5", NULL))
499                        operasendkey("5\n");
500                else if(rcret == getrcconfigint("rc6", NULL))
501                        operasendkey("6\n");
502                else if(rcret == getrcconfigint("rc7", NULL))
503                        operasendkey("7\n");
504                else if(rcret == getrcconfigint("rc8", NULL))
505                        operasendkey("8\n");
506                else if(rcret == getrcconfigint("rc9", NULL))
507                        operasendkey("9\n");
508                else if(rcret == getrcconfigint("rc0", NULL))
509                        operasendkey("0\n");
510        }
511
512        if(operareceiver != NULL)
513        {
514                operareceiver->aktion = STOP;
515                while(operareceiver != NULL && operareceiver->status != DEACTIVE)
516                {
517                        usleep(100000);
518                        i++; if(i > 20) break;
519                }
520
521                if(i > 20)
522                {
523                        err("detect hanging timer sub thread (operareceiver)");
524                }
525        }
526
527        sockclose(&operarcsockfd);
528        sockclose(&operarcconnfd);
529        close(opera_control_r_fd);
530
531        debug(788, "killall -9 opera");
532        tmpstr = ostrcat(tmpstr, "killall -9 opera", 1, 0);
533        system(tmpstr);
534        free(tmpstr); tmpstr = NULL;
535
536        free(operaplayurl); operaplayurl = NULL;
537
538        //writesys("/proc/cpu/alignment", "3", 0);
539
540        //setvideomode("720p50", 0);
541        //changefbresolution("720p50");
542        //sleep(3);
543        fbrestore();
544
545        operaservice(NULL, 1); //stop play, start live tv
546
547        //reset tv pic size
548        status.tvpic = 1;
549        resettvpic();
550        clearfball();
551}
552
553void operareceivercb(char* cmd)
554{
555        int count = 0;
556        char* tmpstr = NULL;
557        struct splitstr* ret = NULL;
558
559        debug(788, "cmd=%s", cmd);
560
561        tmpstr = ostrcat(cmd, NULL, 0, 0);
562        ret = strsplit(tmpstr, " ", &count);
563
564        if(ret != NULL && count > 0)
565        {
566                if(ostrcmp("HELLO", (&ret[0])->part) == 0)
567                {
568                        opera_control_r_fd = open(CONTROL_PIPE_R, O_WRONLY);
569                        if(opera_control_r_fd < 0)
570                        {
571                                perr("open or create "CONTROL_PIPE_R);
572                        }
573                }
574                else if(ostrcmp("AvSetWin", (&ret[0])->part) == 0)
575                {
576                        int x = 0, y = 0, w = 0, h = 0;
577                        float xw = 720.0 / 1280.0;
578                        float yh = 576.0 / 720.0;
579                        char* position = NULL;
580
581                        if(count > 1) x = atoi((&ret[1])->part) * xw;
582                        if(count > 2) y = atoi((&ret[2])->part) * yh;
583                        if(count > 3) w = atoi((&ret[3])->part) * xw;
584                        if(count > 4) h = atoi((&ret[4])->part) * yh;
585
586                        if(w == 0 && h == 0)
587                        {
588                                w = 720;
589                                h = 576;
590                        }
591
592                        position = ostrcat(position, oitoax(x), 1, 1);
593                        position = ostrcat(position, " ", 1, 0);
594                        position = ostrcat(position, oitoax(y), 1, 1);
595                        position = ostrcat(position, " ", 1, 0);
596                        position = ostrcat(position, oitoax(w), 1, 1);
597                        position = ostrcat(position, " ", 1, 0);
598                        position = ostrcat(position, oitoax(h), 1, 1);
599
600                        debug(788, "change tv pic to: %s", position);
601                        writesys("/proc/stb/vmpeg/0/dst_all", position, 0);
602                }
603                else if(ostrcmp("AvGetFullScreen", (&ret[0])->part) == 0)
604                {
605                        char* w = NULL, *h = NULL;
606
607                        w = readsys("/proc/stb/vmpeg/0/dst_width", 1);
608                        h = readsys("/proc/stb/vmpeg/0/dst_height", 1);
609
610                        if(ostrcmp(w, "2d0") == 0 && ostrcmp(h, "240") == 0)
611                                write(opera_control_r_fd, "AvGetFullScreen 1\n", 18);
612                        else
613                                write(opera_control_r_fd, "AvGetFullScreen 0\n", 18);
614
615                        free(w); w = NULL;
616                        free(h); h = NULL;
617                }
618                else if(ostrcmp("AvGetVisible", (&ret[0])->part) == 0)
619                {
620                        unsigned long val = readsysul("/proc/stb/video/alpha", 1);
621
622                        if(val == 0)
623                                write(opera_control_r_fd, "AvGetVisible 1\n", 15);
624                        else
625                                write(opera_control_r_fd, "AvGetVisible 0\n", 15);
626                }
627                /*
628                else if(ostrncmp("AvSetVisible", (&ret[0])->part) == 0)
629                {
630                        //if(count > 1 && ostrcmp("1", (&ret[1])->part) == 0)
631                        //{
632                        //      writesys("/proc/stb/video/alpha", "255", 0);
633                        //else
634                        //      writesys("/proc/stb/video/alpha", "0", 0);
635                        //}
636                }
637                */
638                else if(ostrcmp("AvPlay", (&ret[0])->part) == 0)
639                {
640                        if(count > 2)
641                        {
642                                if(ostrcmp("100", (&ret[2])->part) == 0) //play or continue
643                                {
644                                        if(ostrcmp(operaplayurl, (&ret[1])->part) != 0) //different url, so play
645                                        {
646                                                operaservice((&ret[1])->part, 0); //stop live tv and play
647                                        }
648                                        else
649                                        {
650                                                playercontinue();
651                                                operaservicestate = 1;
652                                        }
653                                }
654                                else if(ostrcmp("0", (&ret[2])->part) == 0) //pause
655                                {
656                                        playerpause();
657                                        operaservicestate = 0;
658                                }
659                        }
660                }
661                else if(ostrcmp("AvStop", (&ret[0])->part) == 0)
662                {
663                        operaservice(NULL, 2); //stop play
664                }
665                else if(ostrcmp("AvGetPos", (&ret[0])->part) == 0)
666                {
667                        char* tmppos = NULL;
668                        unsigned long pos = 0;
669
670                        pos = playergetpts() / 90000;
671
672                        tmppos = ostrcat(tmppos, "AvGetPos ", 1, 0);
673                        tmppos = ostrcat(tmppos, olutoa(pos), 1, 1);
674                        tmppos = ostrcat(tmppos, "\n", 1, 0);
675
676                        if(tmppos != NULL)
677                                write(opera_control_r_fd, tmppos, strlen(tmppos));
678
679                        free(tmppos); tmppos = NULL;
680                }
681                else if(ostrcmp("AvGetDuration", (&ret[0])->part) == 0)
682                {
683                        char* tmplen = NULL;
684                        unsigned long len = 0;
685
686                        len = playergetlength();
687
688                        tmplen = ostrcat(tmplen, "AvGetDuration ", 1, 0);
689                        tmplen = ostrcat(tmplen, olutoa(len), 1, 1);
690                        tmplen = ostrcat(tmplen, "\n", 1, 0);
691
692                        if(tmplen != NULL)
693                                write(opera_control_r_fd, tmplen, strlen(tmplen));
694
695                        free(tmplen); tmplen = NULL;
696                }
697                else if(ostrcmp("AvGetState", (&ret[0])->part) == 0)
698                {
699                        char* tmpstate = NULL;
700
701                        tmpstate = ostrcat(tmpstate, "AvGetState ", 1, 0);
702                        if(operaservicestate == 1)
703                                tmpstate = ostrcat(tmpstate, "1", 1, 0);
704                        else
705                                tmpstate = ostrcat(tmpstate, "0", 1, 0);
706                        tmpstate = ostrcat(tmpstate, "\n", 1, 0);
707
708                        if(tmpstate != NULL)
709                                write(opera_control_r_fd, tmpstate, strlen(tmpstate));
710
711                        free(tmpstate); tmpstate = NULL;
712                }
713                else if(ostrcmp("ReleaseHandle", (&ret[0])->part) == 0)
714                {
715                        if(count > 1 && ostrcmp("1", (&ret[1])->part) == 0) //VOD
716                        {
717                                operaservice(NULL, 1); //stop play, start live tv
718                        }
719                }
720        }
721
722        free(tmpstr); tmpstr = NULL;
723        free(ret); ret = NULL;
724}
725
726void screenoperafav()
727{
728        //int ret = 0;
729        struct menulist* mlist = NULL, *mbox = NULL, *tmpmbox = NULL;
730        struct hbbtvfav *node = NULL;
731
732        //ret = servicestop(status.aktservice, 1, 0);
733        //if(ret == 1) return;
734        //setfbtransparent(255);
735
736        readhbbtvfav(getconfig("hbbtvfavfile", NULL));
737        node = hbbtvfav;
738
739        if(status.aktservice->channel != NULL && status.aktservice->channel->hbbtvurl != NULL)
740        {
741                debug(788, "hbbtvurl=%s", status.aktservice->channel->hbbtvurl);
742                tmpmbox = addmenulist(&mlist, _("Channel HBBTV"), NULL, NULL, 0, 0);
743                if(tmpmbox != NULL)
744                        tmpmbox->param = ostrcat(status.aktservice->channel->hbbtvurl, NULL, 0, 0);
745        }
746
747        while(node != NULL)
748        {
749                tmpmbox = addmenulist(&mlist, node->name, NULL, NULL, 0, 0);
750                if(tmpmbox != NULL)
751                        tmpmbox->param = ostrcat(node->addr, NULL, 0, 0);
752
753                node = node->next;
754        }
755
756start:
757        drawscreen(skin, 0, 0);
758        mbox = menulistbox(mlist, "menulist", _("HBBTV Favoriten"), _("Choose your HBBTV Favorite from the following list"), NULL, NULL, 0, 0);
759        if(mbox != NULL)
760        {
761                if(mbox->param != NULL)
762                {
763                        drawscreen(skin, 0, 0);
764                        screenopera(mbox->param);
765                }
766                goto start;
767        }
768
769        freemenulist(mlist, 1);
770        freehbbtvfav();
771        //setosdtransparent(getskinconfigint("osdtransparent", NULL));
772        //if(status.lastservice != NULL)
773        //      servicestart(status.lastservice->channel, NULL, NULL, 0);
774        //flushrc(500);
775}
776
777#endif
Note: See TracBrowser for help on using the repository browser.