source: titan/titan/avsettings.h @ 40903

Last change on this file since 40903 was 40748, checked in by gost, 7 years ago

fix last change

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