source: titan/titan/play.h @ 44535

Last change on this file since 44535 was 44535, checked in by gost, 3 years ago

next test player ff

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