source: titan/titan/play.h @ 44551

Last change on this file since 44551 was 44551, checked in by gost, 4 years ago

test extplayer

File size: 58.2 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)
1213                        {
1214                                videoslowmotion(status.aktservice->videodev, 0);
1215                                videofastforward(status.aktservice->videodev, 0);
1216                        }
1217                }
1218                if(status.slowspeed != 0)
1219                        audioclearbuffer(status.aktservice->audiodev);
1220                playercontinuets();
1221                if((status.playspeed != 0 || status.slowspeed != 0) && checkchipset("HI3798MV200") != 1)
1222                {
1223                        playerresetts();
1224                }
1225        }
1226        else if(playertype == 2)
1227                dvdcontinue();
1228        else
1229        {
1230                if(status.playspeed != 0 || status.slowspeed != 0)
1231                        playerpause();
1232                playercontinue();
1233        }
1234        status.slowspeed = 0;
1235        status.playspeed = 0;
1236        status.pause = 0;
1237        status.play = 1;
1238        *playinfobarstatus = 1;
1239        *playinfobarcount = 0;
1240        screenplayinfobar(file, showname, 0, playertype, flag);
1241}
1242
1243void playrcjumpr(char* file, char* showname, int sec, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1244{
1245//      if(checkbit(status.playercan, 11) == 0) return;
1246
1247        unsigned long long pos = 0;
1248       
1249        if(status.pause == 0 && status.playspeed == 0 && status.slowspeed == 0)
1250        {
1251                //Musik
1252                if(playertype == 0 && flag == 2)
1253                {
1254                        pos = playergetpts() / 90000;
1255                        if(pos + 10 > sec)
1256                                        playerseek(sec * -1);
1257                        else
1258                        {
1259                                playerstop();
1260                                playerstart(file);
1261                        }
1262                        return;
1263                }
1264       
1265                struct skin* load = getscreen("loading");
1266                drawscreen(load, 0, 0);
1267               
1268                //a jump over the beginning of the
1269                //file, freez the player (type 0)
1270                if(playertype == 1)
1271                        playerseekts(getservice(RECORDPLAY, 0), sec * -1, 0);
1272                else if(playertype == 2)
1273                        pos = dvdgetpts() / 90000;
1274                else
1275                        pos = playergetpts() / 90000;
1276       
1277                if(playertype != 1)
1278                {
1279                        if(pos + 10 > sec)
1280                        {
1281                                if(playertype == 2)
1282                                        dvdseek(sec * -1);
1283                                else
1284                                        playerseek(sec * -1);
1285                        }
1286                        else
1287                        {
1288                                if(playertype == 2)
1289                                {
1290                                        dvdstop();
1291                                        dvdstart(file);
1292                                }
1293                                else
1294                                {
1295                                        playerstop();
1296                                        playerstart(file);
1297                                }
1298                        }
1299                }
1300
1301                *playinfobarstatus = 1;
1302                *playinfobarcount = 0;
1303                //status.play = 0;
1304                clearscreen(load);
1305                screenplayinfobar(file, showname, 0, playertype, flag);
1306                //status.play = 1;
1307                sleep(1);
1308        }
1309}
1310
1311void playrcjumpto(char* file, char* showname, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1312{
1313        if(status.pause == 0 && status.playspeed == 0 && status.slowspeed == 0)
1314        {
1315                char* tmpstr = numinput(_("Jump To (min)"), NULL, "000", 0);
1316                if(tmpstr != NULL)
1317                {
1318                        int jump = atoi(tmpstr) * 60;
1319                        playrcjumpf(file, showname, jump, playinfobarstatus, playinfobarcount, playertype, flag);
1320                }
1321                free(tmpstr), tmpstr = NULL;
1322        }
1323}
1324
1325void playrcjumpf(char* file, char* showname, int sec, int* playinfobarstatus, int* playinfobarcount, int playertype, int flag)
1326{
1327//      if(checkbit(status.playercan, 12) == 0) return;
1328
1329        if(status.pause == 0 && status.playspeed == 0 && status.slowspeed == 0)
1330        {
1331                //Musik
1332                if(playertype == 0 && flag == 2)
1333                {
1334                        playerseek(sec);
1335                        return;
1336                }
1337                struct skin* load = getscreen("loading");
1338                drawscreen(load, 0, 0);
1339               
1340                if(playertype == 1)
1341                        playerseekts(getservice(RECORDPLAY, 0), sec, 0);
1342                else if(playertype == 2)
1343                        dvdseek(sec);
1344                else
1345                        playerseek(sec);
1346                *playinfobarstatus = 1;
1347                *playinfobarcount = 0;
1348                //status.play = 0;
1349                clearscreen(load);
1350                screenplayinfobar(file, showname, 0, playertype, flag);
1351                //status.play = 1;
1352        }
1353}
1354
1355void playchangecodec(int playertype)
1356{
1357        if(checkbit(status.playercan, 13) == 0) return;
1358
1359        char** tracklist = NULL;
1360
1361        if(getconfigint("av_ac3default", NULL) == 1)
1362        {
1363                int i = 0;
1364               
1365                tracklist = playergettracklist(1);
1366                if(tracklist != NULL)
1367                {
1368                        while(tracklist[i] != NULL)
1369                        {
1370                                if(ostrcmp(tracklist[i + 1], "A_AC3") == 0)
1371                                {
1372                                        playerchangeaudiotrack(i / 2);
1373                                }
1374                                i += 2;
1375                        }
1376                }
1377                playerfreetracklist(tracklist);
1378                tracklist = NULL;
1379        }
1380}
1381
1382// dirrcret 1 = delete
1383// dirrcret 2 =
1384// dirrcret 3 = epg info
1385// dirrcret 4 = sort
1386// dirrcret 5 = exit
1387// dirrcret 6 = rename
1388// dirrcret 7 = create folder
1389
1390int playcheckdirrcret(char* file, int dirrcret)
1391{
1392        int ret = 0;
1393        char* epgfilename = NULL, *tmpstr = NULL;
1394
1395        if(dirrcret == 4)
1396        {
1397                int sort = screendirsort();
1398                addconfigint("dirsort", sort);
1399                ret = 1;
1400        }
1401        if(dirrcret == 3)
1402        {
1403                epgfilename = changefilenameext(file, ".epg");
1404
1405                tmpstr = readfiletomem(epgfilename, 0);
1406                if(tmpstr != NULL)
1407                        textbox(_("EPG Info"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 600, 0, 2);
1408                else {
1409                        free(epgfilename); epgfilename = NULL;
1410                        epgfilename = changefilenameext(file, ".eit");
1411                        tmpstr = readeittomem(epgfilename);
1412                        if(tmpstr != NULL)
1413                                textbox(_("EPG Info"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 600, 0, 2);
1414                }
1415                free(epgfilename); epgfilename = NULL;
1416                free(tmpstr); tmpstr = NULL;
1417                ret = 1;
1418        }
1419        if(dirrcret == 1)
1420        {
1421                char* subfile = NULL;
1422                subfile = ostrstr(file, "/movie/");
1423                if(subfile != NULL)
1424                        subfile = subfile + 7;
1425                else
1426                        subfile = file;
1427                if(getservicebyrecname(file, 0, 0) != NULL)
1428                        textbox(_("Message"), _("Record in progress"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
1429                else if(textbox(_("Really Delete ?"), subfile, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1430                {
1431                        unlink(file);
1432                        if(file_exist(file))
1433                        {
1434                                char* cmd = ostrcat("rm -rf \"", file, 0, 0);
1435                                cmd = ostrcat(cmd, "\"", 1, 0);
1436                                debug(10, "cmd: %s", cmd);
1437                                system(cmd);
1438                                free(cmd), cmd = NULL;
1439                        }                       
1440                        epgfilename = changefilenameext(file, ".epg");
1441                        unlink(epgfilename);
1442                        free(epgfilename); epgfilename = NULL;
1443                        epgfilename = changefilenameext(file, ".se");
1444                        unlink(epgfilename);
1445                        free(epgfilename); epgfilename = NULL;
1446                        epgfilename = changefilenameext(file, ".ma");
1447                        unlink(epgfilename);
1448                        free(epgfilename); epgfilename = NULL;
1449                        epgfilename = changefilenameext(file, ".as");
1450                        unlink(epgfilename);
1451                        free(epgfilename); epgfilename = NULL;
1452                }
1453                ret = 1;
1454        }
1455        if(dirrcret == 6)
1456        {
1457                char* subfile = NULL, *dname = NULL, *searchext = NULL;
1458                int overwrite;
1459                subfile = ostrstr(file, "/movie/");
1460                if(subfile != NULL)
1461                        subfile = subfile + 7;
1462                else
1463                        subfile = file;
1464                if(getservicebyrecname(file, 0, 0) != NULL)
1465                        textbox(_("Message"), _("Record in progress"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
1466                else if(textbox(_("Really Rename ?"), subfile, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1467                {
1468                        tmpstr = ostrcat(basename(file), NULL, 0, 0);
1469
1470                        char* search = textinput(_("Rename"), tmpstr);
1471                        free(tmpstr), tmpstr = NULL;
1472
1473                        if(search != NULL)
1474                        {
1475                                dname = ostrcat(file, NULL, 0, 0);
1476                                dname = dirname(dname);
1477                                tmpstr = createpath(dname, search);
1478                                if(file_exist(tmpstr))
1479                                {
1480                                        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)
1481                                                overwrite = 1;
1482                                        else
1483                                                overwrite = 0;
1484                                }
1485                                else
1486                                        overwrite = 1;
1487
1488                                if(overwrite == 1)
1489                                {
1490                                        debug(10, "rename %s > %s", file, tmpstr);
1491                                        ret = rename(file, tmpstr);
1492                                        free(tmpstr), tmpstr = NULL;
1493                                        free(dname), dname = NULL;
1494               
1495                                        epgfilename = changefilenameext(file, ".epg");
1496                                        if(file_exist(epgfilename))
1497                                        {
1498                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1499                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1500                                                dname = dirname(dname);
1501                                                searchext = changefilenameext(search, ".epg");
1502                                                tmpstr = createpath(dname, searchext);
1503                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1504                                                ret = rename(epgfilename, tmpstr);
1505                                                free(tmpstr), tmpstr = NULL;
1506                                                free(dname), dname = NULL;
1507                                        }
1508                                        free(epgfilename); epgfilename = NULL;
1509               
1510                                        epgfilename = changefilenameext(file, ".se");
1511                                        if(file_exist(epgfilename))
1512                                        {
1513                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1514                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1515                                                dname = dirname(dname);
1516                                                searchext = changefilenameext(search, ".se");
1517                                                tmpstr = createpath(dname, searchext);
1518                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1519                                                ret = rename(epgfilename, tmpstr);
1520                                                free(tmpstr), tmpstr = NULL;
1521                                                free(dname), dname = NULL;
1522                                        }
1523                                        free(epgfilename); epgfilename = NULL;
1524               
1525                                        epgfilename = changefilenameext(file, ".ma");
1526                                        if(file_exist(epgfilename))
1527                                        {
1528                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1529                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1530                                                dname = dirname(dname);
1531                                                searchext = changefilenameext(search, ".ma");
1532                                                tmpstr = createpath(dname, searchext);
1533                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1534                                                ret = rename(epgfilename, tmpstr);
1535                                                free(tmpstr), tmpstr = NULL;
1536                                                free(dname), dname = NULL;
1537                                        }
1538                                        free(epgfilename); epgfilename = NULL;
1539               
1540                                        epgfilename = changefilenameext(file, ".as");
1541                                        if(file_exist(epgfilename))
1542                                        {
1543                                                tmpstr = ostrcat(basename(epgfilename), NULL, 0, 0);
1544                                                dname = ostrcat(epgfilename, NULL, 0, 0);
1545                                                dname = dirname(dname);
1546                                                searchext = changefilenameext(search, ".as");
1547                                                tmpstr = createpath(dname, searchext);
1548                                                debug(10, "rename %s > %s", epgfilename, tmpstr);
1549                                                ret = rename(epgfilename, tmpstr);
1550                                                free(tmpstr), tmpstr = NULL;
1551                                                free(dname), dname = NULL;
1552                                        }
1553                                        free(epgfilename); epgfilename = NULL;
1554                                }
1555                        }
1556                }
1557//              ret = 1;
1558        }
1559        if(dirrcret == 7)
1560        {
1561                char* dname = NULL;
1562                dname = ostrcat(file, NULL, 0, 0);
1563                dname = dirname(dname);
1564                if(textbox(_("Really Create Folder in ?"), dname, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
1565                {
1566                        tmpstr = ostrcat(basename(file), NULL, 0, 0);
1567
1568                        char* search = textinput(_("Create Folder"), "New Folder");
1569                        free(tmpstr), tmpstr = NULL;
1570
1571                        if(search != NULL)
1572                        {
1573                                tmpstr = createpath(dname, search);
1574                                debug(10, "create %s", tmpstr);
1575                                ret = mkdir(tmpstr, 0777);
1576                        }
1577                }
1578//              ret = 1;
1579        }
1580        return ret;
1581}
1582
1583void playwritevfd(char* file, char* showname)
1584{
1585        char* tmpstr = NULL;
1586
1587        if(showname == NULL)
1588        {
1589                tmpstr = ostrcat(file, NULL, 0, 0);
1590                if(tmpstr != NULL) writevfdmenu(basename(tmpstr));
1591                free(tmpstr); tmpstr = NULL;
1592        }
1593        else
1594                writevfdmenu(showname);
1595}
1596
1597
1598void playstartservice()
1599{
1600        char* tmpstr = NULL;
1601
1602        if(status.aktservice->channel != NULL)
1603        {
1604                tmpstr = ostrcat(status.aktservice->channellist, NULL, 0, 0);
1605                servicecheckret(servicestart(status.aktservice->channel, tmpstr, NULL, 3), 0);
1606        }
1607        else
1608        {
1609                tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0);
1610                servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 0), 0);
1611        }
1612        free(tmpstr); tmpstr = NULL;
1613}
1614
1615// flag 0 = dirlist/playing/infobar
1616// flag 1 = playing/infobar
1617// flag 2 = playing
1618// flag 3 = not stop/start live service
1619// flag 4 = playing with screensaver
1620// startfolder 2 = do nothing with playstop/playstart
1621int screenplay(char* startfile, char* showname, int startfolder, int flag)
1622{
1623        int rcret = 0, playertype = 0, ret = 0, rcwait = 1000, screensaver_delay = 0, holdselection = 0, waitofbuffer = 0, videooff = 0;
1624        char* file = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
1625        char* tmppolicy = NULL, *startdir = NULL;
1626        char* formats = NULL;
1627        struct channel* pipchannel = NULL;
1628        struct skin* playinfobar = getscreen("playinfobar");
1629        struct skin* sprogress = getscreennode(playinfobar, "progress");
1630        struct skin* load = getscreen("loading");
1631        struct skin* blackscreen = getscreen("blackscreen");
1632
1633        int oldsort = getconfigint("dirsort", NULL);
1634        int skip13 = getconfigint("skip13", NULL);
1635        int skip46 = getconfigint("skip46", NULL);
1636        int skip79 = getconfigint("skip79", NULL);
1637
1638        resettvpic();
1639
1640        if(startfolder == 0 && flag != 3)
1641        {
1642                rcret = servicestop(status.aktservice, 1, 1);
1643                if(rcret == 1) return ret;
1644        }
1645
1646printf("[screenplay] status.webplayfile: %s\n",status.webplayfile);
1647
1648        if(status.webplayfile != NULL)
1649        {
1650                // stream over tithek enable start
1651                printf("startfile: %s\n", status.webplayfile);
1652                struct skin* tithekplugin = getplugin("TiTan Mediathek");
1653                if(tithekplugin != NULL)
1654                {
1655                        struct tithek* (*startplugin)(char*);
1656
1657                        startplugin = dlsym(tithekplugin->pluginhandle, "list_hoster_streams");
1658                        if(startplugin != NULL)
1659                        {
1660                                startfile = (char*)startplugin(status.webplayfile);
1661                                printf("startfile changed: %s\n", startfile);
1662                        }
1663                }
1664                else
1665                        startfile = status.webplayfile;
1666
1667printf("[screenplay] 1startfile: %s\n",startfile);
1668
1669                // stream over tithek enable end
1670
1671                rcret = servicestop(status.aktservice, 1, 1);
1672                if(rcret == 1) return ret;
1673        }
1674printf("[screenplay] 2startfile: %s\n",startfile);
1675
1676        // allowed from atemio avi mkv mpg4 xvid mpg1 mpg2 jpeg png
1677        if(startfolder == 1)
1678                formats = ostrcat(formats, ".ts", 1, 0);
1679        else if(file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))
1680                formats = ostrcat(formats, ".m3u8 .flac .ogg .mp3 .avi .dat .divx .flv .mkv .m4v .mp4 .mov .mpg .mpeg .mts .m2ts .trp .ts .vdr .vob .wmv .rm", 1, 0);
1681        else
1682                formats = ostrcat(formats, ".avi .mkv .mpg .mpeg .ts .mp3 .flac .ogg", 1, 0);
1683
1684       
1685        status.updatevfd = PAUSE;
1686        tmppolicy = getpolicy();
1687
1688playerstart:
1689        //reset timeline
1690        sprogress->progresssize = 0;
1691
1692        if(startfolder == 0)
1693                startdir = getconfig("rec_moviepath", NULL);
1694        else
1695                startdir = getconfig("rec_path", NULL);
1696
1697        status.playspeed = 0, status.play = 0, status.pause = 0, status.slowspeed = 0;
1698        int playinfobarcount = 0, playinfobarstatus = 1, dirrcret = 0;
1699
1700        if(startfile == NULL)
1701        {
1702                readmediadb(getconfig("mediadbfile", NULL), 0, 0);
1703
1704                tmpstr = ostrcat(file, NULL, 0, 0);
1705                char* tmpstartdir = startdir;
1706                if(file != NULL)
1707                {
1708                        tmpstr1 = ostrcat(file, NULL, 0, 0);
1709                        startdir = dirname(tmpstr1);
1710                }
1711                free(file); file = NULL;
1712                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);
1713                holdselection = 0;
1714                free(tmpstr); tmpstr = NULL;
1715                free(tmpstr1); tmpstr1 = NULL;
1716                startdir = tmpstartdir;
1717        }
1718        else
1719                file = ostrcat(startfile, NULL, 0, 0);
1720
1721        if(file == NULL)
1722        {
1723                if(playcheckdirrcret(file, dirrcret) == 1)
1724                        goto playerstart;
1725        }
1726
1727        if(file != NULL)
1728        {
1729                //if(getconfigint("playertype", NULL) == 1 && cmpfilenameext(file, ".ts") == 0)
1730                int noworkaround = getconfigint("playnotintern", NULL);
1731                if(cmpfilenameext(file, ".ts") == 0 && checkbox("VUSOLO2") != 1 && vubox1 != 1 && noworkaround == 0)
1732                {
1733                        playertype = 1;
1734                        addconfig("lastplayertype", "1");
1735                }
1736                else
1737                        addconfig("lastplayertype", "0");       
1738
1739                if(startfile == NULL)
1740                {
1741                        tmpstr = ostrcat(file, NULL, 0, 0);
1742                        if(tmpstr != NULL && startfolder == 0) addconfig("rec_moviepath", dirname(tmpstr));
1743                        free(tmpstr); tmpstr = NULL;
1744               
1745                        if(playcheckdirrcret(file, dirrcret) == 1)
1746                        {
1747                                if(dirrcret == 1) holdselection = 1;
1748                                goto playerstart;
1749                        }
1750
1751                        if(startfolder == 1 && flag != 3)
1752                        {
1753                                rcret = servicestop(status.aktservice, 1, 1);
1754                                if(rcret == 1)
1755                                {
1756                                        free(tmppolicy);
1757                                        free(file);
1758                                        free(formats);
1759                                        addconfigint("dirsort", oldsort);
1760                                        return ret;
1761                                }
1762                        }
1763                }
1764
1765                drawscreen(skin, 0, 0);
1766                drawscreen(load, 0, 0);
1767                playwritevfd(file, showname);
1768                printf("player--> playertype: %i\n", playertype);
1769                if(playertype == 1)
1770                        rcret = playerstartts(file, 0);
1771                else if(playertype == 2)
1772                        rcret = playerstart(file);
1773                else
1774                {
1775#ifdef EPLAYER3
1776                        if(ostrstr(file, "http://") == file || ostrstr(file, "https://") == file)
1777                        {
1778                                struct stimerthread* bufferstatus = addtimer(&screenplaybufferstatus, START, 1000, 1, NULL, NULL, NULL);
1779                                rcret = playerstart(file);
1780                                if(bufferstatus != NULL && gettimer(bufferstatus) != NULL)
1781                                {
1782                                        bufferstatus->aktion = STOP;
1783                                        usleep(100000);
1784                                }
1785                        }
1786                        else
1787                                rcret = playerstart(file);
1788#else
1789                        rcret = playerstart(file);
1790#endif
1791                }
1792#ifndef SIMULATE
1793                if(rcret != 0)
1794                {
1795                        textbox(_("Message"), _("Can't start playback !"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 7, 0);
1796                        writevfdmenu("Player");
1797                       
1798                        if(startfile == NULL)
1799                        {
1800                                if(startfolder == 1 && flag != 3) playstartservice();
1801                                goto playerstart;
1802                        }
1803                        else
1804                        {
1805                                ret = 2;
1806                                goto playerend;
1807                        }
1808                }
1809#endif
1810                clearscreen(load);
1811                if(status.prefillbuffer == 0)
1812                        screenplayinfobar(file, showname, 0, playertype, flag);
1813                else
1814                        waitofbuffer = 1;
1815               
1816                if(flag == 4 && getconfigint("screensaver", NULL) == 1)
1817                {
1818                        screensaver_delay = getconfigint("screensaver_delay", NULL);
1819                        initscreensaver();
1820                }                                                               
1821               
1822                //change codec if ac3default and video has ac3
1823                //deaktivate, freeze player, makes a seek -5
1824                //see eplayer container_ffmpeg_switch_audio
1825                //the seek to the beginning of the file freez
1826                //eplayer.
1827                //playchangecodec();
1828                free(status.playfile); status.playfile = NULL;
1829                status.playfile = ostrcat(file, NULL, 0, 0);
1830                status.play = 1;
1831                int count = 0;
1832                while(1)
1833                {
1834                        while((playertype == 0 && playerisplaying()) || (playertype == 1 && playerisplayingts()))
1835                        {
1836                                rcret = waitrc(playinfobar, rcwait, 0);
1837#ifdef EPLAYER4
1838                                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);
1839
1840                                if(waitofbuffer == 1 && status.prefillbuffer == 0 && (status.cleaninfobar == 1 || status.prefillbuffercount == 200))
1841                                {
1842                                        drawscreen(skin, 0, 0);
1843                                        if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1844                                        waitofbuffer = 0;
1845                                        status.cleaninfobar = 0;
1846                                       
1847                                }
1848                                else if(waitofbuffer == 0 && status.prefillbuffer == 0 && (status.cleaninfobar == 0 || status.prefillbuffercount == 200))
1849                                {
1850                                        playinfobarcount++;
1851                                        if(playinfobarstatus > 0)
1852                                                if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1853                                        if(playinfobarstatus == 1 && playinfobarcount >= getconfigint("infobartimeout", NULL))
1854                                        {
1855                                                playinfobarstatus = 0;
1856                                                if(videooff == 0) screenplayinfobar(NULL, NULL, 1, playertype, flag);
1857                                        }
1858                                }
1859#else
1860#ifdef EXTEPLAYER3
1861//                              getsubtext();
1862#endif
1863                                playinfobarcount++;
1864                                if(playinfobarstatus > 0)
1865                                        if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1866                                if(playinfobarstatus == 1 && playinfobarcount >= getconfigint("infobartimeout", NULL))
1867                                {
1868                                        playinfobarstatus = 0;
1869                                        if(videooff == 0) screenplayinfobar(NULL, NULL, 1, playertype, flag);
1870                                }
1871
1872                                if(waitofbuffer == 1 && status.prefillbuffer == 0)
1873                                {
1874                                        if(videooff == 0) screenplayinfobar(file, showname, 0, playertype, flag);
1875                                        waitofbuffer = 0;
1876                                }
1877#endif
1878                                if(flag == 4)
1879                                {
1880                                        if(status.play == 1 && screensaver != NULL)
1881                                                count++;
1882       
1883                                        if(count > screensaver_delay && screensaver != NULL)
1884                                        {
1885                                                showscreensaver();
1886#ifdef EPLAYER4
1887                                                if(screensaver->speed < 50)
1888                                                        rcwait = screensaver->speed * 10;
1889                                                else
1890                                                        rcwait = screensaver->speed;
1891#else
1892                                                rcwait = screensaver->speed;
1893#endif
1894                                        }
1895                                }
1896
1897#ifdef EXTEPLAYER3
1898//                              if(rcret == getrcconfigint("rchelp", NULL))
1899//                                      printf("getsubtext: %s\n", getsubtext());
1900#endif
1901
1902                                if(rcret == getrcconfigint("rcpip", NULL))
1903                                {
1904                                        if(status.pipservice->videodev == NULL)
1905                                        {
1906                                                pipchannel = status.lastservice->channel;
1907                                                printf("++++ RC: %i\n",pipstart(pipchannel, NULL, 0));
1908                                        }
1909                                        else
1910                                        {
1911                                                pipstop(status.pipservice, 0);
1912                                                pipchannel = NULL;
1913                                        }
1914                                }                               
1915                               
1916                                if(rcret == getrcconfigint("rcyellow", NULL))
1917                                        playrcyellow(file, showname, playinfobarstatus, playertype, flag);
1918                               
1919                                if(rcret == getrcconfigint("rctext", NULL) || rcret == getrcconfigint("rcsubtitel", NULL))
1920                                        playrctext(file, showname, playinfobarstatus, playertype, flag);
1921                                       
1922                                if(rcret == getrcconfigint("rcgreen", NULL))
1923                                        playrcgreen(file, showname, playinfobarstatus, playertype, flag);
1924                                       
1925                                if(rcret == getrcconfigint("rcblue", NULL))
1926                                        playrcblue(file, showname, playinfobarstatus, playertype, flag);
1927                                       
1928                                if(rcret == getrcconfigint("rcok", NULL))
1929                                        playrcok(file, showname, playinfobarstatus, playertype, flag);
1930                               
1931                                if(rcret == getrcconfigint("rcred", NULL))
1932                                        playrcred(file, showname, playinfobarstatus, playertype, flag);
1933
1934                                if(rcret == getrcconfigint("rcinfo", NULL))
1935                                        playrcinfo(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1936
1937                                if(rcret == getrcconfigint("rcpower", NULL) && status.play == 1 && videooff == 0)
1938                                {
1939                                        videooff = 1;
1940                                        drawscreen(blackscreen, 0, 0);
1941                                }
1942                                else if(rcret == getrcconfigint("rcexit", NULL) && videooff == 1)
1943                                {
1944                                        videooff = 0;
1945                                        drawscreen(skin, 0, 0);
1946                                }
1947                                else if(rcret == getrcconfigint("rcstop", NULL) || rcret == getrcconfigint("rcexit", NULL))
1948                                {
1949                                        if(status.prefillbuffer == 1)
1950                                        {
1951                                                status.prefillbuffer = 2;
1952                                                continue;
1953                                        }
1954                                        playrcstop(playertype, flag);
1955                                        if(startfile == NULL)
1956                                        {                                               
1957                                                if(startfolder == 1 && flag != 3) playstartservice();
1958                                                goto playerstart;
1959                                        }
1960                                        else
1961                                        {
1962                                                ret = 1;
1963                                                goto playerend;
1964                                        }
1965                                }
1966                               
1967                                if(rcret == getrcconfigint("rcsf", NULL))
1968                                        playrcsf(file, showname, &playinfobarstatus, &playinfobarcount, playertype, 0, flag);
1969         
1970                        if(rcret == getrcconfigint("rcsr", NULL))
1971                                        playrcsr(file, showname, &playinfobarstatus, &playinfobarcount, playertype, 0, flag);
1972
1973                                if(rcret == getrcconfigint("rcff", NULL))
1974                                        playrcff(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1975                               
1976                                if(rcret == getrcconfigint("rcfr", NULL))
1977                                        playrcfr(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1978
1979                                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))
1980                                {       
1981                                        playrcpause(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1982                                        continue;
1983                                }
1984
1985                                if(rcret == getrcconfigint("rcplay", NULL))
1986                                        playrcplay(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
1987
1988                                if(rcret == getrcconfigint("rcleft", NULL))
1989                                        playrcjumpr(file, showname, 60, &playinfobarstatus, &playinfobarcount, playertype, flag);
1990                               
1991                                if(rcret == getrcconfigint("rc1", NULL))
1992                                        playrcjumpr(file, showname, skip13, &playinfobarstatus, &playinfobarcount, playertype, flag);
1993                               
1994                                if(rcret == getrcconfigint("rc4", NULL))
1995                                        playrcjumpr(file, showname, skip46, &playinfobarstatus, &playinfobarcount, playertype, flag);
1996                               
1997                                if(rcret == getrcconfigint("rc7", NULL))
1998                                        playrcjumpr(file, showname, skip79, &playinfobarstatus, &playinfobarcount, playertype, flag);
1999
2000                                if(rcret == getrcconfigint("rc2", NULL))
2001                                        playrcjumpto(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
2002                               
2003                                if(rcret == getrcconfigint("rcright", NULL))
2004                                        playrcjumpf(file, showname, 60, &playinfobarstatus, &playinfobarcount, playertype, flag);
2005                               
2006                                if(rcret == getrcconfigint("rc3", NULL))
2007                                        playrcjumpf(file, showname, skip13, &playinfobarstatus, &playinfobarcount, playertype, flag);
2008                               
2009                                if(rcret == getrcconfigint("rc6", NULL))
2010                                        playrcjumpf(file, showname, skip46, &playinfobarstatus, &playinfobarcount, playertype, flag);
2011                               
2012                                if(rcret == getrcconfigint("rc9", NULL))
2013                                        playrcjumpf(file, showname, skip79, &playinfobarstatus, &playinfobarcount, playertype, flag);
2014
2015                                if(rcret == getrcconfigint("rcdown", NULL))
2016                                        playrcjumpr(file, showname, 300, &playinfobarstatus, &playinfobarcount, playertype, flag);
2017
2018                                if(rcret == getrcconfigint("rcup", NULL))
2019                                        playrcjumpf(file, showname, 300, &playinfobarstatus, &playinfobarcount, playertype, flag);
2020                               
2021                                if(rcret == getrcconfigint("rc0", NULL))
2022                                        setmarker();
2023                                       
2024                                if(rcret == getrcconfigint("rc5", NULL))
2025                                        screenmarker(file, showname, &playinfobarstatus, &playinfobarcount, playertype, flag);
2026                               
2027                                if(rcret == getrcconfigint("rcmenu", NULL)) {
2028                                        char* asfile = changefilenameext(file, ".as");
2029                                        if(status.autoseek == 0) {
2030                                                status.autoseek = 1;
2031                                                textbox(_("Message"), _("Marker autoseek is started"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 10, 0);
2032                                                addtimer(&markerautoseek_thread, START, 10000, 1, NULL, NULL, NULL);
2033                                                FILE* testseek = fopen(asfile, "w");
2034                                                if(testseek != NULL)
2035                                                {
2036                                                        fprintf(testseek,"autoseek is started\n");
2037                                                        fclose(testseek);
2038                                                }
2039                                        }
2040                                        else {
2041                                                status.autoseek = 0;
2042                                                textbox(_("Message"), _("Marker autoseek is stopped"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 10, 0);
2043                                                unlink(asfile);
2044                                        }
2045                                        free(asfile); asfile = NULL;
2046                                }
2047                        }
2048                        //don't change this sleep, without this
2049                        //the player stops to fast, and a last seek can
2050                        //produce a segfault
2051playerend:
2052                        sleep(1);
2053                        if(playertype == 1)
2054                                playerafterendts();
2055                        else
2056                                playerafterend();
2057
2058                        writevfdmenu("Player");
2059                        screenplayinfobar(file, showname, 1, playertype, flag);
2060
2061                        if(startfile == NULL)
2062                        {
2063                                if(startfolder == 1 && flag != 3) playstartservice();
2064                                goto playerstart;
2065                        }
2066                        else
2067                                break;
2068                }
2069        }
2070        if(startfolder == 0 && flag != 3) playstartservice();
2071        status.updatevfd = START;
2072       
2073        if(status.webplayfile != NULL)
2074        {
2075                playstartservice();
2076                free(status.webplayfile); status.webplayfile = NULL;
2077        }
2078
2079        if(tmppolicy != NULL)
2080        {
2081                setpolicy(tmppolicy);
2082                free(tmppolicy);
2083        }
2084       
2085        if(flag == 4)
2086                deinitscreensaver();
2087
2088        addconfigint("dirsort", oldsort);
2089        free(status.playfile); status.playfile = NULL;
2090        status.slowspeed = 0;
2091        status.playspeed = 0;
2092        status.pause = 0;
2093        status.play = 0;
2094        free(file);
2095        free(formats);
2096
2097        if(status.mediadbthread == NULL)
2098        {
2099                if(status.writemediadb == 1)
2100                        writemediadb(getconfig("mediadbfile", NULL), NULL);
2101                freemediadb(0);
2102        }
2103
2104        return ret;
2105}
2106
2107#endif
Note: See TracBrowser for help on using the repository browser.