1 | #ifndef HTTDPSETTINGS_H |
---|
2 | #define HTTPDSETTINGS_H |
---|
3 | |
---|
4 | void screenhttpdsettings() |
---|
5 | { |
---|
6 | int rcret = 0; |
---|
7 | struct skin* httpdsettings = getscreen("httpdsettings"); |
---|
8 | struct skin* listbox = getscreennode(httpdsettings, "listbox"); |
---|
9 | struct skin* httpdstart = getscreennode(httpdsettings, "httpdstart"); |
---|
10 | struct skin* user = getscreennode(httpdsettings, "user"); |
---|
11 | struct skin* password = getscreennode(httpdsettings, "password"); |
---|
12 | struct skin* httpdport = getscreennode(httpdsettings, "httpdport"); |
---|
13 | struct skin* streamport = getscreennode(httpdsettings, "streamport"); |
---|
14 | struct skin* rguidstart = getscreennode(httpdsettings, "rguidstart"); |
---|
15 | struct skin* rguidport = getscreennode(httpdsettings, "rguidport"); |
---|
16 | struct skin* webifip = getscreennode(httpdsettings, "webifip"); |
---|
17 | struct skin* streamzapping = getscreennode(httpdsettings, "streamzapping"); |
---|
18 | struct skin* transcode = getscreennode(httpdsettings, "transcode"); |
---|
19 | struct skin* bitrate = getscreennode(httpdsettings, "bitrate"); |
---|
20 | struct skin* resolution = getscreennode(httpdsettings, "resolution"); |
---|
21 | struct skin* aspectratio = getscreennode(httpdsettings, "aspectratio"); |
---|
22 | |
---|
23 | |
---|
24 | struct skin* tmp = NULL; |
---|
25 | char* tmpstr = NULL, *pos = NULL; |
---|
26 | |
---|
27 | addchoicebox(httpdstart, "0", _("no")); |
---|
28 | addchoicebox(httpdstart, "1", _("yes")); |
---|
29 | setchoiceboxselection(httpdstart, getconfig("httpdstart", NULL)); |
---|
30 | |
---|
31 | tmpstr = ostrcat(getconfig("httpauth", NULL), NULL, 0, 0); |
---|
32 | if(tmpstr != NULL) |
---|
33 | { |
---|
34 | pos = ostrstr(tmpstr, ":"); |
---|
35 | if(pos != NULL) |
---|
36 | { |
---|
37 | pos[0] = '\0'; |
---|
38 | changeinput(user, tmpstr); |
---|
39 | pos++; |
---|
40 | changeinput(password, pos); |
---|
41 | } |
---|
42 | } |
---|
43 | free(tmpstr); tmpstr = NULL; |
---|
44 | |
---|
45 | changemask(httpdport, "00000"); |
---|
46 | changeinput(httpdport, getconfig("httpdport", NULL)); |
---|
47 | httpdport->input = mask(httpdport->input, 5, "0"); |
---|
48 | |
---|
49 | addchoicebox(webifip, "0", _("intern")); |
---|
50 | addchoicebox(webifip, "1", _("extern")); |
---|
51 | setchoiceboxselection(webifip, getconfig("webifip", NULL)); |
---|
52 | |
---|
53 | changemask(streamport, "00000"); |
---|
54 | changeinput(streamport, getconfig("streamport", NULL)); |
---|
55 | streamport->input = mask(streamport->input, 5, "0"); |
---|
56 | |
---|
57 | addchoicebox(rguidstart, "0", _("no")); |
---|
58 | addchoicebox(rguidstart, "1", _("yes")); |
---|
59 | setchoiceboxselection(rguidstart, getconfig("rguidstart", NULL)); |
---|
60 | |
---|
61 | changemask(rguidport, "00000"); |
---|
62 | changeinput(rguidport, getconfig("rguidport", NULL)); |
---|
63 | rguidport->input = mask(rguidport->input, 5, "0"); |
---|
64 | |
---|
65 | addchoicebox(streamzapping, "0", _("no")); |
---|
66 | addchoicebox(streamzapping, "1", _("yes")); |
---|
67 | setchoiceboxselection(streamzapping, getconfig("streamzapping", NULL)); |
---|
68 | |
---|
69 | #ifndef MIPSEL |
---|
70 | transcode->hidden=YES; |
---|
71 | bitrate->hidden=YES; |
---|
72 | resolution->hidden=YES; |
---|
73 | aspectratio->hidden=YES; |
---|
74 | |
---|
75 | #else |
---|
76 | addchoicebox(transcode, "0", _("off")); |
---|
77 | addchoicebox(transcode, "1", _("on")); |
---|
78 | setchoiceboxselection(transcode, getconfig("web_trans_transcode", NULL)); |
---|
79 | |
---|
80 | addchoicebox(bitrate, "-1", _("Auto")); |
---|
81 | addchoicebox(bitrate, "100000", "100 Kbits"); |
---|
82 | addchoicebox(bitrate, "150000", "150 Kbits"); |
---|
83 | addchoicebox(bitrate, "200000", "200 Kbits"); |
---|
84 | addchoicebox(bitrate, "250000", "250 Kbits"); |
---|
85 | addchoicebox(bitrate, "300000", "300 Kbits"); |
---|
86 | addchoicebox(bitrate, "350000", "350 Kbits"); |
---|
87 | addchoicebox(bitrate, "400000", "400 Kbits"); |
---|
88 | addchoicebox(bitrate, "450000", "450 Kbits"); |
---|
89 | addchoicebox(bitrate, "500000", "500 Kbits"); |
---|
90 | addchoicebox(bitrate, "750000", "750 Kbits"); |
---|
91 | addchoicebox(bitrate, "1000000", "1 Mbits"); |
---|
92 | addchoicebox(bitrate, "1500000", "1.5 Mbits"); |
---|
93 | addchoicebox(bitrate, "2000000", "2 Mbits"); |
---|
94 | addchoicebox(bitrate, "2500000", "2.5 Mbits"); |
---|
95 | addchoicebox(bitrate, "3000000", "3 Mbits"); |
---|
96 | addchoicebox(bitrate, "3500000", "3.5 Mbits"); |
---|
97 | addchoicebox(bitrate, "4000000", "4 Mbits"); |
---|
98 | addchoicebox(bitrate, "4500000", "4.5 Mbits"); |
---|
99 | addchoicebox(bitrate, "5000000", "5 Mbits"); |
---|
100 | addchoicebox(bitrate, "10000000", "10 Mbits"); |
---|
101 | setchoiceboxselection(bitrate, getconfig("web_trans_bitrate", NULL)); |
---|
102 | |
---|
103 | addchoicebox(resolution, "0", "480p"); |
---|
104 | addchoicebox(resolution, "1", "576p"); |
---|
105 | addchoicebox(resolution, "2", "720p"); |
---|
106 | addchoicebox(resolution, "3", "320x240"); |
---|
107 | addchoicebox(resolution, "4", "160x120"); |
---|
108 | setchoiceboxselection(resolution, getconfig("web_trans_resolution", NULL)); |
---|
109 | |
---|
110 | addchoicebox(aspectratio, "0", _("auto")); |
---|
111 | addchoicebox(aspectratio, "1", "4x3"); |
---|
112 | addchoicebox(aspectratio, "2", "16x9"); |
---|
113 | setchoiceboxselection(aspectratio, getconfig("web_trans_aspectratio", NULL)); |
---|
114 | |
---|
115 | if(checkchipset("BCM7424") != 1) |
---|
116 | { |
---|
117 | transcode->hidden=YES; |
---|
118 | bitrate->hidden=YES; |
---|
119 | resolution->hidden=YES; |
---|
120 | aspectratio->hidden=YES; |
---|
121 | } |
---|
122 | else |
---|
123 | { |
---|
124 | transcode->hidden=NO; |
---|
125 | if(getconfigint("web_trans_transcode", NULL) == 0) |
---|
126 | { |
---|
127 | bitrate->hidden=YES; |
---|
128 | resolution->hidden=YES; |
---|
129 | aspectratio->hidden=YES; |
---|
130 | } |
---|
131 | else |
---|
132 | { |
---|
133 | bitrate->hidden=NO; |
---|
134 | resolution->hidden=NO; |
---|
135 | aspectratio->hidden=NO; |
---|
136 | } |
---|
137 | } |
---|
138 | #endif |
---|
139 | |
---|
140 | |
---|
141 | drawscreen(httpdsettings, 0, 0); |
---|
142 | addscreenrc(httpdsettings, listbox); |
---|
143 | |
---|
144 | tmp = listbox->select; |
---|
145 | while(1) |
---|
146 | { |
---|
147 | addscreenrc(httpdsettings, tmp); |
---|
148 | rcret = waitrc(httpdsettings, 0, 0); |
---|
149 | tmp = listbox->select; |
---|
150 | |
---|
151 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
152 | if(rcret == getrcconfigint("rcok", NULL)) |
---|
153 | { |
---|
154 | if(httpdstart->ret != NULL) |
---|
155 | { |
---|
156 | if(ostrcmp(getconfig("httpdstart", NULL), httpdstart->ret) != 0) |
---|
157 | { |
---|
158 | addconfigscreen("httpdstart", httpdstart); |
---|
159 | if(ostrcmp(httpdstart->ret, "0") == 0) |
---|
160 | starthttpd(0); |
---|
161 | else |
---|
162 | starthttpd(1); |
---|
163 | } |
---|
164 | } |
---|
165 | if(user->ret != NULL && password->ret != NULL && strlen(user->ret) > 0 && strlen(password->ret) > 0) |
---|
166 | { |
---|
167 | tmpstr = ostrcat(tmpstr, user->ret, 1, 0); |
---|
168 | tmpstr = ostrcat(tmpstr, ":", 1, 0); |
---|
169 | tmpstr = ostrcat(tmpstr, password->ret, 1, 0); |
---|
170 | addconfig("httpauth", tmpstr); |
---|
171 | free(tmpstr); tmpstr = NULL; |
---|
172 | } |
---|
173 | else |
---|
174 | delconfig("httpauth"); |
---|
175 | free(status.httpauth); |
---|
176 | status.httpauth = ostrcat(getconfig("httpauth", NULL), NULL, 0, 0); |
---|
177 | if(httpdport->ret != NULL) |
---|
178 | { |
---|
179 | int hport = atoi(httpdport->ret); |
---|
180 | addconfigint("httpdport", hport); |
---|
181 | } |
---|
182 | |
---|
183 | addconfigscreencheck("webifip", webifip, "0"); |
---|
184 | addconfigscreencheck("streamzapping", streamzapping, "0"); |
---|
185 | |
---|
186 | if(streamport->ret != NULL) |
---|
187 | { |
---|
188 | int sport = atoi(streamport->ret); |
---|
189 | addconfigint("streamport", sport); |
---|
190 | } |
---|
191 | if(rguidstart->ret != NULL) |
---|
192 | { |
---|
193 | if(ostrcmp(getconfig("rguidstart", NULL), rguidstart->ret) != 0) |
---|
194 | { |
---|
195 | addconfigscreen("rguidstart", rguidstart); |
---|
196 | if(ostrcmp(rguidstart->ret, "0") == 0) |
---|
197 | startrguid(0); |
---|
198 | else |
---|
199 | startrguid(1); |
---|
200 | } |
---|
201 | } |
---|
202 | if(rguidport->ret != NULL) |
---|
203 | { |
---|
204 | int rport = atoi(rguidport->ret); |
---|
205 | addconfigint("rguidport", rport); |
---|
206 | } |
---|
207 | #ifndef MIPSEL |
---|
208 | break; |
---|
209 | } |
---|
210 | #else |
---|
211 | addconfigscreencheck("web_trans_transcode", transcode, "0"); |
---|
212 | addconfigscreencheck("web_trans_bitrate", bitrate, "0"); |
---|
213 | addconfigscreencheck("web_trans_resolution", resolution, "0"); |
---|
214 | addconfigscreencheck("web_trans_aspectratio", aspectratio, "0"); |
---|
215 | break; |
---|
216 | } |
---|
217 | if((rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)) && listbox->select != NULL && ostrcmp(listbox->select->name, "transcode") == 0) |
---|
218 | { |
---|
219 | if(ostrcmp(transcode->ret, "0") == 0) |
---|
220 | { |
---|
221 | bitrate->hidden=YES; |
---|
222 | resolution->hidden=YES; |
---|
223 | aspectratio->hidden=YES; |
---|
224 | } |
---|
225 | else |
---|
226 | { |
---|
227 | bitrate->hidden=NO; |
---|
228 | resolution->hidden=NO; |
---|
229 | aspectratio->hidden=NO; |
---|
230 | } |
---|
231 | drawscreen(httpdsettings, 0, 0); |
---|
232 | } |
---|
233 | #endif |
---|
234 | } |
---|
235 | |
---|
236 | delownerrc(httpdsettings); |
---|
237 | clearscreen(httpdsettings); |
---|
238 | } |
---|
239 | |
---|
240 | #endif |
---|