source: titan/titan/play.h @ 44983

Last change on this file since 44983 was 44983, checked in by obi, 2 years ago

update filelist

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