source: titan/titan/avsettings.h @ 37145

Last change on this file since 37145 was 34893, checked in by gost, 9 years ago

[titan] mipsel.. fix audio delay

File size: 14.0 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#ifdef MIPSEL
218        addchoicebox(audiodelaybitstream, "0", _("no"));
219        addchoicebox(audiodelaybitstream, "08CA", "25ms");
220        addchoicebox(audiodelaybitstream, "1194", "50ms");
221        addchoicebox(audiodelaybitstream, "1A5E", "75ms");
222        addchoicebox(audiodelaybitstream, "2328", "100ms");
223        addchoicebox(audiodelaybitstream, "34BC", "150ms");
224        addchoicebox(audiodelaybitstream, "4650", "200ms");
225        addchoicebox(audiodelaybitstream, "6978", "300ms");
226        addchoicebox(audiodelaybitstream, "8CA0", "400ms");
227        addchoicebox(audiodelaybitstream, "AFC8", "500ms");
228        setchoiceboxselection(audiodelaybitstream, getconfig("audiodelaybitstream", NULL));
229       
230        addchoicebox(audiodelaypcm, "0", _("no"));
231        addchoicebox(audiodelaypcm, "08CA", "25ms");
232        addchoicebox(audiodelaypcm, "1194", "50ms");
233        addchoicebox(audiodelaypcm, "1A5E", "75ms");
234        addchoicebox(audiodelaypcm, "2328", "100ms");
235        addchoicebox(audiodelaypcm, "34BC", "150ms");
236        addchoicebox(audiodelaypcm, "4650", "200ms");
237        addchoicebox(audiodelaypcm, "6978", "300ms");
238        addchoicebox(audiodelaypcm, "8CA0", "400ms");
239        addchoicebox(audiodelaypcm, "AFC8", "500ms");
240        setchoiceboxselection(audiodelaypcm, getconfig("audiodelaypcm", NULL));
241#else   
242        addchoicebox(audiodelaybitstream, "0", _("no"));
243        addchoicebox(audiodelaybitstream, "350", "10ms");
244        addchoicebox(audiodelaybitstream, "700", "20ms");
245        addchoicebox(audiodelaybitstream, "1050", "30ms");
246        addchoicebox(audiodelaybitstream, "1400", "40ms");
247        addchoicebox(audiodelaybitstream, "1750", "50ms");
248        addchoicebox(audiodelaybitstream, "2100", "60ms");
249        addchoicebox(audiodelaybitstream, "2450", "70ms");
250        addchoicebox(audiodelaybitstream, "2800", "80ms");
251        addchoicebox(audiodelaybitstream, "3150", "90ms");
252        addchoicebox(audiodelaybitstream, "3500", "100ms");
253        setchoiceboxselection(audiodelaybitstream, getconfig("audiodelaybitstream", NULL));
254
255        addchoicebox(audiodelaypcm, "0", _("no"));
256        addchoicebox(audiodelaypcm, "350", "10ms");
257        addchoicebox(audiodelaypcm, "700", "20ms");
258        addchoicebox(audiodelaypcm, "1050", "30ms");
259        addchoicebox(audiodelaypcm, "1400", "40ms");
260        addchoicebox(audiodelaypcm, "1750", "50ms");
261        addchoicebox(audiodelaypcm, "2100", "60ms");
262        addchoicebox(audiodelaypcm, "2450", "70ms");
263        addchoicebox(audiodelaypcm, "2800", "80ms");
264        addchoicebox(audiodelaypcm, "3150", "90ms");
265        addchoicebox(audiodelaypcm, "3500", "100ms");
266        setchoiceboxselection(audiodelaypcm, getconfig("audiodelaypcm", NULL));
267#endif
268       
269        drawscreen(avsettings, 0, 0);
270        addscreenrc(avsettings, listbox);
271
272//      if(flag == 1 && listbox->select != NULL)
273        if(listbox->select != NULL)
274                writevfdmenu(listbox->select->text);
275
276        tmp = listbox->select;
277        while(1)
278        {
279                addscreenrc(avsettings, tmp);
280                rcret = waitrc(avsettings, 0, 0);
281                tmp = listbox->select;
282
283//              if(flag == 1 && listbox->select != NULL)
284//              {
285                        if(rcret == getrcconfigint("rcup", NULL) || rcret == getrcconfigint("rcdown", NULL))
286                                writevfdmenu(listbox->select->text);
287                        if(rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL))
288                        {
289                                setlr = 1;
290                                writevfdmenu(listbox->select->ret);
291                        }       
292//              }
293//          else
294//          {
295//                      if(listbox->select != NULL)
296//                      {       
297//                              if(rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL))
298//                                      setlr = 1;
299//                      }
300//              }
301                if(setlr == 1 && ostrcmp(listbox->select->name, "autoresolution") == 0)
302                {       
303                        autoressd->hidden=YES;
304                        autorests->hidden=YES;
305                        if(ostrcmp(autoresolution->ret, "off") != 0)
306                        {
307                                if(ostrcmp(autoresolution->ret, "key") == 0)
308                                        autoressd->hidden=NO;
309                                else if(ostrcmp(autoresolution->ret, "auto") == 0)
310                                {       
311                                        autoressd->hidden=NO;
312                                        autorests->hidden=NO;
313                                }
314                        }
315                        drawscreen(avsettings, 0, 0);
316                }
317                setlr = 0;
318       
319                if(rcret == getrcconfigint("rcexit", NULL)) break;
320                if(flag == 1 || rcret == getrcconfigint("rcok", NULL))
321                {
322                        if(resolution->ret != NULL)
323                        {
324                                ret = getvideomode();
325                                if(ostrcmp(ret, resolution->ret) != 0)
326                                {
327                                        setvideomode(resolution->ret, 0);
328                                        changefbresolution(resolution->ret, 0);
329                                        if(flag == 0)
330                                        {
331                                                int tret = textbox(_("Message"), _("Is this Videomode ok ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 10, 0);
332                                                if(tret == 0 || tret == 2)
333                                                {
334                                                        setvideomode(ret, 0);
335                                                        changefbresolution(ret, 0);
336                                                }
337                                                else
338                                                {
339                                                        writeallconfig(1);
340                                                        debug(10, "resolution->ret: %s", resolution->ret);
341                                                        if(ostrncmp("576", resolution->ret, 3) == 0 || ostrncmp("pal", resolution->ret, 3) == 0)
342                                                        {
343                                                                debug(10, "create /var/etc/.scart");
344                                                                writesys("/var/etc/.scart", "0", 0);
345                                                        }
346                                                        else
347                                                        {
348                                                                debug(10, "unlink /var/etc/.scart");
349                                                                unlink("/var/etc/.scart");
350                                                        }
351                                                }
352                                        }
353                                        if(flag == 1) drawscreen(avsettings, 0, 0);
354                                }
355                                free(ret); ret = NULL;
356                        }
357                        if(autoresolution->ret != NULL)
358                        {
359                                addconfig("av_videomode_autores", autoresolution->ret);
360                                addconfig("av_videomode_autores_sd", autoressd->ret);
361                                addconfig("av_videomode_autores_ts", autorests->ret);
362                        }
363                       
364                        if(stepmute->ret != NULL)
365                                addconfig("stepmute", stepmute->ret);
366                               
367                        if(policy->ret != NULL)
368                        {
369                                ret = getpolicy();
370                                if(ostrcmp(ret, policy->ret) != 0)
371                                        setpolicy(policy->ret);
372                                free(ret); ret = NULL;
373                        }
374#ifndef MIPSEL
375                        if(aspect->ret != NULL)
376                        {
377                                ret = getaspect();
378                                if(ostrcmp(ret, aspect->ret) != 0)
379                                        setaspect(aspect->ret);
380                                free(ret); ret = NULL;
381                        }
382#endif
383                        if(colformat->ret != NULL)
384                        {
385                                setcolorformat(colformat->ret, 0);
386                                ret = getcolorformat(1);
387                                changeinput(colformat, ret);
388                                free(ret); ret = NULL;
389                                drawscreen(avsettings, 0, 0);
390                        }
391                        if(colformatscart->ret != NULL)
392                        {
393                                setcolorformat(colformatscart->ret, 1);
394                                ret = getcolorformat(2);
395                                changeinput(colformatscart, ret);
396                                free(ret); ret = NULL;
397                                drawscreen(avsettings, 0, 0);
398                        }
399                        if(audiosource->ret != NULL)
400                        {
401                                ret = getaudiosource();
402                                if(ostrcmp(ret, audiosource->ret) != 0)
403                                        setaudiosource(audiosource->ret);
404                                free(ret); ret = NULL;
405                        }
406                        if(ac3mode->ret != NULL)
407                        {
408                                ret = getac3();
409                                if(ostrcmp(ret, ac3mode->ret) != 0)
410                                        setac3(ac3mode->ret);
411                                free(ret); ret = NULL;
412                        }
413                        if(aacmode->ret != NULL)
414                        {
415                                ret = getaac();
416                                if(ostrcmp(ret, aacmode->ret) != 0)
417                                        setaac(aacmode->ret);
418                                free(ret); ret = NULL;
419                        }
420                        if(wssmode->ret != NULL)
421                        {
422                                ret = getwss();
423                                if(ostrcmp(ret, wssmode->ret) != 0)
424                                        setwss(wssmode->ret);
425                                free(ret); ret = NULL;
426                                drawscreen(avsettings, 0, 0);
427                        }
428                        if(mode3d->ret != NULL)
429                        {
430                                ret = getmode3d();
431                                if(ostrcmp(ret, mode3d->ret) != 0)
432                                {
433                                        clearscreen(avsettings);
434                                        blitfb(0);
435                                        setmode3d(mode3d->ret);
436                                        drawscreen(avsettings, 0, 0);
437                                }
438                                free(ret); ret = NULL;
439                        }
440                        if(audiodelaybitstream->ret != NULL)
441                        {
442                                ret = getaudiodelaybitstream();
443                                if(ostrcmp(ret, audiodelaybitstream->ret) != 0)
444                                        setaudiodelaybitstream(audiodelaybitstream->ret);
445                                free(ret); ret = NULL;
446                        }
447
448                        if(audiodelaypcm->ret != NULL)
449                        {
450                                ret = getaudiodelaypcm();
451                                if(ostrcmp(ret, audiodelaypcm->ret) != 0)
452                                        setaudiodelaypcm(audiodelaypcm->ret);
453                                free(ret); ret = NULL;
454                        }
455
456                        addconfigscreencheck("volautochangevalue", volautochangevalue, 0);
457                        status.volautochangevalue = getconfigint("volautochangevalue", NULL);
458                        addconfigscreencheck("av_ac3default", ac3default, 0);
459                        addconfigscreencheck("autosubtitle", autosubtitle, 0);
460                        status.autosubtitle = getconfigint("autosubtitle", NULL);
461                        addconfigscreen("vol_playerstart", playerstart);
462                        addconfigscreen("vol_playerstop", playerstop);
463
464                        if(rcret == getrcconfigint("rcok", NULL)) break;
465                }
466        }
467
468        delownerrc(avsettings);
469        clearscreen(avsettings);
470}
471
472#endif
Note: See TracBrowser for help on using the repository browser.