1 | #ifndef INFOBAR_H |
---|
2 | #define INFOBAR_H |
---|
3 | |
---|
4 | void screeninfobar() |
---|
5 | { |
---|
6 | int rcret = 0, ret = 0, infobartimeout = 0, rcwait = 1000, count = 0; |
---|
7 | struct skin* infobar1 = getscreen("infobar"); |
---|
8 | struct skin* infobar2 = getscreen("infobar2"); |
---|
9 | struct skin* infobar = infobar1; |
---|
10 | struct skin* standbymenu = NULL; |
---|
11 | char* tmpstr = NULL; char* tmpnr = NULL; |
---|
12 | |
---|
13 | status.mute = 0; |
---|
14 | status.infobar = 2; |
---|
15 | |
---|
16 | addrc(getrcconfigint("rcvolup", NULL), screenvolumeup, NULL, NULL); |
---|
17 | addrc(getrcconfigint("rcvoldown", NULL), screenvolumedown, NULL, NULL); |
---|
18 | addrc(getrcconfigint("rcmute", NULL), screenmute, NULL, NULL); |
---|
19 | |
---|
20 | while(1) |
---|
21 | { |
---|
22 | if(status.standby == 1) |
---|
23 | screenstandby(); |
---|
24 | if(status.infobar == 1) |
---|
25 | { |
---|
26 | rcret = waitrc(infobar, 1000, 0); |
---|
27 | infobartimeout++; |
---|
28 | } |
---|
29 | else if(status.infobar == 2) |
---|
30 | { |
---|
31 | if(getconfigint("infobarsleep", NULL) > 0) |
---|
32 | rcret = waitrc(infobar, getconfigint("infobarsleep", NULL) * 1000, 0); |
---|
33 | else |
---|
34 | rcret = RCTIMEOUT; |
---|
35 | if(rcret == RCTIMEOUT) |
---|
36 | { |
---|
37 | status.infobar = 1; |
---|
38 | infobar = infobar1; |
---|
39 | drawscreen(infobar, 0); |
---|
40 | continue; |
---|
41 | } |
---|
42 | else |
---|
43 | status.infobar = 0; |
---|
44 | } |
---|
45 | else |
---|
46 | { |
---|
47 | int screensaver_delay = getconfigint("screensaver_delay", NULL); |
---|
48 | rcret = 0; count = 0; rcwait = 1000; |
---|
49 | if(status.servicetype == 1 && getconfigint("screensaver", NULL) == 1) |
---|
50 | initscreensaver(); |
---|
51 | if(screensaver == NULL) rcwait = 0; |
---|
52 | while(rcret == 0 || rcret == RCTIMEOUT) |
---|
53 | { |
---|
54 | rcret = waitrc(infobar, rcwait, 0); |
---|
55 | count++; |
---|
56 | if(rcret == RCTIMEOUT && screensaver != NULL && count > screensaver_delay) |
---|
57 | { |
---|
58 | if(status.aktservice->channel != NULL) |
---|
59 | screensaver->value = ostrcat(status.aktservice->channel->name, NULL, 0, 0); |
---|
60 | else |
---|
61 | screensaver->value = ostrcat("Radio", NULL, 0, 0); |
---|
62 | showscreensaver(); |
---|
63 | free(screensaver->value); |
---|
64 | rcwait = screensaver->speed; |
---|
65 | } |
---|
66 | } |
---|
67 | deinitscreensaver(); |
---|
68 | drawscreen(skin, 0); |
---|
69 | infobartimeout = 0; |
---|
70 | } |
---|
71 | |
---|
72 | if(rcret == getrcconfigint("rcpause", NULL)) |
---|
73 | { |
---|
74 | //timeshift |
---|
75 | timeshiftpause(); |
---|
76 | continue; |
---|
77 | } |
---|
78 | if(status.timeshift == 1) |
---|
79 | { |
---|
80 | if(rcret == getrcconfigint("rcstop", NULL)) |
---|
81 | { |
---|
82 | timeshiftstop(0); |
---|
83 | continue; |
---|
84 | } |
---|
85 | if(rcret == getrcconfigint("rcplay", NULL)) |
---|
86 | { |
---|
87 | timeshiftplay(); |
---|
88 | continue; |
---|
89 | } |
---|
90 | //TODO: ff, fr, seek |
---|
91 | if(rcret == getrcconfigint("rcff", NULL)) |
---|
92 | { |
---|
93 | if(status.playing == 1) { |
---|
94 | if(status.timeshiftseek > 10000) { |
---|
95 | timeshiftseek((status.timeshiftseek - 10000) * 2 + 10000); |
---|
96 | } |
---|
97 | else |
---|
98 | timeshiftseek(10002); |
---|
99 | } |
---|
100 | continue; |
---|
101 | } |
---|
102 | if(rcret == getrcconfigint("rcfr", NULL)) |
---|
103 | { |
---|
104 | if(status.playing == 1) { |
---|
105 | if(status.timeshiftseek > 102) |
---|
106 | timeshiftplay(); |
---|
107 | timeshiftseek(-10); |
---|
108 | } |
---|
109 | continue; |
---|
110 | } |
---|
111 | if(rcret == getrcconfigint("rc3", NULL)) |
---|
112 | { |
---|
113 | if(status.timeshiftseek > 102) |
---|
114 | timeshiftplay(); |
---|
115 | timeshiftseek(60); |
---|
116 | continue; |
---|
117 | } |
---|
118 | if(rcret == getrcconfigint("rc6", NULL)) |
---|
119 | { |
---|
120 | if(status.timeshiftseek > 102) |
---|
121 | timeshiftplay(); |
---|
122 | timeshiftseek(300); |
---|
123 | continue; |
---|
124 | } |
---|
125 | if(rcret == getrcconfigint("rc9", NULL)) |
---|
126 | { |
---|
127 | if(status.timeshiftseek > 102) |
---|
128 | timeshiftplay(); |
---|
129 | timeshiftseek(600); |
---|
130 | continue; |
---|
131 | } |
---|
132 | if(rcret == getrcconfigint("rc1", NULL)) |
---|
133 | { |
---|
134 | if(status.timeshiftseek > 102) |
---|
135 | timeshiftplay(); |
---|
136 | timeshiftseek(-60); |
---|
137 | continue; |
---|
138 | } |
---|
139 | if(rcret == getrcconfigint("rc4", NULL)) |
---|
140 | { |
---|
141 | if(status.timeshiftseek > 102) |
---|
142 | timeshiftplay(); |
---|
143 | timeshiftseek(-300); |
---|
144 | continue; |
---|
145 | } |
---|
146 | if(rcret == getrcconfigint("rc7", NULL)) |
---|
147 | { |
---|
148 | if(status.timeshiftseek > 102) |
---|
149 | timeshiftplay(); |
---|
150 | timeshiftseek(-600); |
---|
151 | continue; |
---|
152 | } |
---|
153 | if(rcret == getrcconfigint("rcinfo", NULL)) |
---|
154 | { |
---|
155 | if(status.timeshiftseek > 102 && status.timeshiftseek < 999999) |
---|
156 | timeshiftplay(); |
---|
157 | if(status.timeshiftseek == 999999) |
---|
158 | status.timeshiftseek = 0; |
---|
159 | else { |
---|
160 | timeshiftseek(999999); |
---|
161 | continue; |
---|
162 | } |
---|
163 | } |
---|
164 | } |
---|
165 | if(rcret == getrcconfigint("rcstop", NULL)) |
---|
166 | { |
---|
167 | subtitlepause(1); |
---|
168 | status.infobar = 0; |
---|
169 | clearscreen(infobar); |
---|
170 | screenrecordstop(); |
---|
171 | status.updatevfd = START; |
---|
172 | drawscreen(skin, 0); |
---|
173 | subtitlepause(0); |
---|
174 | continue; |
---|
175 | } |
---|
176 | if(rcret == getrcconfigint("rcblue", NULL) && getconfig("bluekey", NULL) == NULL) |
---|
177 | rcret = getrcconfigint("rctvradio", NULL); |
---|
178 | if(rcret == getrcconfigint("rcok", NULL) || rcret == getrcconfigint("rcup", NULL) || rcret == getrcconfigint("rcdown", NULL) || rcret == getrcconfigint("rctvradio", NULL) || rcret == getrcconfigint("rcfav", NULL)) |
---|
179 | { |
---|
180 | int tmpservicetype = status.servicetype; |
---|
181 | subtitlepause(1); |
---|
182 | clearscreen(infobar); |
---|
183 | if(rcret == getrcconfigint("rctvradio", NULL)) |
---|
184 | { |
---|
185 | if(status.servicetype == 0) |
---|
186 | status.servicetype = 1; |
---|
187 | else |
---|
188 | status.servicetype = 0; |
---|
189 | } |
---|
190 | drawscreen(skin, 0); |
---|
191 | if(rcret == getrcconfigint("rcfav", NULL)) |
---|
192 | ret = screenchannellist(NULL, NULL, 2); |
---|
193 | else |
---|
194 | ret = screenchannellist(NULL, NULL, 0); |
---|
195 | if(ret >= 20 || ret < 0) |
---|
196 | status.servicetype = tmpservicetype; |
---|
197 | drawscreen(skin, 0); |
---|
198 | status.infobar = 2; |
---|
199 | continue; |
---|
200 | } |
---|
201 | if(rcret == getrcconfigint("rcexit", NULL)) |
---|
202 | { |
---|
203 | if(status.timeshiftseek == 999999) |
---|
204 | status.timeshiftseek = 0; |
---|
205 | subtitlepause(1); |
---|
206 | status.infobar = 0; |
---|
207 | clearscreen(infobar); |
---|
208 | drawscreen(skin, 0); |
---|
209 | subtitlepause(0); |
---|
210 | continue; |
---|
211 | } |
---|
212 | if(rcret == getrcconfigint("rctext", NULL)) |
---|
213 | { |
---|
214 | if(status.aktservice->channel != NULL && status.aktservice->channel->txtpid > 0) |
---|
215 | { |
---|
216 | subtitlepause(1); |
---|
217 | status.infobar = 0; |
---|
218 | status.sec = 0; |
---|
219 | clearscreen(infobar); |
---|
220 | tmpstr = ostrcat(getconfig("tuxtxtfile", NULL), " ", 0, 0); |
---|
221 | tmpnr = oitoa(status.aktservice->channel->txtpid); |
---|
222 | tmpstr = ostrcat(tmpstr, tmpnr, 1, 1); |
---|
223 | drawscreen(skin, 0); |
---|
224 | system(tmpstr); |
---|
225 | free(tmpstr); tmpstr = NULL; tmpnr = NULL; |
---|
226 | drawscreen(skin, 0); |
---|
227 | subtitlepause(0); |
---|
228 | } |
---|
229 | continue; |
---|
230 | } |
---|
231 | if(rcret == getrcconfigint("rcrecord", NULL)) |
---|
232 | { |
---|
233 | subtitlepause(1); |
---|
234 | status.infobar = 0; |
---|
235 | clearscreen(infobar); |
---|
236 | screenrecorddirect(); |
---|
237 | status.updatevfd = START; |
---|
238 | drawscreen(skin, 0); |
---|
239 | subtitlepause(0); |
---|
240 | continue; |
---|
241 | } |
---|
242 | if(status.timeshift == 0 && (rcret == getrcconfigint("rcplay", NULL) || rcret == getrcconfigint("rcarchive", NULL))) |
---|
243 | { |
---|
244 | subtitlepause(1); |
---|
245 | status.infobar = 0; |
---|
246 | clearscreen(infobar); |
---|
247 | screenplay(1, 0); |
---|
248 | status.updatevfd = START; |
---|
249 | drawscreen(skin, 0); |
---|
250 | subtitlepause(0); |
---|
251 | continue; |
---|
252 | } |
---|
253 | if(rcret == getrcconfigint("rcred", NULL)) |
---|
254 | { |
---|
255 | subtitlepause(1); |
---|
256 | status.infobar = 0; |
---|
257 | clearscreen(infobar); |
---|
258 | screenkeyactions(1, 0); |
---|
259 | status.updatevfd = START; |
---|
260 | drawscreen(skin, 0); |
---|
261 | subtitlepause(0); |
---|
262 | continue; |
---|
263 | } |
---|
264 | if(rcret == getrcconfigint("rcgreen", NULL)) |
---|
265 | { |
---|
266 | subtitlepause(1); |
---|
267 | status.infobar = 0; |
---|
268 | clearscreen(infobar); |
---|
269 | screenvideomode(); |
---|
270 | drawscreen(skin, 0); |
---|
271 | subtitlepause(0); |
---|
272 | continue; |
---|
273 | } |
---|
274 | if(rcret == getrcconfigint("rcsubchannel", NULL)) |
---|
275 | { |
---|
276 | subtitlepause(1); |
---|
277 | status.infobar = 0; |
---|
278 | clearscreen(infobar); |
---|
279 | screenlinkedchannel(); |
---|
280 | drawscreen(skin, 0); |
---|
281 | subtitlepause(0); |
---|
282 | continue; |
---|
283 | } |
---|
284 | if(rcret == getrcconfigint("rcsleep", NULL)) |
---|
285 | { |
---|
286 | subtitlepause(1); |
---|
287 | status.infobar = 0; |
---|
288 | clearscreen(infobar); |
---|
289 | screenpowerofftimer(); |
---|
290 | drawscreen(skin, 0); |
---|
291 | subtitlepause(0); |
---|
292 | continue; |
---|
293 | } |
---|
294 | if(rcret == getrcconfigint("rcsubtitel", NULL)) |
---|
295 | { |
---|
296 | subtitlepause(1); |
---|
297 | status.infobar = 0; |
---|
298 | clearscreen(infobar); |
---|
299 | screensubtitle(); |
---|
300 | drawscreen(skin, 0); |
---|
301 | subtitlepause(0); |
---|
302 | continue; |
---|
303 | } |
---|
304 | if(rcret == getrcconfigint("rcyellow", NULL)) |
---|
305 | { |
---|
306 | subtitlepause(1); |
---|
307 | status.infobar = 0; |
---|
308 | clearscreen(infobar); |
---|
309 | screenaudiotrack(); |
---|
310 | drawscreen(skin, 0); |
---|
311 | subtitlepause(0); |
---|
312 | continue; |
---|
313 | } |
---|
314 | if(rcret == getrcconfigint("rcblue", NULL)) |
---|
315 | { |
---|
316 | subtitlepause(1); |
---|
317 | status.infobar = 0; |
---|
318 | clearscreen(infobar); |
---|
319 | screenkeyactions(0, 0); |
---|
320 | status.updatevfd = START; |
---|
321 | drawscreen(skin, 0); |
---|
322 | subtitlepause(0); |
---|
323 | continue; |
---|
324 | } |
---|
325 | if(rcret == getrcconfigint("rcmedia", NULL)) |
---|
326 | { |
---|
327 | struct skin* pluginnode = getplugin("Media Center"); |
---|
328 | void (*startplugin)(void); |
---|
329 | subtitlepause(1); |
---|
330 | status.infobar = 0; |
---|
331 | clearscreen(infobar); |
---|
332 | if(pluginnode != NULL) |
---|
333 | { |
---|
334 | startplugin = dlsym(pluginnode->pluginhandle, "start"); |
---|
335 | if(startplugin != NULL) |
---|
336 | startplugin(); |
---|
337 | } |
---|
338 | drawscreen(skin, 0); |
---|
339 | subtitlepause(0); |
---|
340 | continue; |
---|
341 | } |
---|
342 | if(rcret == getrcconfigint("rcmenu", NULL)) |
---|
343 | { |
---|
344 | subtitlepause(1); |
---|
345 | status.infobar = 0; |
---|
346 | clearscreen(infobar); |
---|
347 | menu(getscreen("mainmenu")); |
---|
348 | status.menurelease = 0; |
---|
349 | status.updatevfd = START; |
---|
350 | drawscreen(skin, 0); |
---|
351 | subtitlepause(0); |
---|
352 | continue; |
---|
353 | } |
---|
354 | if(rcret == getrcconfigint("rcepg", NULL)) |
---|
355 | { |
---|
356 | subtitlepause(1); |
---|
357 | status.infobar = 0; |
---|
358 | clearscreen(infobar); |
---|
359 | epgchoice(NULL); |
---|
360 | drawscreen(skin, 0); |
---|
361 | subtitlepause(0); |
---|
362 | continue; |
---|
363 | } |
---|
364 | if(rcret == getrcconfigint("rcresolution", NULL)) |
---|
365 | { |
---|
366 | subtitlepause(1); |
---|
367 | status.infobar = 0; |
---|
368 | clearscreen(infobar); |
---|
369 | switchvideomode(); |
---|
370 | drawscreen(skin, 0); |
---|
371 | subtitlepause(0); |
---|
372 | continue; |
---|
373 | } |
---|
374 | if(rcret == getrcconfigint("rcinfo", NULL)) |
---|
375 | { |
---|
376 | if(status.infobar == 1) |
---|
377 | { |
---|
378 | if(getconfigint("secondinfobar", NULL) == 2) |
---|
379 | { |
---|
380 | clearscreen(infobar); |
---|
381 | epgchoice(NULL); |
---|
382 | status.infobar = 0; |
---|
383 | drawscreen(skin, 0); |
---|
384 | subtitlepause(0); |
---|
385 | } |
---|
386 | else if(getconfigint("secondinfobar", NULL) == 0 || infobar2 == status.skinerr || infobar == infobar2) |
---|
387 | { |
---|
388 | status.infobar = 0; |
---|
389 | drawscreen(skin, 0); |
---|
390 | subtitlepause(0); |
---|
391 | } |
---|
392 | else |
---|
393 | { |
---|
394 | infobar = infobar2; |
---|
395 | drawscreen(infobar, 0); |
---|
396 | } |
---|
397 | } |
---|
398 | else |
---|
399 | { |
---|
400 | subtitlepause(1); |
---|
401 | status.infobar = 1; |
---|
402 | infobar = infobar1; |
---|
403 | drawscreen(infobar, 0); |
---|
404 | } |
---|
405 | continue; |
---|
406 | } |
---|
407 | if(rcret == getrcconfigint("rcpower", NULL)) |
---|
408 | { |
---|
409 | subtitlepause(1); |
---|
410 | status.infobar = 0; |
---|
411 | clearscreen(infobar); |
---|
412 | drawscreen(skin, 0); |
---|
413 | switch(getconfigint("poweraktion", NULL)) |
---|
414 | { |
---|
415 | case 1: //power off |
---|
416 | oshutdown(1, 1); |
---|
417 | break; |
---|
418 | case 2: //standby |
---|
419 | status.standby = 1; |
---|
420 | break; |
---|
421 | case 3: //restart |
---|
422 | oshutdown(2, 1); |
---|
423 | break; |
---|
424 | case 4: //Gui restart |
---|
425 | oshutdown(3, 1); |
---|
426 | break; |
---|
427 | default: |
---|
428 | standbymenu = getscreen("standbymenu"); |
---|
429 | menu(standbymenu); |
---|
430 | break; |
---|
431 | } |
---|
432 | status.updatevfd = START; |
---|
433 | drawscreen(skin, 0); |
---|
434 | subtitlepause(0); |
---|
435 | continue; |
---|
436 | } |
---|
437 | if(rcret == getrcconfigint("rcrecall", NULL) || rcret == getrcconfigint("rc0", NULL)) |
---|
438 | { |
---|
439 | subtitlepause(1); |
---|
440 | clearscreen(infobar); |
---|
441 | drawscreen(skin, 0); |
---|
442 | if(status.lastservice->channel != NULL) |
---|
443 | { |
---|
444 | tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0); |
---|
445 | servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 0), 0); |
---|
446 | free(tmpstr); tmpstr = NULL; |
---|
447 | } |
---|
448 | infobartimeout = 0; |
---|
449 | status.infobar = 1; |
---|
450 | infobar = infobar1; |
---|
451 | drawscreen(infobar, 0); |
---|
452 | continue; |
---|
453 | } |
---|
454 | if(rcret == getrcconfigint("rcchup", NULL)) |
---|
455 | { |
---|
456 | subtitlepause(1); |
---|
457 | zapup(); |
---|
458 | clearscreen(infobar); |
---|
459 | drawscreen(skin, 0); |
---|
460 | infobartimeout = 0; |
---|
461 | status.infobar = 2; |
---|
462 | continue; |
---|
463 | } |
---|
464 | if(rcret == getrcconfigint("rcchdown", NULL)) |
---|
465 | { |
---|
466 | subtitlepause(1); |
---|
467 | zapdown(); |
---|
468 | clearscreen(infobar); |
---|
469 | drawscreen(skin, 0); |
---|
470 | infobartimeout = 0; |
---|
471 | status.infobar = 2; |
---|
472 | continue; |
---|
473 | } |
---|
474 | if(rcret == rcnumber(rcret)) |
---|
475 | { |
---|
476 | subtitlepause(1); |
---|
477 | clearscreen(infobar); |
---|
478 | screenchannelbynr(rcret); |
---|
479 | status.infobar = 2; |
---|
480 | continue; |
---|
481 | } |
---|
482 | if(rcret == RCTIMEOUT) |
---|
483 | { |
---|
484 | if(getconfigint("infobartimeout", NULL) > infobartimeout) |
---|
485 | { |
---|
486 | clearscreen(infobar); |
---|
487 | drawscreen(infobar, 0); |
---|
488 | } |
---|
489 | else |
---|
490 | { |
---|
491 | status.infobar = 0; |
---|
492 | drawscreen(skin, 0); |
---|
493 | subtitlepause(0); |
---|
494 | } |
---|
495 | } |
---|
496 | } |
---|
497 | } |
---|
498 | |
---|
499 | #endif |
---|