source: titan/plugins/dvdplayer/dvdplay.h @ 14986

Last change on this file since 14986 was 14986, checked in by nit, 12 years ago

[titan] add eject to dvd player

File size: 5.3 KB
Line 
1#ifndef DVDPLAY_H
2#define DVDPLAY_H
3
4extern struct skin* skin;
5
6void screendvdplay(int flag)
7{
8        int rcret = 0, playertype = 2, dirrcret = 0;
9        char* tmpstr = NULL, *startdir = NULL;
10        char* file = NULL, *tmppolicy = NULL;
11        struct skin* playinfobar = getscreen("playinfobar");
12
13        int skip13 = getconfigint("skip13", NULL);
14        int skip46 = getconfigint("skip46", NULL);
15        int skip79 = getconfigint("skip79", NULL);
16       
17        status.updatevfd = PAUSE;
18        tmppolicy = getpolicy();
19
20playerstart:
21        startdir = getconfig("dvdpath", NULL);
22        if(startdir == NULL)
23                startdir = getconfig("rec_moviepath", NULL);
24
25        status.playspeed = 0, status.play = 0, status.pause = 0;
26        int playinfobarcount = 0, playinfobarstatus = 0;
27
28        tmpstr = ostrcat(file, "", 1, 0); file = NULL;
29        file = screendir(startdir, NULL, basename(tmpstr), &dirrcret, NULL, _("EJECT"), getrcconfigint("rcred", NULL), _("SELECT"), 0, NULL, 0, NULL, 0, 90, 1, 90, 1, 2);
30        free(tmpstr); tmpstr = NULL;
31       
32        if(dirrcret == 1)
33        {
34                system("umount /media/dvd");
35                system("eject /dev/sr0");
36                goto playerstart;
37        }
38
39        if(file != NULL)
40        {
41                tmpstr = ostrcat(file, "", 0, 0);
42                if(tmpstr != NULL) addconfig("dvdpath", dirname(tmpstr));
43                free(tmpstr); tmpstr = NULL;
44               
45                rcret = servicestop(status.aktservice, 1, 1);
46                if(rcret == 1)
47                {
48                        free(tmppolicy);
49                        free(file);
50                        return;
51                }
52
53                drawscreen(skin, 0);
54                playwritevfd(file);
55
56                rcret = dvdstart(file);
57#ifndef SIMULATE
58                if(rcret != 0)
59                {
60                        textbox(_("Message"), _("Can't start playback !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
61                        writevfd("DVD");
62                       
63                        playstartservice();
64                        goto playerstart;
65                }
66#endif
67
68                //screenplayinfobar(file, 0, playertype, flag);
69
70                //change codec if ac3default and video has ac3
71                //deaktivate, freeze player, makes a seek -5
72                //see eplayer container_ffmpeg_switch_audio
73                //the seek to the beginning of the file freez
74                //eplayer.
75                //playchangecodec();
76                free(status.playfile); status.playfile = NULL;
77                status.playfile = ostrcat(file, "", 0, 0);
78                status.play = 1;
79                while(1)
80                {
81                        while(dvdisplaying())
82                        {
83                                dvdgotmessage();
84                                rcret = waitrc(playinfobar, 100, 0);
85                                dvdkeypress(rcret);
86                                playinfobarcount++;
87                                if(playinfobarstatus > 0)
88                                        screenplayinfobar(file, 0, playertype, flag);
89                                if(playinfobarstatus == 1 && playinfobarcount >= getconfigint("infobartimeout", NULL) * 10)
90                                {
91                                        playinfobarstatus = 0;
92                                        screenplayinfobar(NULL, 1, playertype, flag);
93                                }
94
95                                if(rcret == getrcconfigint("rcstop", NULL))
96                                {
97                                        playrcstop(playertype, flag);
98                                        playstartservice();
99                                        goto playerstart;
100                                }
101
102                                if(dvdmenuopen() == 1)
103                                {
104                                        if(playinfobarstatus == 1)
105                                        {
106                                                screenplayinfobar(NULL, 1, playertype, flag);
107                                                playinfobarstatus = 0;
108                                        }
109                                        continue;
110                                }
111
112                                if(rcret == RCTIMEOUT) continue;
113
114                                //if(rcret == getrcconfigint("rcyellow", NULL))
115                                //      playrcyellow(file, playinfobarstatus, playertype, flag);
116                               
117                                //if(rcret == getrcconfigint("rctext", NULL) || rcret == getrcconfigint("rcsubtitel", NULL))
118                                //      playrctext(file, playinfobarstatus, playertype, flag);
119                                       
120                                if(rcret == getrcconfigint("rcgreen", NULL))
121                                {
122                                        playrcgreen(file, playinfobarstatus, playertype, flag);
123                                        dvdchangevideo();
124                                }
125                                       
126                                if(rcret == getrcconfigint("rcred", NULL))
127                                        playrcred(file, playinfobarstatus, playertype, flag);
128
129                                if(rcret == getrcconfigint("rcinfo", NULL))
130                                        playrcinfo(file, &playinfobarstatus, &playinfobarcount, playertype, flag);
131                               
132                                if(rcret == getrcconfigint("rcff", NULL))
133                                        playrcff(file, &playinfobarstatus, &playinfobarcount, playertype, flag);
134                               
135                                if(rcret == getrcconfigint("rcfr", NULL))
136                                        playrcfr(file, &playinfobarstatus, &playinfobarcount, playertype, flag);
137
138                                if(rcret == getrcconfigint("rcpause", NULL))
139                                        playrcpause(file, &playinfobarstatus, &playinfobarcount, playertype, flag);
140
141                                if(rcret == getrcconfigint("rcplay", NULL))
142                                        playrcplay(file, &playinfobarstatus, &playinfobarcount, playertype, flag);
143
144                                if(rcret == getrcconfigint("rc1", NULL))
145                                        playrcjumpr(file, skip13, &playinfobarstatus, &playinfobarcount, playertype, flag);
146                               
147                                if(rcret == getrcconfigint("rc4", NULL))
148                                        playrcjumpr(file, skip46, &playinfobarstatus, &playinfobarcount, playertype, flag);
149                               
150                                if(rcret == getrcconfigint("rc7", NULL))
151                                        playrcjumpr(file, skip79, &playinfobarstatus, &playinfobarcount, playertype, flag);
152                               
153                                if(rcret == getrcconfigint("rc3", NULL))
154                                        playrcjumpf(file, skip13, &playinfobarstatus, &playinfobarcount, playertype, flag);
155                               
156                                if(rcret == getrcconfigint("rc6", NULL))
157                                        playrcjumpf(file, skip46, &playinfobarstatus, &playinfobarcount, playertype, flag);
158                               
159                                if(rcret == getrcconfigint("rc9", NULL))
160                                        playrcjumpf(file, skip79, &playinfobarstatus, &playinfobarcount, playertype, flag);
161                        }
162                        //don't change this sleep, without this
163                        //the player stops to fast, and a last seek can
164                        //produce a segfault
165                        sleep(1);
166                        dvdafterend();
167
168                        writevfd("DVD");
169                        screenplayinfobar(file, 1, playertype, flag);
170
171                        playstartservice();
172                        goto playerstart;
173                }
174        }
175
176        status.updatevfd = START;
177
178        if(tmppolicy != NULL)
179        {
180                setpolicy(tmppolicy);
181                free(tmppolicy);
182        }
183       
184        free(status.playfile); status.playfile = NULL;
185        status.playspeed = 0;
186        status.pause = 0;
187        status.play = 0;
188        free(file);
189}
190
191#endif
Note: See TracBrowser for help on using the repository browser.