source: titan/titan/play.h @ 43326

Last change on this file since 43326 was 42617, checked in by obi, 6 years ago

fix building

File size: 57.4 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                }
652                if(status.mediadbfiles > 0)
653                        addmenulist(&mlist, "MediaDB Scan Info", _("MediaDB Scan Info"), NULL, 0, 0);
654        }
655        else
656        {
657                addmenulist(&mlist, "Create Favorites sub folder", _("Create Favorites sub folder"), NULL, 0, 0);
658                addmenulist(&mlist, "Create Favorites sub folder(PIN secured)", _("Create Favorites sub folder(PIN secured)"), NULL, 0, 0);
659
660                if(flag < 199)
661                {
662                        if(file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))
663                        {
664                                addmenulist(&mlist, "Search on KinoX", _("Search on KinoX"), NULL, 0, 0);
665                                addmenulist(&mlist, "Search on KinoX (local)", _("Search on KinoX (local)"), NULL, 0, 0);
666/*
667                                addmenulist(&mlist, "Search on Movie4k", NULL, _("Search on Movie4k"), 0, 0);
668                                addmenulist(&mlist, "Search on Movie4k (local)", _("Search on Movie4k (local)"), NULL, 0, 0);
669*/
670/*
671                                addmenulist(&mlist, "Search on Solarmovies (movie)", _("Search on Solarmovies (movie)"), NULL, 0, 0);
672                                addmenulist(&mlist, "Search on Solarmovies (serie)", _("Search on Solarmovies (serie)"), NULL, 0, 0);
673                                addmenulist(&mlist, "Search on Solarmovies (local)", _("Search on Solarmovies (local)"), NULL, 0, 0);
674*/
675/*
676                                addmenulist(&mlist, "Search on Mle-HD (local)", _("Search on Mle-HD (local)"), NULL, 0, 0);
677*/
678/*
679                                addmenulist(&mlist, "Search on Beeg (local)", _("Search on Beeg (local)"), NULL, 0, 0);
680*/
681/*
682                                addmenulist(&mlist, "Search on Xvideos (local)", _("Search on Xvideos (local)"), NULL, 0, 0);
683*/
684                                addmenulist(&mlist, "Search on FilmOn (local)", _("Search on FilmOn (local)"), NULL, 0, 0);
685                        }
686                        addmenulist(&mlist, "Search on Netzkino (local)", _("Search on Netzkino (local)"), NULL, 0, 0);
687/*
688                        addmenulist(&mlist, "Search on Youtube", _("Search on Youtube"), NULL, 0, 0);
689                        addmenulist(&mlist, "Search on Youtube (local)", _("Search on Youtube (local)"), NULL, 0, 0);
690*/
691/*
692                        addmenulist(&mlist, "Search on MyVideo", _("Search on MyVideo"), NULL, 0, 0);
693                        addmenulist(&mlist, "Search on MyVideo (local)", _("Search on MyVideo (local)"), NULL, 0, 0);
694*/
695                        addmenulist(&mlist, "Search on ARD (local)", _("Search on ARD (local)"), NULL, 0, 0);
696/*
697                        addmenulist(&mlist, "Search on ZDF (local)", _("Search on ZDF (local)"), NULL, 0, 0);
698*/
699/*
700                        addmenulist(&mlist, "Search on TecTime (local)", _("Search on TecTime (local)"), NULL, 0, 0);
701*/
702/*
703                        addmenulist(&mlist, "Search on Giga (local)", _("Search on Giga (local)"), NULL, 0, 0);
704*/
705/*
706                        addmenulist(&mlist, "Search on NowTv (local)", _("Search on NowTv (local)"), NULL, 0, 0);
707*/
708/*
709                        addmenulist(&mlist, "Search on InternetTv (local)", _("Search on InternetTv (local)"), NULL, 0, 0);
710*/
711                        addmenulist(&mlist, "Search on InternetRadio (local)", _("Search on InternetRadio (local)"), NULL, 0, 0);
712                        addmenulist(&mlist, "Search on All (local)", _("Search on All (local)"), NULL, 0, 0);
713                }
714        }
715
716        addmenulist(&mlist, "Downloads", _("Downloads"), NULL, 0, 0);
717
718        if(flag < 199)
719        {
720                //add plugins
721                while(child != NULL)
722                {
723                        if(child->del == PLUGINDELMARK && (status.security >= 1 || (status.security == 0 && checkpluginskip(child->name) == 0)))
724                        {
725                                if(ostrcmp(child->name, "Streaminfo") == 0 && status.play == 1)
726                                        addmenulist(&mlist, child->name, _(child->name), child->pic, 0, 0);
727                                else if(ostrcmp(child->name, "IMDb") == 0)
728                                        addmenulist(&mlist, child->name, _(child->name), child->pic, 0, 0);
729                                else if(ostrcmp(child->name, "IMDb-API") == 0)
730                                        addmenulist(&mlist, child->name, _(child->name), child->pic, 0, 0);
731        //                      else if(ostrcmp(child->name, "TMDb") == 0)
732        //                              addmenulist(&mlist, child->name, _(child->name), child->pic, 0, 0);
733                        }
734                        child = child->next;
735                }
736        }
737
738        mbox = menulistbox(mlist, NULL, skintitle, _("Choose your Red-Menu entry from the following list"), NULL, NULL, 1, 0);
739        if(mbox != NULL)
740        {
741printf("mbox->name=%s\n", mbox->name);
742
743                if(ostrcmp(mbox->name, "Video Settings") == 0)
744                        screenvideosettings();
745                else if(ostrcmp(mbox->name, "AV Settings") == 0)
746                        screenavsettings(0);
747                else if(ostrcmp(mbox->name, "IMDb") == 0)
748                        imdb_submenu(file, 0);
749                else if(ostrcmp(mbox->name, "IMDb-API") == 0)
750                        imdb_submenu(file, 1);
751                else if(ostrcmp(mbox->name, "TMDb") == 0)
752                        imdb_submenu(file, 2);
753                else if(ostrcmp(mbox->name, "iD3Tag Info") == 0)
754                        id3tag_info(file);
755                else if(ostrcmp(mbox->name, "MediaDB Scan Info") == 0)
756                        get_mediadb_scan_info();
757                else if(ostrcmp(mbox->name, "MediaDB Edit") == 0)
758                        screenmediadbedit(file, 0, 0);
759                else if(ostrcmp(mbox->name, "Delete File") == 0)
760                {
761                        playcheckdirrcret(file, 1);
762                        ret = 9999;
763                }
764                else if(ostrcmp(mbox->name, "Rename File") == 0)
765                {
766                        playcheckdirrcret(file, 6);
767                        ret = 9999;
768                }
769                else if(ostrcmp(mbox->name, "Create Folder") == 0)
770                {
771                        playcheckdirrcret(file, 7);
772                        ret = 9999;
773                }
774                else if(ostrcmp(mbox->name, "Downloads") == 0)
775                        screenbgdownload(1);
776                else if(ostrcmp(mbox->name, "Create Favorites sub folder") == 0)
777                        ret = 0;
778                else if(ostrcmp(mbox->name, "Create Favorites sub folder(PIN secured)") == 0)
779                        ret = 1000;
780                else if(ostrcmp(mbox->name, "Search on KinoX") == 0)
781                        ret = 2;
782                else if(ostrcmp(mbox->name, "Search on KinoX (local)") == 0)
783                        ret = 8;
784/*
785                else if(ostrcmp(mbox->name, "Search on Solarmovies (movie)") == 0)
786                        ret = 3;
787                else if(ostrcmp(mbox->name, "Search on Solarmovies (serie)") == 0)
788                        ret = 4;
789                else if(ostrcmp(mbox->name, "Search on Solarmovies (local)") == 0)
790                        ret = 9;
791*/
792/*
793                else if(ostrcmp(mbox->name, "Search on Youtube") == 0)
794                        ret = 5;
795                else if(ostrcmp(mbox->name, "Search on Youtube (local)") == 0)
796                        ret = 10;
797*/
798/*
799                else if(ostrcmp(mbox->name, "Search on MyVideo") == 0)
800                        ret = 6;
801                else if(ostrcmp(mbox->name, "Search on MyVideo (local)") == 0)
802                        ret = 11;
803*/
804/*
805                else if(ostrcmp(mbox->name, "Search on Movie4k") == 0)
806                        ret = 7;
807                else if(ostrcmp(mbox->name, "Search on Movie4k (local)") == 0)
808                        ret = 12;
809*/
810                else if(ostrcmp(mbox->name, "Search on InternetRadio (local)") == 0)
811                        ret = 13;
812/*
813                else if(ostrcmp(mbox->name, "Search on InternetTv (local)") == 0)
814                        ret = 14;
815*/
816                else if(ostrcmp(mbox->name, "Search on ARD (local)") == 0)
817                        ret = 15;
818/*
819                else if(ostrcmp(mbox->name, "Search on ZDF (local)") == 0)
820                        ret = 16;
821*/
822/*
823                else if(ostrcmp(mbox->name, "Search on TecTime (local)") == 0)
824                        ret = 17;
825*/
826/*
827                else if(ostrcmp(mbox->name, "Search on Giga (local)") == 0)
828                        ret = 18;
829*/
830/*
831                else if(ostrcmp(mbox->name, "Search on Beeg (local)") == 0)
832                        ret = 19;
833*/
834/*
835                else if(ostrcmp(mbox->name, "Search on NowTv (local)") == 0)
836                        ret = 20;
837*/
838                else if(ostrcmp(mbox->name, "Search on All (local)") == 0)
839                        ret = 21;
840/*
841                else if(ostrcmp(mbox->name, "Search on Xvideos (local)") == 0)
842                        ret = 24;
843*/
844/*
845                else if(ostrcmp(mbox->name, "Search on Mle-HD (local)") == 0)
846                        ret = 25;
847*/
848                else if(ostrcmp(mbox->name, "Search on Netzkino (local)") == 0)
849                        ret = 26;
850                else if(ostrcmp(mbox->name, "Search on FilmOn (local)") == 0)
851                        ret = 27;
852                else if(ostrcmp(mbox->name, "Downloads") == 0)
853                {
854                        if(status.play == 1)
855                                screenbgdownload(1);
856                        else
857                                screenbgdownload(0);
858                }                       
859                else
860                {
861                        pluginnode = getplugin(mbox->name);
862
863                        if(pluginnode != NULL)
864                        {
865                                startplugin = dlsym(pluginnode->pluginhandle, "start");
866                                if(startplugin != NULL)
867                                        startplugin();
868                        }
869                }
870        }
871
872        freemenulist(mlist, 1); mlist = NULL;
873        drawscreen(skin, 0, 0);
874        resettvpic();
875        if(playinfobarstatus > 0 &&     status.play == 1)
876                screenplayinfobar(file, showname, 0, playertype, flag);
877
878        status.hangtime = hangtime;
879printf("ret=%d\n", ret);
880        return ret;
881}
882
883void playrcinfo(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
884{
885        if(checkbit(status.playercan, 14) == 0) return;
886
887        if(*playinfobarstatus == 0)
888        {
889                *playinfobarstatus = 1;
890                *playinfobarcount = 0;
891                screenplayinfobar(file, showname, 0, playertype, flag);
892        }
893        else if(*playinfobarstatus == 1)
894        {
895                *playinfobarstatus = 0;
896                screenplayinfobar(NULL, NULL, 1, playertype, flag);
897        }
898}
899
900void playrcstop(int playertype, int flag)
901{
902        if(checkbit(status.playercan, 6) == 0) return;
903
904        free(status.playfile); status.playfile = NULL;
905       
906        if(playertype == 1)
907                playerstopts(0, 0);
908        else if(playertype == 2)
909                dvdstop();
910        else
911                playerstop();
912
913        writevfdmenu("Player");
914        screenplayinfobar(NULL, NULL, 1, playertype, flag);
915}
916
917//type 0: only from play
918//type 1: only from pause
919void playrcsf(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int type, int flag)
920{
921        if(checkbit(status.playercan, 15) == 0) return;
922
923        if(status.playspeed == 0 && ((type == 0 && status.pause == 0) || (type == 1 && status.pause == 1)))
924        {
925                status.slowspeed++;
926                if(status.slowspeed > 6) status.slowspeed = 6;
927                if(status.slowspeed > 0)
928                {
929                        status.play = 0;
930
931                        if(playertype == 1)
932                                playerslowts((int)pow(2, status.slowspeed));
933                        else if(playertype == 0)
934                                playerslow(status.slowspeed);
935                        *playinfobarstatus = 2;
936                        *playinfobarcount = 0;
937                        screenplayinfobar(file, showname, 0, playertype, flag);
938                }
939                if(status.slowspeed == 0)
940                {
941                        status.pause = 0;
942                        status.play = 1;
943                        if(playertype == 1)
944                        {
945                                playerpausets();
946                                audioclearbuffer(status.aktservice->audiodev);
947                                playercontinuets();
948                                playerresetts();
949                        }
950                        else if(playertype == 2)
951                                dvdcontinue();
952                        else
953                                playercontinue();
954                        *playinfobarstatus = 1;
955                        *playinfobarcount = 0;
956                        screenplayinfobar(file, showname, 0, playertype, flag);
957                }
958        }
959}
960
961//type 0: only from play
962//type 1: only from pause
963void playrcsr(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int type, int flag)
964{
965        if(checkbit(status.playercan, 15) == 0) return;
966
967        if(status.playspeed == 0 && ((type == 0 && status.pause == 0) || (type == 1 && status.pause == 1)))
968        {
969                status.slowspeed--;
970                if(status.slowspeed < 0) status.slowspeed = 0;
971                if(status.slowspeed > 0)
972                {
973                        status.play = 0;
974                        if(playertype == 1)
975                                playerslowts((int)pow(2, status.slowspeed));
976                        else if(playertype == 0)
977                                playerslowts(status.slowspeed);
978                        *playinfobarstatus = 2;
979                        *playinfobarcount = 0;
980                        screenplayinfobar(file, showname, 0, playertype, flag);
981                }
982                if(status.slowspeed == 0)
983                {
984                        status.pause = 0;
985                        status.play = 1;
986                        if(playertype == 1)
987                        {
988                                playerpausets();
989                                audioclearbuffer(status.aktservice->audiodev);
990                                playercontinuets();
991                                playerresetts();
992                        }
993                        else if(playertype == 2)
994                                dvdcontinue();
995                        else
996                                playercontinue();
997                        *playinfobarstatus = 1;
998                        *playinfobarcount = 0;
999                        screenplayinfobar(file, showname, 0, playertype, flag);
1000                }
1001        }
1002}
1003
1004void playrcff(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1005{
1006        if(status.pause == 1)
1007        {
1008                playrcsf(file, showname, playinfobarstatus, playinfobarcount, playertype, 1, flag);
1009                return;
1010        }
1011
1012        if(checkbit(status.playercan, 7) == 0) return;
1013
1014        if(status.pause == 0 && status.slowspeed == 0)
1015        {
1016                status.playspeed++;
1017                if(status.playspeed > 6) status.playspeed = 6;
1018                if(status.playspeed > 0)
1019                {
1020                        status.play = 0;
1021                        if(playertype == 1)
1022                                playerffts((int)pow(2, status.playspeed));
1023                        else if(playertype == 2)
1024                                dvdff(status.playspeed);
1025                        else   
1026                                playerff(status.playspeed);
1027                               
1028                        //Musik
1029                        if(playertype != 0 || flag != 2)
1030                        {               
1031                                *playinfobarstatus = 2;
1032                                *playinfobarcount = 0;
1033                                screenplayinfobar(file, showname, 0, playertype, flag);
1034                        }
1035                }
1036                if(status.playspeed < 0)
1037                {
1038                        status.play = 0;
1039                        if(playertype == 1)
1040                                playerfrts((int)(pow(2, status.playspeed * -1) * -1), 0);
1041                        else if(playertype == 2)
1042                                dvdfr(status.playspeed);
1043                        else
1044                                playerfr(status.playspeed);
1045                        //Musik
1046                        if(playertype != 0 || flag != 2)
1047                        {               
1048                                *playinfobarstatus = 2;
1049                                *playinfobarcount = 0;
1050                                screenplayinfobar(file, showname, 0, playertype, flag);
1051                        }
1052                }
1053                if(status.playspeed == 0)
1054                {
1055                        status.play = 1;
1056                        if(playertype == 1)
1057                        {
1058                                playerpausets();
1059                                playercontinuets();
1060                                playerresetts();
1061                        }
1062                        else if(playertype == 2)
1063                                dvdcontinue();
1064                        else
1065                                playercontinue();
1066                        //Musik
1067                        if(playertype != 0 || flag != 2)
1068                        {               
1069                                *playinfobarstatus = 1;
1070                                *playinfobarcount = 0;
1071                                screenplayinfobar(file, showname, 0, playertype, flag);
1072                        }
1073                }
1074        }
1075}
1076
1077void playrcfr(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1078{
1079        if(status.pause == 1)
1080        {
1081                playrcsr(file, showname, playinfobarstatus, playinfobarcount, playertype, 1, flag);
1082                return;
1083        }
1084       
1085        if(checkbit(status.playercan, 8) == 0) return;
1086
1087        if(status.pause == 0 && status.slowspeed == 0)
1088        {
1089                status.playspeed--;
1090                if(status.playspeed < -6) status.playspeed = -6;
1091                if(status.playspeed > 0)
1092                {
1093                        status.play = 0;
1094                        if(playertype == 1)
1095                                playerffts((int)pow(2, status.playspeed));
1096                        else if(playertype == 2)
1097                                dvdff(status.playspeed);
1098                        else
1099                                playerff(status.playspeed);
1100                        //Musik
1101                        if(playertype != 0 || flag != 2)
1102                        {               
1103                                *playinfobarstatus = 2;
1104                                *playinfobarcount = 0;
1105                                screenplayinfobar(file, showname, 0, playertype, flag);
1106                        }
1107                }
1108                if(status.playspeed < 0)
1109                {
1110                        status.play = 0;
1111                        if(playertype == 1)
1112                                playerfrts((int)(pow(2, status.playspeed * -1) * -1), 0);
1113                        else if(playertype == 2)
1114                                dvdfr(status.playspeed);
1115                        else
1116                                playerfr(status.playspeed);
1117                        //Musik
1118                        if(playertype != 0 || flag != 2)
1119                        {               
1120                                *playinfobarstatus = 2;
1121                                *playinfobarcount = 0;
1122                                screenplayinfobar(file, showname, 0, playertype, flag);
1123                        }
1124                }
1125                if(status.playspeed == 0)
1126                {
1127                        status.play = 1;
1128                        if(playertype == 1)
1129                        {
1130                                playerpausets();
1131                                playercontinuets();
1132                                playerresetts();
1133                        }
1134                        else if(playertype == 2)
1135                                dvdcontinue();
1136                        else
1137                                playercontinue();
1138                        //Musik
1139                        if(playertype != 0 || flag != 2)
1140                        {               
1141                                *playinfobarstatus = 1;
1142                                *playinfobarcount = 0;
1143                                screenplayinfobar(file, showname, 0, playertype, flag);
1144                        }
1145                }
1146        }
1147}
1148
1149void playrcpause(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1150{
1151        if(status.playspeed != 0 || status.slowspeed != 0)
1152        {
1153                playrcplay(file, showname, playinfobarstatus, playinfobarcount, playertype, flag);
1154                return;
1155        }
1156       
1157        if(checkbit(status.playercan, 9) == 0) return;
1158
1159        if(status.pause == 1)
1160        {
1161                if(playertype == 1)
1162                {
1163                        playercontinuets();
1164                }
1165                else if(playertype == 2)
1166                        dvdcontinue();
1167                else
1168                        playercontinue();
1169                status.slowspeed = 0;
1170                status.playspeed = 0;
1171                status.play = 1;
1172                status.pause = 0;
1173                *playinfobarstatus = 1;
1174                *playinfobarcount = 0;
1175                screenplayinfobar(file, showname, 0, playertype, flag);
1176        }
1177        else
1178        {
1179                status.slowspeed = 0;
1180                status.playspeed = 0;
1181                status.play = 0;
1182                status.pause = 1;
1183                if(playertype == 1)
1184                        playerpausets();
1185                else if(playertype == 2)
1186                        dvdpause();
1187                else
1188                        playerpause();
1189                *playinfobarstatus = 2;
1190                *playinfobarcount = 0;
1191                screenplayinfobar(file, showname, 0, playertype, flag);
1192        }
1193}
1194
1195void playrcplay(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1196{
1197        if(checkbit(status.playercan, 10) == 0) return;
1198
1199        free(status.playfile); status.playfile = NULL;
1200        status.playfile = ostrcat(file, NULL, 0, 0);
1201
1202        if(playertype == 1)
1203        {
1204                if(status.playspeed != 0 || status.slowspeed != 0)
1205                        playerpausets();
1206                if(status.slowspeed != 0)
1207                        audioclearbuffer(status.aktservice->audiodev);
1208                playercontinuets();
1209                if(status.playspeed != 0 || status.slowspeed != 0)
1210                        playerresetts();
1211        }
1212        else if(playertype == 2)
1213                dvdcontinue();
1214        else
1215                playercontinue();
1216        status.slowspeed = 0;
1217        status.playspeed = 0;
1218        status.pause = 0;
1219        status.play = 1;
1220        *playinfobarstatus = 1;
1221        *playinfobarcount = 0;
1222        screenplayinfobar(file, showname, 0, playertype, flag);
1223}
1224
1225void playrcjumpr(char* file, char* showname, int sec, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1226{
1227//      if(checkbit(status.playercan, 11) == 0) return;
1228
1229        unsigned long long pos = 0;
1230       
1231        if(status.pause == 0 && status.playspeed == 0 && status.slowspeed == 0)
1232        {
1233                //Musik
1234                if(playertype == 0 && flag == 2)
1235                {
1236                        pos = playergetpts() / 90000;
1237                        if(pos + 10 > sec)
1238                                        playerseek(sec * -1);
1239                        else
1240                        {
1241                                playerstop();
1242                                playerstart(file);
1243                        }
1244                        return;
1245                }
1246       
1247                struct skin* load = getscreen("loading");
1248                drawscreen(load, 0, 0);
1249               
1250                //a jump over the beginning of the
1251                //file, freez the player (type 0)
1252                if(playertype == 1)
1253                        playerseekts(getservice(RECORDPLAY, 0), sec * -1, 0);
1254                else if(playertype == 2)
1255                        pos = dvdgetpts() / 90000;
1256                else
1257                        pos = playergetpts() / 90000;
1258       
1259                if(playertype != 1)
1260                {
1261                        if(pos + 10 > sec)
1262                        {
1263                                if(playertype == 2)
1264                                        dvdseek(sec * -1);
1265                                else
1266                                        playerseek(sec * -1);
1267                        }
1268                        else
1269                        {
1270                                if(playertype == 2)
1271                                {
1272                                        dvdstop();
1273                                        dvdstart(file);
1274                                }
1275                                else
1276                                {
1277                                        playerstop();
1278                                        playerstart(file);
1279                                }
1280                        }
1281                }
1282
1283                *playinfobarstatus = 1;
1284                *playinfobarcount = 0;
1285                //status.play = 0;
1286                clearscreen(load);
1287                screenplayinfobar(file, showname, 0, playertype, flag);
1288                //status.play = 1;
1289                sleep(1);
1290        }
1291}
1292
1293void playrcjumpto(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1294{
1295        if(status.pause == 0 && status.playspeed == 0 && status.slowspeed == 0)
1296        {
1297                char* tmpstr = numinput(_("Jump To (min)"), NULL, "000", 0);
1298                if(tmpstr != NULL)
1299                {
1300                        int jump = atoi(tmpstr) * 60;
1301                        playrcjumpf(file, showname, jump, playinfobarstatus, playinfobarcount, playertype, flag);
1302                }
1303                free(tmpstr), tmpstr = NULL;
1304        }
1305}
1306
1307void playrcjumpf(char* file, char* showname, int sec, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1308{
1309//      if(checkbit(status.playercan, 12) == 0) return;
1310
1311        if(status.pause == 0 && status.playspeed == 0 && status.slowspeed == 0)
1312        {
1313                //Musik
1314                if(playertype == 0 && flag == 2)
1315                {
1316                        playerseek(sec);
1317                        return;
1318                }
1319                struct skin* load = getscreen("loading");
1320                drawscreen(load, 0, 0);
1321               
1322                if(playertype == 1)
1323                        playerseekts(getservice(RECORDPLAY, 0), sec, 0);
1324                else if(playertype == 2)
1325                        dvdseek(sec);
1326                else
1327                        playerseek(sec);
1328                *playinfobarstatus = 1;
1329                *playinfobarcount = 0;
1330                //status.play = 0;
1331                clearscreen(load);
1332                screenplayinfobar(file, showname, 0, playertype, flag);
1333                //status.play = 1;
1334        }
1335}
1336
1337void playchangecodec(int playertype)
1338{
1339        if(checkbit(status.playercan, 13) == 0) return;
1340
1341        char** tracklist = NULL;
1342
1343        if(getconfigint("av_ac3default", NULL) == 1)
1344        {
1345                int i = 0;
1346               
1347                tracklist = playergettracklist(1);
1348                if(tracklist != NULL)
1349                {
1350                        while(tracklist[i] != NULL)
1351                        {
1352                                if(ostrcmp(tracklist[i + 1], "A_AC3") == 0)
1353                                {
1354                                        playerchangeaudiotrack(i / 2);
1355                                }
1356                                i += 2;
1357                        }
1358                }
1359                playerfreetracklist(tracklist);
1360                tracklist = NULL;
1361        }
1362}
1363
1364// dirrcret 1 = delete
1365// dirrcret 2 =
1366// dirrcret 3 = epg info
1367// dirrcret 4 = sort
1368// dirrcret 5 = exit
1369// dirrcret 6 = rename
1370// dirrcret 7 = create folder
1371
1372int playcheckdirrcret(char* file, int dirrcret)
1373{
1374        int ret = 0;
1375        char* epgfilename = NULL, *tmpstr = NULL;
1376
1377        if(dirrcret == 4)
1378        {
1379                int sort = screendirsort();
1380                addconfigint("dirsort", sort);
1381                ret = 1;
1382        }
1383        if(dirrcret == 3)
1384        {
1385                epgfilename = changefilenameext(file, ".epg");
1386
1387                tmpstr = readfiletomem(epgfilename, 0);
1388                if(tmpstr != NULL)
1389                        textbox(_("EPG Info"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 600, 0, 2);
1390                else {
1391                        free(epgfilename); epgfilename = NULL;
1392                        epgfilename = changefilenameext(file, ".eit");
1393                        tmpstr = readeittomem(epgfilename);
1394                        if(tmpstr != NULL)
1395                                textbox(_("EPG Info"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 600, 0, 2);
1396                }
1397                free(epgfilename); epgfilename = NULL;
1398                free(tmpstr); tmpstr = NULL;
1399                ret = 1;
1400        }
1401        if(dirrcret == 1)
1402        {
1403                char* subfile = NULL;
1404                subfile = ostrstr(file, "/movie/");
1405                if(subfile != NULL)
1406                        subfile = subfile + 7;
1407                else
1408                        subfile = file;
1409                if(getservicebyrecname(file, 0, 0) != NULL)
1410                        textbox(_("Message"), _("Record in progress"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
1411                else if(textbox(_("Really Delete ?"), subfile, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1412                {
1413                        unlink(file);
1414                        if(file_exist(file))
1415                        {
1416                                char* cmd = ostrcat("rm -rf \"", file, 0, 0);
1417                                cmd = ostrcat(cmd, "\"", 1, 0);
1418                                debug(10, "cmd: %s", cmd);
1419                                system(cmd);
1420                                free(cmd), cmd = NULL;
1421                        }                       
1422                        epgfilename = changefilenameext(file, ".epg");
1423                        unlink(epgfilename);
1424                        free(epgfilename); epgfilename = NULL;
1425                        epgfilename = changefilenameext(file, ".se");
1426                        unlink(epgfilename);
1427                        free(epgfilename); epgfilename = NULL;
1428                        epgfilename = changefilenameext(file, ".ma");
1429                        unlink(epgfilename);
1430                        free(epgfilename); epgfilename = NULL;
1431                        epgfilename = changefilenameext(file, ".as");
1432                        unlink(epgfilename);
1433                        free(epgfilename); epgfilename = NULL;
1434                }
1435                ret = 1;
1436        }
1437        if(dirrcret == 6)
1438        {
1439                char* subfile = NULL, *dname = NULL, *searchext = NULL;
1440                int overwrite;
1441                subfile = ostrstr(file, "/movie/");
1442                if(subfile != NULL)
1443                        subfile = subfile + 7;
1444                else
1445                        subfile = file;
1446                if(getservicebyrecname(file, 0, 0) != NULL)
1447                        textbox(_("Message"), _("Record in progress"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
1448                else if(textbox(_("Really Rename ?"), subfile, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1449                {
1450                        tmpstr = ostrcat(basename(file), NULL, 0, 0);
1451
1452                        char* search = textinput(_("Rename"), tmpstr);
1453                        free(tmpstr), tmpstr = NULL;
1454
1455                        if(search != NULL)
1456                        {
1457                                dname = ostrcat(file, NULL, 0, 0);
1458                                dname = dirname(dname);
1459                                tmpstr = createpath(dname, search);
1460                                if(file_exist(tmpstr))
1461                                {
1462                                        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)
1463                                                overwrite = 1;
1464                                        else
1465                                                overwrite = 0;
1466                                }
1467                                else
1468                                        overwrite = 1;
1469
1470                                if(overwrite == 1)
1471                                {
1472                                        debug(10, "rename %s > %s", file, tmpstr);
1473                                        ret = rename(file, tmpstr);
1474                                        free(tmpstr), tmpstr = NULL;
1475                                        free(dname), dname = NULL;
1476               
1477                                        epgfilename = changefilenameext(file, ".epg");
1478                                        if(file_exist(epgfilename))
1479                                        {
1480                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1481                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1482                                                dname = dirname(dname);
1483                                                searchext = changefilenameext(search, ".epg");
1484                                                tmpstr = createpath(dname, searchext);
1485                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1486                                                ret = rename(epgfilename, tmpstr);
1487                                                free(tmpstr), tmpstr = NULL;
1488                                                free(dname), dname = NULL;
1489                                        }
1490                                        free(epgfilename); epgfilename = NULL;
1491               
1492                                        epgfilename = changefilenameext(file, ".se");
1493                                        if(file_exist(epgfilename))
1494                                        {
1495                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1496                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1497                                                dname = dirname(dname);
1498                                                searchext = changefilenameext(search, ".se");
1499                                                tmpstr = createpath(dname, searchext);
1500                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1501                                                ret = rename(epgfilename, tmpstr);
1502                                                free(tmpstr), tmpstr = NULL;
1503                                                free(dname), dname = NULL;
1504                                        }
1505                                        free(epgfilename); epgfilename = NULL;
1506               
1507                                        epgfilename = changefilenameext(file, ".ma");
1508                                        if(file_exist(epgfilename))
1509                                        {
1510                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1511                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1512                                                dname = dirname(dname);
1513                                                searchext = changefilenameext(search, ".ma");
1514                                                tmpstr = createpath(dname, searchext);
1515                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1516                                                ret = rename(epgfilename, tmpstr);
1517                                                free(tmpstr), tmpstr = NULL;
1518                                                free(dname), dname = NULL;
1519                                        }
1520                                        free(epgfilename); epgfilename = NULL;
1521               
1522                                        epgfilename = changefilenameext(file, ".as");
1523                                        if(file_exist(epgfilename))
1524                                        {
1525                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1526                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1527                                                dname = dirname(dname);
1528                                                searchext = changefilenameext(search, ".as");
1529                                                tmpstr = createpath(dname, searchext);
1530                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1531                                                ret = rename(epgfilename, tmpstr);
1532                                                free(tmpstr), tmpstr = NULL;
1533                                                free(dname), dname = NULL;
1534                                        }
1535                                        free(epgfilename); epgfilename = NULL;
1536                                }
1537                        }
1538                }
1539//              ret = 1;
1540        }
1541        if(dirrcret == 7)
1542        {
1543                char* dname = NULL;
1544                dname = ostrcat(file, NULL, 0, 0);
1545                dname = dirname(dname);
1546                if(textbox(_("Really Create Folder in ?"), dname, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1547                {
1548                        tmpstr = ostrcat(basename(file), NULL, 0, 0);
1549
1550                        char* search = textinput(_("Create Folder"), "New Folder");
1551                        free(tmpstr), tmpstr = NULL;
1552
1553                        if(search != NULL)
1554                        {
1555                                tmpstr = createpath(dname, search);
1556                                debug(10, "create %s", tmpstr);
1557                                ret = mkdir(tmpstr, 0777);
1558                        }
1559                }
1560//              ret = 1;
1561        }
1562        return ret;
1563}
1564
1565void playwritevfd(char* file, char* showname)
1566{
1567        char* tmpstr = NULL;
1568
1569        if(showname == NULL)
1570        {
1571                tmpstr = ostrcat(file, NULL, 0, 0);
1572                if(tmpstr != NULL) writevfdmenu(basename(tmpstr));
1573                free(tmpstr); tmpstr = NULL;
1574        }
1575        else
1576                writevfdmenu(showname);
1577}
1578
1579
1580void playstartservice()
1581{
1582        char* tmpstr = NULL;
1583
1584        if(status.aktservice->channel != NULL)
1585        {
1586                tmpstr = ostrcat(status.aktservice->channellist, NULL, 0, 0);
1587                servicecheckret(servicestart(status.aktservice->channel, tmpstr, NULL, 3), 0);
1588        }
1589        else
1590        {
1591                tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0);
1592                servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 0), 0);
1593        }
1594        free(tmpstr); tmpstr = NULL;
1595}
1596
1597// flag 0 = dirlist/playing/infobar
1598// flag 1 = playing/infobar
1599// flag 2 = playing
1600// flag 3 = not stop/start live service
1601// flag 4 = playing with screensaver
1602// startfolder 2 = do nothing with playstop/playstart
1603int screenplay(char* startfile, char* showname, int startfolder, int flag)
1604{
1605        int rcret = 0, playertype = 0, ret = 0, rcwait = 1000, screensaver_delay = 0, holdselection = 0, waitofbuffer = 0, videooff = 0;
1606        char* file = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
1607        char* tmppolicy = NULL, *startdir = NULL;
1608        char* formats = NULL;
1609        struct channel* pipchannel = NULL;
1610        struct skin* playinfobar = getscreen("playinfobar");
1611        struct skin* sprogress = getscreennode(playinfobar, "progress");
1612        struct skin* load = getscreen("loading");
1613        struct skin* blackscreen = getscreen("blackscreen");
1614
1615        int oldsort = getconfigint("dirsort", NULL);
1616        int skip13 = getconfigint("skip13", NULL);
1617        int skip46 = getconfigint("skip46", NULL);
1618        int skip79 = getconfigint("skip79", NULL);
1619
1620        resettvpic();
1621
1622        if(startfolder == 0 && flag != 3)
1623        {
1624                rcret = servicestop(status.aktservice, 1, 1);
1625                if(rcret == 1) return ret;
1626        }
1627
1628        if(status.webplayfile != NULL)
1629        {
1630                // stream over tithek enable start
1631                printf("startfile: %s\n", status.webplayfile);
1632                struct skin* tithekplugin = getplugin("TiTan Mediathek");
1633                if(tithekplugin != NULL)
1634                {
1635                        struct tithek* (*startplugin)(char*);
1636
1637                        startplugin = dlsym(tithekplugin->pluginhandle, "list_hoster_streams");
1638                        if(startplugin != NULL)
1639                        {
1640                                startfile = (char*)startplugin(status.webplayfile);
1641                                printf("startfile changed: %s\n", startfile);
1642                        }
1643                }
1644                else
1645                        startfile = status.webplayfile;
1646
1647                // stream over tithek enable end
1648
1649                rcret = servicestop(status.aktservice, 1, 1);
1650                if(rcret == 1) return ret;
1651        }
1652
1653        // allowed from atemio avi mkv mpg4 xvid mpg1 mpg2 jpeg png
1654        if(startfolder == 1)
1655                formats = ostrcat(formats, ".ts", 1, 0);
1656        else if(file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))
1657                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);
1658        else
1659                formats = ostrcat(formats, ".avi .mkv .mpg .mpeg .ts .mp3 .flac .ogg", 1, 0);
1660
1661       
1662        status.updatevfd = PAUSE;
1663        tmppolicy = getpolicy();
1664
1665playerstart:
1666        //reset timeline
1667        sprogress->progresssize = 0;
1668
1669        if(startfolder == 0)
1670                startdir = getconfig("rec_moviepath", NULL);
1671        else
1672                startdir = getconfig("rec_path", NULL);
1673
1674        status.playspeed = 0, status.play = 0, status.pause = 0, status.slowspeed = 0;
1675        int playinfobarcount = 0, playinfobarstatus = 1, dirrcret = 0;
1676
1677        if(startfile == NULL)
1678        {
1679                readmediadb(getconfig("mediadbfile", NULL), 0, 0);
1680
1681                tmpstr = ostrcat(file, NULL, 0, 0);
1682                char* tmpstartdir = startdir;
1683                if(file != NULL)
1684                {
1685                        tmpstr1 = ostrcat(file, NULL, 0, 0);
1686                        startdir = dirname(tmpstr1);
1687                }
1688                free(file); file = NULL;
1689                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);
1690                holdselection = 0;
1691                free(tmpstr); tmpstr = NULL;
1692                free(tmpstr1); tmpstr1 = NULL;
1693                startdir = tmpstartdir;
1694        }
1695        else
1696                file = ostrcat(startfile, NULL, 0, 0);
1697
1698        if(file == NULL)
1699        {
1700                if(playcheckdirrcret(file, dirrcret) == 1)
1701                        goto playerstart;
1702        }
1703
1704        if(file != NULL)
1705        {
1706                //if(getconfigint("playertype", NULL) == 1 && cmpfilenameext(file, ".ts") == 0)
1707                if(cmpfilenameext(file, ".ts") == 0 && checkbox("VUSOLO2") != 1)
1708                {
1709                        playertype = 1;
1710                        addconfig("lastplayertype", "1");
1711                }
1712                else
1713                        addconfig("lastplayertype", "0");       
1714
1715                if(startfile == NULL)
1716                {
1717                        tmpstr = ostrcat(file, NULL, 0, 0);
1718                        if(tmpstr != NULL && startfolder == 0) addconfig("rec_moviepath", dirname(tmpstr));
1719                        free(tmpstr); tmpstr = NULL;
1720               
1721                        if(playcheckdirrcret(file, dirrcret) == 1)
1722                        {
1723                                if(dirrcret == 1) holdselection = 1;
1724                                goto playerstart;
1725                        }
1726
1727                        if(startfolder == 1 && flag != 3)
1728                        {
1729                                rcret = servicestop(status.aktservice, 1, 1);
1730                                if(rcret == 1)
1731                                {
1732                                        free(tmppolicy);
1733                                        free(file);
1734                                        free(formats);
1735                                        addconfigint("dirsort", oldsort);
1736                                        return ret;
1737                                }
1738                        }
1739                }
1740
1741                drawscreen(skin, 0, 0);
1742                drawscreen(load, 0, 0);
1743                playwritevfd(file, showname);
1744                if(playertype == 1)
1745                        rcret = playerstartts(file, 0);
1746                else if(playertype == 2)
1747                        rcret = playerstart(file);
1748                else
1749                {
1750#ifdef EPLAYER3
1751                        if(ostrstr(file, "http://") == file || ostrstr(file, "https://") == file)
1752                        {
1753                                struct stimerthread* bufferstatus = addtimer(&screenplaybufferstatus, START, 1000, 1, NULL, NULL, NULL);
1754                                rcret = playerstart(file);
1755                                if(bufferstatus != NULL && gettimer(bufferstatus) != NULL)
1756                                {
1757                                        bufferstatus->aktion = STOP;
1758                                        usleep(100000);
1759                                }
1760                        }
1761                        else
1762                                rcret = playerstart(file);
1763#else
1764                        rcret = playerstart(file);
1765#endif
1766                }
1767#ifndef SIMULATE
1768                if(rcret != 0)
1769                {
1770                        textbox(_("Message"), _("Can't start playback !"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 7, 0);
1771                        writevfdmenu("Player");
1772                       
1773                        if(startfile == NULL)
1774                        {
1775                                if(startfolder == 1 && flag != 3) playstartservice();
1776                                goto playerstart;
1777                        }
1778                        else
1779                        {
1780                                ret = 2;
1781                                goto playerend;
1782                        }
1783                }
1784#endif
1785                clearscreen(load);
1786                if(status.prefillbuffer == 0)
1787                        screenplayinfobar(file, showname, 0, playertype, flag);
1788                else
1789                        waitofbuffer = 1;
1790               
1791                if(flag == 4 && getconfigint("screensaver", NULL) == 1)
1792                {
1793                        screensaver_delay = getconfigint("screensaver_delay", NULL);
1794                        initscreensaver();
1795                }                                                               
1796               
1797                //change codec if ac3default and video has ac3
1798                //deaktivate, freeze player, makes a seek -5
1799                //see eplayer container_ffmpeg_switch_audio
1800                //the seek to the beginning of the file freez
1801                //eplayer.
1802                //playchangecodec();
1803                free(status.playfile); status.playfile = NULL;
1804                status.playfile = ostrcat(file, NULL, 0, 0);
1805                status.play = 1;
1806                int count = 0;
1807                while(1)
1808                {
1809                        while((playertype == 0 && playerisplaying()) || (playertype == 1 && playerisplayingts()))
1810                        {
1811                                rcret = waitrc(playinfobar, rcwait, 0);
1812#ifdef EPLAYER4
1813                                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);
1814
1815                                if(waitofbuffer == 1 && status.prefillbuffer == 0 && (status.cleaninfobar == 1 || status.prefillbuffercount == 200))
1816                                {
1817                                        drawscreen(skin, 0, 0);
1818                                        if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1819                                        waitofbuffer = 0;
1820                                        status.cleaninfobar = 0;
1821                                       
1822                                }
1823                                else if(waitofbuffer == 0 && status.prefillbuffer == 0 && (status.cleaninfobar == 0 || status.prefillbuffercount == 200))
1824                                {
1825                                        playinfobarcount++;
1826                                        if(playinfobarstatus > 0)
1827                                                if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1828                                        if(playinfobarstatus == 1 && playinfobarcount >= getconfigint("infobartimeout", NULL))
1829                                        {
1830                                                playinfobarstatus = 0;
1831                                                if(videooff == 0) screenplayinfobar(NULL, NULL, 1, playertype, flag);
1832                                        }
1833                                }
1834#else
1835#ifdef EXTEPLAYER3
1836                                getsubtext();
1837#endif
1838                                playinfobarcount++;
1839                                if(playinfobarstatus > 0)
1840                                        if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1841                                if(playinfobarstatus == 1 && playinfobarcount >= getconfigint("infobartimeout", NULL))
1842                                {
1843                                        playinfobarstatus = 0;
1844                                        if(videooff == 0) screenplayinfobar(NULL, NULL, 1, playertype, flag);
1845                                }
1846
1847                                if(waitofbuffer == 1 && status.prefillbuffer == 0)
1848                                {
1849                                        if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1850                                        waitofbuffer = 0;
1851                                }
1852#endif
1853                                if(flag == 4)
1854                                {
1855                                        if(status.play == 1 && screensaver != NULL)
1856                                                count++;
1857       
1858                                        if(count > screensaver_delay && screensaver != NULL)
1859                                        {
1860                                                showscreensaver();
1861#ifdef EPLAYER4
1862                                                if(screensaver->speed < 50)
1863                                                        rcwait = screensaver->speed * 10;
1864                                                else
1865                                                        rcwait = screensaver->speed;
1866#else
1867                                                rcwait = screensaver->speed;
1868#endif
1869                                        }
1870                                }
1871
1872#ifdef EXTEPLAYER3
1873                                if(rcret == getrcconfigint("rchelp", NULL))
1874                                        printf("getsubtext: %s\n", getsubtext());
1875#endif
1876
1877                                if(rcret == getrcconfigint("rcpip", NULL))
1878                                {
1879                                        if(status.pipservice->videodev == NULL)
1880                                        {
1881                                                pipchannel = status.lastservice->channel;
1882                                                printf("++++ RC: %i\n",pipstart(pipchannel, NULL, 0));
1883                                        }
1884                                        else
1885                                        {
1886                                                pipstop(status.pipservice, 0);
1887                                                pipchannel = NULL;
1888                                        }
1889                                }                               
1890                               
1891                                if(rcret == getrcconfigint("rcyellow", NULL))
1892                                        playrcyellow(file, showname, playinfobarstatus, playertype, flag);
1893                               
1894                                if(rcret == getrcconfigint("rctext", NULL) || rcret == getrcconfigint("rcsubtitel", NULL))
1895                                        playrctext(file, showname, playinfobarstatus, playertype, flag);
1896                                       
1897                                if(rcret == getrcconfigint("rcgreen", NULL))
1898                                        playrcgreen(file, showname, playinfobarstatus, playertype, flag);
1899                                       
1900                                if(rcret == getrcconfigint("rcblue", NULL))
1901                                        playrcblue(file, showname, playinfobarstatus, playertype, flag);
1902                                       
1903                                if(rcret == getrcconfigint("rcok", NULL))
1904                                        playrcok(file, showname, playinfobarstatus, playertype, flag);
1905                               
1906                                if(rcret == getrcconfigint("rcred", NULL))
1907                                        playrcred(file, showname, playinfobarstatus, playertype, flag);
1908
1909                                if(rcret == getrcconfigint("rcinfo", NULL))
1910                                        playrcinfo(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1911
1912                                if(rcret == getrcconfigint("rcpower", NULL) && status.play == 1 && videooff == 0)
1913                                {
1914                                        videooff = 1;
1915                                        drawscreen(blackscreen, 0, 0);
1916                                }
1917                                else if(rcret == getrcconfigint("rcexit", NULL) && videooff == 1)
1918                                {
1919                                        videooff = 0;
1920                                        drawscreen(skin, 0, 0);
1921                                }
1922                                else if(rcret == getrcconfigint("rcstop", NULL) || rcret == getrcconfigint("rcexit", NULL))
1923                                {
1924                                        if(status.prefillbuffer == 1)
1925                                        {
1926                                                status.prefillbuffer = 2;
1927                                                continue;
1928                                        }
1929                                        playrcstop(playertype, flag);
1930                                        if(startfile == NULL)
1931                                        {                                               
1932                                                if(startfolder == 1 && flag != 3) playstartservice();
1933                                                goto playerstart;
1934                                        }
1935                                        else
1936                                        {
1937                                                ret = 1;
1938                                                goto playerend;
1939                                        }
1940                                }
1941                               
1942                                if(rcret == getrcconfigint("rcsf", NULL))
1943                                        playrcsf(file, showname, &playinfobarstatus, &playinfobarcount, playertype, 0, flag);
1944         
1945                        if(rcret == getrcconfigint("rcsr", NULL))
1946                                        playrcsr(file, showname, &playinfobarstatus, &playinfobarcount, playertype, 0, flag);
1947
1948                                if(rcret == getrcconfigint("rcff", NULL))
1949                                        playrcff(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1950                               
1951                                if(rcret == getrcconfigint("rcfr", NULL))
1952                                        playrcfr(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1953
1954                                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))
1955                                {       
1956                                        playrcpause(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1957                                        continue;
1958                                }
1959
1960                                if(rcret == getrcconfigint("rcplay", NULL))
1961                                        playrcplay(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1962
1963                                if(rcret == getrcconfigint("rcleft", NULL))
1964                                        playrcjumpr(file, showname, 60, &playinfobarstatus, &playinfobarcount, playertype, flag);
1965                               
1966                                if(rcret == getrcconfigint("rc1", NULL))
1967                                        playrcjumpr(file, showname, skip13, &playinfobarstatus, &playinfobarcount, playertype, flag);
1968                               
1969                                if(rcret == getrcconfigint("rc4", NULL))
1970                                        playrcjumpr(file, showname, skip46, &playinfobarstatus, &playinfobarcount, playertype, flag);
1971                               
1972                                if(rcret == getrcconfigint("rc7", NULL))
1973                                        playrcjumpr(file, showname, skip79, &playinfobarstatus, &playinfobarcount, playertype, flag);
1974
1975                                if(rcret == getrcconfigint("rc2", NULL))
1976                                        playrcjumpto(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1977                               
1978                                if(rcret == getrcconfigint("rcright", NULL))
1979                                        playrcjumpf(file, showname, 60, &playinfobarstatus, &playinfobarcount, playertype, flag);
1980                               
1981                                if(rcret == getrcconfigint("rc3", NULL))
1982                                        playrcjumpf(file, showname, skip13, &playinfobarstatus, &playinfobarcount, playertype, flag);
1983                               
1984                                if(rcret == getrcconfigint("rc6", NULL))
1985                                        playrcjumpf(file, showname, skip46, &playinfobarstatus, &playinfobarcount, playertype, flag);
1986                               
1987                                if(rcret == getrcconfigint("rc9", NULL))
1988                                        playrcjumpf(file, showname, skip79, &playinfobarstatus, &playinfobarcount, playertype, flag);
1989
1990                                if(rcret == getrcconfigint("rcdown", NULL))
1991                                        playrcjumpr(file, showname, 300, &playinfobarstatus, &playinfobarcount, playertype, flag);
1992
1993                                if(rcret == getrcconfigint("rcup", NULL))
1994                                        playrcjumpf(file, showname, 300, &playinfobarstatus, &playinfobarcount, playertype, flag);
1995                               
1996                                if(rcret == getrcconfigint("rc0", NULL))
1997                                        setmarker();
1998                                       
1999                                if(rcret == getrcconfigint("rc5", NULL))
2000                                        screenmarker(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
2001                               
2002                                if(rcret == getrcconfigint("rcmenu", NULL)) {
2003                                        char* asfile = changefilenameext(file, ".as");
2004                                        if(status.autoseek == 0) {
2005                                                status.autoseek = 1;
2006                                                textbox(_("Message"), _("Marker autoseek is started"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 10, 0);
2007                                                addtimer(&markerautoseek_thread, START, 10000, 1, NULL, NULL, NULL);
2008                                                FILE* testseek = fopen(asfile, "w");
2009                                                if(testseek != NULL)
2010                                                {
2011                                                        fprintf(testseek,"autoseek is started\n");
2012                                                        fclose(testseek);
2013                                                }
2014                                        }
2015                                        else {
2016                                                status.autoseek = 0;
2017                                                textbox(_("Message"), _("Marker autoseek is stopped"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 10, 0);
2018                                                unlink(asfile);
2019                                        }
2020                                        free(asfile); asfile = NULL;
2021                                }
2022                        }
2023                        //don't change this sleep, without this
2024                        //the player stops to fast, and a last seek can
2025                        //produce a segfault
2026playerend:
2027                        sleep(1);
2028                        if(playertype == 1)
2029                                playerafterendts();
2030                        else
2031                                playerafterend();
2032
2033                        writevfdmenu("Player");
2034                        screenplayinfobar(file, showname, 1, playertype, flag);
2035
2036                        if(startfile == NULL)
2037                        {
2038                                if(startfolder == 1 && flag != 3) playstartservice();
2039                                goto playerstart;
2040                        }
2041                        else
2042                                break;
2043                }
2044        }
2045        if(startfolder == 0 && flag != 3) playstartservice();
2046        status.updatevfd = START;
2047       
2048        if(status.webplayfile != NULL)
2049        {
2050                playstartservice();
2051                free(status.webplayfile); status.webplayfile = NULL;
2052        }
2053
2054        if(tmppolicy != NULL)
2055        {
2056                setpolicy(tmppolicy);
2057                free(tmppolicy);
2058        }
2059       
2060        if(flag == 4)
2061                deinitscreensaver();
2062
2063        addconfigint("dirsort", oldsort);
2064        free(status.playfile); status.playfile = NULL;
2065        status.slowspeed = 0;
2066        status.playspeed = 0;
2067        status.pause = 0;
2068        status.play = 0;
2069        free(file);
2070        free(formats);
2071
2072        if(status.mediadbthread == NULL)
2073        {
2074                if(status.writemediadb == 1)
2075                        writemediadb(getconfig("mediadbfile", NULL), NULL);
2076                freemediadb(0);
2077        }
2078
2079        return ret;
2080}
2081
2082#endif
Note: See TracBrowser for help on using the repository browser.