source: titan/titan/play.h @ 39947

Last change on this file since 39947 was 39839, checked in by obi, 7 years ago

fix

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