source: titan/titan/play.h @ 44773

Last change on this file since 44773 was 44773, checked in by gost, 3 years ago

next fix

File size: 58.5 KB
Line 
1#ifndef PLAY_H
2#define PLAY_H
3
4extern struct screensaver* screensaver;
5
6void screenplaypolicy()
7{
8        if(checkbit(status.playercan, 0) == 0) return;
9
10        int rcret = 0;
11        struct skin* playpolicy = getscreen("playpolicy");
12        char* tmpstr = NULL;
13
14start:
15        changepolicy();
16        tmpstr = getpolicy();
17        changetext(playpolicy, _(tmpstr));
18        free(tmpstr); tmpstr = NULL;
19        drawscreen(playpolicy, 0, 0);
20
21        while(1)
22        {
23                rcret = waitrc(playpolicy, 1000, 0);
24                if(rcret == getrcconfigint("rcok", NULL))
25                        goto start;
26                break;
27        }
28
29        clearscreen(playpolicy);
30}
31
32void screenplaybufferstatus(struct stimerthread* self)
33{
34        int rcret = -1, draw = 50;
35        if(self == NULL) return;
36
37        struct skin* playbufferstatus = getscreen("playbufferstatus");
38
39        playbufferstatus->progresssize = 0;
40       
41        while(self->aktion != STOP)
42        {
43                rcret = waitrc(0, 1, 0);
44                if(rcret == getrcconfigint("rcexit", NULL))
45                {
46                        playerstopbuffer();
47                        break;
48                }
49
50                if(draw == 50)
51                {
52                        draw = 0;
53                        if(playergetbuffersize() > 0)
54                                drawscreen(playbufferstatus, 0, 0);
55                }
56                //usleep(10000);
57                draw++;
58        }
59       
60        if(playergetbuffersize() > 0)
61        {
62                clearscreen(playbufferstatus);
63                drawscreen(skin, 0, 0);
64        }
65}
66
67//flag = 4 ---> timeshift
68//flag = 5 --> timeshift, not in play mode (only recording)
69void screenplayinfobar(char* file, char* showname, int mode, int playertype, int flag)
70{
71        int change = 1;
72        int videodevpts = 1;
73
74        if(checkbit(status.playercan, 14) == 0) return;
75
76        if((flag == 2) || (flag == 3))
77        {
78                return;
79        }
80        struct skin* playinfobar = getscreen("playinfobar");
81        struct skin* playinfobarpic = getscreen("playinfobarpic");
82        if(mode == 1)
83        {
84                clearscreen(playinfobar);
85                clearscreen(playinfobarpic);
86                drawscreen(skin, 0, 0);
87                return;
88        }
89
90        struct skin* title = getscreennode(playinfobar, "title");
91        struct skin* spos = getscreennode(playinfobar, "pos");
92        struct skin* slen = getscreennode(playinfobar, "len");
93        struct skin* sreverse = getscreennode(playinfobar, "reverse");
94        struct skin* sprogress = getscreennode(playinfobar, "progress");
95        char* tmpstr = NULL;
96        unsigned long long pos = 0, dpos = 0, len = 0, reverse = 0;
97
98        // show thumb cover start
99        struct skin* playinfobarcover = getscreen("playinfobarcover");
100        struct skin* cover = getscreennode(playinfobarcover, "cover");
101        cover->hidden = YES;
102        if(file != NULL)
103        {
104                struct mediadb* node = NULL;
105                char* dname = ostrcat(file, NULL, 0, 0);
106                dname = dirname(dname);
107                node = getmediadb(dname, basename(file), 0);
108                free(dname); dname = NULL;
109               
110                if(node != NULL)
111                {
112                        if(ostrncmp("tt", node->id, 2) == 0)
113                        {
114                                tmpstr = ostrcat(tmpstr, getconfig("mediadbpath", NULL), 1, 0);
115                                tmpstr = ostrcat(tmpstr, "/", 1, 0);
116                                tmpstr = ostrcat(tmpstr, node->id, 1, 0);
117                                tmpstr = ostrcat(tmpstr, "_poster.jpg", 0, 0);
118                                if(file_exist(tmpstr))
119                                {
120                                        changepic(cover, tmpstr);
121                                        cover->hidden = NO;
122                                }
123                                free(tmpstr), tmpstr = NULL;
124                        }
125                }
126        }
127        // show thumb cover end
128
129        if(showname == NULL)
130        {
131                tmpstr = ostrcat(file, NULL, 0, 0);
132                if(tmpstr != NULL) changetext(title, basename(tmpstr));
133                free(tmpstr); tmpstr = NULL;
134        }
135        else
136                changetext(title, showname);
137
138        videodevpts = 1;
139        if(playertype == 1)
140        {
141                int ret = 0;
142                unsigned long long startpos = 0;
143                if(flag == 4)
144                        ret = playergetinfots(&len, &startpos, NULL, &pos, NULL, 1);
145                else if(flag == 5)
146                        ret = playergetinfots(&len, &startpos, NULL, &pos, NULL, 2);
147                else
148                {
149                        ret = playergetinfots(&len, &startpos, NULL, &pos, NULL, 0);
150                        if(ret == 0)
151                        {
152                                ret = videogetpts(status.aktservice->videodev, &dpos);
153                                if(ret == 0)
154                                {
155                                        pos = dpos;
156                                        videodevpts = 1;
157                                }
158                                else
159                                {
160                                        ret = 0;
161                                        videodevpts = 0;
162                                }
163                        }
164                }
165                len = len / 90000;
166                pos = (pos - startpos) / 90000;
167                if(ret != 0) change = 0;
168        }
169        else if(playertype == 2)
170        {
171                pos = dvdgetpts() / 90000;
172                len = dvdgetlength();
173        }
174        else
175        {
176                pos = playergetpts() / 90000;
177                len = playergetlength();
178        }
179        if(pos < 0) pos = 0;
180        reverse = len - pos;
181
182        if(change == 1)
183        {
184                if(len == 0)
185                        sprogress->progresssize = 0;
186                else
187                        sprogress->progresssize = pos * 100 / len;
188        }
189
190        tmpstr = convert_timesec(pos);
191        if(videodevpts == 1)
192                changetext(spos, tmpstr);
193        else
194                changetext(spos, " ");
195        free(tmpstr); tmpstr = NULL;
196
197        tmpstr = convert_timesec(len);
198        changetext(slen, tmpstr);
199        free(tmpstr); tmpstr = NULL;
200
201        tmpstr = convert_timesec(reverse);
202        changetext(sreverse, tmpstr);
203        free(tmpstr); tmpstr = NULL;
204
205        drawscreen(playinfobar, 0, 0);
206        drawscreen(playinfobarpic, 0, 0);
207        drawscreen(playinfobarcover, 0, 0);
208}
209
210void screenplaytracklist(int mode, int playertype, int flag)
211{
212        //mode 1 = audiotracks
213        //mode 2 = subtitle tracks
214
215        if(mode == 1 && checkbit(status.playercan, 1) == 0) return;
216        if(mode == 2 && checkbit(status.playercan, 2) == 0) return;
217
218        if(playertype == 1)
219        {
220                screenplayinfobar(NULL, NULL, 1, playertype, flag);
221                if(mode == 1)
222                        playerchangeaudiotrackts();
223                else if(mode == 2)
224                        playerchangesubtitletrackts();
225                blitfb(0);
226                return;
227        }
228
229        int i = 0;
230        int rcret = 0, curtrackid = 0;
231        struct skin* track = NULL;
232        if(mode == 1)
233                track = getscreen("audiotrack");
234        else if(mode == 2)
235                track = getscreen("subtitle");
236        struct skin* listbox = getscreennode(track, "listbox");
237        struct skin* tmp = NULL;
238        char** tracklist = NULL;
239        char* curtrackencoding = NULL, *curtrackname = NULL;
240        char* tmpstr = NULL;
241
242        playergetcurtrac(mode, &curtrackid, &curtrackencoding, &curtrackname);
243        tracklist = playergettracklist(mode);
244
245        if(tracklist != NULL)
246        {
247                while(tracklist[i] != NULL)
248                {
249                        tmp = addlistbox(track, listbox, tmp, 1);
250                        if(tmp != NULL)
251                        {
252                                if(ostrcmp(tracklist[i], "und") == 0)
253                                        tmpstr = ostrcat(tmpstr, _("undefined"), 1, 0);
254                                else
255                                        tmpstr = ostrcat(tmpstr, _(tracklist[i]), 1, 0);
256                                       
257                                if(tracklist[i + 1] != NULL && strlen(tracklist[i + 1]) > 0)
258                                {       
259                                        tmpstr = ostrcat(tmpstr, " (", 1, 0);
260                                        tmpstr = ostrcat(tmpstr, tracklist[i + 1], 1, 0);
261                                        tmpstr = ostrcat(tmpstr, ")", 1, 0);
262                                }
263                               
264                               
265                                changetext(tmp, tmpstr);
266                                free(tmpstr); tmpstr = NULL;
267                                tmp->type = CHOICEBOX;
268                                tmp->del = 1;
269                                if(tracklist[i] != NULL && atoi(tracklist[i]) != 0)
270                                        tmp->handle = (char*)atoi(tracklist[i]);
271                                else
272                                        tmp->handle = (char*)(i / 2);
273                               
274#ifdef EPLAYER4
275                                if(curtrackid == (i / 2))
276                                {
277                                        tmp->handle1 = "running";
278                                        changeinput(tmp, _("running"));
279                                }
280                                else
281                                        changeinput(tmp, "");
282#else
283                                if((ostrcmp(curtrackname, tracklist[i]) == 0 && ostrcmp(curtrackencoding, tracklist[i + 1]) == 0) || (tracklist[i] != NULL && curtrackid == atoi(tracklist[i])))
284                                {
285                                        tmp->handle1 = "running";
286                                        changeinput(tmp, _("running"));
287                                }
288                                else
289                                        changeinput(tmp, "");
290#endif
291                        }
292                        i += 2;
293                }
294        }
295
296        free(curtrackencoding); curtrackencoding = NULL;
297        free(curtrackname); curtrackname = NULL;
298        playerfreetracklist(tracklist);
299        tracklist = NULL;
300
301        listbox->aktline = 1;
302        listbox->aktpage = -1;
303
304        screenplayinfobar(NULL, NULL, 1, playertype, flag);
305        drawscreen(track, 0, 0);
306        addscreenrc(track, listbox);
307
308        while(1)
309        {
310                rcret = waitrc(track, 0, 0);
311
312                if(rcret == getrcconfigint("rcexit", NULL)) break;
313                if(rcret == getrcconfigint("rcyellow", NULL)) break;
314                if(rcret == getrcconfigint("rcok", NULL))
315                {
316                        if(listbox->select != NULL)
317                        {
318                                if(mode == 1) {
319                                        playerchangeaudiotrack((int)listbox->select->handle);
320#ifdef EPLAYER4
321                                        if(playertype == 0)
322                                                playerseek(-1);
323#endif
324                                }
325                                else if(mode == 2)
326                                {
327                                        if(listbox->select->handle1 != NULL)
328                                                playerstopsubtitletrack();
329                                        else   
330                                                playerchangesubtitletrack((int)listbox->select->handle);
331                                }
332                        }
333                        break;
334                }
335        }
336
337        delmarkedscreennodes(track, 1);
338        delownerrc(track);
339        clearscreen(track);
340        blitfb(0);
341       
342        if(rcret == getrcconfigint("rcyellow", NULL))
343                screenplaytracklist(2, playertype, flag);
344}
345
346void playrcyellow(char* file, char* showname, int playinfobarstatus, int playertype, int flag)
347{
348//      if(checkbit(status.playercan, 1) == 0) return;
349
350        screenplaytracklist(1, playertype, flag);
351        if(playinfobarstatus > 0)
352                screenplayinfobar(file, showname, 0, playertype, flag);
353}
354
355void playrctext(char* file, char* showname, int playinfobarstatus, int playertype, int flag)
356{
357//      if(checkbit(status.playercan, 2) == 0) return;
358
359        screenplaytracklist(2, playertype, flag);
360        if(playinfobarstatus > 0)
361                screenplayinfobar(file, showname, 0, playertype, flag);
362}
363
364void playrcgreen(char* file, char* showname, int playinfobarstatus, int playertype, int flag)
365{
366//      if(checkbit(status.playercan, 3) == 0) return;
367
368        screenplayinfobar(file, showname, 1, playertype, flag);
369        if(playertype == 2)
370                screenvideomode(2);
371        else
372                screenvideomode(1);
373        drawscreen(skin, 0, 0);
374        if(playinfobarstatus > 0)
375                screenplayinfobar(file, showname, 0, playertype, flag);
376}
377
378void playrcblue(char* file, char* showname, int playinfobarstatus, int playertype, int flag)
379{
380        if(checkbit(status.playercan, 4) == 0) return;
381
382        screenplayinfobar(file, showname, 1, playertype, flag);
383        screenpowerofftimer();
384        drawscreen(skin, 0, 0);
385        if(playinfobarstatus > 0)
386                screenplayinfobar(file, showname, 0, playertype, flag);
387}
388
389void playrcok(char* file, char* showname, int playinfobarstatus, int playertype, int flag)
390{
391//      if(checkbit(status.playercan, 0) == 0) return;
392
393        free(status.playfile); status.playfile = NULL;
394        status.playfile = ostrcat(file, NULL, 0, 0);
395        screenplaypolicy(file, 1);
396        drawscreen(skin, 0, 0);
397        if(playinfobarstatus > 0)
398                screenplayinfobar(file, showname, 0, playertype, flag);
399}
400
401void id3tag_info(char* file)
402{
403        char* tmpstr = NULL;
404
405        if(file == NULL) return;
406        if(!filelistflt(".mp3 .flac .ogg .wma .ra .wav", file))
407        {
408                struct id3tag* id3tag = NULL;
409                int hash = gethash(file);
410                char* tmphash = olutoa(hash);
411                               
412                id3tag = getid3(file, tmphash, 1);
413                free(tmphash); tmphash = NULL;
414       
415                if(id3tag != NULL)
416                {
417                        tmpstr = ostrcat(tmpstr, _("Title:"), 1, 0);
418                        tmpstr = ostrcat(tmpstr, " ", 1, 0);
419                        tmpstr = ostrcat(tmpstr, id3tag->title, 1, 0);
420                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
421                       
422                        tmpstr = ostrcat(tmpstr, _("Artist:"), 1, 0);
423                        tmpstr = ostrcat(tmpstr, " ", 1, 0);
424                        tmpstr = ostrcat(tmpstr, id3tag->artist, 1, 0);
425                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
426                       
427                        tmpstr = ostrcat(tmpstr, _("Album:"), 1, 0);
428                        tmpstr = ostrcat(tmpstr, " ", 1, 0);
429                        tmpstr = ostrcat(tmpstr, id3tag->album, 1, 0);
430                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
431                       
432                        tmpstr = ostrcat(tmpstr, _("Year:"), 1, 0);
433                        tmpstr = ostrcat(tmpstr, " ", 1, 0);
434                        tmpstr = ostrcat(tmpstr, id3tag->year, 1, 0);
435                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
436               
437                        tmpstr = ostrcat(tmpstr, _("Genre:"), 1, 0);
438                        tmpstr = ostrcat(tmpstr, " ", 1, 0);
439                        tmpstr = ostrcat(tmpstr, id3tag->genretext, 1, 0);
440                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
441
442                        tmpstr = ostrcat(tmpstr, _("Comment:"), 1, 0);
443                        tmpstr = ostrcat(tmpstr, " ", 1, 0);
444                        tmpstr = ostrcat(tmpstr, id3tag->comment, 1, 0);
445                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
446                }
447                freeid3(id3tag); id3tag = NULL;         
448        }
449        else
450        {
451                tmpstr = ostrcat(tmpstr, _("Title:"), 1, 0);
452                tmpstr = ostrcat(tmpstr, " ", 1, 0);
453                tmpstr = ostrcat(tmpstr, playergetinfo("Title"), 1, 1);
454                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
455               
456                tmpstr = ostrcat(tmpstr, _("Artist:"), 1, 0);
457                tmpstr = ostrcat(tmpstr, " ", 1, 0);
458                tmpstr = ostrcat(tmpstr, playergetinfo("Artist"), 1, 1);
459                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
460               
461                tmpstr = ostrcat(tmpstr, _("Album:"), 1, 0);
462                tmpstr = ostrcat(tmpstr, " ", 1, 0);
463                tmpstr = ostrcat(tmpstr, playergetinfo("Album"), 1, 1);
464                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
465               
466                tmpstr = ostrcat(tmpstr, _("Year:"), 1, 0);
467                tmpstr = ostrcat(tmpstr, " ", 1, 0);
468                tmpstr = ostrcat(tmpstr, playergetinfo("Year"), 1, 1);
469                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
470       
471                tmpstr = ostrcat(tmpstr, _("Genre:"), 1, 0);
472                tmpstr = ostrcat(tmpstr, " ", 1, 0);
473                tmpstr = ostrcat(tmpstr, playergetinfo("Genre"), 1, 1);
474                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
475               
476                tmpstr = ostrcat(tmpstr, _("Comment:"), 1, 0);
477                tmpstr = ostrcat(tmpstr, " ", 1, 0);
478                tmpstr = ostrcat(tmpstr, playergetinfo("Comment"), 1, 1);
479                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
480               
481                tmpstr = ostrcat(tmpstr, _("Track:"), 1, 0);
482                tmpstr = ostrcat(tmpstr, " ", 1, 0);
483                tmpstr = ostrcat(tmpstr, playergetinfo("Track"), 1, 1);
484                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
485               
486                tmpstr = ostrcat(tmpstr, _("Copyright:"), 1, 0);
487                tmpstr = ostrcat(tmpstr, " ", 1, 0);
488                tmpstr = ostrcat(tmpstr, playergetinfo("Copyright"), 1, 1);
489                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
490               
491        //      tmpstr = ostrcat(tmpstr, _("TestLibEplayer:"), 1, 0);
492        //      tmpstr = ostrcat(tmpstr, " ", 1, 0);
493        //      tmpstr = ostrcat(tmpstr, playergetinfo("TestLibEplayer"), 1, 1);
494        //      tmpstr = ostrcat(tmpstr, "\n", 1, 0);
495        }
496                       
497        textbox(_("iD3Tag"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 500, 100, 0);
498        free(tmpstr), tmpstr = NULL;
499}
500
501void imdb_submenu(char* file, int mode)
502{
503        struct skin* pluginnode = NULL;
504        void (*startplugin)(char*, char*, int, char*, char*);
505
506        startplugin = NULL;
507       
508        if(mode == 0)
509                pluginnode = getplugin("IMDb");
510        else if(mode == 1)
511                pluginnode = getplugin("IMDb-API");
512        else if(mode == 2)
513                pluginnode = getplugin("TMDb");
514                       
515        if(pluginnode != NULL)
516        {                       
517                if(mode == 0)
518                        startplugin = dlsym(pluginnode->pluginhandle, "screenimdb");
519                else if(mode == 1)
520                        startplugin = dlsym(pluginnode->pluginhandle, "screenimdbapi");
521                else if(mode == 2)
522                        startplugin = dlsym(pluginnode->pluginhandle, "screentmdb");
523
524                if(startplugin != NULL)
525                {
526                                debug(133, "file=%s", basename(file));
527                        if(file != NULL)
528                        {
529                                if(ostrstr(file, "/") != NULL)
530                                {
531                                        //create imdb search name
532       
533                                        char* dname = ostrcat(file, NULL, 0, 0);
534                                        dname = dirname(dname);
535                               
536                                        char* shortname = ostrcat(basename(file), NULL, 0, 0);
537                                        string_tolower(shortname);
538        //                              shortname = string_shortname(shortname, 1);
539                                        shortname = string_shortname(shortname, 2);
540                                        string_removechar(shortname);
541                                        strstrip(shortname);
542       
543                                        debug(133, "inputfile=%s", file);
544                                        debug(133, "shortname=%s", shortname);
545                                        debug(133, "dname=%s", dname);
546                                        debug(133, "file=%s", basename(file));
547       
548                                        startplugin(shortname, NULL, 2, dname, basename(file));
549       
550                                        free(shortname), shortname = NULL;
551                                        free(dname), dname = NULL;
552                                }
553                                else
554                                {
555                                        startplugin(file, NULL, 2, NULL, NULL);
556                                }
557                               
558                        }                               
559                }
560        }
561}
562
563void get_mediadb_scan_info()
564{
565        int videocount = 0, audiocount = 0, picturecount = 0;
566        getmediadbcounts(&videocount, &audiocount, &picturecount);
567
568        char* tmpstr = NULL;
569        tmpstr = ostrcat(tmpstr, "scanning (", 1, 0);
570        tmpstr = ostrcat(tmpstr, oitoa(videocount), 1, 1);
571        tmpstr = ostrcat(tmpstr, "/", 1, 0);
572        tmpstr = ostrcat(tmpstr, oitoa(status.mediadbfiles), 1, 1);
573        tmpstr = ostrcat(tmpstr, ")", 1, 0);
574       
575        tmpstr = ostrcat(tmpstr, "\n\n ", 1, 0);
576        tmpstr = ostrcat(tmpstr, _("MediaDB directory scan started in Background !"), 1, 0);
577        tmpstr = ostrcat(tmpstr, "\n\n  ", 1, 0);
578        tmpstr = ostrcat(tmpstr, _("Delete MediaDB before scan"), 1, 0);
579        tmpstr = ostrcat(tmpstr, ": \t", 1, 0);
580        if(ostrcmp(getconfig("mediadbscandelall", NULL), "1") == 0)
581                tmpstr = ostrcat(tmpstr, _("yes"), 1, 0);
582        else
583                tmpstr = ostrcat(tmpstr, _("no"), 1, 0);
584        tmpstr = ostrcat(tmpstr, "\n  ", 1, 0);                 
585        tmpstr = ostrcat(tmpstr, _("Delete unused entrys before scan"), 1, 0);
586        tmpstr = ostrcat(tmpstr, ": \t", 1, 0);         
587        if(ostrcmp(getconfig("mediadbscandelnotfound", NULL), "1") == 0)
588                tmpstr = ostrcat(tmpstr, _("yes"), 1, 0);
589        else
590                tmpstr = ostrcat(tmpstr, _("no"), 1, 0);
591        tmpstr = ostrcat(tmpstr, "\n  ", 1, 0);
592        tmpstr = ostrcat(tmpstr, _("scan Directory"), 1, 0);
593        tmpstr = ostrcat(tmpstr, ": \t\t\t", 1, 0);
594        tmpstr = ostrcat(tmpstr, getconfig("mc_vp_path", NULL), 1, 0);
595        tmpstr = ostrcat(tmpstr, "\n  ", 1, 0);         
596        tmpstr = ostrcat(tmpstr, _("MediaDB place"), 1, 0);
597        tmpstr = ostrcat(tmpstr, ": \t\t\t", 1, 0);                             
598        tmpstr = ostrcat(tmpstr, getconfig("mediadbpath", NULL), 1, 0);
599        tmpstr = ostrcat(tmpstr, "\n  ", 1, 0);
600        tmpstr = ostrcat(tmpstr, _("MediaDB Debug"), 1, 0);
601        tmpstr = ostrcat(tmpstr, ": \t\t\t", 1, 0);
602        if(ostrcmp(getconfig("mediadbdebug", NULL), "1") == 0)
603                tmpstr = ostrcat(tmpstr, _("yes"), 1, 0);
604        else
605                tmpstr = ostrcat(tmpstr, _("no"), 1, 0);
606        tmpstr = ostrcat(tmpstr, "\n  ", 1, 0);         
607        tmpstr = ostrcat(tmpstr, _("Backdrop Download Count"), 1, 0);
608        tmpstr = ostrcat(tmpstr, ": \t\t", 1, 0);               
609        if(getconfigint("mediadbbackdrop", NULL) == 0)
610                tmpstr = ostrcat(tmpstr, _("all"), 1, 0);
611        else
612                tmpstr = ostrcat(tmpstr, oitoa(getconfigint("mediadbbackdrop", NULL)), 1, 1);
613
614        textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 500, 10, 0);
615        free(tmpstr), tmpstr = NULL;
616}
617
618// flag 100 = tithek
619int playrcred(char* file, char* showname, int playinfobarstatus, int playertype, int flag)
620{
621        int ret = 1;
622//      if(checkbit(status.playercan, 5) == 0) return;
623        if(status.play == 1)
624                screenplayinfobar(file, showname, 1, playertype, flag);
625
626        int hangtime = status.hangtime;
627
628        struct skin* pluginnode = NULL;
629        void (*startplugin)(void);
630        struct skin* plugin = getscreen("plugin");
631        struct skin* child = plugin->child;
632        struct menulist* mlist = NULL, *mbox = NULL;
633        char* skintitle = _("Menu");
634               
635        if(flag < 99)
636        {
637                if(status.play == 1)
638                {
639                        addmenulist(&mlist, "Video Settings", _("Video Settings"), NULL, 0, 0);
640                        addmenulist(&mlist, "AV Settings", _("AV Settings"), NULL, 0, 0);
641                        addmenulist(&mlist, "iD3Tag Info", _("iD3Tag Info"), NULL, 0, 0);
642                }
643
644                addmenulist(&mlist, "MediaDB Edit", _("MediaDB Edit"), NULL, 0, 0);
645       
646                if(status.play == 0)
647                {
648                        addmenulist(&mlist, "Delete File", _("Delete File"), NULL, 0, 0);
649                        addmenulist(&mlist, "Rename File", _("Delete File"), NULL, 0, 0);
650                        addmenulist(&mlist, "Create Folder", _("Create Folder"), NULL, 0, 0);
651//                      addmenulist(&mlist, "Update Iptv", _("Update Iptv"), NULL, 0, 0);
652                }
653                if(status.mediadbfiles > 0)
654                        addmenulist(&mlist, "MediaDB Scan Info", _("MediaDB Scan Info"), NULL, 0, 0);
655        }
656        else
657        {
658                addmenulist(&mlist, "Create Favorites sub folder", _("Create Favorites sub folder"), NULL, 0, 0);
659                addmenulist(&mlist, "Create Favorites sub folder(PIN secured)", _("Create Favorites sub folder(PIN secured)"), NULL, 0, 0);
660
661                if(flag < 199)
662                {
663                        if(file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))
664                        {
665                                addmenulist(&mlist, "Search on KinoX", _("Search on KinoX"), NULL, 0, 0);
666                                addmenulist(&mlist, "Search on KinoX (local)", _("Search on KinoX (local)"), NULL, 0, 0);
667/*
668                                addmenulist(&mlist, "Search on Movie4k", NULL, _("Search on Movie4k"), 0, 0);
669                                addmenulist(&mlist, "Search on Movie4k (local)", _("Search on Movie4k (local)"), NULL, 0, 0);
670*/
671/*
672                                addmenulist(&mlist, "Search on Solarmovies (movie)", _("Search on Solarmovies (movie)"), NULL, 0, 0);
673                                addmenulist(&mlist, "Search on Solarmovies (serie)", _("Search on Solarmovies (serie)"), NULL, 0, 0);
674                                addmenulist(&mlist, "Search on Solarmovies (local)", _("Search on Solarmovies (local)"), NULL, 0, 0);
675*/
676/*
677                                addmenulist(&mlist, "Search on Mle-HD (local)", _("Search on Mle-HD (local)"), NULL, 0, 0);
678*/
679/*
680                                addmenulist(&mlist, "Search on Beeg (local)", _("Search on Beeg (local)"), NULL, 0, 0);
681*/
682/*
683                                addmenulist(&mlist, "Search on Xvideos (local)", _("Search on Xvideos (local)"), NULL, 0, 0);
684*/
685                                addmenulist(&mlist, "Search on FilmOn (local)", _("Search on FilmOn (local)"), NULL, 0, 0);
686                        }
687                        addmenulist(&mlist, "Search on Netzkino (local)", _("Search on Netzkino (local)"), NULL, 0, 0);
688/*
689                        addmenulist(&mlist, "Search on Youtube", _("Search on Youtube"), NULL, 0, 0);
690                        addmenulist(&mlist, "Search on Youtube (local)", _("Search on Youtube (local)"), NULL, 0, 0);
691*/
692/*
693                        addmenulist(&mlist, "Search on MyVideo", _("Search on MyVideo"), NULL, 0, 0);
694                        addmenulist(&mlist, "Search on MyVideo (local)", _("Search on MyVideo (local)"), NULL, 0, 0);
695*/
696                        addmenulist(&mlist, "Search on ARD (local)", _("Search on ARD (local)"), NULL, 0, 0);
697/*
698                        addmenulist(&mlist, "Search on ZDF (local)", _("Search on ZDF (local)"), NULL, 0, 0);
699*/
700/*
701                        addmenulist(&mlist, "Search on TecTime (local)", _("Search on TecTime (local)"), NULL, 0, 0);
702*/
703/*
704                        addmenulist(&mlist, "Search on Giga (local)", _("Search on Giga (local)"), NULL, 0, 0);
705*/
706/*
707                        addmenulist(&mlist, "Search on NowTv (local)", _("Search on NowTv (local)"), NULL, 0, 0);
708*/
709/*
710                        addmenulist(&mlist, "Search on InternetTv (local)", _("Search on InternetTv (local)"), NULL, 0, 0);
711*/
712                        addmenulist(&mlist, "Search on InternetRadio (local)", _("Search on InternetRadio (local)"), NULL, 0, 0);
713                        addmenulist(&mlist, "Search on All (local)", _("Search on All (local)"), NULL, 0, 0);
714                }
715        }
716
717        addmenulist(&mlist, "Downloads", _("Downloads"), NULL, 0, 0);
718
719        if(flag < 199)
720        {
721                //add plugins
722                while(child != NULL)
723                {
724                        if(child->del == PLUGINDELMARK && (status.security >= 1 || (status.security == 0 && checkpluginskip(child->name) == 0)))
725                        {
726                                if(ostrcmp(child->name, "Streaminfo") == 0 && status.play == 1)
727                                        addmenulist(&mlist, child->name, _(child->name), child->pic, 0, 0);
728                                else if(ostrcmp(child->name, "IMDb") == 0)
729                                        addmenulist(&mlist, child->name, _(child->name), child->pic, 0, 0);
730                                else if(ostrcmp(child->name, "IMDb-API") == 0)
731                                        addmenulist(&mlist, child->name, _(child->name), child->pic, 0, 0);
732        //                      else if(ostrcmp(child->name, "TMDb") == 0)
733        //                              addmenulist(&mlist, child->name, _(child->name), child->pic, 0, 0);
734                        }
735                        child = child->next;
736                }
737        }
738
739        mbox = menulistbox(mlist, NULL, skintitle, _("Choose your Red-Menu entry from the following list"), NULL, NULL, 1, 0);
740        if(mbox != NULL)
741        {
742printf("mbox->name=%s\n", mbox->name);
743
744                if(ostrcmp(mbox->name, "Video Settings") == 0)
745                        screenvideosettings();
746                else if(ostrcmp(mbox->name, "AV Settings") == 0)
747                        screenavsettings(0);
748                else if(ostrcmp(mbox->name, "IMDb") == 0)
749                        imdb_submenu(file, 0);
750                else if(ostrcmp(mbox->name, "IMDb-API") == 0)
751                        imdb_submenu(file, 1);
752                else if(ostrcmp(mbox->name, "TMDb") == 0)
753                        imdb_submenu(file, 2);
754                else if(ostrcmp(mbox->name, "iD3Tag Info") == 0)
755                        id3tag_info(file);
756                else if(ostrcmp(mbox->name, "MediaDB Scan Info") == 0)
757                        get_mediadb_scan_info();
758                else if(ostrcmp(mbox->name, "MediaDB Edit") == 0)
759                        screenmediadbedit(file, 0, 0);
760//              else if(ostrcmp(mbox->name, "Update Iptv") == 0)
761//                      ret = update_iptv(file);
762                else if(ostrcmp(mbox->name, "Delete File") == 0)
763                {
764                        playcheckdirrcret(file, 1);
765                        ret = 9999;
766                }
767                else if(ostrcmp(mbox->name, "Rename File") == 0)
768                {
769                        playcheckdirrcret(file, 6);
770                        ret = 9999;
771                }
772                else if(ostrcmp(mbox->name, "Create Folder") == 0)
773                {
774                        playcheckdirrcret(file, 7);
775                        ret = 9999;
776                }
777                else if(ostrcmp(mbox->name, "Downloads") == 0)
778                        screenbgdownload(1);
779                else if(ostrcmp(mbox->name, "Create Favorites sub folder") == 0)
780                        ret = 0;
781                else if(ostrcmp(mbox->name, "Create Favorites sub folder(PIN secured)") == 0)
782                        ret = 1000;
783                else if(ostrcmp(mbox->name, "Search on KinoX") == 0)
784                        ret = 2;
785                else if(ostrcmp(mbox->name, "Search on KinoX (local)") == 0)
786                        ret = 8;
787/*
788                else if(ostrcmp(mbox->name, "Search on Solarmovies (movie)") == 0)
789                        ret = 3;
790                else if(ostrcmp(mbox->name, "Search on Solarmovies (serie)") == 0)
791                        ret = 4;
792                else if(ostrcmp(mbox->name, "Search on Solarmovies (local)") == 0)
793                        ret = 9;
794*/
795/*
796                else if(ostrcmp(mbox->name, "Search on Youtube") == 0)
797                        ret = 5;
798                else if(ostrcmp(mbox->name, "Search on Youtube (local)") == 0)
799                        ret = 10;
800*/
801/*
802                else if(ostrcmp(mbox->name, "Search on MyVideo") == 0)
803                        ret = 6;
804                else if(ostrcmp(mbox->name, "Search on MyVideo (local)") == 0)
805                        ret = 11;
806*/
807/*
808                else if(ostrcmp(mbox->name, "Search on Movie4k") == 0)
809                        ret = 7;
810                else if(ostrcmp(mbox->name, "Search on Movie4k (local)") == 0)
811                        ret = 12;
812*/
813                else if(ostrcmp(mbox->name, "Search on InternetRadio (local)") == 0)
814                        ret = 13;
815/*
816                else if(ostrcmp(mbox->name, "Search on InternetTv (local)") == 0)
817                        ret = 14;
818*/
819                else if(ostrcmp(mbox->name, "Search on ARD (local)") == 0)
820                        ret = 15;
821/*
822                else if(ostrcmp(mbox->name, "Search on ZDF (local)") == 0)
823                        ret = 16;
824*/
825/*
826                else if(ostrcmp(mbox->name, "Search on TecTime (local)") == 0)
827                        ret = 17;
828*/
829/*
830                else if(ostrcmp(mbox->name, "Search on Giga (local)") == 0)
831                        ret = 18;
832*/
833/*
834                else if(ostrcmp(mbox->name, "Search on Beeg (local)") == 0)
835                        ret = 19;
836*/
837/*
838                else if(ostrcmp(mbox->name, "Search on NowTv (local)") == 0)
839                        ret = 20;
840*/
841                else if(ostrcmp(mbox->name, "Search on All (local)") == 0)
842                        ret = 21;
843/*
844                else if(ostrcmp(mbox->name, "Search on Xvideos (local)") == 0)
845                        ret = 24;
846*/
847/*
848                else if(ostrcmp(mbox->name, "Search on Mle-HD (local)") == 0)
849                        ret = 25;
850*/
851                else if(ostrcmp(mbox->name, "Search on Netzkino (local)") == 0)
852                        ret = 26;
853                else if(ostrcmp(mbox->name, "Search on FilmOn (local)") == 0)
854                        ret = 27;
855                else if(ostrcmp(mbox->name, "Downloads") == 0)
856                {
857                        if(status.play == 1)
858                                screenbgdownload(1);
859                        else
860                                screenbgdownload(0);
861                }                       
862                else
863                {
864                        pluginnode = getplugin(mbox->name);
865
866                        if(pluginnode != NULL)
867                        {
868                                startplugin = dlsym(pluginnode->pluginhandle, "start");
869                                if(startplugin != NULL)
870                                        startplugin();
871                        }
872                }
873        }
874
875        freemenulist(mlist, 1); mlist = NULL;
876        drawscreen(skin, 0, 0);
877        resettvpic();
878        if(playinfobarstatus > 0 &&     status.play == 1)
879                screenplayinfobar(file, showname, 0, playertype, flag);
880
881        status.hangtime = hangtime;
882printf("ret=%d\n", ret);
883        return ret;
884}
885
886void playrcinfo(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
887{
888        if(checkbit(status.playercan, 14) == 0) return;
889
890        if(*playinfobarstatus == 0)
891        {
892                *playinfobarstatus = 1;
893                *playinfobarcount = 0;
894                screenplayinfobar(file, showname, 0, playertype, flag);
895        }
896        else if(*playinfobarstatus == 1)
897        {
898                *playinfobarstatus = 0;
899                screenplayinfobar(NULL, NULL, 1, playertype, flag);
900        }
901}
902
903void playrcstop(int playertype, int flag)
904{
905        if(checkbit(status.playercan, 6) == 0) return;
906
907        free(status.playfile); status.playfile = NULL;
908       
909        if(playertype == 1)
910                playerstopts(0, 0);
911        else if(playertype == 2)
912                dvdstop();
913        else
914                playerstop();
915
916        writevfdmenu("Player");
917        screenplayinfobar(NULL, NULL, 1, playertype, flag);
918}
919
920//type 0: only from play
921//type 1: only from pause
922void playrcsf(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int type, int flag)
923{
924        if(checkbit(status.playercan, 15) == 0) return;
925
926        if(status.playspeed == 0 && ((type == 0 && status.pause == 0) || (type == 1 && status.pause == 1)))
927        {
928                status.slowspeed++;
929                if(status.slowspeed > 6) status.slowspeed = 6;
930                if(status.slowspeed > 0)
931                {
932                        status.play = 0;
933
934                        if(playertype == 1)
935                                playerslowts((int)pow(2, status.slowspeed));
936                        else if(playertype == 0)
937                                playerslow(status.slowspeed);
938                        *playinfobarstatus = 2;
939                        *playinfobarcount = 0;
940                        screenplayinfobar(file, showname, 0, playertype, flag);
941                }
942                if(status.slowspeed == 0)
943                {
944                        status.pause = 0;
945                        status.play = 1;
946                        if(playertype == 1)
947                        {
948                                playerpausets();
949                                audioclearbuffer(status.aktservice->audiodev);
950                                playercontinuets();
951                                playerresetts();
952                        }
953                        else if(playertype == 2)
954                                dvdcontinue();
955                        else
956                                playercontinue();
957                        *playinfobarstatus = 1;
958                        *playinfobarcount = 0;
959                        screenplayinfobar(file, showname, 0, playertype, flag);
960                }
961        }
962}
963
964//type 0: only from play
965//type 1: only from pause
966void playrcsr(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int type, int flag)
967{
968        if(checkbit(status.playercan, 15) == 0) return;
969
970        if(status.playspeed == 0 && ((type == 0 && status.pause == 0) || (type == 1 && status.pause == 1)))
971        {
972                status.slowspeed--;
973                if(status.slowspeed < 0) status.slowspeed = 0;
974                if(status.slowspeed > 0)
975                {
976                        status.play = 0;
977                        if(playertype == 1)
978                                playerslowts((int)pow(2, status.slowspeed));
979                        else if(playertype == 0)
980                                playerslowts(status.slowspeed);
981                        *playinfobarstatus = 2;
982                        *playinfobarcount = 0;
983                        screenplayinfobar(file, showname, 0, playertype, flag);
984                }
985                if(status.slowspeed == 0)
986                {
987                        status.pause = 0;
988                        status.play = 1;
989                        if(playertype == 1)
990                        {
991                                playerpausets();
992                                audioclearbuffer(status.aktservice->audiodev);
993                                playercontinuets();
994                                playerresetts();
995                        }
996                        else if(playertype == 2)
997                                dvdcontinue();
998                        else
999                                playercontinue();
1000                        *playinfobarstatus = 1;
1001                        *playinfobarcount = 0;
1002                        screenplayinfobar(file, showname, 0, playertype, flag);
1003                }
1004        }
1005}
1006
1007void playrcff(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1008{
1009        if(status.pause == 1)
1010        {
1011                playrcsf(file, showname, playinfobarstatus, playinfobarcount, playertype, 1, flag);
1012                return;
1013        }
1014
1015        if(checkbit(status.playercan, 7) == 0) return;
1016
1017        if(status.pause == 0 && status.slowspeed == 0)
1018        {
1019                status.playspeed++;
1020                if(status.playspeed > 6) status.playspeed = 6;
1021                if(status.playspeed > 0)
1022                {
1023                        status.play = 0;
1024                        if(playertype == 1)
1025                                playerffts((int)pow(2, status.playspeed));
1026                        else if(playertype == 2)
1027                                dvdff(status.playspeed);
1028                        else   
1029                                playerff(status.playspeed);
1030                               
1031                        //Musik
1032                        if(playertype != 0 || flag != 2)
1033                        {               
1034                                *playinfobarstatus = 2;
1035                                *playinfobarcount = 0;
1036                                screenplayinfobar(file, showname, 0, playertype, flag);
1037                        }
1038                }
1039                if(status.playspeed < 0)
1040                {
1041                        status.play = 0;
1042                        if(playertype == 1)
1043                                playerfrts((int)(pow(2, status.playspeed * -1) * -1), 0);
1044                        else if(playertype == 2)
1045                                dvdfr(status.playspeed);
1046                        else
1047                                playerfr(status.playspeed);
1048                        //Musik
1049                        if(playertype != 0 || flag != 2)
1050                        {               
1051                                *playinfobarstatus = 2;
1052                                *playinfobarcount = 0;
1053                                screenplayinfobar(file, showname, 0, playertype, flag);
1054                        }
1055                }
1056                if(status.playspeed == 0)
1057                {
1058                        status.play = 1;
1059                        if(playertype == 1)
1060                        {
1061                                playerpausets();
1062                                playercontinuets();
1063                                playerresetts();
1064                        }
1065                        else if(playertype == 2)
1066                                dvdcontinue();
1067                        else
1068                                playercontinue();
1069                        //Musik
1070                        if(playertype != 0 || flag != 2)
1071                        {               
1072                                *playinfobarstatus = 1;
1073                                *playinfobarcount = 0;
1074                                screenplayinfobar(file, showname, 0, playertype, flag);
1075                        }
1076                }
1077        }
1078}
1079
1080void playrcfr(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1081{
1082        if(status.pause == 1)
1083        {
1084                playrcsr(file, showname, playinfobarstatus, playinfobarcount, playertype, 1, flag);
1085                return;
1086        }
1087       
1088        if(checkbit(status.playercan, 8) == 0) return;
1089
1090        if(status.pause == 0 && status.slowspeed == 0)
1091        {
1092                status.playspeed--;
1093                if(status.playspeed < -6) status.playspeed = -6;
1094                if(status.playspeed > 0)
1095                {
1096                        status.play = 0;
1097                        if(playertype == 1)
1098                                playerffts((int)pow(2, status.playspeed));
1099                        else if(playertype == 2)
1100                                dvdff(status.playspeed);
1101                        else
1102                                playerff(status.playspeed);
1103                        //Musik
1104                        if(playertype != 0 || flag != 2)
1105                        {               
1106                                *playinfobarstatus = 2;
1107                                *playinfobarcount = 0;
1108                                screenplayinfobar(file, showname, 0, playertype, flag);
1109                        }
1110                }
1111                if(status.playspeed < 0)
1112                {
1113                        status.play = 0;
1114                        if(playertype == 1)
1115                                playerfrts((int)(pow(2, status.playspeed * -1) * -1), 0);
1116                        else if(playertype == 2)
1117                                dvdfr(status.playspeed);
1118                        else
1119                                playerfr(status.playspeed);
1120                        //Musik
1121                        if(playertype != 0 || flag != 2)
1122                        {               
1123                                *playinfobarstatus = 2;
1124                                *playinfobarcount = 0;
1125                                screenplayinfobar(file, showname, 0, playertype, flag);
1126                        }
1127                }
1128                if(status.playspeed == 0)
1129                {
1130                        status.play = 1;
1131                        if(playertype == 1)
1132                        {
1133                                playerpausets();
1134                                playercontinuets();
1135                                playerresetts();
1136                        }
1137                        else if(playertype == 2)
1138                                dvdcontinue();
1139                        else
1140                                playercontinue();
1141                        //Musik
1142                        if(playertype != 0 || flag != 2)
1143                        {               
1144                                *playinfobarstatus = 1;
1145                                *playinfobarcount = 0;
1146                                screenplayinfobar(file, showname, 0, playertype, flag);
1147                        }
1148                }
1149        }
1150}
1151
1152void playrcpause(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1153{
1154        if(status.playspeed != 0 || status.slowspeed != 0)
1155        {
1156                playrcplay(file, showname, playinfobarstatus, playinfobarcount, playertype, flag);
1157                return;
1158        }
1159       
1160        if(checkbit(status.playercan, 9) == 0) return;
1161
1162        if(status.pause == 1)
1163        {
1164                if(playertype == 1)
1165                {
1166                        playercontinuets();
1167                }
1168                else if(playertype == 2)
1169                        dvdcontinue();
1170                else
1171                        playercontinue();
1172                status.slowspeed = 0;
1173                status.playspeed = 0;
1174                status.play = 1;
1175                status.pause = 0;
1176                *playinfobarstatus = 1;
1177                *playinfobarcount = 0;
1178                screenplayinfobar(file, showname, 0, playertype, flag);
1179        }
1180        else
1181        {
1182                status.slowspeed = 0;
1183                status.playspeed = 0;
1184                status.play = 0;
1185                status.pause = 1;
1186                if(playertype == 1)
1187                        playerpausets();
1188                else if(playertype == 2)
1189                        dvdpause();
1190                else
1191                        playerpause();
1192                *playinfobarstatus = 2;
1193                *playinfobarcount = 0;
1194                screenplayinfobar(file, showname, 0, playertype, flag);
1195        }
1196}
1197
1198void playrcplay(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1199{
1200        if(checkbit(status.playercan, 10) == 0) return;
1201
1202        free(status.playfile); status.playfile = NULL;
1203        status.playfile = ostrcat(file, NULL, 0, 0);
1204
1205        debug(10, "playertype: %i, playspeed %i, slowspeed %i", playertype, status.playspeed, status.slowspeed);
1206        if(playertype == 1)
1207        {
1208               
1209                if(status.playspeed != 0 || status.slowspeed != 0)
1210                {
1211                        playerpausets();
1212                        if(checkchipset("HI3798MV200") == 1 || checkbox("DM7020HD") == 1 || checkbox("DM7020HDV2") == 1 || vubox1 == 1)
1213                        {
1214                                videoslowmotion(status.aktservice->videodev, 0);
1215                                videofastforward(status.aktservice->videodev, 0);
1216                                if(checkbox("DM7020HD") == 1 || checkbox("DM7020HDV2") == 1 || vubox1 == 1)
1217                                        dmxstart(status.aktservice->dmxaudiodev);
1218                        }
1219                }
1220                if(status.slowspeed != 0)
1221                        audioclearbuffer(status.aktservice->audiodev);
1222                if((status.playspeed != 0 || status.slowspeed != 0) && checkchipset("HI3798MV200") != 1 && checkbox("DM7020HD") != 1 && checkbox("DM7020HDV2") != 1 && vubox1 != 1)
1223                {
1224                        playerresetts();
1225                }
1226                else
1227                        playercontinuets();
1228        }
1229        else if(playertype == 2)
1230                dvdcontinue();
1231        else
1232        {
1233                if(status.playspeed != 0 || status.slowspeed != 0)
1234                        playerpause();
1235                playercontinue();
1236        }
1237        status.slowspeed = 0;
1238        status.playspeed = 0;
1239        status.pause = 0;
1240        status.play = 1;
1241        *playinfobarstatus = 1;
1242        *playinfobarcount = 0;
1243        screenplayinfobar(file, showname, 0, playertype, flag);
1244}
1245
1246void playrcjumpr(char* file, char* showname, int sec, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1247{
1248//      if(checkbit(status.playercan, 11) == 0) return;
1249
1250        unsigned long long pos = 0;
1251       
1252        if(status.pause == 0 && status.playspeed == 0 && status.slowspeed == 0)
1253        {
1254                //Musik
1255                if(playertype == 0 && flag == 2)
1256                {
1257                        pos = playergetpts() / 90000;
1258                        if(pos + 10 > sec)
1259                                        playerseek(sec * -1);
1260                        else
1261                        {
1262                                playerstop();
1263                                playerstart(file);
1264                        }
1265                        return;
1266                }
1267       
1268                struct skin* load = getscreen("loading");
1269                drawscreen(load, 0, 0);
1270               
1271                //a jump over the beginning of the
1272                //file, freez the player (type 0)
1273                if(playertype == 1)
1274                        playerseekts(getservice(RECORDPLAY, 0), sec * -1, 0);
1275                else if(playertype == 2)
1276                        pos = dvdgetpts() / 90000;
1277                else
1278                        pos = playergetpts() / 90000;
1279       
1280                if(playertype != 1)
1281                {
1282                        if(pos + 10 > sec)
1283                        {
1284                                if(playertype == 2)
1285                                        dvdseek(sec * -1);
1286                                else
1287                                        playerseek(sec * -1);
1288                        }
1289                        else
1290                        {
1291                                if(playertype == 2)
1292                                {
1293                                        dvdstop();
1294                                        dvdstart(file);
1295                                }
1296                                else
1297                                {
1298                                        playerstop();
1299                                        playerstart(file);
1300                                }
1301                        }
1302                }
1303
1304                *playinfobarstatus = 1;
1305                *playinfobarcount = 0;
1306                //status.play = 0;
1307                clearscreen(load);
1308                screenplayinfobar(file, showname, 0, playertype, flag);
1309                //status.play = 1;
1310                sleep(1);
1311        }
1312}
1313
1314void playrcjumpto(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1315{
1316        if(status.pause == 0 && status.playspeed == 0 && status.slowspeed == 0)
1317        {
1318                char* tmpstr = numinput(_("Jump To (min)"), NULL, "000", 0);
1319                if(tmpstr != NULL)
1320                {
1321                        int jump = atoi(tmpstr) * 60;
1322                        playrcjumpf(file, showname, jump, playinfobarstatus, playinfobarcount, playertype, flag);
1323                }
1324                free(tmpstr), tmpstr = NULL;
1325        }
1326}
1327
1328void playrcjumpf(char* file, char* showname, int sec, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1329{
1330//      if(checkbit(status.playercan, 12) == 0) return;
1331
1332        if(status.pause == 0 && status.playspeed == 0 && status.slowspeed == 0)
1333        {
1334                //Musik
1335                if(playertype == 0 && flag == 2)
1336                {
1337                        playerseek(sec);
1338                        return;
1339                }
1340                struct skin* load = getscreen("loading");
1341                drawscreen(load, 0, 0);
1342               
1343                if(playertype == 1)
1344                        playerseekts(getservice(RECORDPLAY, 0), sec, 0);
1345                else if(playertype == 2)
1346                        dvdseek(sec);
1347                else
1348                        playerseek(sec);
1349                *playinfobarstatus = 1;
1350                *playinfobarcount = 0;
1351                //status.play = 0;
1352                clearscreen(load);
1353                screenplayinfobar(file, showname, 0, playertype, flag);
1354                //status.play = 1;
1355        }
1356}
1357
1358void playchangecodec(int playertype)
1359{
1360        if(checkbit(status.playercan, 13) == 0) return;
1361
1362        char** tracklist = NULL;
1363
1364        if(getconfigint("av_ac3default", NULL) == 1)
1365        {
1366                int i = 0;
1367               
1368                tracklist = playergettracklist(1);
1369                if(tracklist != NULL)
1370                {
1371                        while(tracklist[i] != NULL)
1372                        {
1373                                if(ostrcmp(tracklist[i + 1], "A_AC3") == 0)
1374                                {
1375                                        playerchangeaudiotrack(i / 2);
1376                                }
1377                                i += 2;
1378                        }
1379                }
1380                playerfreetracklist(tracklist);
1381                tracklist = NULL;
1382        }
1383}
1384
1385// dirrcret 1 = delete
1386// dirrcret 2 =
1387// dirrcret 3 = epg info
1388// dirrcret 4 = sort
1389// dirrcret 5 = exit
1390// dirrcret 6 = rename
1391// dirrcret 7 = create folder
1392
1393int playcheckdirrcret(char* file, int dirrcret)
1394{
1395        int ret = 0;
1396        char* epgfilename = NULL, *tmpstr = NULL;
1397
1398        if(dirrcret == 4)
1399        {
1400                int sort = screendirsort();
1401                addconfigint("dirsort", sort);
1402                ret = 1;
1403        }
1404        if(dirrcret == 3)
1405        {
1406                epgfilename = changefilenameext(file, ".epg");
1407
1408                tmpstr = readfiletomem(epgfilename, 0);
1409                if(tmpstr != NULL)
1410                        textbox(_("EPG Info"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 600, 0, 2);
1411                else {
1412                        free(epgfilename); epgfilename = NULL;
1413                        epgfilename = changefilenameext(file, ".eit");
1414                        tmpstr = readeittomem(epgfilename);
1415                        if(tmpstr != NULL)
1416                                textbox(_("EPG Info"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 600, 0, 2);
1417                }
1418                free(epgfilename); epgfilename = NULL;
1419                free(tmpstr); tmpstr = NULL;
1420                ret = 1;
1421        }
1422        if(dirrcret == 1)
1423        {
1424                char* subfile = NULL;
1425                subfile = ostrstr(file, "/movie/");
1426                if(subfile != NULL)
1427                        subfile = subfile + 7;
1428                else
1429                        subfile = file;
1430                if(getservicebyrecname(file, 0, 0) != NULL)
1431                        textbox(_("Message"), _("Record in progress"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
1432                else if(textbox(_("Really Delete ?"), subfile, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1433                {
1434                        unlink(file);
1435                        if(file_exist(file))
1436                        {
1437                                char* cmd = ostrcat("rm -rf \"", file, 0, 0);
1438                                cmd = ostrcat(cmd, "\"", 1, 0);
1439                                debug(10, "cmd: %s", cmd);
1440                                system(cmd);
1441                                free(cmd), cmd = NULL;
1442                        }                       
1443                        epgfilename = changefilenameext(file, ".epg");
1444                        unlink(epgfilename);
1445                        free(epgfilename); epgfilename = NULL;
1446                        epgfilename = changefilenameext(file, ".se");
1447                        unlink(epgfilename);
1448                        free(epgfilename); epgfilename = NULL;
1449                        epgfilename = changefilenameext(file, ".ma");
1450                        unlink(epgfilename);
1451                        free(epgfilename); epgfilename = NULL;
1452                        epgfilename = changefilenameext(file, ".as");
1453                        unlink(epgfilename);
1454                        free(epgfilename); epgfilename = NULL;
1455                }
1456                ret = 1;
1457        }
1458        if(dirrcret == 6)
1459        {
1460                char* subfile = NULL, *dname = NULL, *searchext = NULL;
1461                int overwrite;
1462                subfile = ostrstr(file, "/movie/");
1463                if(subfile != NULL)
1464                        subfile = subfile + 7;
1465                else
1466                        subfile = file;
1467                if(getservicebyrecname(file, 0, 0) != NULL)
1468                        textbox(_("Message"), _("Record in progress"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
1469                else if(textbox(_("Really Rename ?"), subfile, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1470                {
1471                        tmpstr = ostrcat(basename(file), NULL, 0, 0);
1472
1473                        char* search = textinput(_("Rename"), tmpstr);
1474                        free(tmpstr), tmpstr = NULL;
1475
1476                        if(search != NULL)
1477                        {
1478                                dname = ostrcat(file, NULL, 0, 0);
1479                                dname = dirname(dname);
1480                                tmpstr = createpath(dname, search);
1481                                if(file_exist(tmpstr))
1482                                {
1483                                        if(textbox(_("File Exist, Really Rename and Overwrite exist File ?"), search, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1484                                                overwrite = 1;
1485                                        else
1486                                                overwrite = 0;
1487                                }
1488                                else
1489                                        overwrite = 1;
1490
1491                                if(overwrite == 1)
1492                                {
1493                                        debug(10, "rename %s > %s", file, tmpstr);
1494                                        ret = rename(file, tmpstr);
1495                                        free(tmpstr), tmpstr = NULL;
1496                                        free(dname), dname = NULL;
1497               
1498                                        epgfilename = changefilenameext(file, ".epg");
1499                                        if(file_exist(epgfilename))
1500                                        {
1501                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1502                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1503                                                dname = dirname(dname);
1504                                                searchext = changefilenameext(search, ".epg");
1505                                                tmpstr = createpath(dname, searchext);
1506                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1507                                                ret = rename(epgfilename, tmpstr);
1508                                                free(tmpstr), tmpstr = NULL;
1509                                                free(dname), dname = NULL;
1510                                        }
1511                                        free(epgfilename); epgfilename = NULL;
1512               
1513                                        epgfilename = changefilenameext(file, ".se");
1514                                        if(file_exist(epgfilename))
1515                                        {
1516                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1517                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1518                                                dname = dirname(dname);
1519                                                searchext = changefilenameext(search, ".se");
1520                                                tmpstr = createpath(dname, searchext);
1521                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1522                                                ret = rename(epgfilename, tmpstr);
1523                                                free(tmpstr), tmpstr = NULL;
1524                                                free(dname), dname = NULL;
1525                                        }
1526                                        free(epgfilename); epgfilename = NULL;
1527               
1528                                        epgfilename = changefilenameext(file, ".ma");
1529                                        if(file_exist(epgfilename))
1530                                        {
1531                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1532                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1533                                                dname = dirname(dname);
1534                                                searchext = changefilenameext(search, ".ma");
1535                                                tmpstr = createpath(dname, searchext);
1536                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1537                                                ret = rename(epgfilename, tmpstr);
1538                                                free(tmpstr), tmpstr = NULL;
1539                                                free(dname), dname = NULL;
1540                                        }
1541                                        free(epgfilename); epgfilename = NULL;
1542               
1543                                        epgfilename = changefilenameext(file, ".as");
1544                                        if(file_exist(epgfilename))
1545                                        {
1546                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1547                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1548                                                dname = dirname(dname);
1549                                                searchext = changefilenameext(search, ".as");
1550                                                tmpstr = createpath(dname, searchext);
1551                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1552                                                ret = rename(epgfilename, tmpstr);
1553                                                free(tmpstr), tmpstr = NULL;
1554                                                free(dname), dname = NULL;
1555                                        }
1556                                        free(epgfilename); epgfilename = NULL;
1557                                }
1558                        }
1559                }
1560//              ret = 1;
1561        }
1562        if(dirrcret == 7)
1563        {
1564                char* dname = NULL;
1565                dname = ostrcat(file, NULL, 0, 0);
1566                dname = dirname(dname);
1567                if(textbox(_("Really Create Folder in ?"), dname, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1568                {
1569                        tmpstr = ostrcat(basename(file), NULL, 0, 0);
1570
1571                        char* search = textinput(_("Create Folder"), "New Folder");
1572                        free(tmpstr), tmpstr = NULL;
1573
1574                        if(search != NULL)
1575                        {
1576                                tmpstr = createpath(dname, search);
1577                                debug(10, "create %s", tmpstr);
1578                                ret = mkdir(tmpstr, 0777);
1579                        }
1580                }
1581//              ret = 1;
1582        }
1583        return ret;
1584}
1585
1586void playwritevfd(char* file, char* showname)
1587{
1588        char* tmpstr = NULL;
1589
1590        if(showname == NULL)
1591        {
1592                tmpstr = ostrcat(file, NULL, 0, 0);
1593                if(tmpstr != NULL) writevfdmenu(basename(tmpstr));
1594                free(tmpstr); tmpstr = NULL;
1595        }
1596        else
1597                writevfdmenu(showname);
1598}
1599
1600
1601void playstartservice()
1602{
1603        char* tmpstr = NULL;
1604
1605        if(status.aktservice->channel != NULL)
1606        {
1607                tmpstr = ostrcat(status.aktservice->channellist, NULL, 0, 0);
1608                servicecheckret(servicestart(status.aktservice->channel, tmpstr, NULL, 3), 0);
1609        }
1610        else
1611        {
1612                tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0);
1613                servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 0), 0);
1614        }
1615        free(tmpstr); tmpstr = NULL;
1616}
1617
1618// flag 0 = dirlist/playing/infobar
1619// flag 1 = playing/infobar
1620// flag 2 = playing
1621// flag 3 = not stop/start live service
1622// flag 4 = playing with screensaver
1623// startfolder 2 = do nothing with playstop/playstart
1624int screenplay(char* startfile, char* showname, int startfolder, int flag)
1625{
1626        int rcret = 0, playertype = 0, ret = 0, rcwait = 1000, screensaver_delay = 0, holdselection = 0, waitofbuffer = 0, videooff = 0;
1627        char* file = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
1628        char* tmppolicy = NULL, *startdir = NULL;
1629        char* formats = NULL;
1630        struct channel* pipchannel = NULL;
1631        struct skin* playinfobar = getscreen("playinfobar");
1632        struct skin* sprogress = getscreennode(playinfobar, "progress");
1633        struct skin* load = getscreen("loading");
1634        struct skin* blackscreen = getscreen("blackscreen");
1635
1636        int oldsort = getconfigint("dirsort", NULL);
1637        int skip13 = getconfigint("skip13", NULL);
1638        int skip46 = getconfigint("skip46", NULL);
1639        int skip79 = getconfigint("skip79", NULL);
1640
1641        resettvpic();
1642
1643        if(startfolder == 0 && flag != 3)
1644        {
1645                rcret = servicestop(status.aktservice, 1, 1);
1646                if(rcret == 1) return ret;
1647        }
1648
1649printf("[screenplay] status.webplayfile: %s\n",status.webplayfile);
1650
1651        if(status.webplayfile != NULL)
1652        {
1653                // stream over tithek enable start
1654                printf("startfile: %s\n", status.webplayfile);
1655                struct skin* tithekplugin = getplugin("TiTan Mediathek");
1656                if(tithekplugin != NULL)
1657                {
1658                        struct tithek* (*startplugin)(char*);
1659
1660                        startplugin = dlsym(tithekplugin->pluginhandle, "list_hoster_streams");
1661                        if(startplugin != NULL)
1662                        {
1663                                startfile = (char*)startplugin(status.webplayfile);
1664                                printf("startfile changed: %s\n", startfile);
1665                        }
1666                }
1667                else
1668                        startfile = status.webplayfile;
1669
1670printf("[screenplay] 1startfile: %s\n",startfile);
1671
1672                // stream over tithek enable end
1673
1674                rcret = servicestop(status.aktservice, 1, 1);
1675                if(rcret == 1) return ret;
1676        }
1677printf("[screenplay] 2startfile: %s\n",startfile);
1678
1679        // allowed from atemio avi mkv mpg4 xvid mpg1 mpg2 jpeg png
1680        if(startfolder == 1)
1681                formats = ostrcat(formats, ".ts", 1, 0);
1682        else if(file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))
1683                formats = ostrcat(formats, ".m3u8 .flac .ogg .mp3 .avi .dat .divx .flv .mkv .m4v .mp4 .mov .mpg .mpeg .mts .m2ts .trp .ts .vdr .vob .wmv .rm", 1, 0);
1684        else
1685                formats = ostrcat(formats, ".avi .mkv .mpg .mpeg .ts .mp3 .flac .ogg", 1, 0);
1686
1687       
1688        status.updatevfd = PAUSE;
1689        tmppolicy = getpolicy();
1690
1691playerstart:
1692        //reset timeline
1693        sprogress->progresssize = 0;
1694
1695        if(startfolder == 0)
1696                startdir = getconfig("rec_moviepath", NULL);
1697        else
1698                startdir = getconfig("rec_path", NULL);
1699
1700        status.playspeed = 0, status.play = 0, status.pause = 0, status.slowspeed = 0;
1701        int playinfobarcount = 0, playinfobarstatus = 1, dirrcret = 0;
1702
1703        if(startfile == NULL)
1704        {
1705                readmediadb(getconfig("mediadbfile", NULL), 0, 0);
1706
1707                tmpstr = ostrcat(file, NULL, 0, 0);
1708                char* tmpstartdir = startdir;
1709                if(file != NULL)
1710                {
1711                        tmpstr1 = ostrcat(file, NULL, 0, 0);
1712                        startdir = dirname(tmpstr1);
1713                }
1714                free(file); file = NULL;
1715                file = screendirreal(startdir, formats, basename(tmpstr), &dirrcret, ".epg", _("DEL"), getrcconfigint("rcred", NULL), _("SELECT"), 0, _("EPG"), getrcconfigint("rcyellow", NULL), _("SORT"), getrcconfigint("rcblue", NULL), 90, 1, 90, 1, holdselection, 64);
1716                holdselection = 0;
1717                free(tmpstr); tmpstr = NULL;
1718                free(tmpstr1); tmpstr1 = NULL;
1719                startdir = tmpstartdir;
1720        }
1721        else
1722                file = ostrcat(startfile, NULL, 0, 0);
1723
1724        if(file == NULL)
1725        {
1726                if(playcheckdirrcret(file, dirrcret) == 1)
1727                        goto playerstart;
1728        }
1729
1730        if(file != NULL)
1731        {
1732                int noworkaround = getconfigint("playnotintern", NULL);
1733                //if(cmpfilenameext(file, ".ts") == 0 && checkbox("VUSOLO2") != 1 && vubox1 != 1 && noworkaround == 0)
1734                if(cmpfilenameext(file, ".ts") == 0)
1735                {
1736                        playertype = 1;
1737                        addconfig("lastplayertype", "1");
1738                }
1739                else
1740                        addconfig("lastplayertype", "0");       
1741
1742                if(startfile == NULL)
1743                {
1744                        tmpstr = ostrcat(file, NULL, 0, 0);
1745                        if(tmpstr != NULL && startfolder == 0) addconfig("rec_moviepath", dirname(tmpstr));
1746                        free(tmpstr); tmpstr = NULL;
1747               
1748                        if(playcheckdirrcret(file, dirrcret) == 1)
1749                        {
1750                                if(dirrcret == 1) holdselection = 1;
1751                                goto playerstart;
1752                        }
1753
1754                        if(startfolder == 1 && flag != 3)
1755                        {
1756                                rcret = servicestop(status.aktservice, 1, 1);
1757                                if(rcret == 1)
1758                                {
1759                                        free(tmppolicy);
1760                                        free(file);
1761                                        free(formats);
1762                                        addconfigint("dirsort", oldsort);
1763                                        return ret;
1764                                }
1765                        }
1766                }
1767
1768                drawscreen(skin, 0, 0);
1769                drawscreen(load, 0, 0);
1770                playwritevfd(file, showname);
1771                printf("player--> playertype: %i\n", playertype);
1772                if(playertype == 1)
1773                        rcret = playerstartts(file, 0);
1774                else if(playertype == 2)
1775                        rcret = playerstart(file);
1776                else
1777                {
1778#ifdef EPLAYER3
1779                        if(ostrstr(file, "http://") == file || ostrstr(file, "https://") == file)
1780                        {
1781                                struct stimerthread* bufferstatus = addtimer(&screenplaybufferstatus, START, 1000, 1, NULL, NULL, NULL);
1782                                rcret = playerstart(file);
1783                                if(bufferstatus != NULL && gettimer(bufferstatus) != NULL)
1784                                {
1785                                        bufferstatus->aktion = STOP;
1786                                        usleep(100000);
1787                                }
1788                        }
1789                        else
1790                                rcret = playerstart(file);
1791#else
1792                        rcret = playerstart(file);
1793#endif
1794                }
1795#ifndef SIMULATE
1796                if(rcret != 0)
1797                {
1798                        textbox(_("Message"), _("Can't start playback !"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 7, 0);
1799                        writevfdmenu("Player");
1800                       
1801                        if(startfile == NULL)
1802                        {
1803                                if(startfolder == 1 && flag != 3) playstartservice();
1804                                goto playerstart;
1805                        }
1806                        else
1807                        {
1808                                ret = 2;
1809                                goto playerend;
1810                        }
1811                }
1812#endif
1813                clearscreen(load);
1814                if(status.prefillbuffer == 0)
1815                        screenplayinfobar(file, showname, 0, playertype, flag);
1816                else
1817                        waitofbuffer = 1;
1818               
1819                if(flag == 4 && getconfigint("screensaver", NULL) == 1)
1820                {
1821                        screensaver_delay = getconfigint("screensaver_delay", NULL);
1822                        initscreensaver();
1823                }                                                               
1824               
1825                //change codec if ac3default and video has ac3
1826                //deaktivate, freeze player, makes a seek -5
1827                //see eplayer container_ffmpeg_switch_audio
1828                //the seek to the beginning of the file freez
1829                //eplayer.
1830                //playchangecodec();
1831                free(status.playfile); status.playfile = NULL;
1832                status.playfile = ostrcat(file, NULL, 0, 0);
1833                status.play = 1;
1834                int count = 0;
1835                while(1)
1836                {
1837                        while((playertype == 0 && playerisplaying()) || (playertype == 1 && playerisplayingts()))
1838                        {
1839                                rcret = waitrc(playinfobar, rcwait, 0);
1840#ifdef EPLAYER4
1841                                debug(150, "waitofbuffer=%d status.cleaninfobar=%d status.prefillbuffer=%d status.prefillbuffercount=%d playinfobarstatus=%d playinfobarcount=%d",waitofbuffer , status.cleaninfobar, status.prefillbuffer, status.prefillbuffercount, playinfobarstatus, playinfobarcount);
1842
1843                                if(waitofbuffer == 1 && status.prefillbuffer == 0 && (status.cleaninfobar == 1 || status.prefillbuffercount == 200))
1844                                {
1845                                        drawscreen(skin, 0, 0);
1846                                        if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1847                                        waitofbuffer = 0;
1848                                        status.cleaninfobar = 0;
1849                                       
1850                                }
1851                                else if(waitofbuffer == 0 && status.prefillbuffer == 0 && (status.cleaninfobar == 0 || status.prefillbuffercount == 200))
1852                                {
1853                                        playinfobarcount++;
1854                                        if(playinfobarstatus > 0)
1855                                                if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1856                                        if(playinfobarstatus == 1 && playinfobarcount >= getconfigint("infobartimeout", NULL))
1857                                        {
1858                                                playinfobarstatus = 0;
1859                                                if(videooff == 0) screenplayinfobar(NULL, NULL, 1, playertype, flag);
1860                                        }
1861                                }
1862#else
1863#ifdef EXTEPLAYER3
1864//                              getsubtext();
1865#endif
1866                                playinfobarcount++;
1867                                if(playinfobarstatus > 0)
1868                                        if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1869                                if(playinfobarstatus == 1 && playinfobarcount >= getconfigint("infobartimeout", NULL))
1870                                {
1871                                        playinfobarstatus = 0;
1872                                        if(videooff == 0) screenplayinfobar(NULL, NULL, 1, playertype, flag);
1873                                }
1874
1875                                if(waitofbuffer == 1 && status.prefillbuffer == 0)
1876                                {
1877                                        if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1878                                        waitofbuffer = 0;
1879                                }
1880#endif
1881                                if(flag == 4)
1882                                {
1883                                        if(status.play == 1 && screensaver != NULL)
1884                                                count++;
1885       
1886                                        if(count > screensaver_delay && screensaver != NULL)
1887                                        {
1888                                                showscreensaver();
1889#ifdef EPLAYER4
1890                                                if(screensaver->speed < 50)
1891                                                        rcwait = screensaver->speed * 10;
1892                                                else
1893                                                        rcwait = screensaver->speed;
1894#else
1895                                                rcwait = screensaver->speed;
1896#endif
1897                                        }
1898                                }
1899
1900#ifdef EXTEPLAYER3
1901//                              if(rcret == getrcconfigint("rchelp", NULL))
1902//                                      printf("getsubtext: %s\n", getsubtext());
1903#endif
1904
1905                                if(rcret == getrcconfigint("rcpip", NULL))
1906                                {
1907                                        if(status.pipservice->videodev == NULL)
1908                                        {
1909                                                pipchannel = status.lastservice->channel;
1910                                                printf("++++ RC: %i\n",pipstart(pipchannel, NULL, 0));
1911                                        }
1912                                        else
1913                                        {
1914                                                pipstop(status.pipservice, 0);
1915                                                pipchannel = NULL;
1916                                        }
1917                                }                               
1918                               
1919                                if(rcret == getrcconfigint("rcyellow", NULL))
1920                                        playrcyellow(file, showname, playinfobarstatus, playertype, flag);
1921                               
1922                                if(rcret == getrcconfigint("rctext", NULL) || rcret == getrcconfigint("rcsubtitel", NULL))
1923                                        playrctext(file, showname, playinfobarstatus, playertype, flag);
1924                                       
1925                                if(rcret == getrcconfigint("rcgreen", NULL))
1926                                        playrcgreen(file, showname, playinfobarstatus, playertype, flag);
1927                                       
1928                                if(rcret == getrcconfigint("rcblue", NULL))
1929                                        playrcblue(file, showname, playinfobarstatus, playertype, flag);
1930                                       
1931                                if(rcret == getrcconfigint("rcok", NULL))
1932                                        playrcok(file, showname, playinfobarstatus, playertype, flag);
1933                               
1934                                if(rcret == getrcconfigint("rcred", NULL))
1935                                        playrcred(file, showname, playinfobarstatus, playertype, flag);
1936
1937                                if(rcret == getrcconfigint("rcinfo", NULL))
1938                                        playrcinfo(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1939
1940                                if(rcret == getrcconfigint("rcpower", NULL) && status.play == 1 && videooff == 0)
1941                                {
1942                                        videooff = 1;
1943                                        drawscreen(blackscreen, 0, 0);
1944                                }
1945                                else if(rcret == getrcconfigint("rcexit", NULL) && videooff == 1)
1946                                {
1947                                        videooff = 0;
1948                                        drawscreen(skin, 0, 0);
1949                                }
1950                                else if(rcret == getrcconfigint("rcstop", NULL) || rcret == getrcconfigint("rcexit", NULL))
1951                                {
1952                                        if(status.prefillbuffer == 1)
1953                                        {
1954                                                status.prefillbuffer = 2;
1955                                                continue;
1956                                        }
1957                                        playrcstop(playertype, flag);
1958                                        if(startfile == NULL)
1959                                        {                                               
1960                                                if(startfolder == 1 && flag != 3) playstartservice();
1961                                                goto playerstart;
1962                                        }
1963                                        else
1964                                        {
1965                                                ret = 1;
1966                                                goto playerend;
1967                                        }
1968                                }
1969                               
1970                                if(rcret == getrcconfigint("rcsf", NULL))
1971                                        playrcsf(file, showname, &playinfobarstatus, &playinfobarcount, playertype, 0, flag);
1972         
1973                        if(rcret == getrcconfigint("rcsr", NULL))
1974                                        playrcsr(file, showname, &playinfobarstatus, &playinfobarcount, playertype, 0, flag);
1975
1976                                if(rcret == getrcconfigint("rcff", NULL))
1977                                        playrcff(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1978                               
1979                                if(rcret == getrcconfigint("rcfr", NULL))
1980                                        playrcfr(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1981
1982                                if(rcret == getrcconfigint("rcpause", NULL) || ((checkbox("DM7020HD") == 1 || checkbox("DM7020HDV2") == 1 || checkbox("DM900") == 1 || checkbox("DM920") == 1 || checkbox("DM520") == 1 || checkbox("DM525") == 1 || checkbox("ATEMIO520") == 1 || checkbox("ATEMIO530") == 1) && rcret == getrcconfigint("rcplay", NULL) && status.pause == 0 && status.slowspeed == 0 && status.playspeed == 0 && ostrcmp(getconfig("remotecontrol", NULL), "0") == 0))
1983                                {       
1984                                        playrcpause(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1985                                        continue;
1986                                }
1987
1988                                if(rcret == getrcconfigint("rcplay", NULL))
1989                                        playrcplay(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1990
1991                                if(rcret == getrcconfigint("rcleft", NULL))
1992                                        playrcjumpr(file, showname, 60, &playinfobarstatus, &playinfobarcount, playertype, flag);
1993                               
1994                                if(rcret == getrcconfigint("rc1", NULL))
1995                                        playrcjumpr(file, showname, skip13, &playinfobarstatus, &playinfobarcount, playertype, flag);
1996                               
1997                                if(rcret == getrcconfigint("rc4", NULL))
1998                                        playrcjumpr(file, showname, skip46, &playinfobarstatus, &playinfobarcount, playertype, flag);
1999                               
2000                                if(rcret == getrcconfigint("rc7", NULL))
2001                                        playrcjumpr(file, showname, skip79, &playinfobarstatus, &playinfobarcount, playertype, flag);
2002
2003                                if(rcret == getrcconfigint("rc2", NULL))
2004                                        playrcjumpto(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
2005                               
2006                                if(rcret == getrcconfigint("rcright", NULL))
2007                                        playrcjumpf(file, showname, 60, &playinfobarstatus, &playinfobarcount, playertype, flag);
2008                               
2009                                if(rcret == getrcconfigint("rc3", NULL))
2010                                        playrcjumpf(file, showname, skip13, &playinfobarstatus, &playinfobarcount, playertype, flag);
2011                               
2012                                if(rcret == getrcconfigint("rc6", NULL))
2013                                        playrcjumpf(file, showname, skip46, &playinfobarstatus, &playinfobarcount, playertype, flag);
2014                               
2015                                if(rcret == getrcconfigint("rc9", NULL))
2016                                        playrcjumpf(file, showname, skip79, &playinfobarstatus, &playinfobarcount, playertype, flag);
2017
2018                                if(rcret == getrcconfigint("rcdown", NULL))
2019                                        playrcjumpr(file, showname, 300, &playinfobarstatus, &playinfobarcount, playertype, flag);
2020
2021                                if(rcret == getrcconfigint("rcup", NULL))
2022                                        playrcjumpf(file, showname, 300, &playinfobarstatus, &playinfobarcount, playertype, flag);
2023                               
2024                                if(rcret == getrcconfigint("rc0", NULL))
2025                                        setmarker();
2026                                       
2027                                if(rcret == getrcconfigint("rc5", NULL))
2028                                        screenmarker(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
2029                               
2030                                if(rcret == getrcconfigint("rcmenu", NULL)) {
2031                                        char* asfile = changefilenameext(file, ".as");
2032                                        if(status.autoseek == 0) {
2033                                                status.autoseek = 1;
2034                                                textbox(_("Message"), _("Marker autoseek is started"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 10, 0);
2035                                                addtimer(&markerautoseek_thread, START, 10000, 1, NULL, NULL, NULL);
2036                                                FILE* testseek = fopen(asfile, "w");
2037                                                if(testseek != NULL)
2038                                                {
2039                                                        fprintf(testseek,"autoseek is started\n");
2040                                                        fclose(testseek);
2041                                                }
2042                                        }
2043                                        else {
2044                                                status.autoseek = 0;
2045                                                textbox(_("Message"), _("Marker autoseek is stopped"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 10, 0);
2046                                                unlink(asfile);
2047                                        }
2048                                        free(asfile); asfile = NULL;
2049                                }
2050                        }
2051                        //don't change this sleep, without this
2052                        //the player stops to fast, and a last seek can
2053                        //produce a segfault
2054playerend:
2055                        sleep(1);
2056                        if(playertype == 1)
2057                                playerafterendts();
2058                        else
2059                                playerafterend();
2060
2061                        writevfdmenu("Player");
2062                        screenplayinfobar(file, showname, 1, playertype, flag);
2063
2064                        if(startfile == NULL)
2065                        {
2066                                if(startfolder == 1 && flag != 3) playstartservice();
2067                                goto playerstart;
2068                        }
2069                        else
2070                                break;
2071                }
2072        }
2073        if(startfolder == 0 && flag != 3) playstartservice();
2074        status.updatevfd = START;
2075       
2076        if(status.webplayfile != NULL)
2077        {
2078                playstartservice();
2079                free(status.webplayfile); status.webplayfile = NULL;
2080        }
2081
2082        if(tmppolicy != NULL)
2083        {
2084                setpolicy(tmppolicy);
2085                free(tmppolicy);
2086        }
2087       
2088        if(flag == 4)
2089                deinitscreensaver();
2090
2091        addconfigint("dirsort", oldsort);
2092        free(status.playfile); status.playfile = NULL;
2093        status.slowspeed = 0;
2094        status.playspeed = 0;
2095        status.pause = 0;
2096        status.play = 0;
2097        free(file);
2098        free(formats);
2099
2100        if(status.mediadbthread == NULL)
2101        {
2102                if(status.writemediadb == 1)
2103                        writemediadb(getconfig("mediadbfile", NULL), NULL);
2104                freemediadb(0);
2105        }
2106
2107        return ret;
2108}
2109
2110#endif
Note: See TracBrowser for help on using the repository browser.