source: titan/titan/play.h @ 37618

Last change on this file since 37618 was 37618, checked in by obi, 8 years ago

redmenu/infomenu add create folder and rename funcktion

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