source: titan/titan/avsettings.h @ 34379

Last change on this file since 34379 was 34231, checked in by Stephan, 9 years ago

add pcm delay option

File size: 12.8 KB
Line 
1#ifndef AVSETTINGS_H
2#define AVSETTINGS_H
3
4//flag 0: without vfd output
5//flag 1: with vfd output
6void screenavsettings(int flag)
7{
8        int rcret = 0;
9        char* ret = NULL;
10        struct skin* avsettings = getscreen("avsettings");
11        struct skin* listbox = getscreennode(avsettings, "listbox");
12        struct skin* resolution = getscreennode(avsettings, "resolution");
13        struct skin* aktresolution = getscreennode(avsettings, "aktresolution");
14        struct skin* autoresolution = getscreennode(avsettings, "autoresolution");
15        struct skin* autoressd = getscreennode(avsettings, "autoressd");
16        struct skin* autorests = getscreennode(avsettings, "autorests");
17        struct skin* stepmute = getscreennode(avsettings, "stepmute");
18        struct skin* policy = getscreennode(avsettings, "policy");
19        struct skin* aspect = getscreennode(avsettings, "aspect");
20        struct skin* colformat = getscreennode(avsettings, "colformat");
21        struct skin* colformatscart = getscreennode(avsettings, "colformatscart");
22        struct skin* audiosource = getscreennode(avsettings, "audiosource");
23        struct skin* ac3default = getscreennode(avsettings, "ac3default");
24        struct skin* ac3mode = getscreennode(avsettings, "ac3mode");
25        struct skin* aacmode = getscreennode(avsettings, "aacmode");
26        struct skin* wssmode = getscreennode(avsettings, "wssmode");
27        struct skin* volautochangevalue = getscreennode(avsettings, "volautochangevalue");
28        struct skin* mode3d = getscreennode(avsettings, "mode3d");
29        struct skin* autosubtitle = getscreennode(avsettings, "autosubtitle");
30        struct skin* audiodelaybitstream = getscreennode(avsettings, "audiodelaybitstream");
31        struct skin* audiodelaypcm = getscreennode(avsettings, "audiodelaypcm");
32        struct skin* playerstart = getscreennode(avsettings, "playerstart");
33        struct skin* playerstop = getscreennode(avsettings, "playerstop");
34
35        struct skin* tmp = NULL;
36
37        ret = getvideomodechoices();
38        changeinput(resolution, ret);
39        free(ret); ret = NULL;
40
41        ret = getconfig("av_videomode", NULL);
42        if(ret == NULL)
43        {
44                ret = getvideomode();
45                setchoiceboxselection(resolution, ret);
46                free(ret); ret = NULL;
47        }
48        else
49                setchoiceboxselection(resolution, ret);
50               
51        ret = getvideomode();
52        changeinput(aktresolution, ret);
53        free(ret); ret = NULL;
54       
55        autoressd->hidden=YES;
56        autorests->hidden=YES;
57        if(getconfig("av_videomode_autores", NULL) != NULL)
58        {
59                if(ostrcmp(getconfig("av_videomode_autores", NULL), "off") != 0)
60                {
61                        if(ostrcmp(getconfig("av_videomode_autores", NULL), "auto") != 0)
62                                autoressd->hidden=NO;
63                        else {
64                                autoressd->hidden=NO;
65                                autorests->hidden=NO;
66                        }
67                }
68        }
69        int setlr=0;
70        addchoicebox(autoresolution, "off", _("off"));
71        addchoicebox(autoresolution, "auto", _("auto"));
72        addchoicebox(autoresolution, "key", _("redKey"));
73        setchoiceboxselection(autoresolution, getconfig("av_videomode_autores", NULL));
74
75        ret = getvideomodechoices();
76        changeinput(autoressd, ret);
77        free(ret); ret = NULL;
78        setchoiceboxselection(autoressd, getconfig("av_videomode_autores_sd", NULL));
79
80        addchoicebox(autorests, "2", _("2 sec"));
81        addchoicebox(autorests, "4", _("4 sec"));
82        addchoicebox(autorests, "6", _("6 sec"));
83        addchoicebox(autorests, "8", _("8 sec"));
84        addchoicebox(autorests, "10", _("10 sec"));
85        setchoiceboxselection(autorests, getconfig("av_videomode_autores_ts", NULL));
86        addchoicebox(stepmute, "0", _("off"));
87        addchoicebox(stepmute, "1", _("on"));
88        setchoiceboxselection(stepmute, getconfig("stepmute", NULL));
89
90        changeinput(playerstart, "30\n40\n50\n60\n70\n80\n90\n100\n10\n20");
91        setchoiceboxselection(playerstart, getconfig("vol_playerstart", NULL));
92#ifdef MIPSEL
93                playerstart->hidden = YES;
94#endif
95        changeinput(playerstop, "70\n80\n90\n100\n10\n20\n30\n40\n50\n60");
96        setchoiceboxselection(playerstop, getconfig("vol_playerstop", NULL));
97#ifdef MIPSEL
98                playerstop->hidden = YES;
99#endif
100        ret = getpolicychoices();
101        changeinput(policy, ret);
102        free(ret); ret = NULL;
103        ret = getpolicy();
104        setchoiceboxselection(policy, ret);
105        free(ret); ret = NULL;
106
107        ret = getaspectchoices();
108        changeinput(aspect, ret);
109        free(ret); ret = NULL;
110        ret = getaspect();
111        setchoiceboxselection(aspect, ret);
112        free(ret); ret = NULL;
113
114#ifdef MIPSEL
115        aspect->hidden = YES;
116#endif
117
118        ret = getcolorformat(2);
119        if(ret == NULL || strlen(ret) == 0)
120        {
121                free(ret); ret = NULL;
122                colformatscart->hidden = YES;
123               
124                ret = getcolorformatchoices(0);
125                changeinput(colformat, ret);
126                free(ret); ret = NULL;
127                ret = getcolorformat(1);
128                setchoiceboxselection(colformat, ret);
129                free(ret); ret = NULL;
130        }
131        else
132        {
133                free(ret); ret = NULL;
134                colformatscart->hidden = NO;
135               
136                ret = getcolorformatchoices(1);
137                changeinput(colformat, ret);
138                free(ret); ret = NULL;
139                ret = getcolorformat(1);
140                setchoiceboxselection(colformat, ret);
141                free(ret); ret = NULL;
142               
143                ret = getcolorformatchoices(2);
144                changeinput(colformatscart, ret);
145                free(ret); ret = NULL;
146                ret = getcolorformat(2);
147                setchoiceboxselection(colformatscart, ret);
148                free(ret); ret = NULL;
149        }
150
151        ret = getaudiosourcechoices();
152        changeinput(audiosource, ret);
153        free(ret); ret = NULL;
154        ret = getaudiosource();
155        setchoiceboxselection(audiosource, ret);
156        free(ret); ret = NULL;
157
158#ifdef MIPSEL
159        audiosource->hidden = YES;
160#endif
161
162        addchoicebox(ac3default, "0", _("no"));
163        addchoicebox(ac3default, "1", _("yes"));
164        setchoiceboxselection(ac3default, getconfig("av_ac3default", NULL));
165
166        ret = getac3choices();
167        changeinput(ac3mode, ret);
168        free(ret); ret = NULL;
169        ret = getac3();
170        setchoiceboxselection(ac3mode, ret);
171        free(ret); ret = NULL;
172
173        ret = getaacchoices();
174        changeinput(aacmode, ret);
175        free(ret); ret = NULL;
176        ret = getaac();
177        setchoiceboxselection(aacmode, ret);
178        free(ret); ret = NULL;
179
180#ifdef SH4
181                aacmode->hidden = YES;
182#endif
183
184        ret = getwsschoices();
185        changeinput(wssmode, ret);
186        free(ret); ret = NULL;
187        ret = getwss();
188        setchoiceboxselection(wssmode, ret);
189        free(ret); ret = NULL;
190
191#ifdef SH4
192                wssmode->hidden = YES;
193#endif
194       
195        changeinput(volautochangevalue, "0\n5\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60\n65\n70\n75");
196        setchoiceboxselection(volautochangevalue, getconfig("volautochangevalue", NULL));
197
198#ifdef MIPSEL
199                volautochangevalue->hidden = YES;
200#endif
201
202        ret = getmode3dchoices();
203        changeinput(mode3d, ret);
204        free(ret); ret = NULL;
205        ret = getmode3d();
206// does not work
207        /*addchoicebox(mode3d, "off", _("Off"));
208        addchoicebox(mode3d, "sbs", _("SideBySide"));
209        addchoicebox(mode3d, "tab", _("TopAndBottom"));*/       
210        setchoiceboxselection(mode3d, ret);
211        free(ret); ret = NULL;
212
213        addchoicebox(autosubtitle, "0", _("no"));
214        addchoicebox(autosubtitle, "1", _("yes"));
215        setchoiceboxselection(autosubtitle, getconfig("autosubtitle", NULL));
216
217        addchoicebox(audiodelaybitstream, "0", _("no"));
218        addchoicebox(audiodelaybitstream, "350", "10ms");
219        addchoicebox(audiodelaybitstream, "700", "20ms");
220        addchoicebox(audiodelaybitstream, "1050", "30ms");
221        addchoicebox(audiodelaybitstream, "1400", "40ms");
222        addchoicebox(audiodelaybitstream, "1750", "50ms");
223        addchoicebox(audiodelaybitstream, "2100", "60ms");
224        addchoicebox(audiodelaybitstream, "2450", "70ms");
225        addchoicebox(audiodelaybitstream, "2800", "80ms");
226        addchoicebox(audiodelaybitstream, "3150", "90ms");
227        addchoicebox(audiodelaybitstream, "3500", "100ms");
228        setchoiceboxselection(audiodelaybitstream, getconfig("audiodelaybitstream", NULL));
229
230        addchoicebox(audiodelaypcm, "0", _("no"));
231        addchoicebox(audiodelaypcm, "350", "10ms");
232        addchoicebox(audiodelaypcm, "700", "20ms");
233        addchoicebox(audiodelaypcm, "1050", "30ms");
234        addchoicebox(audiodelaypcm, "1400", "40ms");
235        addchoicebox(audiodelaypcm, "1750", "50ms");
236        addchoicebox(audiodelaypcm, "2100", "60ms");
237        addchoicebox(audiodelaypcm, "2450", "70ms");
238        addchoicebox(audiodelaypcm, "2800", "80ms");
239        addchoicebox(audiodelaypcm, "3150", "90ms");
240        addchoicebox(audiodelaypcm, "3500", "100ms");
241        setchoiceboxselection(audiodelaypcm, getconfig("audiodelaypcm", NULL));
242
243        drawscreen(avsettings, 0, 0);
244        addscreenrc(avsettings, listbox);
245
246//      if(flag == 1 && listbox->select != NULL)
247        if(listbox->select != NULL)
248                writevfdmenu(listbox->select->text);
249
250        tmp = listbox->select;
251        while(1)
252        {
253                addscreenrc(avsettings, tmp);
254                rcret = waitrc(avsettings, 0, 0);
255                tmp = listbox->select;
256
257//              if(flag == 1 && listbox->select != NULL)
258//              {
259                        if(rcret == getrcconfigint("rcup", NULL) || rcret == getrcconfigint("rcdown", NULL))
260                                writevfdmenu(listbox->select->text);
261                        if(rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL))
262                        {
263                                setlr = 1;
264                                writevfdmenu(listbox->select->ret);
265                        }       
266//              }
267//          else
268//          {
269//                      if(listbox->select != NULL)
270//                      {       
271//                              if(rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL))
272//                                      setlr = 1;
273//                      }
274//              }
275                if(setlr == 1 && ostrcmp(listbox->select->name, "autoresolution") == 0)
276                {       
277                        autoressd->hidden=YES;
278                        autorests->hidden=YES;
279                        if(ostrcmp(autoresolution->ret, "off") != 0)
280                        {
281                                if(ostrcmp(autoresolution->ret, "key") == 0)
282                                        autoressd->hidden=NO;
283                                else if(ostrcmp(autoresolution->ret, "auto") == 0)
284                                {       
285                                        autoressd->hidden=NO;
286                                        autorests->hidden=NO;
287                                }
288                        }
289                        drawscreen(avsettings, 0, 0);
290                }
291                setlr = 0;
292       
293                if(rcret == getrcconfigint("rcexit", NULL)) break;
294                if(flag == 1 || rcret == getrcconfigint("rcok", NULL))
295                {
296                        if(resolution->ret != NULL)
297                        {
298                                ret = getvideomode();
299                                if(ostrcmp(ret, resolution->ret) != 0)
300                                {
301                                        setvideomode(resolution->ret, 0);
302                                        changefbresolution(resolution->ret, 0);
303                                        if(flag == 0)
304                                        {
305                                                int tret = textbox(_("Message"), _("Is this Videomode ok ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 10, 0);
306                                                if(tret == 0 || tret == 2)
307                                                {
308                                                        setvideomode(ret, 0);
309                                                        changefbresolution(ret, 0);
310                                                }
311                                                else
312                                                {
313                                                        writeallconfig(1);
314                                                        debug(10, "resolution->ret: %s", resolution->ret);
315                                                        if(ostrncmp("576", resolution->ret, 3) == 0 || ostrncmp("pal", resolution->ret, 3) == 0)
316                                                        {
317                                                                debug(10, "create /var/etc/.scart");
318                                                                writesys("/var/etc/.scart", "0", 0);
319                                                        }
320                                                        else
321                                                        {
322                                                                debug(10, "unlink /var/etc/.scart");
323                                                                unlink("/var/etc/.scart");
324                                                        }
325                                                }
326                                        }
327                                        if(flag == 1) drawscreen(avsettings, 0, 0);
328                                }
329                                free(ret); ret = NULL;
330                        }
331                        if(autoresolution->ret != NULL)
332                        {
333                                addconfig("av_videomode_autores", autoresolution->ret);
334                                addconfig("av_videomode_autores_sd", autoressd->ret);
335                                addconfig("av_videomode_autores_ts", autorests->ret);
336                        }
337                       
338                        if(stepmute->ret != NULL)
339                                addconfig("stepmute", stepmute->ret);
340                               
341                        if(policy->ret != NULL)
342                        {
343                                ret = getpolicy();
344                                if(ostrcmp(ret, policy->ret) != 0)
345                                        setpolicy(policy->ret);
346                                free(ret); ret = NULL;
347                        }
348#ifndef MIPSEL
349                        if(aspect->ret != NULL)
350                        {
351                                ret = getaspect();
352                                if(ostrcmp(ret, aspect->ret) != 0)
353                                        setaspect(aspect->ret);
354                                free(ret); ret = NULL;
355                        }
356#endif
357                        if(colformat->ret != NULL)
358                        {
359                                setcolorformat(colformat->ret, 0);
360                                ret = getcolorformat(1);
361                                changeinput(colformat, ret);
362                                free(ret); ret = NULL;
363                                drawscreen(avsettings, 0, 0);
364                        }
365                        if(colformatscart->ret != NULL)
366                        {
367                                setcolorformat(colformatscart->ret, 1);
368                                ret = getcolorformat(2);
369                                changeinput(colformatscart, ret);
370                                free(ret); ret = NULL;
371                                drawscreen(avsettings, 0, 0);
372                        }
373                        if(audiosource->ret != NULL)
374                        {
375                                ret = getaudiosource();
376                                if(ostrcmp(ret, audiosource->ret) != 0)
377                                        setaudiosource(audiosource->ret);
378                                free(ret); ret = NULL;
379                        }
380                        if(ac3mode->ret != NULL)
381                        {
382                                ret = getac3();
383                                if(ostrcmp(ret, ac3mode->ret) != 0)
384                                        setac3(ac3mode->ret);
385                                free(ret); ret = NULL;
386                        }
387                        if(aacmode->ret != NULL)
388                        {
389                                ret = getaac();
390                                if(ostrcmp(ret, aacmode->ret) != 0)
391                                        setaac(aacmode->ret);
392                                free(ret); ret = NULL;
393                        }
394                        if(wssmode->ret != NULL)
395                        {
396                                ret = getwss();
397                                if(ostrcmp(ret, wssmode->ret) != 0)
398                                        setwss(wssmode->ret);
399                                free(ret); ret = NULL;
400                                drawscreen(avsettings, 0, 0);
401                        }
402                        if(mode3d->ret != NULL)
403                        {
404                                ret = getmode3d();
405                                if(ostrcmp(ret, mode3d->ret) != 0)
406                                {
407                                        clearscreen(avsettings);
408                                        blitfb(0);
409                                        setmode3d(mode3d->ret);
410                                        drawscreen(avsettings, 0, 0);
411                                }
412                                free(ret); ret = NULL;
413                        }
414                        if(audiodelaybitstream->ret != NULL)
415                        {
416                                ret = getaudiodelaybitstream();
417                                if(ostrcmp(ret, audiodelaybitstream->ret) != 0)
418                                        setaudiodelaybitstream(audiodelaybitstream->ret);
419                                free(ret); ret = NULL;
420                        }
421
422                        if(audiodelaypcm->ret != NULL)
423                        {
424                                ret = getaudiodelaypcm();
425                                if(ostrcmp(ret, audiodelaypcm->ret) != 0)
426                                        setaudiodelaypcm(audiodelaypcm->ret);
427                                free(ret); ret = NULL;
428                        }
429
430                        addconfigscreencheck("volautochangevalue", volautochangevalue, 0);
431                        status.volautochangevalue = getconfigint("volautochangevalue", NULL);
432                        addconfigscreencheck("av_ac3default", ac3default, 0);
433                        addconfigscreencheck("autosubtitle", autosubtitle, 0);
434                        status.autosubtitle = getconfigint("autosubtitle", NULL);
435                        addconfigscreen("vol_playerstart", playerstart);
436                        addconfigscreen("vol_playerstop", playerstop);
437
438                        if(rcret == getrcconfigint("rcok", NULL)) break;
439                }
440        }
441
442        delownerrc(avsettings);
443        clearscreen(avsettings);
444}
445
446#endif
Note: See TracBrowser for help on using the repository browser.