1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
|
diff -ruN vdr-1.7.12/HISTORY-liemikuutio vdr-1.7.12.ExtP_NG/HISTORY-liemikuutio
--- vdr-1.7.12/HISTORY-liemikuutio 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/HISTORY-liemikuutio 2010-02-03 22:16:54.460043207 +0100
@@ -0,0 +1,140 @@
+-----------------------------------
+Liemikuutio for Video Disc Recorder
+
+Maintainer: Rolf Ahrenberg
+-----------------------------------
+
+2006-01-08: Version 1.0
+
+- Based on enAIO with these original patches:
+ Simple recordings sorting by Walter@VDRPortal
+ Alternate rename recordings by Ralf Müller
+ Menu selection by Peter Dittmann
+ Recording length by Tobias Faust
+
+2006-01-15: Version 1.1
+
+- Removed patches already found in vdr-1.3.39.
+
+2006-01-25: Version 1.2
+
+- Added "Main menu command position" feature.
+
+2006-02-05: Version 1.3
+
+- Improved menu selection response.
+
+2006-04-18: Version 1.4
+
+- Added Estonian translation (Thanks to Arthur Konovalov).
+
+2006-04-30: Version 1.5
+
+- Added progress bar view into "What's on now?" menu.
+
+2006-06-06: Version 1.6
+
+- Added French translation (Thanks to ECLiPSE).
+
+2006-06-14: Version 1.7
+
+- Fixed RENR crash.
+
+2006-07-14: Version 1.8
+
+- Fixed RENR/OSD bug.
+
+2006-08-27: Version 1.9
+
+- Some modifications to the recording length and rename recordings
+ patches (Thanks to Firefly).
+- Added k1_k3_jumps_20s patch by Petri Hintukainen.
+
+2006-08-29: Version 1.10
+
+- The cRecording:Title() method now defaults to original formatting.
+
+2006-09-04: Version 1.11
+
+- Removed unused variable from cRecording::Title() method (Thanks to
+ C.Y.M.).
+- Some modifications to the rename recordings patch (Thanks to Firefly).
+
+2006-09-13: Version 1.12
+
+- More modifications to the rename recordings patch (Thanks to Firefly).
+
+2006-10-01: Version 1.13
+
+- Removed unnecessary syslog printing (Thanks to Firefly).
+
+2007-08-14: Version 1.14
+
+- Updated for vdr-1.5.7.
+
+2007-10-16: Version 1.15
+
+- Added recmenu play patch (Thanks to Ville Skyttä).
+- Updated French translation (Thanks to ECLiPSE).
+
+2007-11-04: Version 1.16
+
+- Updated for vdr-1.5.11.
+
+2007-12-08: Version 1.17
+
+- Added binary skip patch.
+- Removed k1_k3_jumps_20s patch.
+
+2008-02-17: Version 1.18
+
+- Updated for vdr-1.5.15.
+
+2008-03-02: Version 1.19
+
+- Modified binary skip to use kPrev and kNext keys and the skip is now
+ always shortened after a direction change (Thanks to Timo Eskola).
+- Readded k1_k3_jumps_20s patch.
+
+2008-04-04: Version 1.20
+
+- Added bitrate information into rename menu.
+- Readded the path editing support of rename recordings patch (Thanks
+ to Firefly).
+
+2008-05-08: Version 1.21
+
+- Fixed rename recordings (Thanks to Firefly).
+- Added a DVB subtitles hack for old recordings (Thanks to Anssi Hannula).
+
+2009-01-08: Version 1.22
+
+- Updated for vdr-1.7.3.
+
+2009-01-25: Version 1.23
+
+- Updated for vdr-1.7.4.
+
+2009-02-27: Version 1.24
+
+- Fixed compilation under gcc-4.4.
+
+2009-04-05: Version 1.25
+
+- Fixed the length detection of recordings (Thanks to Thomas Günther).
+
+2009-04-17: Version 1.26
+
+- Fixed the length detection of audio recordings (Thanks to Thomas Günther).
+
+2009-04-26: Version 1.27
+
+- Fixed the length detection of empty recordings (Thanks to Thomas Günther).
+
+2009-07-12: Version 1.28
+
+- Fixed the TS/PES detection of recording marks.
+
+2009-11-23: Version 1.29
+
+- Updated Estonian translation (Thanks to Arthur Konovalov)
diff -ruN vdr-1.7.12/MANUAL vdr-1.7.12.ExtP_NG/MANUAL
--- vdr-1.7.12/MANUAL 2010-01-17 16:13:40.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/MANUAL 2010-02-03 22:16:54.700053369 +0100
@@ -680,6 +680,10 @@
to replay Dolby Digital audio and want to save disk space.
If turned off, Dolby Digital tracks also don't appear in the
"Audio" menu.
+
+ If DOLBYINREC is enabled:
+ Dolby Digital tracks don't appear in the "Audio" menu, if
+ turned off.
Update channels = 5 Controls the automatic channel update function. '0' means
no update, '1' will only update channel names, '2' will
@@ -839,6 +843,31 @@
0 resulting in a file named 'resume', and any other
value resulting in 'resume.n'.
+ Jump&Play = no Turns playing on or off after jumping forward to the
+ next editing mark with the '9' key.
+
+ Play&Jump = no Turns automatic jumping over commercial breaks on or
+ off. This includes jumping to the first mark, if the
+ replay starts at the beginning of a recording - and
+ stopping the replay at the last mark.
+ With this setting enabled, the behaviour of the '8'
+ key during replay is changed too. It moves the actual
+ replay position not only three seconds before the
+ next "start" mark, but also before the next "end"
+ mark. This can be used to test, if the editing marks
+ are correctly positioned for a "smooth" jump over a
+ commercial break.
+
+ Pause at last mark = no
+ Turns pausing of replay at the last editing mark on or
+ off.
+
+ Reload marks = no Turns reloading of editing marks on or off. This can
+ be used if an external programme adjusts the editing
+ marks, e.g. noad in online mode. The marks are reloaded
+ in 10 seconds intervals.
+
+
Miscellaneous:
Min. event timeout = 30
diff -ruN vdr-1.7.12/Make.config.template vdr-1.7.12.ExtP_NG/Make.config.template
--- vdr-1.7.12/Make.config.template 2009-01-18 11:46:13.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/Make.config.template 2010-02-03 22:16:54.660045966 +0100
@@ -42,8 +42,193 @@
## Define if you want vdr to not run as root
#VDR_USER = vdr
+### VDR-Extensions:
+
+#ALTERNATECHANNEL = 1
+#ATSC = 1
+#CHANNELBIND = 1
+#CUTTERLIMIT = 1
+#CUTTERQUEUE = 1
+#CUTTIME = 1
+#DDEPGENTRY = 1
+#DELTIMESHIFTREC = 1
+#DOLBYINREC = 1
+#DVDARCHIVE = 1
+#DVLFRIENDLYNAMES = 1
+#DVLSCRIPTADDON = 1
+#GRAPHTFT = 1
+#HARDLINKCUTTER = 1
+#JUMPINGSECONDS = 1
+#JUMPPLAY = 1
+#LIEMIEXT = 1
+#LIRCSETTINGS = 1
+#LNBSHARE = 1
+#MAINMENUHOOKS = 1
+#MCLI = 1
+#MENUORG = 1
+#NOEPG = 1
+#PINPLUGIN = 1
+#PLUGINMISSING = 1
+#PLUGINPARAM = 1
+#ROTOR = 1
+#SETUP = 1
+#SORTRECORDS = 1
+#SOURCECAPS = 1
+#STATUS_EXTENSION = 1
+#TIMERINFO = 1
+#VALIDINPUT = 1
+#VOLCTRL = 1
+#YAEPG = 1
### You don't need to touch the following:
ifdef DVBDIR
INCLUDES += -I$(DVBDIR)/include
endif
+
+ifdef ALTERNATECHANNEL
+DEFINES += -DUSE_ALTERNATECHANNEL
+endif
+
+ifdef ATSC
+DEFINES += -DUSE_ATSC
+endif
+
+ifdef CHANNELBIND
+DEFINES += -DUSE_CHANNELBIND
+endif
+
+ifdef CUTTERLIMIT
+DEFINES += -DUSE_CUTTERLIMIT
+endif
+
+ifdef CUTTERQUEUE
+DEFINES += -DUSE_CUTTERQUEUE
+endif
+
+ifdef CUTTIME
+DEFINES += -DUSE_CUTTIME
+endif
+
+ifdef DDEPGENTRY
+DEFINES += -DUSE_DDEPGENTRY
+endif
+
+ifdef DELTIMESHIFTREC
+DEFINES += -DUSE_DELTIMESHIFTREC
+endif
+
+ifdef DOLBYINREC
+DEFINES += -DUSE_DOLBYINREC
+endif
+
+ifdef DVDARCHIVE
+DEFINES += -DUSE_DVDARCHIVE
+endif
+
+ifdef DVLFRIENDLYNAMES
+DEFINES += -DUSE_DVLFRIENDLYNAMES
+endif
+
+ifdef DVLSCRIPTADDON
+DEFINES += -DUSE_DVLSCRIPTADDON
+endif
+
+ifdef DVLVDIPREFER
+DEFINES += -DUSE_DVLVIDPREFER
+endif
+
+ifdef GRAPHTFT
+DEFINES += -DUSE_GRAPHTFT
+endif
+
+ifdef HARDLINKCUTTER
+DEFINES += -DUSE_HARDLINKCUTTER
+endif
+
+ifdef JUMPINGSECONDS
+DEFINES += -DUSE_JUMPINGSECONDS
+endif
+
+ifdef JUMPPLAY
+DEFINES += -DUSE_JUMPPLAY
+endif
+
+ifdef LIEMIEXT
+DEFINES += -DUSE_LIEMIEXT
+endif
+
+ifdef LIRCSETTINGS
+DEFINES += -DUSE_LIRCSETTINGS
+endif
+
+ifdef LNBSHARE
+DEFINES += -DUSE_LNBSHARE
+endif
+
+ifdef MAINMENUHOOKS
+DEFINES += -DUSE_MAINMENUHOOKS
+endif
+
+ifdef MCLI
+DEFINES += -DUSE_MCLI
+endif
+
+ifdef MENUORG
+ifndef SETUP
+DEFINES += -DUSE_MENUORG
+endif
+endif
+
+ifdef NOEPG
+DEFINES += -DUSE_NOEPG
+endif
+
+ifdef PINPLUGIN
+DEFINES += -DUSE_PINPLUGIN
+endif
+
+ifdef PLUGINMISSING
+DEFINES += -DUSE_PLUGINMISSING
+endif
+
+ifdef PLUGINPARAM
+DEFINES += -DUSE_PLUGINPARAM
+endif
+
+ifdef ROTOR
+DEFINES += -DUSE_ROTOR
+endif
+
+ifdef SETUP
+ifndef MENUORG
+DEFINES += -DUSE_SETUP
+endif
+endif
+
+ifdef SORTRECORDS
+DEFINES += -DUSE_SORTRECORDS
+endif
+
+ifdef SOURCECAPS
+DEFINES += -DUSE_SOURCECAPS
+endif
+
+ifdef STATUS_EXTENSION
+DEFINES += -DUSE_STATUS_EXTENSION
+endif
+
+ifdef TIMERINFO
+DEFINES += -DUSE_TIMERINFO
+endif
+
+ifdef VALIDINPUT
+DEFINES += -DUSE_VALIDINPUT
+endif
+
+ifdef VOLCTRL
+DEFINES += -DUSE_VOLCTRL
+endif
+
+ifdef YAEPG
+DEFINES += -DUSE_YAEPG
+endif
diff -ruN vdr-1.7.12/Makefile vdr-1.7.12.ExtP_NG/Makefile
--- vdr-1.7.12/Makefile 2010-01-17 13:32:18.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/Makefile 2010-02-03 22:16:54.676047004 +0100
@@ -43,6 +43,10 @@
skinclassic.o skins.o skinsttng.o sources.o spu.o status.o svdrp.o themes.o thread.o\
timers.o tools.o transfer.o vdr.o videodir.o
+ifdef SETUP
+OBJS += tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o submenu.o
+endif
+
ifndef NO_KBD
DEFINES += -DREMOTE_KBD
endif
diff -ruN vdr-1.7.12/README-HLCUTTER vdr-1.7.12.ExtP_NG/README-HLCUTTER
--- vdr-1.7.12/README-HLCUTTER 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/README-HLCUTTER 2010-02-03 22:16:55.094056656 +0100
@@ -0,0 +1,117 @@
+
+ VDR-HLCUTTER README
+
+
+Written by: Udo Richter
+Available at: http://www.udo-richter.de/vdr/patches.html#hlcutter
+ http://www.udo-richter.de/vdr/patches.en.html#hlcutter
+Contact: udo_richter@gmx.de
+
+
+
+About
+-----
+
+The hard link cutter patch changes the recording editing algorithms of VDR to
+use filesystem hard links to 'copy' recording files whenever possible to speed
+up editing recordings noticeably.
+
+The patch has matured to be quite stable, at least I'm using it without issues.
+Nevertheless the patch is still in development and should be used with caution.
+The patch is EXPERIMENTAL for multiple /videoxx folders. The safety checks
+should prevent data loss, but you should always carefully check the results.
+
+While editing a recording, the patch searches for any 00x.vdr files that dont
+contain editing marks and would normally be copied 1:1 unmodified to the edited
+recording. In this case the current target 00x.vdr file will be aborted, and
+the cutter process attempts to duplicate the source file as a hard link, so
+that both files share the same disk space. If this succeeds, the editing
+process fast-forwards through the duplicated file and continues normally
+beginning with the next source file. If hard linking fails, the cutter process
+continues with plain old copying. (but does not take up the aborted last file.)
+
+After editing, the un-edited recording can be deleted as usual, the hard linked
+copies will continue to exist as the only remaining copy.
+
+To be effective, the default 'Max. video file size (MB)' should be lowered.
+The patch lowers the smallest possible file size to 1mb. Since VDR only
+supports up to 255 files, this would limit the recording size to 255Mb or
+10 minutes, in other words: This setting is insane!
+
+To make sure that the 255 file limit will not be reached, the patch also
+introduces "Max. recording size (GB)" with a default of 100Gb (66 hours), and
+increases the file size to 2000Mb early enough, so that 100Gb-recordings will
+fit into the 255 files.
+
+Picking the right parameters can be tricky. The smaller the file size, the
+faster the editing process works. However, with a small file size, long
+recordings will fall back to 2000Mb files soon, that are slow on editing again.
+
+Here are some examples:
+
+Max file size: 100Gb 100Gb 100Gb 100Gb 100Gb 100Gb 100Gb
+Max recording size: 1Mb 10Mb 20Mb 30Mb 40Mb 50Mb 100Mb
+
+Small files: 1-203 1-204 1-205 1-206 1-207 1-209 1-214
+ GBytes: 0.2 2.0 4.0 6.0 8.1 10.2 20.9
+ Hours: 0.13 1.3 2.65 4 5.4 6.8 13.9
+
+Big (2000mb) files: 204-255 204-255 206-255 207-255 208-255 210-255 215-255
+ GBytes: 101.5 99.6 97.7 95.7 93.8 89.8 80.1
+ Hours: 67 66 65 63 62 60 53
+
+A recording limit of 100Gb keeps plenty of reserve without blocking too much
+file numbers. And with a file size of 30-40Mb, recordings of 4-5 hours fit into
+small files completely. (depends on bit rate of course)
+
+
+
+The patch must be enabled in Setup-> Recordings-> Hard Link Cutter. When
+disabled, the cutter process behaves identical to VDR's default cutter.
+
+There's a //#define HARDLINK_TEST_ONLY in the videodir.c file that enables a
+test-mode that hard-links 00x.vdr_ files only, and continues the classic
+editing. The resulting 00x.vdr and 00x.vdr_ files should be identical. If you
+delete the un-edited recording, dont forget to delete the *.vdr_ files too,
+they will now eat real disk space.
+
+Note: 'du' displays the disk space of hard links only on first appearance, and
+usually you will see a noticeably smaller size on the edited recording.
+
+
+History
+-------
+
+Version 0.2.0
+ New: Support for multiple /videoXX recording folders, using advanced searching
+ for matching file systems where a hard link can be created.
+ Also supports deep mounted file systems.
+ Fix: Do not fail if last mark is a cut-in. (Again.)
+
+Version 0.1.4
+ New: Dynamic increase of file size before running out of xxx.vdr files
+ Fix: Last edit mark is not a cut-out
+ Fix: Write error if link-copied file is smaller than allowed file size
+ Fix: Broken index/marks if cut-in is at the start of a new file
+ Fix: Clear dangeling pointer to free'd cUnbufferedFile,
+ thx to Matthias Schwarzott
+
+Version 0.1.0
+ Initial release
+
+
+
+
+Future plans
+------------
+
+Since original and edited copy share disk space, free space is wrong if one of
+them is moved to *.del. Free space should only count files with hard link
+count = 1. This still goes wrong if all copies get deleted.
+
+
+For more safety, the hard-linked files may be made read-only, as modifications
+to one copy will affect the other copy too. (except deleting, of course)
+
+
+SetBrokenLink may get lost on rare cases, this needs some more thoughts.
diff -ruN vdr-1.7.12/README.jumpplay vdr-1.7.12.ExtP_NG/README.jumpplay
--- vdr-1.7.12/README.jumpplay 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/README.jumpplay 2010-02-03 22:16:55.122054930 +0100
@@ -0,0 +1,92 @@
+JumpPlay patch for VDR
+----------------------
+
+This patch changes the replay behaviour for recordings that contain editing
+marks. It allows to immediately continue the replay after jumping forward to
+the next mark, and to automatically jump over the commercial break to the next
+"start" mark, if an "end" mark is reached.
+
+The features of this patch can be turned on or off with parameters in the replay
+setup. See MANUAL for description of this parameters: "Jump&Play", "Play&Jump",
+"Pause at last mark" and "Reload marks".
+
+
+* History
+
+ 2003-07-04: jumpandrun.diff - the Noad <theNoad@SoftHome.net>
+ Jump&Play
+
+ 2003-12-06: Version 0.0 - Torsten Kunkel <vdr@tkunkel.de>
+ Play&Jump (only if progressbar is visible)
+ Setup parameters Jump&Play and Play&Jump in the replay setup
+
+ 2004-01-20: Version 0.1 - Thomas Gnther <tom@toms-cafe.de>
+ Jump&Play:
+ - fixed speed after jump
+ - fixed removing of marks
+ Play&Jump:
+ - jump only on "end" marks
+
+ 2004-01-27: Version 0.2 - Thomas Gnther <tom@toms-cafe.de>
+ Jump&Play:
+ - fixed double jump
+ Play&Jump:
+ - fixed mark detection: fuzzy detection (until 3 seconds after mark)
+ - jump without progressbar
+ - mode "progressbar only" for old behaviour
+
+ 2004-01-31: Version 0.3 - Thomas Gnther <tom@toms-cafe.de>
+ Jump&Play:
+ - fixed display frames
+ Play&Jump:
+ - fixed end of playing at last mark
+
+ 2004-07-11: Version 0.4 - Thomas Gnther <tom@toms-cafe.de>
+ Jump&Play:
+ - don't play after jump to end
+ Play&Jump:
+ - don't prevent jumping after hide or show
+ Less conflicts with other patches (Elchi/AutoPID)
+
+ 2004-08-21: Version 0.5 - Thomas Gnther <tom@toms-cafe.de>
+ Play&Jump:
+ - exact jumps, replay like edited recording (no fuzzy mark detection)
+ - jump to first mark if replay starts at the beginning
+ - check jump marks with '8' key
+ - mode "progressbar only" removed
+ Description in README.jumpplay
+
+ 2004-12-28: Version 0.6 - Thomas Gnther <tom@toms-cafe.de>
+ Adapted noad extensions (from the Noad <theNoad@SoftHome.net>) to
+ jumpplay-0.5:
+ - cyclic reloading of marks found by noad online-scan
+ - don't stop after the last mark in case of live-recordings
+ New setup parameter "Load marks interval (s)"
+ Updated description in README.jumpplay
+
+ 2006-04-14: Version 0.7 - Thomas Gnther <tom@toms-cafe.de>
+ Fixed jump to first mark (crashed with plugin extrecmenu-0.9)
+ Added version define JUMPPLAYVERSNUM
+ Added placeholders for Czech language texts
+ Cleaned up i18n entries (support only VDR >= 1.3.29)
+ Improved description of i18n placeholders - hoping for real language texts
+
+ 2006-05-12: Version 0.8 - Thomas Gnther <tom@toms-cafe.de>
+ Fixed segfault in dvbplayer thread while the replaycontrol thread is
+ reloading the marks (thanks to horchi at vdrportal.de for reporting this -
+ see http://vdrportal.de/board/thread.php?postid=450463#post450463):
+ New class cMarksReload checks the timestamp of marks.vdr in 10 seconds
+ intervals, so the marks in the threads dvbplayer and replaycontrol can be
+ reloaded independently
+ Changed setup parameter "Load marks interval (s)" to "Reload marks"
+ Updated description in README.jumpplay
+
+ 2006-05-28: Version 0.9 - Thomas Gnther <tom@toms-cafe.de>
+ New setup parameter "Pause at last mark"
+ Updated description in README.jumpplay
+ Moved parameters description to MANUAL
+
+ 2009-03-31: Version 1.0 - Thomas Gnther <tom@toms-cafe.de>
+ Play&Jump:
+ - set resume position to 0 if replay stops at the first mark
+ Added French language texts (thanks to Michal Nival)
diff -ruN vdr-1.7.12/README.timer-info vdr-1.7.12.ExtP_NG/README.timer-info
--- vdr-1.7.12/README.timer-info 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/README.timer-info 2010-02-03 22:16:55.134055621 +0100
@@ -0,0 +1,65 @@
++------------------------------------------------------------------------------+
+| Info about the timer-info-patch by Brougs78 |
+| brougs78@gmx.net / home.pages.at/brougs78 |
++------------------------------------------------------------------------------+
+
+
+README timer-info:
+------------------
+
+Features:
+ - Shows info, if it is possible to record an event in the timer menu of vdr.
+ For calculations the free space incl. the deleted recordings is used,
+ considering an average consumtion of 25.75 MB/min (also used by vdr itself).
+ The first column in the timer-list shows:
+ ( + ) recording will be most probably possible (enough space)
+ (+/-) recording may be possible
+ ( - ) recording will most probably fail (to less space)
+ The calculations also consider repeating timers.
+ - It is possible to deactivate the patch in the OSD-menu of VDR.
+
+
+HISTORY timer-info:
+-------------------
+
+25.11.2004: v0.1
+ - Initial release
+
+11.01.2005: v0.1b
+ - Bugfixes for vdr-1.3.18
+ - In the menu the free recording-time no longer includes the space of the
+ deleted recordings, because this slowed the vdr down to much.
+
+08.07.2005: v0.1c
+ - Made the patch configurable
+
+29.01.2006: v0.2 - Thomas Gnther <tom@toms-cafe.de>
+ - Rewritten great parts for vdr-1.3.38+
+ http://toms-cafe.de/vdr/download/vdr-timer-info-0.2-1.3.38+.diff
+
+05.02.2006: v0.3 - Thomas Gnther <tom@toms-cafe.de>
+ - Fixed refresh of timer menu in cMenuTimers::OnOff
+ - Fixed check of repeating timers
+ - Syslog debug messages can be enabled with Define DEBUG_TIMER_INFO
+ http://toms-cafe.de/vdr/download/vdr-timer-info-0.3-1.3.38+.diff
+
+03.03.2006: v0.4 - Thomas Gnther <tom@toms-cafe.de>
+ - Adapted to vdr-1.3.44
+ - Removed setup parameter "Show timer-info"
+ http://toms-cafe.de/vdr/download/vdr-timer-info-0.4-1.3.44.diff
+
+26.03.2006: - Tobias Grimm <tg@e-tobi.net>
+ - Adapted to vdr-1.3.45
+ http://toms-cafe.de/vdr/download/vdr-timer-info-0.4-1.3.45.diff
+
+14.01.2008: - Thomas Gnther <tom@toms-cafe.de>
+ - Adapted to vdr-1.5.13
+ http://toms-cafe.de/vdr/download/vdr-timer-info-0.4-1.5.13.diff
+
+17.02.2008: - Tobias Grimm <tg@e-tobi.net>
+ - Adapted to vdr-1.5.15
+ http://toms-cafe.de/vdr/download/vdr-timer-info-0.4-1.5.15.diff
+
+12.04.2008: v0.5 - Thomas Gnther <tom@toms-cafe.de>
+ - Fixed display of +/- sign with UTF-8
+ http://toms-cafe.de/vdr/download/vdr-timer-info-0.5-1.5.15.diff
diff -ruN vdr-1.7.12/channels.c vdr-1.7.12.ExtP_NG/channels.c
--- vdr-1.7.12/channels.c 2010-01-02 18:38:40.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/channels.c 2010-02-03 22:16:53.785037393 +0100
@@ -13,6 +13,9 @@
#include "device.h"
#include "epg.h"
#include "timers.h"
+#ifdef USE_ALTERNATECHANNEL
+#include "tools.h"
+#endif /* ALTERNATECHANNEL */
// IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
// format characters in order to allow any number of blanks after a numeric
@@ -188,6 +191,9 @@
shortName = strdup("");
provider = strdup("");
portalName = strdup("");
+#ifdef USE_PLUGINPARAM
+ pluginParam = strdup("");
+#endif /* PLUGINPARAM */
memset(&__BeginData__, 0, (char *)&__EndData__ - (char *)&__BeginData__);
inversion = INVERSION_AUTO;
bandwidth = 8000000;
@@ -211,6 +217,9 @@
shortName = NULL;
provider = NULL;
portalName = NULL;
+#ifdef USE_PLUGINPARAM
+ pluginParam = NULL;
+#endif /* PLUGINPARAM */
schedule = NULL;
linkChannels = NULL;
refChannel = NULL;
@@ -247,6 +256,9 @@
shortName = strcpyrealloc(shortName, Channel.shortName);
provider = strcpyrealloc(provider, Channel.provider);
portalName = strcpyrealloc(portalName, Channel.portalName);
+#ifdef USE_PLUGINPARAM
+ pluginParam = strcpyrealloc(pluginParam, Channel.pluginParam);
+#endif /* PLUGINPARAM */
memcpy(&__BeginData__, &Channel.__BeginData__, (char *)&Channel.__EndData__ - (char *)&Channel.__BeginData__);
return *this;
}
@@ -307,9 +319,30 @@
guard = Channel->guard;
hierarchy = Channel->hierarchy;
rollOff = Channel->rollOff;
+#ifdef USE_PLUGINPARAM
+ if (IsPlug()) pluginParam = strcpyrealloc(pluginParam, Channel->pluginParam);
+#endif /* PLUGINPARAM */
}
}
+#ifdef USE_PLUGINPARAM
+bool cChannel::SetPlugTransponderData(int Source, int Frequency, const char *PluginParam)
+{
+ if (source != Source || frequency != Frequency || (strcmp(pluginParam, PluginParam) != 0)) {
+ if (Number()) {
+ dsyslog("changing transponder data of channel %d from %s:%d:%s to %s:%d:%s", Number(), *cSource::ToString(source), frequency, pluginParam, *cSource::ToString(Source), Frequency, PluginParam);
+ modification |= CHANNELMOD_TRANSP;
+ Channels.SetModified();
+ }
+ source = Source;
+ frequency = Frequency;
+ pluginParam = strcpyrealloc(pluginParam, PluginParam);
+ schedule = NULL;
+ }
+ return true;
+}
+#endif /* PLUGINPARAM */
+
bool cChannel::SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation, int System, int RollOff)
{
// Workarounds for broadcaster stupidity:
@@ -439,6 +472,29 @@
}
}
+#ifdef USE_ALTERNATECHANNEL
+void cChannel::SetAlternativeChannelID(const char *AlternativeChannelID)
+{
+ if (!isempty(AlternativeChannelID))
+ alternativeChannelID = tChannelID::FromString(AlternativeChannelID);
+}
+#endif /* ALTERNATECHANNEL */
+
+#ifdef USE_PLUGINPARAM
+void cChannel::SetPluginParam(const char *PluginParam)
+{
+ if (!isempty(PluginParam) && strcmp(pluginParam, PluginParam) != 0) {
+ if (Number()) {
+ dsyslog("changing plugin parameters of channel %d from '%s' to '%s'", Number(), pluginParam, PluginParam);
+ modification |= CHANNELMOD_TRANSP;
+ Channels.SetModified();
+ }
+ pluginParam = strcpyrealloc(pluginParam, PluginParam);
+ }
+}
+
+#endif /* PLUGINPARAM */
+
#define STRDIFF 0x01
#define VALDIFF 0x02
@@ -652,7 +708,11 @@
if (isdigit(type))
type = 'S';
#define ST(s) if (strchr(s, type))
+#ifdef USE_PLUGINPARAM
+ char buffer[256];
+#else
char buffer[64];
+#endif /* PLUGINPARAM */
char *q = buffer;
*q = 0;
ST(" S ") q += sprintf(q, "%c", polarization);
@@ -666,6 +726,9 @@
ST(" S ") q += PrintParameter(q, 'S', MapToUser(system, SystemValues));
ST(" T") q += PrintParameter(q, 'T', MapToUser(transmission, TransmissionValues));
ST(" T") q += PrintParameter(q, 'Y', MapToUser(hierarchy, HierarchyValues));
+#ifdef USE_PLUGINPARAM
+ ST("P ") snprintf(buffer, sizeof(buffer), "%s", pluginParam);
+#endif /* PLUGINPARAM */
return buffer;
}
@@ -694,7 +757,11 @@
bool cChannel::StringToParameters(const char *s)
{
+#ifdef USE_PLUGINPARAM
+ while (s && *s && !IsPlug()) {
+#else
while (s && *s) {
+#endif /* PLUGINPARAM */
switch (toupper(*s)) {
case 'A': s = SkipDigits(s); break; // for compatibility with the "multiproto" approach - may be removed in future versions
case 'B': s = ParseParameter(s, bandwidth, BandwidthValues); break;
@@ -814,7 +881,11 @@
dpids[0] = 0;
ok = false;
if (parambuf && sourcebuf && vpidbuf && apidbuf) {
+#ifdef USE_PLUGINPARAM
+ ok = ((source = cSource::FromString(sourcebuf)) >= 0) && StringToParameters(parambuf);
+#else
ok = StringToParameters(parambuf) && (source = cSource::FromString(sourcebuf)) >= 0;
+#endif /* PLUGINPARAM */
char *p;
if ((p = strchr(vpidbuf, '=')) != NULL) {
@@ -911,6 +982,9 @@
shortName = strcpyrealloc(shortName, p);
}
name = strcpyrealloc(name, namebuf);
+#ifdef USE_PLUGINPARAM
+ if (IsPlug()) pluginParam = strcpyrealloc(pluginParam, parambuf);
+#endif /* PLUGINPARAM */
free(parambuf);
free(sourcebuf);
@@ -989,6 +1063,50 @@
return false;
}
+#ifdef USE_ALTERNATECHANNEL
+bool cChannels::LoadAlternativeChannels(const char *FileName)
+{
+ FILE *fp;
+ char *line;
+ cReadLine ReadLine;
+ cChannel *origChannel;
+ tChannelID channelID;
+ if ((fp = fopen(FileName,"r"))==NULL)
+ {
+ esyslog("Can't open Alternative Channels-File <%s>",FileName);
+ return false;
+ }
+ while ((line = ReadLine.Read(fp)) != NULL)
+ {
+ if (line[0] != '#')
+ {
+ line=strtok(line, ";");
+ if (line != NULL)
+ {
+ channelID = tChannelID::FromString(line);
+ if (channelID == tChannelID::InvalidID)
+ dsyslog("Skipping invalid channel ID <%s>",line);
+ else {
+ origChannel = Channels.GetByChannelID(channelID);
+ if (!origChannel)
+ dsyslog("Skipping unknown channel ID <%s>",line);
+ else {
+ line=strtok(NULL, ";");
+ channelID = tChannelID::FromString(line);
+ if (channelID == tChannelID::InvalidID || !Channels.GetByChannelID(channelID))
+ dsyslog("Skipping invalid/unknown alternative channel ID <%s>",line);
+ else
+ origChannel->SetAlternativeChannelID(line);
+ }
+ }
+ }
+ }
+ } while (line != NULL);
+ fclose(fp);
+ return true;
+}
+#endif /* ALTERNATECHANNEL */
+
void cChannels::HashChannel(cChannel *Channel)
{
channelsHashSid.Add(Channel, Channel->Sid());
diff -ruN vdr-1.7.12/channels.h vdr-1.7.12.ExtP_NG/channels.h
--- vdr-1.7.12/channels.h 2009-12-06 13:57:45.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/channels.h 2010-02-03 22:16:53.832031957 +0100
@@ -116,6 +116,12 @@
char *shortName;
char *provider;
char *portalName;
+#ifdef USE_ALTERNATECHANNEL
+ tChannelID alternativeChannelID;
+#endif /* ALTERNATECHANNEL */
+#ifdef USE_PLUGINPARAM
+ char *pluginParam;
+#endif /* PLUGINPARAM */
int __BeginData__;
int frequency; // MHz
int source;
@@ -171,9 +177,15 @@
const char *ShortName(bool OrName = false) const { return (OrName && isempty(shortName)) ? name : shortName; }
const char *Provider(void) const { return provider; }
const char *PortalName(void) const { return portalName; }
+#ifdef USE_ALTERNATECHANNEL
+ const tChannelID AlternativeChannelID(void) const { return alternativeChannelID; }
+#endif /* ALTERNATECHANNEL */
int Frequency(void) const { return frequency; } ///< Returns the actual frequency, as given in 'channels.conf'
int Transponder(void) const; ///< Returns the transponder frequency in MHz, plus the polarization in case of sat
static int Transponder(int Frequency, char Polarization); ///< builds the transponder from the given Frequency and Polarization
+#ifdef USE_PLUGINPARAM
+ const char *PluginParam(void) const { return pluginParam; }
+#endif /* PLUGINPARAM */
int Source(void) const { return source; }
int Srate(void) const { return srate; }
int Vpid(void) const { return vpid; }
@@ -214,6 +226,9 @@
int RollOff(void) const { return rollOff; }
const cLinkChannels* LinkChannels(void) const { return linkChannels; }
const cChannel *RefChannel(void) const { return refChannel; }
+#ifdef USE_PLUGINPARAM
+ bool IsPlug(void) const { return cSource::IsPlug(source); }
+#endif /* PLUGINPARAM */
bool IsCable(void) const { return cSource::IsCable(source); }
bool IsSat(void) const { return cSource::IsSat(source); }
bool IsTerr(void) const { return cSource::IsTerr(source); }
@@ -221,12 +236,21 @@
bool HasTimer(void) const;
int Modification(int Mask = CHANNELMOD_ALL);
void CopyTransponderData(const cChannel *Channel);
+#ifdef USE_PLUGINPARAM
+ bool SetPlugTransponderData(int Source, int Frequency, const char *PluginParam);
+#endif /* PLUGINPARAM */
bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation, int System, int RollOff);
bool SetCableTransponderData(int Source, int Frequency, int Modulation, int Srate, int CoderateH);
bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission);
void SetId(int Nid, int Tid, int Sid, int Rid = 0);
void SetName(const char *Name, const char *ShortName, const char *Provider);
void SetPortalName(const char *PortalName);
+#ifdef USE_ALTERNATECHANNEL
+ void SetAlternativeChannelID(const char *AlternativeChannelID);
+#endif /* ALTERNATECHANNEL */
+#ifdef USE_PLUGINPARAM
+ void SetPluginParam(const char *PluginParam);
+#endif /* PLUGINPARAM */
void SetPids(int Vpid, int Ppid, int Vtype, int *Apids, char ALangs[][MAXLANGCODE2], int *Dpids, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid);
void SetCaIds(const int *CaIds); // list must be zero-terminated
void SetCaDescriptors(int Level);
@@ -245,6 +269,9 @@
public:
cChannels(void);
bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false);
+#ifdef USE_ALTERNATECHANNEL
+ bool LoadAlternativeChannels(const char *FileName);
+#endif /* ALTERNATECHANNEL */
void HashChannel(cChannel *Channel);
void UnhashChannel(cChannel *Channel);
int GetNextGroup(int Idx); // Get next channel group
diff -ruN vdr-1.7.12/config.c vdr-1.7.12.ExtP_NG/config.c
--- vdr-1.7.12/config.c 2010-01-31 13:36:36.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/config.c 2010-02-03 22:16:53.883036392 +0100
@@ -15,6 +15,9 @@
#include "interface.h"
#include "plugin.h"
#include "recording.h"
+#ifdef USE_SOURCECAPS
+#include "sources.h"
+#endif /* SOURCECAPS */
// IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
// format characters in order to allow any number of blanks after a numeric
@@ -331,6 +334,10 @@
TimeTransponder = 0;
MarginStart = 2;
MarginStop = 10;
+#ifdef USE_JUMPINGSECONDS
+ JumpSeconds = 60;
+ JumpSecondsRepeat = 300;
+#endif /* JUMPINGSECONDS */
AudioLanguages[0] = -1;
DisplaySubtitles = 0;
SubtitleLanguages[0] = -1;
@@ -338,6 +345,12 @@
SubtitleFgTransparency = 0;
SubtitleBgTransparency = 0;
EPGLanguages[0] = -1;
+#ifdef USE_DDEPGENTRY
+ DoubleEpgTimeDelta = 15;
+ DoubleEpgAction = 0;
+ MixEpgAction = 0;
+ DisableVPS = 0;
+#endif /* DDEPGENTRY */
EPGScanTimeout = 5;
EPGBugfixLevel = 3;
EPGLinger = 0;
@@ -354,9 +367,16 @@
UseVps = 0;
VpsMargin = 120;
RecordingDirs = 1;
+#ifdef USE_SORTRECORDS
+ SortRecords = 2;
+ SortRecordsHelper = 2;
+#endif /* SORTRECORDS */
VideoDisplayFormat = 1;
VideoFormat = 0;
UpdateChannels = 5;
+#ifdef USE_CHANNELBIND
+ ChannelBindingByRid = 0;
+#endif /* CHANNELBIND */
UseDolbyDigital = 1;
ChannelInfoPos = 0;
ChannelInfoTime = 5;
@@ -382,25 +402,97 @@
FontSmlSize = 18;
FontFixSize = 20;
MaxVideoFileSize = MAXVIDEOFILESIZEDEFAULT;
+#ifdef USE_HARDLINKCUTTER
+ MaxRecordingSize = DEFAULTRECORDINGSIZE;
+ HardLinkCutter = 0;
+#endif /* HARDLINKCUTTER */
SplitEditedFiles = 0;
+#ifdef USE_DELTIMESHIFTREC
+ DelTimeshiftRec = 0;
+#endif /* DELTIMESHIFTREC */
MinEventTimeout = 30;
MinUserInactivity = 300;
NextWakeupTime = 0;
MultiSpeedMode = 0;
ShowReplayMode = 0;
ResumeID = 0;
+#ifdef USE_JUMPPLAY
+ JumpPlay = 0;
+ PlayJump = 0;
+ PauseLastMark = 0;
+ ReloadMarks = 0;
+#endif /* JUMPPLAY */
+#ifdef USE_SOURCECAPS
+ memset(SourceCaps, 0, sizeof SourceCaps);
+ SourceCapsSet = false;
+#endif /* SOURCECAPS */
CurrentChannel = -1;
CurrentVolume = MAXVOLUME;
CurrentDolby = 0;
+#ifdef USE_DVDARCHIVE
+ TrayOpenOnBegin = 1;
+ TrayOpenOnEnd = 1;
+#endif /* DVDARCHIVE */
InitialChannel = 0;
InitialVolume = -1;
+#ifdef USE_VOLCTRL
+ LRVolumeControl = 0;
+ LRChannelGroups = 1;
+ LRForwardRewind = 1;
+#endif /* VOLCTRL */
ChannelsWrap = 0;
EmergencyExit = 1;
+#ifdef USE_LIRCSETTINGS
+ LircRepeatDelay = 350;
+ LircRepeatFreq = 100;
+ LircRepeatTimeout = 500;
+#endif /* LIRCSETTINGS */
+#ifdef USE_LIEMIEXT
+ ShowRecDate = 1;
+ ShowRecTime = 1;
+ ShowRecLength = 0;
+ ShowProgressBar = 0;
+ MenuCmdPosition = 0;
+#endif /* LIEMIEXT */
+#ifdef USE_LNBSHARE
+ VerboseLNBlog = 0;
+ for (int i = 0; i < MAXDEVICES; i++) CardUsesLNBnr[i] = i + 1;
+#endif /* LNBSHARE */
+#ifdef USE_NOEPG
+ noEPGMode=0;
+ noEPGList=strdup("");
+#endif /* NOEPG */
+#ifdef USE_DVLFRIENDLYFNAMES
+ UseFriendlyFNames = 0; // default = disabled
+#endif /* DVLFRIENDLYFNAMES */
+#ifdef USE_DVLVIDPREFER
+ UseVidPrefer = 0; // default = disabled
+ nVidPrefer = 1;
+ for (int zz = 1; zz < DVLVIDPREFER_MAX; zz++) {
+ VidPreferPrio[ zz ] = 50;
+ VidPreferSize[ zz ] = 100;
+ }
+ VidPreferSize[ 0 ] = 800;
+ VidPreferPrio[ 0 ] = 50;
+#endif /* DVLVIDPREFER */
+
+
+}
+
+#ifdef USE_NOEPG
+cSetup::~cSetup()
+{
+ free(noEPGList);
}
+#endif /* NOEPG */
cSetup& cSetup::operator= (const cSetup &s)
{
memcpy(&__BeginData__, &s.__BeginData__, (char *)&s.__EndData__ - (char *)&s.__BeginData__);
+#ifdef USE_NOEPG
+ free(noEPGList);
+ noEPGList = strdup(s.noEPGList);
+#endif /* NOEPG */
return *this;
}
@@ -496,6 +588,51 @@
return true;
}
+#ifdef USE_SOURCECAPS
+void cSetup::StoreSourceCaps(const char *Name)
+{
+ cSetupLine *l;
+ while ((l = Get(Name)) != NULL)
+ Del(l);
+
+ for (int i = 0; i < MAXDEVICES; i++) {
+ char buffer[MAXSOURCECAPS*8]={0,}, *q = buffer;
+ int j = 0;
+ while (SourceCaps[i][j] && j < MAXSOURCECAPS) {
+ if (j==0)
+ q += snprintf(buffer, sizeof(buffer), "%i ", i+1);
+ q += snprintf(q, sizeof(buffer) - (q-buffer), "%s ", *cSource::ToString(SourceCaps[i][j++]));
+ }
+ if (*buffer)
+ Store(Name, buffer, NULL, true);
+ }
+}
+
+bool cSetup::ParseSourceCaps(const char *Value)
+{
+ char *p;
+ int d = strtol(Value, &p, 10)-1, i = 0;
+ while (p < Value+strlen(Value)) {
+ if (*p==0) return true;
+ if (isblank(*p)) ++p;
+ if (isalpha(*p)) {
+ int source = cSource::FromString(p);
+ if (source != cSource::stNone) {
+ SourceCaps[d][i++] = source;
+ SourceCapsSet = true;
+ }
+ else
+ return false;
+ while (!isblank(*p) && *p)
+ ++p;
+ if (i>MAXSOURCECAPS)
+ return false;
+ }
+ }
+ return true;
+}
+#endif /* SOURCECAPS */
+
bool cSetup::Parse(const char *Name, const char *Value)
{
if (!strcasecmp(Name, "OSDLanguage")) { strn0cpy(OSDLanguage, Value, sizeof(OSDLanguage)); I18nSetLocale(OSDLanguage); }
@@ -519,6 +656,10 @@
else if (!strcasecmp(Name, "TimeTransponder")) TimeTransponder = atoi(Value);
else if (!strcasecmp(Name, "MarginStart")) MarginStart = atoi(Value);
else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value);
+#ifdef USE_JUMPINGSECONDS
+ else if (!strcasecmp(Name, "JumpSeconds")) JumpSeconds = atoi(Value);
+ else if (!strcasecmp(Name, "JumpSecondsRepeat")) JumpSecondsRepeat = atoi(Value);
+#endif /* JUMPINGSECONDS */
else if (!strcasecmp(Name, "AudioLanguages")) return ParseLanguages(Value, AudioLanguages);
else if (!strcasecmp(Name, "DisplaySubtitles")) DisplaySubtitles = atoi(Value);
else if (!strcasecmp(Name, "SubtitleLanguages")) return ParseLanguages(Value, SubtitleLanguages);
@@ -526,6 +667,12 @@
else if (!strcasecmp(Name, "SubtitleFgTransparency")) SubtitleFgTransparency = atoi(Value);
else if (!strcasecmp(Name, "SubtitleBgTransparency")) SubtitleBgTransparency = atoi(Value);
else if (!strcasecmp(Name, "EPGLanguages")) return ParseLanguages(Value, EPGLanguages);
+#ifdef USE_DDEPGENTRY
+ else if (!strcasecmp(Name, "DoubleEpgTimeDelta")) DoubleEpgTimeDelta = atoi(Value);
+ else if (!strcasecmp(Name, "DoubleEpgAction")) DoubleEpgAction = atoi(Value);
+ else if (!strcasecmp(Name, "MixEpgAction")) MixEpgAction = atoi(Value);
+ else if (!strcasecmp(Name, "DisableVPS")) DisableVPS = atoi(Value);
+#endif /* DDEPGENTRY */
else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value);
else if (!strcasecmp(Name, "EPGBugfixLevel")) EPGBugfixLevel = atoi(Value);
else if (!strcasecmp(Name, "EPGLinger")) EPGLinger = atoi(Value);
@@ -542,9 +689,16 @@
else if (!strcasecmp(Name, "UseVps")) UseVps = atoi(Value);
else if (!strcasecmp(Name, "VpsMargin")) VpsMargin = atoi(Value);
else if (!strcasecmp(Name, "RecordingDirs")) RecordingDirs = atoi(Value);
+#ifdef USE_SORTRECORDS
+ else if (!strcasecmp(Name, "SortRecords")) SortRecords = atoi(Value);
+ else if (!strcasecmp(Name, "SortRecordsHelper")) SortRecordsHelper = atoi(Value);
+#endif /* SORTRECORDS */
else if (!strcasecmp(Name, "VideoDisplayFormat")) VideoDisplayFormat = atoi(Value);
else if (!strcasecmp(Name, "VideoFormat")) VideoFormat = atoi(Value);
else if (!strcasecmp(Name, "UpdateChannels")) UpdateChannels = atoi(Value);
+#ifdef USE_CHANNELBIND
+ else if (!strcasecmp(Name, "ChannelBindingByRid")) ChannelBindingByRid= atoi(Value);
+#endif /* CHANNELBIND */
else if (!strcasecmp(Name, "UseDolbyDigital")) UseDolbyDigital = atoi(Value);
else if (!strcasecmp(Name, "ChannelInfoPos")) ChannelInfoPos = atoi(Value);
else if (!strcasecmp(Name, "ChannelInfoTime")) ChannelInfoTime = atoi(Value);
@@ -570,22 +724,113 @@
else if (!strcasecmp(Name, "FontSmlSize")) FontSmlSize = atoi(Value);
else if (!strcasecmp(Name, "FontFixSize")) FontFixSize = atoi(Value);
else if (!strcasecmp(Name, "MaxVideoFileSize")) MaxVideoFileSize = atoi(Value);
+#ifdef USE_HARDLINKCUTTER
+ else if (!strcasecmp(Name, "MaxRecordingSize")) MaxRecordingSize = atoi(Value);
+ else if (!strcasecmp(Name, "HardLinkCutter")) HardLinkCutter = atoi(Value);
+#endif /* HARDLINKCUTTER */
else if (!strcasecmp(Name, "SplitEditedFiles")) SplitEditedFiles = atoi(Value);
+#ifdef USE_DELTIMESHIFTREC
+ else if (!strcasecmp(Name, "DelTimeshiftRec")) DelTimeshiftRec = atoi(Value);
+#endif /* DELTIMESHIFTREC */
else if (!strcasecmp(Name, "MinEventTimeout")) MinEventTimeout = atoi(Value);
else if (!strcasecmp(Name, "MinUserInactivity")) MinUserInactivity = atoi(Value);
else if (!strcasecmp(Name, "NextWakeupTime")) NextWakeupTime = atoi(Value);
else if (!strcasecmp(Name, "MultiSpeedMode")) MultiSpeedMode = atoi(Value);
else if (!strcasecmp(Name, "ShowReplayMode")) ShowReplayMode = atoi(Value);
else if (!strcasecmp(Name, "ResumeID")) ResumeID = atoi(Value);
+#ifdef USE_JUMPPLAY
+ else if (!strcasecmp(Name, "JumpPlay")) JumpPlay = atoi(Value);
+ else if (!strcasecmp(Name, "PlayJump")) PlayJump = atoi(Value);
+ else if (!strcasecmp(Name, "PauseLastMark")) PauseLastMark = atoi(Value);
+ else if (!strcasecmp(Name, "ReloadMarks")) ReloadMarks = atoi(Value);
+#endif /* JUMPPLAY */
+#ifdef USE_SOURCECAPS
+ else if (!strcasecmp(Name, "SourceCaps")) return ParseSourceCaps(Value);
+#endif /* SOURCECAPS */
else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value);
else if (!strcasecmp(Name, "CurrentVolume")) CurrentVolume = atoi(Value);
else if (!strcasecmp(Name, "CurrentDolby")) CurrentDolby = atoi(Value);
+#ifdef USE_DVDARCHIVE
+ else if (!strcasecmp(Name, "TrayOpenOnBegin")) TrayOpenOnBegin = atoi(Value);
+ else if (!strcasecmp(Name, "TrayOpenOnEnd")) TrayOpenOnEnd = atoi(Value);
+#endif /* DVDARCHIVE */
else if (!strcasecmp(Name, "InitialChannel")) InitialChannel = atoi(Value);
else if (!strcasecmp(Name, "InitialVolume")) InitialVolume = atoi(Value);
+#ifdef USE_VOLCTRL
+ else if (!strcasecmp(Name, "LRVolumeControl")) LRVolumeControl = atoi(Value);
+ else if (!strcasecmp(Name, "LRChannelGroups")) LRChannelGroups = atoi(Value);
+ else if (!strcasecmp(Name, "LRForwardRewind")) LRForwardRewind = atoi(Value);
+#endif /* VOLCTRL */
else if (!strcasecmp(Name, "ChannelsWrap")) ChannelsWrap = atoi(Value);
else if (!strcasecmp(Name, "EmergencyExit")) EmergencyExit = atoi(Value);
+#ifdef USE_LIRCSETTINGS
+ else if (!strcasecmp(Name, "LircRepeatDelay")) LircRepeatDelay = atoi(Value);
+ else if (!strcasecmp(Name, "LircRepeatFreq")) LircRepeatFreq = atoi(Value);
+ else if (!strcasecmp(Name, "LircRepeatTimeout")) LircRepeatTimeout = atoi(Value);
+#endif /* LIRCSETTINGS */
+#ifdef USE_LIEMIEXT
+ else if (!strcasecmp(Name, "ShowRecDate")) ShowRecDate = atoi(Value);
+ else if (!strcasecmp(Name, "ShowRecTime")) ShowRecTime = atoi(Value);
+ else if (!strcasecmp(Name, "ShowRecLength")) ShowRecLength = atoi(Value);
+ else if (!strcasecmp(Name, "ShowProgressBar")) ShowProgressBar = atoi(Value);
+ else if (!strcasecmp(Name, "MenuCmdPosition")) MenuCmdPosition = atoi(Value);
+#endif /* LIEMIEXT */
+#ifdef USE_NOEPG
+ else if (!strcasecmp(Name, "noEPGMode")) noEPGMode = atoi(Value);
+ else if (!strcasecmp(Name, "noEPGList")) {
+ free(noEPGList);
+ noEPGList=strdup(Value ? Value : "");
+ }
+#endif /* NOEPG */
+#ifdef USE_DVLFRIENDLYFNAMES
+ else if (strcasecmp(Name, "UseFriendlyFNames") == 0) UseFriendlyFNames = atoi(Value);
+#endif /* DVLFRIENDLYFNAMES */
+#ifdef USE_DVLVIDPREFER
+ else if (strcasecmp(Name, "UseVidPrefer") == 0) UseVidPrefer = atoi(Value);
+ else if (strcasecmp(Name, "nVidPrefer") == 0) nVidPrefer = atoi(Value);
+ else if (strstr(Name, "VidPrefer") == Name) {
+ char *x = (char *)&Name[ strlen(Name) - 1 ];
+ int vN;
+
+ if (isdigit(*x) != 0) {
+ while (isdigit(*x) != 0)
+ x--;
+ x++;
+ }
+
+ vN = atoi(x);
+ if (vN < DVLVIDPREFER_MAX) {
+ if (strstr(Name, "VidPreferPrio") == Name) {
+ VidPreferPrio[ vN ] = atoi(Value);
+ if (VidPreferPrio[ vN ] > 99)
+ VidPreferPrio[ vN ] = 99;
+ }
+ else if (strstr(Name, "VidPreferSize") == Name) {
+ VidPreferSize[ vN ] = atoi(Value);
+ }
+ else
+ return false;
+ }
+ }
+#endif /* DVLVIDPREFER */
else
+#ifdef USE_LNBSHARE
+ if (!strcasecmp(Name, "VerboseLNBlog")) VerboseLNBlog = atoi(Value);
+ else {
+ char tmp[20];
+ bool result = false;
+ for (int i = 1; i <= MAXDEVICES; i++) {
+ sprintf(tmp, "Card%dusesLNBnr", i);
+ if (!strcasecmp(Name, tmp)) {
+ CardUsesLNBnr[i - 1] = atoi(Value);
+ result = true;
+ }
+ }
+ return result;
+ }
+#else
return false;
+#endif /* LNBSHARE */
return true;
}
@@ -612,6 +857,10 @@
Store("TimeTransponder", TimeTransponder);
Store("MarginStart", MarginStart);
Store("MarginStop", MarginStop);
+#ifdef USE_JUMPINGSECONDS
+ Store("JumpSeconds", JumpSeconds);
+ Store("JumpSecondsRepeat", JumpSecondsRepeat);
+#endif /* JUMPINGSECONDS */
StoreLanguages("AudioLanguages", AudioLanguages);
Store("DisplaySubtitles", DisplaySubtitles);
StoreLanguages("SubtitleLanguages", SubtitleLanguages);
@@ -619,6 +868,12 @@
Store("SubtitleFgTransparency", SubtitleFgTransparency);
Store("SubtitleBgTransparency", SubtitleBgTransparency);
StoreLanguages("EPGLanguages", EPGLanguages);
+#ifdef USE_DDEPGENTRY
+ Store("DoubleEpgTimeDelta", DoubleEpgTimeDelta);
+ Store("DoubleEpgAction", DoubleEpgAction);
+ Store("MixEpgAction", MixEpgAction);
+ Store("DisableVPS", DisableVPS);
+#endif /* DDEPGENTRY */
Store("EPGScanTimeout", EPGScanTimeout);
Store("EPGBugfixLevel", EPGBugfixLevel);
Store("EPGLinger", EPGLinger);
@@ -635,9 +890,16 @@
Store("UseVps", UseVps);
Store("VpsMargin", VpsMargin);
Store("RecordingDirs", RecordingDirs);
+#ifdef USE_SORTRECORDS
+ Store("SortRecords", SortRecords);
+ Store("SortRecordsHelper", SortRecordsHelper);
+#endif /* SORTRECORDS */
Store("VideoDisplayFormat", VideoDisplayFormat);
Store("VideoFormat", VideoFormat);
Store("UpdateChannels", UpdateChannels);
+#ifdef USE_CHANNELBIND
+ Store("ChannelBindingByRid",ChannelBindingByRid);
+#endif /* CHANNELBIND */
Store("UseDolbyDigital", UseDolbyDigital);
Store("ChannelInfoPos", ChannelInfoPos);
Store("ChannelInfoTime", ChannelInfoTime);
@@ -664,19 +926,82 @@
Store("FontFixSize", FontFixSize);
Store("MaxVideoFileSize", MaxVideoFileSize);
Store("SplitEditedFiles", SplitEditedFiles);
+#ifdef USE_DELTIMESHIFTREC
+ Store("DelTimeshiftRec", DelTimeshiftRec);
+#endif /* DELTIMESHIFTREC */
Store("MinEventTimeout", MinEventTimeout);
Store("MinUserInactivity", MinUserInactivity);
Store("NextWakeupTime", NextWakeupTime);
Store("MultiSpeedMode", MultiSpeedMode);
Store("ShowReplayMode", ShowReplayMode);
Store("ResumeID", ResumeID);
+#ifdef USE_JUMPPLAY
+ Store("JumpPlay", JumpPlay);
+ Store("PlayJump", PlayJump);
+ Store("PauseLastMark", PauseLastMark);
+ Store("ReloadMarks", ReloadMarks);
+#endif /* JUMPPLAY */
+#ifdef USE_SOURCECAPS
+ if (SourceCapsSet) StoreSourceCaps("SourceCaps");
+#endif /* SOURCECAPS */
Store("CurrentChannel", CurrentChannel);
Store("CurrentVolume", CurrentVolume);
Store("CurrentDolby", CurrentDolby);
+#ifdef USE_DVDARCHIVE
+ Store("TrayOpenOnBegin", TrayOpenOnBegin);
+ Store("TrayOpenOnEnd", TrayOpenOnEnd);
+#endif /* DVDARCHIVE */
Store("InitialChannel", InitialChannel);
Store("InitialVolume", InitialVolume);
+#ifdef USE_VOLCTRL
+ Store("LRVolumeControl", LRVolumeControl);
+ Store("LRChannelGroups", LRChannelGroups);
+ Store("LRForwardRewind", LRForwardRewind);
+#endif /* VOLCTRL */
Store("ChannelsWrap", ChannelsWrap);
Store("EmergencyExit", EmergencyExit);
+#ifdef USE_LIRCSETTINGS
+ Store("LircRepeatDelay", LircRepeatDelay);
+ Store("LircRepeatFreq", LircRepeatFreq);
+ Store("LircRepeatTimeout", LircRepeatTimeout);
+#endif /* LIRCSETTINGS */
+#ifdef USE_LIEMIEXT
+ Store("ShowRecDate", ShowRecDate);
+ Store("ShowRecTime", ShowRecTime);
+ Store("ShowRecLength", ShowRecLength);
+ Store("ShowProgressBar", ShowProgressBar);
+ Store("MenuCmdPosition", MenuCmdPosition);
+#endif /* LIEMIEXT */
+#ifdef USE_NOEPG
+ Store("noEPGMode", noEPGMode);
+ Store("noEPGList", noEPGList);
+#endif /* NOEPG */
+
+#ifdef USE_LNBSHARE
+ Store("VerboseLNBlog", VerboseLNBlog);
+ char tmp[20];
+ if (cDevice::NumDevices() > 1) {
+ for (int i = 1; i <= cDevice::NumDevices(); i++) {
+ sprintf(tmp, "Card%dusesLNBnr", i);
+ Store(tmp, CardUsesLNBnr[i - 1]);
+ }
+ }
+#endif /* LNBSHARE */
+#ifdef USE_DVLFRIENDLYFNAMES
+ Store ("UseFriendlyFNames", UseFriendlyFNames);
+#endif /* DVLFRIENDLYFNAMES */
+#ifdef USE_DVLVIDPREFER
+ Store ("UseVidPrefer", UseVidPrefer);
+ Store ("nVidPrefer", nVidPrefer);
+
+ char vidBuf[32];
+ for (int zz = 0; zz < nVidPrefer; zz++) {
+ sprintf(vidBuf, "VidPreferPrio%d", zz);
+ Store (vidBuf, VidPreferPrio[zz]);
+ sprintf(vidBuf, "VidPreferSize%d", zz);
+ Store (vidBuf, VidPreferSize[zz]);
+ }
+#endif /* DVLVIDPREFER */
Sort();
diff -ruN vdr-1.7.12/config.h vdr-1.7.12.ExtP_NG/config.h
--- vdr-1.7.12/config.h 2010-01-31 12:14:02.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/config.h 2010-02-03 22:16:53.892033984 +0100
@@ -30,20 +30,53 @@
#define APIVERSION "1.7.12"
#define APIVERSNUM 10712 // Version * 10000 + Major * 100 + Minor
+#ifdef USE_YAEPG
+#define YAEPGHDVERSNUM 1
+#endif /* YAEPG */
+
// When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to
// VDR header files since the last APIVERSION. This allows compiled
// plugins to work with newer versions of the core VDR as long as no
// VDR header files have changed.
+#ifdef USE_CHANNELBIND
+#define CHANNELBINDINGVERSNUM 2
+#endif /* CHANNELBIND */
+
+#ifdef USE_JUMPPLAY
+#define JUMPPLAYVERSNUM 100
+#endif /* JUMPPLAY */
+
+#ifdef USE_LIEMIEXT
+#define LIEMIKUUTIO 129
+#endif /* LIEMIEXT */
+
+#ifdef USE_MAINMENUHOOKS
+#define MAINMENUHOOKSVERSNUM 1.0
+#endif /* MAINMENUHOOKS */
+
+#ifdef USE_PLUGINPARAM
+#define PLUGINPARAMPATCHVERSNUM 1
+#endif /* PLUGINPARAM */
+
#define MAXPRIORITY 99
#define MAXLIFETIME 99
+#ifdef USE_DVLVIDPREFER
+#define DVLVIDPREFER_MAX 12
+#endif /* DVLVIDPREFER */
+
#define MINOSDWIDTH 480
#define MAXOSDWIDTH 1920
#define MINOSDHEIGHT 324
#define MAXOSDHEIGHT 1200
+#ifdef USE_SOURCECAPS
+#define MAXDEVICES 16 // the maximum number of devices in the system
+#define MAXSOURCECAPS 128 // the maximum number of different sources per device
+#endif /* SOURCECAPS */
+
#define MaxFileName 256
#define MaxSkinName 16
#define MaxThemeName 16
@@ -206,6 +239,10 @@
void StoreLanguages(const char *Name, int *Values);
bool ParseLanguages(const char *Value, int *Values);
bool Parse(const char *Name, const char *Value);
+#ifdef USE_SOURCECAPS
+ void StoreSourceCaps(const char *Name);
+ bool ParseSourceCaps(const char *Value);
+#endif /* SOURCECAPS */
cSetupLine *Get(const char *Name, const char *Plugin = NULL);
void Store(const char *Name, const char *Value, const char *Plugin = NULL, bool AllowMultiple = false);
void Store(const char *Name, int Value, const char *Plugin = NULL);
@@ -233,12 +270,21 @@
int TimeSource;
int TimeTransponder;
int MarginStart, MarginStop;
+#ifdef USE_JUMPINGSECONDS
+ int JumpSeconds, JumpSecondsRepeat;
+#endif /* JUMPINGSECONDS */
int AudioLanguages[I18N_MAX_LANGUAGES + 1];
int DisplaySubtitles;
int SubtitleLanguages[I18N_MAX_LANGUAGES + 1];
int SubtitleOffset;
int SubtitleFgTransparency, SubtitleBgTransparency;
int EPGLanguages[I18N_MAX_LANGUAGES + 1];
+#ifdef USE_DDEPGENTRY
+ int DoubleEpgTimeDelta;
+ int DoubleEpgAction;
+ int MixEpgAction;
+ int DisableVPS;
+#endif /* DDEPPGENTRY */
int EPGScanTimeout;
int EPGBugfixLevel;
int EPGLinger;
@@ -253,9 +299,16 @@
int UseVps;
int VpsMargin;
int RecordingDirs;
+#ifdef USE_SORTRECORDS
+ int SortRecords;
+ int SortRecordsHelper;
+#endif /* SORTRECORDS */
int VideoDisplayFormat;
int VideoFormat;
int UpdateChannels;
+#ifdef USE_CHANNELBIND
+ int ChannelBindingByRid;
+#endif /* CHANNELBIND */
int UseDolbyDigital;
int ChannelInfoPos;
int ChannelInfoTime;
@@ -275,21 +328,80 @@
int FontSmlSize;
int FontFixSize;
int MaxVideoFileSize;
+#ifdef USE_HARDLINKCUTTER
+ int MaxRecordingSize;
+ int HardLinkCutter;
+#endif /* HARDLINKCUTTER */
int SplitEditedFiles;
+#ifdef USE_DELTIMESHIFTREC
+ int DelTimeshiftRec;
+#endif /* DELTIMESHIFTREC */
int MinEventTimeout, MinUserInactivity;
time_t NextWakeupTime;
int MultiSpeedMode;
int ShowReplayMode;
int ResumeID;
+#ifdef USE_JUMPPLAY
+ int JumpPlay;
+ int PlayJump;
+ int PauseLastMark;
+ int ReloadMarks;
+#endif /* JUMPPLAY */
+#ifdef USE_SOURCECAPS
+ int SourceCaps[MAXDEVICES][MAXSOURCECAPS];
+ bool SourceCapsSet;
+#endif /* SOURCECAPS */
int CurrentChannel;
+#ifdef USE_NOEPG
+ int noEPGMode;
+#endif /* NOEPG */
int CurrentVolume;
int CurrentDolby;
+#ifdef USE_DVDARCHIVE
+ int TrayOpenOnBegin;
+ int TrayOpenOnEnd;
+#endif /* DVDARCHIVE */
int InitialChannel;
int InitialVolume;
+#ifdef USE_VOLCTRL
+ int LRVolumeControl;
+ int LRChannelGroups;
+ int LRForwardRewind;
+#endif /* VOLCTRL */
int ChannelsWrap;
int EmergencyExit;
+#ifdef USE_LIRCSETTINGS
+ int LircRepeatDelay;
+ int LircRepeatFreq;
+ int LircRepeatTimeout;
+#endif /* LIRCSETTINGS */
+#ifdef USE_LIEMIEXT
+ int ShowRecDate, ShowRecTime, ShowRecLength, ShowProgressBar, MenuCmdPosition;
+#endif /* LIEMIEXT */
+#ifdef USE_LNBSHARE
+ int VerboseLNBlog;
+ #define MAXDEVICES 16 // Since VDR 1.3.32 we can not #include "device.h" for MAXDEVICES anymore.
+ // With this workaround a warning will be shown during compilation if
+ // MAXDEVICES changes in device.h.
+ int CardUsesLNBnr[MAXDEVICES];
+#endif /* LNBSHARE */
+#ifdef USE_NOEPG
+ char *noEPGList; // pointer not to be flat-copied
+#endif /* NOEPG */
+#ifdef USE_DVLFRIENDLYFNAMES
+ int UseFriendlyFNames;
+#endif /* DVLFRIENDLYFNAMES */
+#ifdef USE_DVLVIDPREFER
+ int UseVidPrefer; // 0 = VDR's default, 1 = use
+ int nVidPrefer;
+ int VidPreferPrio[DVLVIDPREFER_MAX];
+ int VidPreferSize[DVLVIDPREFER_MAX];
+#endif /* DVLVIDPREFER */
int __EndData__;
cSetup(void);
+#ifdef USE_NOEPG
+ ~cSetup();
+#endif /* NOEPG */
cSetup& operator= (const cSetup &s);
bool Load(const char *FileName);
bool Save(void);
diff -ruN vdr-1.7.12/cutter.c vdr-1.7.12.ExtP_NG/cutter.c
--- vdr-1.7.12/cutter.c 2010-01-02 14:08:08.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/cutter.c 2010-02-03 22:16:53.953033918 +0100
@@ -15,6 +15,19 @@
// --- cCuttingThread --------------------------------------------------------
+#ifdef USE_CUTTERLIMIT
+#ifndef CUTTER_MAX_BANDWIDTH
+#define CUTTER_MAX_BANDWIDTH MEGABYTE(10) // 10 MB/s
+#endif
+#ifndef CUTTER_REL_BANDWIDTH
+#define CUTTER_REL_BANDWIDTH 75 // %
+#endif
+#ifndef CUTTER_PRIORITY
+#define CUTTER_PRIORITY sched_get_priority_min(SCHED_OTHER)
+#endif
+#define CUTTER_TIMESLICE 100 // ms
+#endif /* CUTTERLIMIT */
+
class cCuttingThread : public cThread {
private:
const char *error;
@@ -67,6 +80,19 @@
void cCuttingThread::Action(void)
{
+#ifdef USE_CUTTERLIMIT
+ {
+ sched_param tmp;
+ tmp.sched_priority = CUTTER_PRIORITY;
+ if(!pthread_setschedparam(pthread_self(), SCHED_OTHER, &tmp))
+ printf("cCuttingThread::Action: cant set priority\n");
+ }
+
+ int bytes = 0;
+ int __attribute__((unused)) burst_size = CUTTER_MAX_BANDWIDTH * CUTTER_TIMESLICE / 1000; // max bytes/timeslice
+ cTimeMs __attribute__((unused)) t;
+#endif /* CUTTERLIMIT */
+
cMark *Mark = fromMarks.First();
if (Mark) {
fromFile = fromFileName->Open();
@@ -78,6 +104,9 @@
Mark = fromMarks.Next(Mark);
off_t FileSize = 0;
int CurrentFileNumber = 0;
+#ifdef USE_HARDLINKCUTTER
+ bool SkipThisSourceFile = false;
+#endif /* HARDLINKCUTTER */
int LastIFrame = 0;
toMarks.Add(0);
toMarks.Save();
@@ -96,12 +125,101 @@
// Read one frame:
+#ifdef USE_HARDLINKCUTTER
+ if (!fromIndex->Get(Index++, &FileNumber, &FileOffset, &Independent, &Length)) {
+ // Error, unless we're past last cut-in and there's no cut-out
+ if (Mark || LastMark)
+ error = "index";
+ break;
+ }
+
+ if (FileNumber != CurrentFileNumber) {
+ fromFile = fromFileName->SetOffset(FileNumber, FileOffset);
+ fromFile->SetReadAhead(MEGABYTE(20));
+ CurrentFileNumber = FileNumber;
+ if (SkipThisSourceFile) {
+ // At end of fast forward: Always skip to next file
+ toFile = toFileName->NextFile();
+ if (!toFile) {
+ error = "toFile 4";
+ break;
+ }
+ FileSize = 0;
+ SkipThisSourceFile = false;
+ }
+
+
+ if (Setup.HardLinkCutter && FileOffset == 0) {
+ // We are at the beginning of a new source file.
+ // Do we need to copy the whole file?
+
+ // if !Mark && LastMark, then we're past the last cut-out and continue to next I-frame
+ // if !Mark && !LastMark, then there's just a cut-in, but no cut-out
+ // if Mark, then we're between a cut-in and a cut-out
+
+ uint16_t MarkFileNumber;
+ off_t MarkFileOffset;
+ // Get file number of next cut mark
+ if (!Mark && !LastMark
+ || Mark
+ && fromIndex->Get(Mark->position, &MarkFileNumber, &MarkFileOffset)
+ && (MarkFileNumber != CurrentFileNumber)) {
+ // The current source file will be copied completely.
+ // Start new output file unless we did that already
+ if (FileSize != 0) {
+ toFile = toFileName->NextFile();
+ if (!toFile) {
+ error = "toFile 3";
+ break;
+ }
+ FileSize = 0;
+ }
+
+ // Safety check that file has zero size
+ struct stat buf;
+ if (stat(toFileName->Name(), &buf) == 0) {
+ if (buf.st_size != 0) {
+ esyslog("cCuttingThread: File %s exists and has nonzero size", toFileName->Name());
+ error = "nonzero file exist";
+ break;
+ }
+ }
+ else if (errno != ENOENT) {
+ esyslog("cCuttingThread: stat failed on %s", toFileName->Name());
+ error = "stat";
+ break;
+ }
+
+ // Clean the existing 0-byte file
+ toFileName->Close();
+ cString ActualToFileName(ReadLink(toFileName->Name()), true);
+ unlink(ActualToFileName);
+ unlink(toFileName->Name());
+
+ // Try to create a hard link
+ if (HardLinkVideoFile(fromFileName->Name(), toFileName->Name())) {
+ // Success. Skip all data transfer for this file
+ SkipThisSourceFile = true;
+ cutIn = false;
+ toFile = NULL; // was deleted by toFileName->Close()
+ }
+ else {
+ // Fallback: Re-open the file if necessary
+ toFile = toFileName->Open();
+ }
+ }
+ }
+ }
+
+ if (!SkipThisSourceFile) {
+#else
if (fromIndex->Get(Index++, &FileNumber, &FileOffset, &Independent, &Length)) {
if (FileNumber != CurrentFileNumber) {
fromFile = fromFileName->SetOffset(FileNumber, FileOffset);
fromFile->SetReadAhead(MEGABYTE(20));
CurrentFileNumber = FileNumber;
}
+#endif /* HARDLINKCUTTER */
if (fromFile) {
int len = ReadFrame(fromFile, buffer, Length, sizeof(buffer));
if (len < 0) {
@@ -118,19 +236,25 @@
break;
}
}
+#ifndef USE_HARDLINKCUTTER
else {
// Error, unless we're past the last cut-in and there's no cut-out
if (Mark || LastMark)
error = "index";
break;
}
+#endif /* HARDLINKCUTTER */
// Write one frame:
if (Independent) { // every file shall start with an independent frame
if (LastMark) // edited version shall end before next I-frame
break;
+#ifdef USE_HARDLINKCUTTER
+ if (!SkipThisSourceFile && FileSize > toFileName->MaxFileSize()) {
+#else
if (FileSize > maxVideoFileSize) {
+#endif /* HARDLINKCUTTER */
toFile = toFileName->NextFile();
if (!toFile) {
error = "toFile 1";
@@ -140,7 +264,11 @@
}
LastIFrame = 0;
+#ifdef USE_HARDLINKCUTTER
+ if (!SkipThisSourceFile && cutIn) {
+#else
if (cutIn) {
+#endif /* HARDLINKCUTTER */
if (isPesRecording)
cRemux::SetBrokenLink(buffer, Length);
else
@@ -148,7 +276,11 @@
cutIn = false;
}
}
+#ifdef USE_HARDLINKCUTTER
+ if (!SkipThisSourceFile && toFile->Write(buffer, Length) < 0) {
+#else
if (toFile->Write(buffer, Length) < 0) {
+#endif /* HARDLINKCUTTER */
error = "safe_write";
break;
}
@@ -183,8 +315,39 @@
}
}
else
+#ifdef USE_HARDLINKCUTTER
+ LastMark = true; // After last cut-out: Write on until next I-frame, then exit
+#else
LastMark = true;
+#endif /* HARDLINKCUTTER */
}
+
+#ifdef USE_CUTTERLIMIT
+ bytes += Length;
+ if(bytes >= burst_size) {
+ int elapsed = t.Elapsed();
+ int sleep = 0;
+
+#if CUTTER_REL_BANDWIDTH > 0 && CUTTER_REL_BANDWIDTH < 100
+ // stay under max. relative bandwidth
+
+ sleep = (elapsed * 100 / CUTTER_REL_BANDWIDTH) - elapsed;
+ //if(sleep<=0 && elapsed<=2) sleep = 1;
+ //if(sleep) esyslog("cutter: relative bandwidth limit, sleep %d ms (chunk %dk / %dms)", sleep, burst_size/1024, CUTTER_TIMESLICE);
+#endif
+ // stay under max. absolute bandwidth
+ if(elapsed < CUTTER_TIMESLICE) {
+ sleep = max(CUTTER_TIMESLICE - elapsed, sleep);
+ //if(sleep) esyslog("cutter: absolute bandwidth limit, sleep %d ms (chunk %dk / %dms)", sleep, burst_size/1024, CUTTER_TIMESLICE);
+ }
+
+ if(sleep>0)
+ cCondWait::SleepMs(sleep);
+ t.Set();
+ bytes = 0;
+ }
+#endif /* CUTTERLIMIT */
+
}
Recordings.TouchUpdate();
}
@@ -194,18 +357,80 @@
// --- cCutter ---------------------------------------------------------------
+#ifdef USE_CUTTERQUEUE
+#define WAIT_BEFORE_NEXT_CUT (10*1000) // 10 seconds
+
+class cStringListObject : public cListObject {
+ public:
+ cStringListObject(const char *s) { str = strdup(s); }
+ ~cStringListObject() { free(str); }
+
+ const char *Value() { return str; }
+ operator const char * () { return str; }
+
+ private:
+ char *str;
+};
+#endif /* CUTTERQUEUE */
+
char *cCutter::editedVersionName = NULL;
cCuttingThread *cCutter::cuttingThread = NULL;
bool cCutter::error = false;
bool cCutter::ended = false;
+#ifdef USE_CUTTERQUEUE
+cMutex *cCutter::cutterLock = new cMutex();
+
+static uint64_t lastCuttingEndTime = 0;
+static cList<cStringListObject> cutterQueue;
+#endif /* CUTTERQUEUE */
bool cCutter::Start(const char *FileName)
{
+#ifdef USE_CUTTERQUEUE
+ cMutexLock(cutterLock);
+
+ if(FileName) {
+ /* Add file to queue.
+ * If cutter is still active, next cutting will be started
+ * when vdr.c:main calls cCutter::Active and previous cutting has
+ * been stopped > 10 s before
+ */
+ cutterQueue.Add(new cStringListObject(FileName));
+ }
+
+ if (cuttingThread)
+ return true;
+
+ /* cut next file from queue */
+ if(!(cutterQueue.First()))
+ return false;
+ FileName = cutterQueue.First()->Value();
+#endif /* CUTTTERQUEUE */
+
if (!cuttingThread) {
error = false;
ended = false;
cRecording Recording(FileName);
+
+#ifdef USE_CUTTIME
+ cMarks FromMarks;
+ FromMarks.Load(FileName);
+ cMark *First=FromMarks.First();
+ if (First) Recording.SetStartTime(Recording.start+(int(First->position/Recording.FramesPerSecond()+30)/60)*60);
+#endif /* CUTTIME */
+
const char *evn = Recording.PrefixFileName('%');
+
+#ifdef USE_CUTTERQUEUE
+ if(!(Recordings.GetByName(FileName))) {
+ // Should _not_ remove any cutted recordings
+ // (original recording already deleted ?)
+ // so, just pop item from queue and return.
+ esyslog("can't cut non-existing recording %s", FileName);
+ cutterQueue.Del(cutterQueue.First());
+ return true; // might be already queued recording
+ }
+#endif /* CUTTERQUEUE */
if (evn && RemoveVideoFile(evn) && MakeDirs(evn, true)) {
// XXX this can be removed once RenameVideoFile() follows symlinks (see videodir.c)
// remove a possible deleted recording with the same name to avoid symlink mixups:
@@ -231,6 +456,10 @@
void cCutter::Stop(void)
{
+#ifdef USE_CUTTERQUEUE
+ cMutexLock(cutterLock);
+#endif /* CUTTERQUEUE */
+
bool Interrupted = cuttingThread && cuttingThread->Active();
const char *Error = cuttingThread ? cuttingThread->Error() : NULL;
delete cuttingThread;
@@ -242,11 +471,20 @@
esyslog("ERROR: '%s' during editing process", Error);
RemoveVideoFile(editedVersionName); //XXX what if this file is currently being replayed?
Recordings.DelByName(editedVersionName);
+#ifdef USE_CUTTERQUEUE
+ cutterQueue.Del(cutterQueue.First());
+#endif /* CUTTERQUEUE */
}
+#ifdef USE_CUTTERQUEUE
+ lastCuttingEndTime = cTimeMs::Now();
+#endif /* CUTTERQUEUE */
}
bool cCutter::Active(void)
{
+#ifdef USE_CUTTERQUEUE
+ cMutexLock(cutterLock);
+#endif /* CUTTERQUEUE */
if (cuttingThread) {
if (cuttingThread->Active())
return true;
@@ -257,12 +495,42 @@
free(editedVersionName);
editedVersionName = NULL;
ended = true;
+#ifdef USE_CUTTERQUEUE
+ /* Remove original (if cutting was successful) */
+ if(!error) {
+ cRecording *recording = Recordings.GetByName(*cutterQueue.First());
+ if (!recording) {
+ esyslog("ERROR: Can't found '%s' after editing process", cutterQueue.First()->Value());
+ } else {
+ if (recording->Delete()) {
+ //Recordings.Del(recording);
+ //cReplayControl::ClearLastReplayed(ri->FileName());
+ Recordings.DelByName(recording->FileName());
+ } else {
+ esyslog("ERROR: Can't delete '%s' after editing process", cutterQueue.First()->Value());
+ }
+ }
}
+ lastCuttingEndTime = cTimeMs::Now();
+ cutterQueue.Del(cutterQueue.First());
+#endif /* CUTTERQUEUE */
+ }
+#ifdef USE_CUTTERQUEUE
+ if(!cuttingThread && cutterQueue.First()) {
+ /* start next cutting from queue*/
+ if(cTimeMs::Now() > lastCuttingEndTime + WAIT_BEFORE_NEXT_CUT)
+ Start(NULL);
+ }
+#endif /* CUTTERQUEUE */
+
return false;
}
bool cCutter::Error(void)
{
+#ifdef USE_CUTTERQUEUE
+ cMutexLock(cutterLock);
+#endif /* CUTTERQUEUE */
bool result = error;
error = false;
return result;
@@ -270,6 +538,9 @@
bool cCutter::Ended(void)
{
+#ifdef USE_CUTTERQUEUE
+ cMutexLock(cutterLock);
+#endif /* CUTTERQUEUE */
bool result = ended;
ended = false;
return result;
diff -ruN vdr-1.7.12/cutter.h vdr-1.7.12.ExtP_NG/cutter.h
--- vdr-1.7.12/cutter.h 2010-01-02 13:09:54.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/cutter.h 2010-02-03 22:16:53.963043124 +0100
@@ -11,6 +11,9 @@
#define __CUTTER_H
class cCuttingThread;
+#ifdef USE_CUTTERQUEUE
+class cMutex;
+#endif /* CUTTERQUEUE */
class cCutter {
private:
@@ -18,6 +21,9 @@
static cCuttingThread *cuttingThread;
static bool error;
static bool ended;
+#ifdef USE_CUTTERQUEUE
+ static cMutex *cutterLock;
+#endif /* CUTTERQUEUE */
public:
static bool Start(const char *FileName);
static void Stop(void);
diff -ruN vdr-1.7.12/device.c vdr-1.7.12.ExtP_NG/device.c
--- vdr-1.7.12/device.c 2010-01-30 12:06:51.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/device.c 2010-02-03 22:16:53.987038104 +0100
@@ -18,6 +18,9 @@
#include "receiver.h"
#include "status.h"
#include "transfer.h"
+#ifdef USE_LNBSHARE
+#include "diseqc.h"
+#endif /* LNBSHARE */
// --- cLiveSubtitle ---------------------------------------------------------
@@ -70,6 +73,12 @@
SetVideoFormat(Setup.VideoFormat);
+#ifdef USE_LNBSHARE
+ LNBstate = -1;
+ LNBnr = Setup.CardUsesLNBnr[cardIndex];
+ LNBsource = NULL;
+#endif /* LNBSHARE */
+
mute = false;
volume = Setup.CurrentVolume;
@@ -95,8 +104,16 @@
for (int i = 0; i < MAXRECEIVERS; i++)
receiver[i] = NULL;
+#ifdef USE_SOURCECAPS
+ if (numDevices < MAXDEVICES) {
+#else
if (numDevices < MAXDEVICES)
+#endif /* SOURCECAPS */
device[numDevices++] = this;
+#ifdef USE_SOURCECAPS
+ SetSourceCaps(cardIndex);
+ }
+#endif /* SOURCECAPS */
else
esyslog("ERROR: too many devices!");
}
@@ -131,6 +148,17 @@
useDevice |= (1 << n);
}
+#ifdef USE_LNBSHARE
+void cDevice::SetLNBnr(void)
+{
+ for (int i = 0; i < numDevices; i++) {
+ device[i]->LNBnr = Setup.CardUsesLNBnr[i];
+ isyslog("LNB-sharing: setting device %d to use LNB %d", i, device[i]->LNBnr);
+ }
+}
+#endif /* LNBSHARE */
+
+
int cDevice::NextCardIndex(int n)
{
if (n > 0) {
@@ -195,6 +223,98 @@
return d;
}
+#ifdef USE_LNBSHARE
+cDevice *cDevice::GetBadDevice(const cChannel *Channel)
+{
+ if(!cSource::IsSat(Channel->Source())) return NULL;
+ if (Setup.DiSEqC) {
+ cDiseqc *diseqc;
+ diseqc = Diseqcs.Get(Channel->Source(), Channel->Frequency(), Channel->Polarization());
+
+ for (int i = 0; i < numDevices; i++) {
+ if (this != device[i] && device[i]->GetLNBnr() == LNBnr && device[i]->GetLNBsource() != (int*) diseqc) {
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Device check for channel %d on device %d. LNB or DiSEq conflict with device %d", LNBnr, Channel->Number(), this->DeviceNumber(), i);
+ }
+ return device[i];
+ }
+ }
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Device check for for channel %d on device %d. OK", LNBnr, Channel->Number(), this->DeviceNumber());
+ }
+ } else {
+ char requiredState;
+ if (Channel->Frequency() >= Setup.LnbSLOF) {
+ requiredState = 1 ;
+ } else {
+ requiredState = 0;
+ }
+ if (Channel->Polarization() == 'v' || Channel->Polarization() == 'V') requiredState += 2;
+
+ for (int i = 0; i < numDevices; i++) {
+ if (this != device[i] && device[i]->GetLNBnr() == LNBnr && device[i]->GetLNBconf() != requiredState) {
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Device check for channel %d, LNBstate %d on device %d, current LNBstate %d. Conflict with device %d, LNBstate %d", LNBnr, Channel->Number(), requiredState, this->DeviceNumber(), LNBstate, i, device[i]->GetLNBconf());
+ }
+ return device[i];
+ }
+ }
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Device check for channel %d, LNBstate %d on device %d, current LNBstate %d. No other devices affected", LNBnr, Channel->Number(), requiredState, this->DeviceNumber(), LNBstate);
+ }
+ }
+ return NULL;
+}
+
+int cDevice::GetMaxBadPriority(const cChannel *Channel)
+{
+ if(!cSource::IsSat(Channel->Source())) return -2;
+ bool PrimaryIsBad = false;
+ int maxBadPriority = -2;
+ if (Setup.DiSEqC) {
+ cDiseqc *diseqc;
+ diseqc = Diseqcs.Get(Channel->Source(), Channel->Frequency(), Channel->Polarization());
+
+ for (int i = 0; i < numDevices; i++) {
+ if (this != device[i] && device[i]->GetLNBnr() == LNBnr && device[i]->GetLNBsource() != (int*) diseqc) {
+ if (device[i]->Receiving() && device[i]->Priority() > maxBadPriority) {
+ maxBadPriority = device[i]->Priority();
+ }
+ if (device[i]->IsPrimaryDevice()) {
+ PrimaryIsBad = true;
+ }
+ }
+ }
+ } else {
+ char requiredState;
+ if (Channel->Frequency() >= Setup.LnbSLOF) {
+ requiredState = 1 ;
+ } else {
+ requiredState = 0;
+ }
+ if (Channel->Polarization() == 'v' || Channel->Polarization() == 'V') requiredState += 2;
+
+ for (int i = 0; i < numDevices; i++) {
+ if (this != device[i] && device[i]->GetLNBnr() == LNBnr && device[i]->GetLNBconf() != requiredState) {
+ if (device[i]->Receiving() && device[i]->Priority() > maxBadPriority) {
+ maxBadPriority = device[i]->Priority();
+ }
+ if (device[i]->IsPrimaryDevice()) {
+ PrimaryIsBad = true;
+ }
+ }
+ }
+ }
+ if (PrimaryIsBad && maxBadPriority == -2) {
+ maxBadPriority = -1;
+ }
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Request for channel %d on device %d. MaxBadPriority is %d", LNBnr, Channel->Number(), this->DeviceNumber(), maxBadPriority);
+ }
+ return maxBadPriority;
+}
+#endif /* LNBSHARE */
+
cDevice *cDevice::GetDevice(int Index)
{
return (0 <= Index && Index < numDevices) ? device[Index] : NULL;
@@ -223,6 +343,9 @@
int NumCamSlots = CamSlots.Count();
int SlotPriority[NumCamSlots];
int NumUsableSlots = 0;
+#ifdef USE_MCLI
+ bool InternalCamNeeded = false;
+#endif /* MCLI */
if (Channel->Ca() >= CA_ENCRYPTED_MIN) {
for (cCamSlot *CamSlot = CamSlots.First(); CamSlot; CamSlot = CamSlots.Next(CamSlot)) {
SlotPriority[CamSlot->Index()] = MAXPRIORITY + 1; // assumes it can't be used
@@ -236,7 +359,11 @@
}
}
if (!NumUsableSlots)
+#ifdef USE_MCLI
+ InternalCamNeeded = true; // no CAM is able to decrypt this channel
+#else
return NULL; // no CAM is able to decrypt this channel
+#endif /* MCLI */
}
bool NeedsDetachReceivers = false;
@@ -247,16 +374,32 @@
for (int j = 0; j < NumCamSlots || !NumUsableSlots; j++) {
if (NumUsableSlots && SlotPriority[j] > MAXPRIORITY)
continue; // there is no CAM available in this slot
+#ifdef USE_LNBSHARE
+//ML
+ int badPriority;
+ uint imp2;
+//ML-Ende
+#endif /* LNBSHARE */
for (int i = 0; i < numDevices; i++) {
if (device[i] == AvoidDevice)
continue; // this device shall be temporarily avoided
if (Channel->Ca() && Channel->Ca() <= CA_DVB_MAX && Channel->Ca() != device[i]->CardIndex() + 1)
continue; // a specific card was requested, but not this one
+#ifdef USE_MCLI
+ if (InternalCamNeeded && !device[i]->HasInternalCam())
+ continue; // no CAM is able to decrypt this channel and the device uses vdr handled CAMs
+ if (NumUsableSlots && !device[i]->HasInternalCam() && !CamSlots.Get(j)->Assign(device[i], true))
+#else
if (NumUsableSlots && !CamSlots.Get(j)->Assign(device[i], true))
+#endif /* MCLI */
continue; // CAM slot can't be used with this device
bool ndr;
if (device[i]->ProvidesChannel(Channel, Priority, &ndr)) { // this device is basicly able to do the job
+#ifdef USE_MCLI
+ if (NumUsableSlots && !device[i]->HasInternalCam() && device[i]->CamSlot() && device[i]->CamSlot() != CamSlots.Get(j))
+#else
if (NumUsableSlots && device[i]->CamSlot() && device[i]->CamSlot() != CamSlots.Get(j))
+#endif /* MCLI */
ndr = true; // using a different CAM slot requires detaching receivers
// Put together an integer number that reflects the "impact" using
// this device would have on the overall system. Each condition is represented
@@ -271,18 +414,57 @@
imp <<= 2; imp |= GetClippedNumProvidedSystems(2, device[i]) - 1; // avoid cards which support multiple delivery systems
imp <<= 1; imp |= device[i] == cTransferControl::ReceiverDevice(); // avoid the Transfer Mode receiver device
imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
+#ifdef USE_MCLI
+ imp <<= 8; imp |= min(max(((NumUsableSlots && !device[i]->HasInternalCam()) ? SlotPriority[j] : 0) + MAXPRIORITY, 0), 0xFF); // use the CAM slot with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
+#else
imp <<= 8; imp |= min(max((NumUsableSlots ? SlotPriority[j] : 0) + MAXPRIORITY, 0), 0xFF); // use the CAM slot with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
+#endif /* MCLI */
imp <<= 1; imp |= ndr; // avoid devices if we need to detach existing receivers
imp <<= 1; imp |= device[i]->IsPrimaryDevice(); // avoid the primary device
+#ifdef USE_MCLI
+ imp <<= 1; imp |= (NumUsableSlots || InternalCamNeeded) ? 0 : device[i]->HasCi(); // avoid cards with Common Interface for FTA channels
+#else
imp <<= 1; imp |= NumUsableSlots ? 0 : device[i]->HasCi(); // avoid cards with Common Interface for FTA channels
+#endif /* MCLI */
imp <<= 1; imp |= device[i]->HasDecoder(); // avoid full featured cards
+#ifdef USE_MCLI
+ imp <<= 1; imp |= (NumUsableSlots && !device[i]->HasInternalCam()) ? !ChannelCamRelations.CamDecrypt(Channel->GetChannelID(), j + 1) : 0; // prefer CAMs that are known to decrypt this channel
+#else
imp <<= 1; imp |= NumUsableSlots ? !ChannelCamRelations.CamDecrypt(Channel->GetChannelID(), j + 1) : 0; // prefer CAMs that are known to decrypt this channel
+#endif /* MCLI */
+#ifdef USE_LNBSHARE
+ badPriority = device[i]->GetMaxBadPriority(Channel);
+ if (badPriority >= Priority || (badPriority == -1 && Priority < Setup.PrimaryLimit)) {
+ // channel is not available for the requested prioity
+ imp = 0xFFFFFFFF;
+ } else {
+ switch (badPriority) {
+ case -2: // not affected by LNB-sharing
+ imp2 = 0;
+ break;
+ case -1: // the primary device would need a channel switch
+ imp += 1 << 17;
+ imp2 = 0xFFFFFFFF | 1 << 17;
+ break;
+ default: // a device receiving with lower priority would need to be stopped
+ imp += badPriority << 8;
+ imp2 = 0xFFFFFFFF | badPriority << 8;
+ break;
+ }
+ }
+ if (imp < Impact && imp2 < Impact) {
+#else
if (imp < Impact) {
+#endif /* LNBSHARE */
// This device has less impact than any previous one, so we take it.
Impact = imp;
d = device[i];
NeedsDetachReceivers = ndr;
+#ifdef USE_MCLI
+ if (NumUsableSlots && !device[i]->HasInternalCam())
+#else
if (NumUsableSlots)
+#endif /* MCLI */
s = CamSlots.Get(j);
}
}
@@ -318,6 +500,18 @@
camSlot = CamSlot;
}
+#ifdef USE_SOURCECAPS
+void cDevice::SetSourceCaps(int Index)
+{
+ for (int d = 0; d < numDevices; d++) {
+ if (Index < 0 || Index == device[d]->CardIndex()) {
+ for (int i = 0; i < MAXSOURCECAPS; i++)
+ device[d]->sourceCaps[i] = Setup.SourceCaps[device[d]->CardIndex()][i];
+ }
+ }
+}
+#endif /* SOURCECAPS */
+
void cDevice::Shutdown(void)
{
primaryDevice = NULL;
@@ -548,6 +742,13 @@
return -1;
}
+#ifdef USE_MCLI
+int cDevice::ReadFilter(int Handle, void *Buffer, size_t Length)
+{
+ return safe_read(Handle, Buffer, Length);
+}
+#endif /* MCLI */
+
void cDevice::CloseFilter(int Handle)
{
close(Handle);
@@ -578,7 +779,11 @@
bool cDevice::ProvidesTransponderExclusively(const cChannel *Channel) const
{
for (int i = 0; i < numDevices; i++) {
+#ifdef USE_LNBSHARE
+ if (device[i] && device[i] != this && device[i]->ProvidesTransponder(Channel) && device[i]->GetLNBnr() != LNBnr)
+#else
if (device[i] && device[i] != this && device[i]->ProvidesTransponder(Channel))
+#endif /* LNBSHARE */
return false;
}
return true;
@@ -606,6 +811,26 @@
bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView)
{
+
+#ifdef USE_LNBSHARE
+ cDevice *tmpDevice;
+ if (this->GetMaxBadPriority(Channel) >= 0) {
+ Skins.Message(mtInfo, tr("Channel locked by LNB!"));
+ return false;
+ }
+ while ((tmpDevice = GetBadDevice(Channel)) != NULL) {
+ if (tmpDevice->IsPrimaryDevice() && LiveView)
+ tmpDevice->SwitchChannelForced(Channel, true);
+ else
+ tmpDevice->SwitchChannelForced(Channel, false);
+ }
+ return SwitchChannelForced(Channel, LiveView);
+}
+
+bool cDevice::SwitchChannelForced(const cChannel *Channel, bool LiveView)
+{
+#endif /* LNBSHARE */
+
if (LiveView) {
isyslog("switching to channel %d", Channel->Number());
cControl::Shutdown(); // prevents old channel from being shown too long if GetDevice() takes longer
@@ -636,7 +861,14 @@
cChannel *channel;
while ((channel = Channels.GetByNumber(n, Direction)) != NULL) {
// try only channels which are currently available
+#ifdef USE_PINPLUGIN
+ if (cStatus::MsgChannelProtected(0, channel) == false) // PIN PATCH
+#endif /* PINPLUGIN */
+#ifdef USE_LNBSHARE
+ if (PrimaryDevice()->GetMaxBadPriority(channel) < 0 && (GetDevice(channel, 0, true)))
+#else
if (GetDevice(channel, 0, true))
+#endif /* LNBSHARE */
break;
n = channel->Number() + Direction;
}
@@ -657,6 +889,13 @@
eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
{
+#ifdef USE_PINPLUGIN
+ // I hope 'LiveView = false' indicates a channel switch for recording, // PIN PATCH
+ // I really don't know, but it works ... // PIN PATCH
+ if (LiveView && cStatus::MsgChannelProtected(this, Channel) == true) // PIN PATCH
+ return scrNotAvailable; // PIN PATCH
+#endif /* PINPLUGIN */
+
if (LiveView) {
StopReplay();
DELETENULL(liveSubtitle);
@@ -669,11 +908,39 @@
eSetChannelResult Result = scrOk;
+#ifdef USE_LNBSHARE
+ char requiredState;
+ if (Channel->Frequency() >= Setup.LnbSLOF) {
+ requiredState = 1;
+ } else {
+ requiredState = 0;
+ }
+ if (Channel->Polarization() == 'v' || Channel->Polarization() == 'V') requiredState += 2;
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Switching device %d to channel %d", LNBnr, this->DeviceNumber(), Channel->Number());
+ }
+#endif /* LNBSHARE */
+
// If this DVB card can't receive this channel, let's see if we can
// use the card that actually can receive it and transfer data from there:
if (NeedsTransferMode) {
if (Device && CanReplay()) {
+
+#ifdef USE_LNBSHARE
+ if (Device->GetLNBnr() == LNBnr) {
+ if (LNBstate != requiredState || (Setup.DiSEqC && LNBsource != (int*) Diseqcs.Get(Channel->Source(), Channel->Frequency(), Channel->Polarization())) ) {
+ if (IsPrimaryDevice()) {
+ SetChannelDevice(Channel, true);
+ } else {
+ SetChannelDevice(Channel, false);
+ }
+ LNBstate = requiredState;
+ LNBsource = (int*) Diseqcs.Get(Channel->Source(), Channel->Frequency(), Channel->Polarization());
+ }
+ }
+#endif /* LNBSHARE */
+
cStatus::MsgChannelSwitch(this, 0); // only report status if we are actually going to switch the channel
if (Device->SetChannel(Channel, false) == scrOk) // calling SetChannel() directly, not SwitchChannel()!
cControl::Launch(new cTransferControl(Device, Channel));
@@ -691,6 +958,11 @@
sectionHandler->SetStatus(false);
sectionHandler->SetChannel(NULL);
}
+
+#ifdef USE_LNBSHARE
+ LNBstate = requiredState;
+ LNBsource = (int*) Diseqcs.Get(Channel->Source(), Channel->Frequency(), Channel->Polarization());
+#endif /* LNBSHARE */
// Tell the camSlot about the channel switch and add all PIDs of this
// channel to it, for possible later decryption:
if (camSlot)
@@ -983,7 +1255,12 @@
int LanguagePreference = INT_MAX; // higher than the maximum possible value
for (int i = ttSubtitleFirst; i <= ttSubtitleLast; i++) {
const tTrackId *TrackId = GetTrack(eTrackType(i));
+#ifdef USE_LIEMIEXT
+ if (TrackId && TrackId->id && (I18nIsPreferredLanguage(Setup.SubtitleLanguages, TrackId->language, LanguagePreference) ||
+ ((i == ttSubtitleFirst + 8) && !(*TrackId->language) && (LanguagePreference == INT_MAX))))
+#else
if (TrackId && TrackId->id && I18nIsPreferredLanguage(Setup.SubtitleLanguages, TrackId->language, LanguagePreference))
+#endif /* LIEMIEXT */
PreferredTrack = eTrackType(i);
}
// Make sure we're set to an available subtitle track:
diff -ruN vdr-1.7.12/device.h vdr-1.7.12.ExtP_NG/device.h
--- vdr-1.7.12/device.h 2010-01-01 16:04:27.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/device.h 2010-02-03 22:16:54.000038602 +0100
@@ -24,6 +24,9 @@
#include "spu.h"
#include "thread.h"
#include "tools.h"
+#ifdef USE_ROTOR
+#include <linux/dvb/frontend.h>
+#endif /* ROTOR */
#define MAXDEVICES 16 // the maximum number of devices in the system
#define MAXPIDHANDLES 64 // the maximum number of different PIDs per device
@@ -145,6 +148,35 @@
static void SetAvoidDevice(cDevice *Device) { avoidDevice = Device; }
///< Sets the given Device to be temporarily avoided in the next call to
///< GetDevice(const cChannel, int, bool).
+#ifdef USE_LNBSHARE
+private:
+ char LNBstate; // Current frequency band and polarization of the DVB-tuner
+// cDiseqc *LNBsource; // can not #include "diseqc.h". A workaround follows:
+ int *LNBsource; // [DiSEqC] DiSEqC-Source
+ int LNBnr; // Number of LNB used
+public:
+ char GetLNBconf(void) { return LNBstate; }
+ int *GetLNBsource(void) { return LNBsource; }
+ int GetLNBnr(void) { return LNBnr; }
+ static void SetLNBnr(void);
+ cDevice *GetBadDevice(const cChannel *Channel);
+ ///< Returns NULL if there is no device which uses the same LNB or if
+ ///< all of those devices are tuned to the same frequency band and
+ ///< polarization as of the requested channel.
+ ///< Otherwise returns the first device found.
+ int GetMaxBadPriority(const cChannel *Channel);
+ ///< Returns the highest priority of all receiving devices which use
+ ///< the same LNB and are tuned to a different frequency band or
+ ///< polarization as of the requested channel.
+ ///< Returns -1 if there are no such devices, but the primary device
+ ///< would be affected by switching to the requested channel.
+ ///< Returns -2 if there are no such devices and the primary device
+ ///< would not be affected by switching to the requested channel.
+#endif /* LNBSHARE */
+#ifdef USE_SOURCECAPS
+ static void SetSourceCaps(int Index = -1);
+ ///< Sets the SourceCaps of the given device according to the Setup data.
+#endif /* SOURCECAPS */
static void Shutdown(void);
///< Closes down all devices.
///< Must be called at the end of the program.
@@ -152,6 +184,9 @@
static int nextCardIndex;
int cardIndex;
protected:
+#ifdef USE_SOURCECAPS
+ int sourceCaps[MAXSOURCECAPS];
+#endif /* SOURCECAPS */
cDevice(void);
virtual ~cDevice();
virtual bool Ready(void);
@@ -241,17 +276,28 @@
bool SwitchChannel(const cChannel *Channel, bool LiveView);
///< Switches the device to the given Channel, initiating transfer mode
///< if necessary.
+#ifdef USE_LNBSHARE
+ bool SwitchChannelForced(const cChannel *Channel, bool LiveView);
+ ///< Switches the device to the given channel, initiating transfer mode
+ ///< if necessary. Forces the switch without taking care of the LNB configuration.
+#endif /* LNBSHARE */
static bool SwitchChannel(int Direction);
///< Switches the primary device to the next available channel in the given
///< Direction (only the sign of Direction is evaluated, positive values
///< switch to higher channel numbers).
private:
+#ifndef USE_YAEPG
eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView);
///< Sets the device to the given channel (general setup).
+#endif /* YAEPG */
protected:
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
///< Sets the device to the given channel (actual physical setup).
public:
+#ifdef USE_YAEPG
+ eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView);
+ ///< Sets the device to the given channel (general setup).
+#endif /* YAEPG */
static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; }
///< Returns the number of the current channel on the primary device.
static void SetCurrentChannel(const cChannel *Channel) { currentChannel = Channel ? Channel->Number() : 0; }
@@ -269,6 +315,9 @@
virtual bool HasProgramme(void);
///< Returns true if the device is currently showing any programme to
///< the user, either through replaying or live.
+#ifdef USE_ROTOR
+ virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd) {return false;}
+#endif /* ROTOR */
// PID handle facilities
@@ -322,6 +371,12 @@
///< Opens a file handle for the given filter data.
///< A derived device that provides section data must
///< implement this function.
+#ifdef USE_MCLI
+ virtual int ReadFilter(int Handle, void *Buffer, size_t Length);
+ ///< Read from a handle for the given filter data.
+ ///< a derived class need not implement this function, because this
+ ///< is done by the default implementation.
+#endif /* MCLI */
virtual void CloseFilter(int Handle);
///< Closes a file handle that has previously been opened
///< by OpenFilter(). If this is as simple as calling close(Handle),
@@ -340,6 +395,14 @@
public:
virtual bool HasCi(void);
///< Returns true if this device has a Common Interface.
+#ifdef USE_MCLI
+ virtual bool HasInternalCam(void) { return false; }
+ ///< Returns true if this device handles encrypted channels itself
+ ///< without VDR assistance. This can be e.g. when the device is a
+ ///< client that gets the stream from another VDR instance that has
+ ///< already decrypted the stream. In this case ProvidesChannel()
+ ///< shall check whether the channel can be decrypted.
+#endif /* MCLI */
void SetCamSlot(cCamSlot *CamSlot);
///< Sets the given CamSlot to be used with this device.
cCamSlot *CamSlot(void) const { return camSlot; }
diff -ruN vdr-1.7.12/dvbdevice.c vdr-1.7.12.ExtP_NG/dvbdevice.c
--- vdr-1.7.12/dvbdevice.c 2010-01-04 15:06:24.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/dvbdevice.c 2010-02-03 22:16:54.089037139 +0100
@@ -30,6 +30,9 @@
class cDvbTuner : public cThread {
private:
enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
+#ifdef USE_ROTOR
+ bool SendDiseqc;
+#endif /* ROTOR */
int fd_frontend;
int adapter, frontend;
int tuneTimeout;
@@ -42,6 +45,9 @@
cMutex mutex;
cCondVar locked;
cCondVar newSet;
+#ifdef USE_ROTOR
+ dvb_diseqc_master_cmd diseqc_cmd;
+#endif /* ROTOR */
bool GetFrontendStatus(fe_status_t &Status, int TimeoutMs = 0);
bool SetFrontend(void);
virtual void Action(void);
@@ -50,12 +56,18 @@
virtual ~cDvbTuner();
bool IsTunedTo(const cChannel *Channel) const;
void Set(const cChannel *Channel);
+#ifdef USE_ROTOR
+ bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
+#endif /* ROTOR */
bool Locked(int TimeoutMs = 0);
};
cDvbTuner::cDvbTuner(int Fd_Frontend, int Adapter, int Frontend, fe_delivery_system FrontendType)
{
fd_frontend = Fd_Frontend;
+#ifdef USE_ROTOR
+ SendDiseqc=false;
+#endif /* ROTOR */
adapter = Adapter;
frontend = Frontend;
frontendType = FrontendType;
@@ -123,6 +135,19 @@
return tunerStatus >= tsLocked;
}
+#ifdef USE_ROTOR
+bool cDvbTuner::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
+{
+ cMutexLock MutexLock(&mutex);
+ if ((frontendType!=SYS_DVBS2 && frontendType!=SYS_DVBS) || SendDiseqc)
+ return false;
+ diseqc_cmd=cmd;
+ SendDiseqc=true;
+ newSet.Broadcast();
+ return true;
+}
+#endif /* ROTOR */
+
bool cDvbTuner::GetFrontendStatus(fe_status_t &Status, int TimeoutMs)
{
if (TimeoutMs) {
@@ -280,6 +305,18 @@
tuneTimeout = DVBT_TUNE_TIMEOUT;
lockTimeout = DVBT_LOCK_TIMEOUT;
}
+#ifdef USE_ATSC
+ else if (frontendType == SYS_ATSC) {
+ // ATSC
+ SETCMD(DTV_DELIVERY_SYSTEM, frontendType);
+ SETCMD(DTV_FREQUENCY, FrequencyToHz(channel.Frequency()));
+ SETCMD(DTV_INVERSION, channel.Inversion());
+ SETCMD(DTV_MODULATION, channel.Modulation());
+
+ tuneTimeout = DVBT_TUNE_TIMEOUT;
+ lockTimeout = DVBT_LOCK_TIMEOUT;
+ }
+#endif /* USE_ATSC */
else {
esyslog("ERROR: attempt to set channel with unknown DVB frontend type");
return false;
@@ -302,6 +339,12 @@
if (GetFrontendStatus(NewStatus, 10))
Status = NewStatus;
cMutexLock MutexLock(&mutex);
+#ifdef USE_ROTOR
+ if (SendDiseqc) {
+ CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &diseqc_cmd));
+ SendDiseqc=false;
+ }
+#endif /* ROTOR */
switch (tunerStatus) {
case tsIdle:
break;
@@ -597,10 +640,23 @@
bool cDvbDevice::ProvidesSource(int Source) const
{
int type = Source & cSource::st_Mask;
+#ifdef USE_SOURCECAPS
+ if (Setup.SourceCapsSet && type == cSource::stSat && (frontendType == SYS_DVBS || frontendType == SYS_DVBS2)) {
+ for (int i = 0; i < MAXSOURCECAPS; i++)
+ if (sourceCaps[i] == Source)
+ return true;
+ return false;
+ }
+ else
+#endif /* SOURCECAPS */
return type == cSource::stNone
|| type == cSource::stCable && (frontendType == SYS_DVBC_ANNEX_AC || frontendType == SYS_DVBC_ANNEX_B)
|| type == cSource::stSat && (frontendType == SYS_DVBS || frontendType == SYS_DVBS2)
+#ifdef USE_ATSC
+ || type == cSource::stTerr && (frontendType == SYS_DVBT || frontendType == SYS_ATSC);
+#else
|| type == cSource::stTerr && (frontendType == SYS_DVBT);
+#endif /* ATSC */
}
bool cDvbDevice::ProvidesTransponder(const cChannel *Channel) const
@@ -620,6 +676,17 @@
bool hasPriority = Priority < 0 || Priority > this->Priority();
bool needsDetachReceivers = false;
+#ifdef USE_CHANNELBIND
+ if (Setup.ChannelBindingByRid && Channel->Rid()) {
+ if (0 == ((unsigned) Channel->Rid() & (1<<(unsigned) CardIndex())) ) {
+ #if 0
+ printf("device %d doesn't provide channel %s", CardIndex(), *Channel->ToText());
+ #endif
+ return false;
+ }
+ }
+#endif /* CHANNELBIND */
+
if (ProvidesTransponder(Channel)) {
result = hasPriority;
if (Priority >= 0 && Receiving(true)) {
@@ -669,6 +736,13 @@
return dvbTuner ? dvbTuner->Locked(TimeoutMs) : false;
}
+#ifdef USE_ROTOR
+bool cDvbDevice::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
+{
+ return dvbTuner->SendDiseqcCmd(cmd);
+}
+#endif /* ROTOR */
+
void cDvbDevice::SetTransferModeForDolbyDigital(int Mode)
{
setTransferModeForDolbyDigital = Mode;
diff -ruN vdr-1.7.12/dvbdevice.h vdr-1.7.12.ExtP_NG/dvbdevice.h
--- vdr-1.7.12/dvbdevice.h 2010-01-04 15:07:12.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/dvbdevice.h 2010-02-03 22:16:54.096038052 +0100
@@ -80,6 +80,9 @@
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
public:
virtual bool HasLock(int TimeoutMs = 0);
+#ifdef USE_ROTOR
+ virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
+#endif /* ROTOR */
// PID handle facilities
diff -ruN vdr-1.7.12/dvbplayer.c vdr-1.7.12.ExtP_NG/dvbplayer.c
--- vdr-1.7.12/dvbplayer.c 2009-12-13 14:49:56.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/dvbplayer.c 2010-02-03 22:16:54.113042702 +0100
@@ -204,6 +204,9 @@
cNonBlockingFileReader *nonBlockingFileReader;
cRingBufferFrame *ringBuffer;
cPtsIndex ptsIndex;
+#ifdef USE_JUMPPLAY
+ cMarksReload marks;
+#endif /* JUMPPLAY */
cFileName *fileName;
cIndexFile *index;
cUnbufferedFile *replayFile;
@@ -249,7 +252,11 @@
int cDvbPlayer::Speeds[] = { 0, -2, -4, -8, 1, 2, 4, 12, 0 };
cDvbPlayer::cDvbPlayer(const char *FileName)
+#ifdef USE_JUMPPLAY
+:cThread("dvbplayer"), marks(FileName)
+#else
:cThread("dvbplayer")
+#endif /* JUMPPLAY */
{
nonBlockingFileReader = NULL;
ringBuffer = NULL;
@@ -357,6 +364,12 @@
if (index) {
int Index = ptsIndex.FindIndex(DeviceGetSTC());
if (Index >= 0) {
+#ifdef USE_JUMPPLAY
+ // set resume position to 0 if replay stops at the first mark
+ if (Setup.PlayJump && marks.First() &&
+ abs(Index - marks.First()->position) <= int(round(RESUMEBACKUP * framesPerSecond)))
+ Index = 0;
+#endif /* JUMPPLAY */
Index -= int(round(RESUMEBACKUP * framesPerSecond));
if (Index > 0)
Index = index->GetNextIFrame(Index, false);
@@ -383,11 +396,30 @@
{
uchar *p = NULL;
int pc = 0;
+#ifdef USE_JUMPPLAY
+ bool cutIn = false;
+ int total = -1;
+#endif /* JUMPPLAY */
readIndex = Resume();
if (readIndex >= 0)
isyslog("resuming replay at index %d (%s)", readIndex, *IndexToHMSF(readIndex, true, framesPerSecond));
+#ifdef USE_JUMPPLAY
+ if (Setup.PlayJump && readIndex <= 0 && marks.First() && index) {
+ int Index = marks.First()->position;
+ uint16_t FileNumber;
+ off_t FileOffset;
+ if (index->Get(Index, &FileNumber, &FileOffset) &&
+ NextFile(FileNumber, FileOffset)) {
+ isyslog("PlayJump: start replay at first mark %d (%s)",
+ Index, *IndexToHMSF(Index, true, framesPerSecond));
+ readIndex = Index;
+ }
+ }
+
+ bool LastMarkPause = false;
+#endif /* JUMPPLAY */
nonBlockingFileReader = new cNonBlockingFileReader;
int Length = 0;
bool Sleep = false;
@@ -412,7 +444,11 @@
// Read the next frame from the file:
+#ifdef USE_JUMPPLAY
+ if (playMode != pmStill && playMode != pmPause && !LastMarkPause) {
+#else
if (playMode != pmStill && playMode != pmPause) {
+#endif /* JUMPPLAY */
if (!readFrame && (replayFile || readIndex >= 0)) {
if (!nonBlockingFileReader->Reading()) {
if (!SwitchToPlayFrame && (playMode == pmFast || (playMode == pmSlow && playDir == pdBackward))) {
@@ -449,6 +485,46 @@
else if (index) {
uint16_t FileNumber;
off_t FileOffset;
+#ifdef USE_JUMPPLAY
+ if (Setup.PlayJump || Setup.PauseLastMark) {
+ // check for end mark - jump to next mark or pause
+ readIndex++;
+ marks.Reload();
+ cMark *m = marks.Get(readIndex);
+ if (m && (m->Index() & 0x01) != 0) {
+ m = marks.Next(m);
+ int Index;
+ if (m)
+ Index = m->position;
+ else if (Setup.PauseLastMark) {
+ // pause at last mark
+ isyslog("PauseLastMark: pause at position %d (%s)",
+ readIndex, *IndexToHMSF(readIndex, true, framesPerSecond));
+ LastMarkPause = true;
+ Index = -1;
+ }
+ else if (total == index->Last())
+ // at last mark jump to end of recording
+ Index = index->Last() - 1;
+ else
+ // jump but stay off end of live-recordings
+ Index = index->GetNextIFrame(index->Last() - int(round(MAXSTUCKATEOF * framesPerSecond)), true);
+ // don't jump in edited recordings
+ if (Setup.PlayJump && Index > readIndex &&
+ Index > index->GetNextIFrame(readIndex, true)) {
+ isyslog("PlayJump: %d frames to %d (%s)",
+ Index - readIndex, Index,
+ *IndexToHMSF(Index, true, framesPerSecond));
+ readIndex = Index;
+ cutIn = true;
+ }
+ }
+ readIndex--;
+ }
+ // for detecting growing length of live-recordings
+ if (index->Get(readIndex + 1, &FileNumber, &FileOffset, &readIndependent) && readIndependent)
+ total = index->Last();
+#endif /* JUMPPLAY */
if (index->Get(readIndex + 1, &FileNumber, &FileOffset, &readIndependent, &Length) && NextFile(FileNumber, FileOffset))
readIndex++;
else
@@ -493,6 +569,15 @@
// Store the frame in the buffer:
if (readFrame) {
+#ifdef USE_JUMPPLAY
+ if (cutIn) {
+ if (isPesRecording)
+ cRemux::SetBrokenLink(readFrame->Data(), readFrame->Count());
+ else
+ TsSetTeiOnBrokenPackets(readFrame->Data(), readFrame->Count());
+ cutIn = false;
+ }
+#endif /* JUMPPLAY */
if (ringBuffer->Put(readFrame))
readFrame = NULL;
else
@@ -552,8 +637,19 @@
p = NULL;
}
}
+#ifdef USE_JUMPPLAY
+ else {
+ if (LastMarkPause) {
+ LastMarkPause = false;
+ playMode = pmPause;
+ }
+#else
else
+#endif /* JUMPPLAY */
Sleep = true;
+#ifdef USE_JUMPPLAY
+ }
+#endif /* JUMPPLAY */
// Handle hitting begin/end of recording:
diff -ruN vdr-1.7.12/eit.c vdr-1.7.12.ExtP_NG/eit.c
--- vdr-1.7.12/eit.c 2010-01-08 16:17:09.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/eit.c 2010-02-03 22:16:54.190042224 +0100
@@ -24,7 +24,30 @@
class cEIT : public SI::EIT {
public:
cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bool OnlyRunningStatus = false);
- };
+
+#ifdef USE_NOEPG
+private:
+ bool allowedEPG(tChannelID kanalID);
+#endif /* NOEPG */
+ };
+#ifdef USE_NOEPG
+bool cEIT::allowedEPG(tChannelID kanalID) {
+ bool rc;
+
+ if (Setup.noEPGMode == 1) {
+ rc=false;
+ if (strstr(::Setup.noEPGList,kanalID.ToString())!=NULL)
+ rc=true;
+ }
+ else {
+ rc=true;
+ if (strstr(::Setup.noEPGList,kanalID.ToString())!=NULL)
+ rc=false;
+ }
+
+ return rc;
+}
+#endif /* NOEPG */
cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bool OnlyRunningStatus)
:SI::EIT(Data, false)
@@ -37,6 +60,14 @@
if (!channel)
return; // only collect data for known channels
+#ifdef USE_NOEPG
+ // only use epg from channels not blocked by noEPG-patch
+ tChannelID kanalID;
+ kanalID=channel->GetChannelID();
+ if (!allowedEPG(kanalID))
+ return;
+#endif /* NOEPG */
+
cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channel, true);
bool Empty = true;
@@ -83,7 +114,87 @@
uchar TableID = pEvent->TableID();
if (TableID == 0x00) {
if (pEvent->Version() == getVersionNumber())
+#ifdef USE_DDEPGENTRY
+ {
+ if(Setup.MixEpgAction == 0)
+ continue;
+
+ //printf("in");
+ //printf("%s", pEvent->GetTimeString());
+ // to use the info of the original epg, update the extern one,
+ // if it has less info
+ SI::Descriptor *d;
+ SI::ExtendedEventDescriptors *ExtendedEventDescriptors = NULL;
+ //SI::ExtendedEventDescriptor *eed = NULL;
+ SI::ShortEventDescriptor *ShortEventDescriptor = NULL;
+ //SI::ShortEventDescriptor *sed = NULL;
+ //SI::TimeShiftedEventDescriptor *tsed = NULL;
+ //cLinkChannels *LinkChannels = NULL;
+ for (SI::Loop::Iterator it2; (d = SiEitEvent.eventDescriptors.getNext(it2));)
+ {
+ if(d->getDescriptorTag() == SI::ShortEventDescriptorTag)
+ {
+ int LanguagePreferenceShort = -1;
+ SI::ShortEventDescriptor *sed = (SI::ShortEventDescriptor *)d;
+ if (I18nIsPreferredLanguage(Setup.EPGLanguages, sed->languageCode, LanguagePreferenceShort) || !ShortEventDescriptor)
+ {
+ delete ShortEventDescriptor;
+ ShortEventDescriptor = sed;
+ d = NULL; // so that it is not deleted
+ }
+ }
+ else if(d->getDescriptorTag() == SI::ExtendedEventDescriptorTag)
+ {
+ int LanguagePreferenceExt = -1;
+ bool UseExtendedEventDescriptor = false;
+ SI::ExtendedEventDescriptor *eed = (SI::ExtendedEventDescriptor *)d;
+ if (I18nIsPreferredLanguage(Setup.EPGLanguages, eed->languageCode, LanguagePreferenceExt) || !ExtendedEventDescriptors)
+ {
+ delete ExtendedEventDescriptors;
+ ExtendedEventDescriptors = new SI::ExtendedEventDescriptors;
+ UseExtendedEventDescriptor = true;
+ }
+ if (UseExtendedEventDescriptor)
+ {
+ ExtendedEventDescriptors->Add(eed);
+ d = NULL; // so that it is not deleted
+ }
+ if (eed->getDescriptorNumber() == eed->getLastDescriptorNumber())
+ UseExtendedEventDescriptor = false;
+ }
+ delete d;
+ }
+ if(pEvent)
+ {
+
+ if(ShortEventDescriptor)
+ {
+ char buffer[256];
+ if(ShortEventDescriptor->text.getText(buffer, sizeof(buffer)) && pEvent->ShortText() && (strlen(ShortEventDescriptor->text.getText(buffer, sizeof(buffer))) > strlen(pEvent->ShortText())))
+ {
+ pEvent->SetShortText(ShortEventDescriptor->text.getText(buffer, sizeof(buffer)));
+ pEvent->FixEpgBugs();
+ }
+ }
+ if(ExtendedEventDescriptors)
+ {
+ char buffer[ExtendedEventDescriptors->getMaximumTextLength(": ") + 1];
+ //pEvent->SetDescription(ExtendedEventDescriptors->getText(buffer, sizeof(buffer), ": "));
+
+ if(ExtendedEventDescriptors->getText(buffer, sizeof(buffer), ": ") && pEvent->Description() && (strlen(ExtendedEventDescriptors->getText(buffer, sizeof(buffer), ": ")) > strlen(pEvent->Description())))
+ {
+ pEvent->SetDescription(ExtendedEventDescriptors->getText(buffer, sizeof(buffer), ": "));
+ pEvent->FixEpgBugs();
+ }
+ }
+ }
+ delete ExtendedEventDescriptors;
+ delete ShortEventDescriptor;
continue;
+ }
+#else
+ continue;
+#endif /* DDEPGENTRY */
HasExternalData = ExternalData = true;
}
// If the new event has a higher table ID, let's skip it.
@@ -108,7 +219,11 @@
if (newEvent)
pSchedule->AddEvent(newEvent);
if (Tid == 0x4E) { // we trust only the present/following info on the actual TS
+#ifdef USE_DDEPGENTRY
+ if (Setup.DisableVPS == 0 && SiEitEvent.getRunningStatus() >= SI::RunningStatusNotRunning)
+#else
if (SiEitEvent.getRunningStatus() >= SI::RunningStatusNotRunning)
+#endif /* DDEPGENTRY */
pSchedule->SetRunningStatus(pEvent, SiEitEvent.getRunningStatus(), channel);
}
if (OnlyRunningStatus)
@@ -297,6 +412,82 @@
if (LinkChannels)
channel->SetLinkChannels(LinkChannels);
Modified = true;
+
+#ifdef USE_DDEPGENTRY
+ //to avoid double epg-entrys from ext and int epg sources :EW
+ if (pEvent && pEvent->TableID() != 0x00)
+ {
+ cEvent *pPreviousEvent = (cEvent *)pSchedule->GetPreviousEvent(pEvent);
+
+ if (pPreviousEvent)
+ {
+ if(Setup.DoubleEpgAction == 0)
+ {
+ pPreviousEvent->SetStartTime(pEvent->StartTime());
+ pPreviousEvent->SetDuration(pEvent->Duration());
+
+ if(Setup.DisableVPS == 0)
+ {
+ if(channel)
+ pPreviousEvent->SetRunningStatus(pEvent->RunningStatus(), channel);
+ else
+ pPreviousEvent->SetRunningStatus(pEvent->RunningStatus());
+ }
+
+ // to use the info of the original epg, update the extern one,
+ // if it has less info
+ char buffer_short_intern[256];
+ char buffer_short_extern[256];
+ int len_short_intern = 0;
+ int len_short_extern = 0;
+
+ if (pEvent->ShortText())
+ len_short_intern = snprintf (buffer_short_intern, sizeof(buffer_short_intern), "%s", pEvent->ShortText());
+
+ if (pPreviousEvent->ShortText())
+ len_short_extern = snprintf (buffer_short_extern, sizeof(buffer_short_extern), "%s",pPreviousEvent->ShortText());
+
+ if(len_short_intern > 0)
+ {
+ if(len_short_extern < 1)
+ pPreviousEvent->SetShortText(buffer_short_intern);
+ else if (len_short_intern > len_short_extern)
+ pPreviousEvent->SetShortText(buffer_short_intern);
+ }
+
+ if(pEvent->Description())
+ {
+ char buffer_title_intern[4096];
+ char buffer_title_extern[4096];
+ int len_title_intern = 0;
+ int len_title_extern = 0;
+
+ if (pEvent->Description())
+ len_title_intern = snprintf (buffer_title_intern, sizeof(buffer_title_intern), "%s", pEvent->Description());
+
+ if (pPreviousEvent->Description())
+ len_title_extern = snprintf (buffer_title_extern, sizeof(buffer_title_extern), "%s", pPreviousEvent->Description());
+
+ if(len_title_intern > 0)
+ {
+ if(len_title_extern < 1)
+ pPreviousEvent->SetDescription(buffer_title_intern);
+ else if (len_title_intern > len_title_extern)
+ pPreviousEvent->SetDescription(buffer_title_intern);
+ }
+ }
+
+ if(pPreviousEvent->Vps() == 0 && pEvent->Vps() != 0)
+ pPreviousEvent->SetVps(pEvent->Vps());
+
+ pSchedule->DelEvent(pEvent);
+ pPreviousEvent->FixEpgBugs();
+ }
+ else
+ pSchedule->DelEvent(pPreviousEvent);
+ }
+ }
+#endif /* DDEPGENTRY */
}
if (Tid == 0x4E) {
if (Empty && getSectionNumber() == 0)
diff -ruN vdr-1.7.12/eitscan.c vdr-1.7.12.ExtP_NG/eitscan.c
--- vdr-1.7.12/eitscan.c 2006-01-07 15:10:17.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/eitscan.c 2010-02-03 22:16:54.222039593 +0100
@@ -151,9 +151,17 @@
if (Device->ProvidesTransponder(Channel)) {
if (!Device->Receiving()) {
bool MaySwitchTransponder = Device->MaySwitchTransponder();
+#ifdef USE_LNBSHARE
+ if (MaySwitchTransponder && Device->GetMaxBadPriority(Channel) == -2 || Device->ProvidesTransponderExclusively(Channel) && Device->GetMaxBadPriority(Channel) <= -1 && now - lastActivity > Setup.EPGScanTimeout * 3600) {
+#else
if (MaySwitchTransponder || Device->ProvidesTransponderExclusively(Channel) && now - lastActivity > Setup.EPGScanTimeout * 3600) {
+#endif /* LNBSHARE */
if (!MaySwitchTransponder) {
+#ifdef USE_LNBSHARE
+ if ((Device == cDevice::ActualDevice() || Device->GetMaxBadPriority(Channel) == -1) && !currentChannel) {
+#else
if (Device == cDevice::ActualDevice() && !currentChannel) {
+#endif /* LNBSHARE */
cDevice::PrimaryDevice()->StopReplay(); // stop transfer mode
currentChannel = Device->CurrentChannel();
Skins.Message(mtInfo, tr("Starting EPG scan"));
diff -ruN vdr-1.7.12/epg.c vdr-1.7.12.ExtP_NG/epg.c
--- vdr-1.7.12/epg.c 2010-01-08 16:20:28.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/epg.c 2010-02-03 22:16:54.250044742 +0100
@@ -443,8 +443,10 @@
if (components) {
for (int i = 0; i < components->NumComponents(); i++) {
tComponent *p = components->Component(i);
+#ifndef USE_DOLBYINREC
if (!Setup.UseDolbyDigital && p->stream == 0x02 && p->type == 0x05)
continue;
+#endif /* DOLBYINREC */
fprintf(f, "%sX %s\n", Prefix, *p->ToString());
}
}
@@ -932,6 +934,31 @@
return pe;
}
+#ifdef USE_DDEPGENTRY
+const cEvent *cSchedule::GetPreviousEvent(cEvent *Event) const
+{
+
+ if(!Event || Event->Duration() == 0 || Event->StartTime() == 0)
+ return NULL;
+ // Returns either the event info to the previous/following event to the given EventID or, if that one can't be found NULL :EW
+ cEvent *pt = NULL;
+ int epgTimeDelta = Setup.DoubleEpgTimeDelta * 60 + 1;
+ for (pt = events.First(); pt; pt = events.Next(pt))
+ if(pt && pt->TableID() == 0x00)
+ if ((Event->StartTime() - pt->StartTime()) > - epgTimeDelta && (Event->StartTime() - pt->StartTime()) < epgTimeDelta)
+ {
+ if((pt->Duration() + (pt->Duration()/ 5) + 1) > Event->Duration() && (pt->Duration() - (pt->Duration()/ 5) - 1) < Event->Duration())
+ return pt;
+ else if (pt->Title() && Event->Title() && (strcmp(pt->Title(), ".") != 0 && strcmp(Event->Title(), ".") != 0))
+ {
+ if (strstr(pt->Title(), Event->Title()) != NULL || strstr(Event->Title(), pt->Title()) != NULL)
+ return pt;
+ }
+ }
+ return NULL;
+}
+#endif /* DDEPGENTRY */
+
void cSchedule::SetRunningStatus(cEvent *Event, int RunningStatus, cChannel *Channel)
{
hasRunning = false;
diff -ruN vdr-1.7.12/epg.h vdr-1.7.12.ExtP_NG/epg.h
--- vdr-1.7.12/epg.h 2010-01-08 16:20:34.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/epg.h 2010-02-03 22:16:54.260042756 +0100
@@ -163,6 +163,9 @@
void DropOutdated(time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version);
void Cleanup(time_t Time);
void Cleanup(void);
+#ifdef USE_DDEPGENTRY
+ const cEvent *GetPreviousEvent(cEvent *Event) const; //:EW
+#endif /* DDEPGENTRY */
cEvent *AddEvent(cEvent *Event);
void DelEvent(cEvent *Event);
void HashEvent(cEvent *Event);
diff -ruN vdr-1.7.12/lirc.c vdr-1.7.12.ExtP_NG/lirc.c
--- vdr-1.7.12/lirc.c 2006-05-28 10:48:13.000000000 +0200
+++ vdr-1.7.12.ExtP_NG/lirc.c 2010-02-03 22:16:54.615046179 +0100
@@ -12,6 +12,10 @@
#include "lirc.h"
#include <netinet/in.h>
#include <sys/socket.h>
+#ifdef USE_LIRCSETTINGS
+#include "config.h"
+#endif /* LIRCSETTINGS */
+
#define REPEATDELAY 350 // ms
#define REPEATFREQ 100 // ms
@@ -94,7 +98,11 @@
continue;
}
if (count == 0) {
+#ifdef USE_LIRCSETTINGS
+ if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < (unsigned int)Setup.LircRepeatDelay)
+#else
if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < REPEATDELAY)
+#endif /* LIRCSETTINGS */
continue; // skip keys coming in too fast
if (repeat)
Put(LastKeyName, false, true);
@@ -104,18 +112,34 @@
timeout = -1;
}
else {
+#ifdef USE_LIRCSETTINGS
+ if (LastTime.Elapsed() < (unsigned int)Setup.LircRepeatFreq)
+#else
if (LastTime.Elapsed() < REPEATFREQ)
+#endif /* LIRCSETTINGS */
continue; // repeat function kicks in after a short delay (after last key instead of first key)
+#ifdef USE_LIRCSETTINGS
+ if (FirstTime.Elapsed() < (unsigned int)Setup.LircRepeatDelay)
+#else
if (FirstTime.Elapsed() < REPEATDELAY)
+#endif /* LIRCSETTINGS */
continue; // skip keys coming in too fast (for count != 0 as well)
repeat = true;
+#ifdef USE_LIRCSETTINGS
+ timeout = Setup.LircRepeatDelay;
+#else
timeout = REPEATDELAY;
+#endif /* LIRCSETTINGS */
}
LastTime.Set();
Put(KeyName, repeat);
}
else if (repeat) { // the last one was a repeat, so let's generate a release
+#ifdef USE_LIRCSETTINGS
+ if (LastTime.Elapsed() >= (unsigned int)Setup.LircRepeatTimeout) {
+#else
if (LastTime.Elapsed() >= REPEATTIMEOUT) {
+#endif /* LIRCSETTINGS */
Put(LastKeyName, false, true);
repeat = false;
*LastKeyName = 0;
diff -ruN vdr-1.7.12/mainmenuitemsprovider.h vdr-1.7.12.ExtP_NG/mainmenuitemsprovider.h
--- vdr-1.7.12/mainmenuitemsprovider.h 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/mainmenuitemsprovider.h 2010-02-03 22:16:54.640047157 +0100
@@ -0,0 +1,62 @@
+#ifdef USE_MENUORG
+/*
+ * vdr-menuorg - A plugin for the Linux Video Disk Recorder
+ * Copyright (c) 2007 - 2008 Tobias Grimm <vdr@e-tobi.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ *
+ */
+
+#ifndef __MAINMENUITEMSPROVIDER_H
+#define __MAINMENUITEMSPROVIDER_H
+
+#include <vector>
+
+class cOsdItem;
+class cOsdMenu;
+
+class IMenuItemDefinition
+{
+ public:
+ virtual ~IMenuItemDefinition() {};
+ virtual bool IsCustomOsdItem() = 0;
+ virtual bool IsPluginItem() = 0;
+ virtual bool IsSeparatorItem() = 0;
+ virtual cOsdItem* CustomOsdItem() = 0;
+ virtual const char* PluginMenuEntry() = 0;
+ virtual bool IsSelected() = 0;
+ virtual int PluginIndex() = 0;
+};
+
+typedef std::vector<IMenuItemDefinition*> MenuItemDefinitions;
+
+#define MENU_ITEMS_PROVIDER_SERVICE_ID "MenuOrgPatch-v0.4.2::MainMenuItemsProvider"
+
+class IMainMenuItemsProvider
+{
+ public:
+ virtual ~IMainMenuItemsProvider() {};
+ virtual bool IsCustomMenuAvailable() = 0;
+ virtual MenuItemDefinitions* MainMenuItems() = 0;
+ virtual void EnterRootMenu() = 0;
+ virtual void EnterSubMenu(cOsdItem* item) = 0;
+ virtual bool LeaveSubMenu() = 0;
+ virtual cOsdMenu* Execute(cOsdItem* item) = 0;
+};
+
+#endif //__MAINMENUITEMSPROVIDER_H
+#endif /* MENUORG */
diff -ruN vdr-1.7.12/menu.c vdr-1.7.12.ExtP_NG/menu.c
--- vdr-1.7.12/menu.c 2010-01-31 13:43:24.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/menu.c 2010-02-03 22:16:54.757051858 +0100
@@ -30,6 +30,9 @@
#include "timers.h"
#include "transfer.h"
#include "videodir.h"
+#ifdef USE_MENUORG
+#include "menuorgpatch.h"
+#endif /* MENUORG */
#define MAXWAIT4EPGINFO 3 // seconds
#define MODETIMEOUT 3 // seconds
@@ -190,10 +193,16 @@
cChannel *channel;
cChannel data;
char name[256];
+#ifdef USE_PLUGINPARAM
+ char pluginParam[256];
+#endif /* PLUGINPARAM */
void Setup(void);
public:
cMenuEditChannel(cChannel *Channel, bool New = false);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuEditChannel"; }
+#endif /* GRAPHTFT */
};
cMenuEditChannel::cMenuEditChannel(cChannel *Channel, bool New)
@@ -222,6 +231,9 @@
// Parameters for all types of sources:
strn0cpy(name, data.name, sizeof(name));
+#ifdef USE_PLUGINPARAM
+ strn0cpy(pluginParam, data.pluginParam, sizeof(pluginParam));
+#endif /* PLUGINPARAM */
Add(new cMenuEditStrItem( tr("Name"), name, sizeof(name)));
Add(new cMenuEditSrcItem( tr("Source"), &data.source));
Add(new cMenuEditIntItem( tr("Frequency"), &data.frequency));
@@ -241,6 +253,9 @@
Add(new cMenuEditIntItem( tr("Tid"), &data.tid, 0));
Add(new cMenuEditIntItem( tr("Rid"), &data.rid, 0));
XXX*/
+#ifdef USE_CHANNELBIND
+ Add(new cMenuEditIntItem( tr("Rid"), &data.rid, 0)); // channel binding patch
+#endif /* CHANNELBIND */
// Parameters for specific types of sources:
ST(" S ") Add(new cMenuEditChrItem( tr("Polarization"), &data.polarization, "hvlr"));
ST(" S ") Add(new cMenuEditMapItem( tr("System"), &data.system, SystemValues));
@@ -254,6 +269,9 @@
ST(" T") Add(new cMenuEditMapItem( tr("Guard"), &data.guard, GuardValues));
ST(" T") Add(new cMenuEditMapItem( tr("Hierarchy"), &data.hierarchy, HierarchyValues));
ST(" S ") Add(new cMenuEditMapItem( tr("Rolloff"), &data.rollOff, RollOffValues));
+#ifdef USE_PLUGINPARAM
+ ST("P ") Add(new cMenuEditStrItem( tr("Parameters"), pluginParam, sizeof(pluginParam), tr(FileNameChars)));
+#endif /* PLUGINPARAM */
SetCurrent(Get(current));
Display();
@@ -268,6 +286,9 @@
if (Key == kOk) {
if (Channels.HasUniqueChannelID(&data, channel)) {
data.name = strcpyrealloc(data.name, name);
+#ifdef USE_PLUGINPARAM
+ data.pluginParam = strcpyrealloc(data.pluginParam, pluginParam);
+#endif /* PLUGINPARAM */
if (channel) {
*channel = data;
isyslog("edited channel %d %s", channel->Number(), *data.ToText());
@@ -371,6 +392,9 @@
cMenuChannels(void);
~cMenuChannels();
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuChannels"; }
+#endif /* GRAPHTFT */
};
cMenuChannels::cMenuChannels(void)
@@ -909,7 +933,37 @@
Add(new cMenuEditBitItem( tr("VPS"), &data.flags, tfVps));
Add(new cMenuEditIntItem( tr("Priority"), &data.priority, 0, MAXPRIORITY));
Add(new cMenuEditIntItem( tr("Lifetime"), &data.lifetime, 0, MAXLIFETIME));
+#ifdef USE_PINPLUGIN
+ // PIN PATCH
+ if (cOsd::pinValid || !data.fskProtection) Add(new cMenuEditBoolItem(tr("Childlock"),&data.fskProtection));
+ else {
+ char* buf = 0;
+ asprintf(&buf, "%s\t%s", tr("Childlock"), data.fskProtection ? tr("yes") : tr("no"));
+ Add(new cOsdItem(buf));
+ free(buf);
+ }
+
+#endif /* PINPLUGIN */
+#ifdef USE_LIEMIEXT
+
+ char* p = strrchr(data.file, '~');
+ if (p) {
+ p++;
+ Utf8Strn0Cpy(name, p, sizeof(name));
+ Utf8Strn0Cpy(path, data.file, sizeof(path));
+ p = strrchr(path, '~');
+ if (p)
+ p[0] = 0;
+ }
+ else {
+ Utf8Strn0Cpy(name, data.file, sizeof(name));
+ Utf8Strn0Cpy(path, "", sizeof(path));
+ }
+ Add(file = new cMenuEditStrItem( tr("File"), name, sizeof(name), tr(FileNameChars)));
+ Add(new cMenuEditRecPathItem(tr("Path"), path, sizeof(path)));
+#else
Add(file = new cMenuEditStrItem( tr("File"), data.file, sizeof(data.file)));
+#endif /* LIEMIEXT */
SetFirstDayItem();
}
SetHelpKeys();
@@ -975,6 +1029,12 @@
Skins.Message(mtError, tr("*** Invalid Channel ***"));
break;
}
+#ifdef USE_LIEMIEXT
+ if(strlen(path))
+ snprintf(data.file, sizeof(data.file), "%s~%s", path, name);
+ else
+ snprintf(data.file, sizeof(data.file), "%s", name);
+#endif /* LIEMIEXT */
if (!*data.file)
strcpy(data.file, data.Channel()->ShortName(true));
if (timer) {
@@ -1009,8 +1069,14 @@
class cMenuTimerItem : public cOsdItem {
private:
cTimer *timer;
+#ifdef USE_TIMERINFO
+ char diskStatus;
+#endif /* TIMERINFO */
public:
cMenuTimerItem(cTimer *Timer);
+#ifdef USE_TIMERINFO
+ void SetDiskStatus(char DiskStatus);
+#endif /* TIMERINFO */
virtual int Compare(const cListObject &ListObject) const;
virtual void Set(void);
cTimer *Timer(void) { return timer; }
@@ -1019,6 +1085,9 @@
cMenuTimerItem::cMenuTimerItem(cTimer *Timer)
{
timer = Timer;
+#ifdef USE_TIMERINFO
+ diskStatus = ' ';
+#endif /* TIMERINFO */
Set();
}
@@ -1044,7 +1113,14 @@
strftime(buffer, sizeof(buffer), "%Y%m%d", &tm_r);
day = buffer;
}
+#ifdef USE_TIMERINFO
+ cCharSetConv csc("ISO-8859-1", cCharSetConv::SystemCharacterTable());
+ char diskStatusString[2] = { diskStatus, 0 };
+ SetText(cString::sprintf("%s%c\t%d\t%s%s%s\t%02d:%02d\t%02d:%02d\t%s",
+ csc.Convert(diskStatusString),
+#else
SetText(cString::sprintf("%c\t%d\t%s%s%s\t%02d:%02d\t%02d:%02d\t%s",
+#endif /* TIMERINFO */
!(timer->HasFlags(tfActive)) ? ' ' : timer->FirstDay() ? '!' : timer->Recording() ? '#' : '>',
timer->Channel()->Number(),
*name,
@@ -1057,6 +1133,59 @@
timer->File()));
}
+#ifdef USE_TIMERINFO
+void cMenuTimerItem::SetDiskStatus(char DiskStatus)
+{
+ diskStatus = DiskStatus;
+ Set();
+}
+
+// --- cTimerEntry -----------------------------------------------------------
+
+class cTimerEntry : public cListObject {
+private:
+ cMenuTimerItem *item;
+ const cTimer *timer;
+ time_t start;
+public:
+ cTimerEntry(cMenuTimerItem *item) : item(item), timer(item->Timer()), start(timer->StartTime()) {}
+ cTimerEntry(const cTimer *timer, time_t start) : item(NULL), timer(timer), start(start) {}
+ virtual int Compare(const cListObject &ListObject) const;
+ bool active(void) const { return timer->HasFlags(tfActive); }
+ time_t startTime(void) const { return start; }
+ int priority(void) const { return timer->Priority(); }
+ int duration(void) const;
+ bool repTimer(void) const { return !timer->IsSingleEvent(); }
+ bool isDummy(void) const { return item == NULL; }
+ const cTimer *Timer(void) const { return timer; }
+ void SetDiskStatus(char DiskStatus);
+ };
+
+int cTimerEntry::Compare(const cListObject &ListObject) const
+{
+ cTimerEntry *entry = (cTimerEntry *)&ListObject;
+ int r = startTime() - entry->startTime();
+ if (r == 0)
+ r = entry->priority() - priority();
+ return r;
+}
+
+int cTimerEntry::duration(void) const
+{
+ int dur = (timer->Stop() / 100 * 60 + timer->Stop() % 100) -
+ (timer->Start() / 100 * 60 + timer->Start() % 100);
+ if (dur < 0)
+ dur += 24 * 60;
+ return dur;
+}
+
+void cTimerEntry::SetDiskStatus(char DiskStatus)
+{
+ if (item)
+ item->SetDiskStatus(DiskStatus);
+}
+#endif /* TIMERINFO */
+
// --- cMenuTimers -----------------------------------------------------------
class cMenuTimers : public cOsdMenu {
@@ -1069,14 +1198,28 @@
eOSState Info(void);
cTimer *CurrentTimer(void);
void SetHelpKeys(void);
+#ifdef USE_TIMERINFO
+ void ActualiseDiskStatus(void);
+ bool actualiseDiskStatus;
+#endif /* TIMERINFO */
public:
cMenuTimers(void);
virtual ~cMenuTimers();
+#ifdef USE_TIMERINFO
+ virtual void Display(void);
+#endif /* TIMERINFO */
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuTimers"; }
+#endif /* GRAPHTFT */
};
cMenuTimers::cMenuTimers(void)
+#ifdef USE_TIMERINFO
+:cOsdMenu(tr("Timers"), 3, CHNUMWIDTH, 10, 6, 6)
+#else
:cOsdMenu(tr("Timers"), 2, CHNUMWIDTH, 10, 6, 6)
+#endif /* TIMERINFO */
{
helpKeys = -1;
for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
@@ -1087,6 +1230,9 @@
SetCurrent(First());
SetHelpKeys();
Timers.IncBeingEdited();
+#ifdef USE_TIMERINFO
+ actualiseDiskStatus = true;
+#endif /* TIMERINFO */
}
cMenuTimers::~cMenuTimers()
@@ -1125,7 +1271,11 @@
timer->OnOff();
timer->SetEventFromSchedule();
RefreshCurrent();
+#ifdef USE_TIMERINFO
+ Display();
+#else
DisplayCurrent(true);
+#endif /* TIMERINFO */
if (timer->FirstDay())
isyslog("timer %s first day set to %s", *timer->ToDescr(), *timer->PrintFirstDay());
else
@@ -1184,6 +1334,69 @@
return osContinue;
}
+#ifdef USE_TIMERINFO
+void cMenuTimers::ActualiseDiskStatus(void)
+{
+ if (!actualiseDiskStatus || !Count())
+ return;
+
+ // compute free disk space
+ int freeMB, freeMinutes, runshortMinutes;
+ VideoDiskSpace(&freeMB);
+ freeMinutes = int(double(freeMB) * 1.1 / MB_PER_MINUTE); // overestimate by 10 percent
+ runshortMinutes = freeMinutes / 5; // 20 Percent
+
+ // fill entries list
+ cTimerEntry *entry;
+ cList<cTimerEntry> entries;
+ for (cOsdItem *item = First(); item; item = Next(item))
+ entries.Add(new cTimerEntry((cMenuTimerItem *)item));
+
+ // search last start time
+ time_t last = 0;
+ for (entry = entries.First(); entry; entry = entries.Next(entry))
+ last = max(entry->startTime(), last);
+
+ // add entries for repeating timers
+ for (entry = entries.First(); entry; entry = entries.Next(entry))
+ if (entry->repTimer() && !entry->isDummy())
+ for (time_t start = cTimer::IncDay(entry->startTime(), 1);
+ start <= last;
+ start = cTimer::IncDay(start, 1))
+ if (entry->Timer()->DayMatches(start))
+ entries.Add(new cTimerEntry(entry->Timer(), start));
+
+ // set the disk-status
+ entries.Sort();
+ for (entry = entries.First(); entry; entry = entries.Next(entry)) {
+ char status = ' ';
+ if (entry->active()) {
+ freeMinutes -= entry->duration();
+ status = freeMinutes > runshortMinutes ? '+' : freeMinutes > 0 ? 177 /* +/- */ : '-';
+ }
+ entry->SetDiskStatus(status);
+#ifdef DEBUG_TIMER_INFO
+ dsyslog("timer-info: %c | %d | %s | %s | %3d | %+5d -> %+5d",
+ status,
+ entry->startTime(),
+ entry->active() ? "aktiv " : "n.akt.",
+ entry->repTimer() ? entry->isDummy() ? " dummy " : "mehrmalig" : "einmalig ",
+ entry->duration(),
+ entry->active() ? freeMinutes + entry->duration() : freeMinutes,
+ freeMinutes);
+#endif
+ }
+
+ actualiseDiskStatus = false;
+}
+
+void cMenuTimers::Display(void)
+{
+ ActualiseDiskStatus();
+ cOsdMenu::Display();
+}
+#endif /* TIMERINFO */
+
eOSState cMenuTimers::ProcessKey(eKeys Key)
{
int TimerNumber = HasSubMenu() ? Count() : -1;
@@ -1192,18 +1405,36 @@
if (state == osUnknown) {
switch (Key) {
case kOk: return Edit();
+#ifdef USE_TIMERINFO
+ case kRed: actualiseDiskStatus = true;
+ state = OnOff(); break; // must go through SetHelpKeys()!
+#else
case kRed: state = OnOff(); break; // must go through SetHelpKeys()!
+#endif /* TIMERINFO */
case kGreen: return New();
+#ifdef USE_TIMERINFO
+ case kYellow: actualiseDiskStatus = true;
+ state = Delete(); break;
+#else
case kYellow: state = Delete(); break;
+#endif /* TIMERINFO */
case kInfo:
case kBlue: return Info();
break;
default: break;
}
}
+#ifdef USE_TIMERINFO
+ if (TimerNumber >= 0 && !HasSubMenu()) {
+ if (Timers.Get(TimerNumber)) // a newly created timer was confirmed with Ok
+ Add(new cMenuTimerItem(Timers.Get(TimerNumber)), true);
+ Sort();
+ actualiseDiskStatus = true;
+#else
if (TimerNumber >= 0 && !HasSubMenu() && Timers.Get(TimerNumber)) {
// a newly created timer was confirmed with Ok
Add(new cMenuTimerItem(Timers.Get(TimerNumber)), true);
+#endif /* TIMERINFO */
Display();
}
if (Key != kNone)
@@ -1233,6 +1464,9 @@
{
cOsdMenu::Display();
DisplayMenu()->SetEvent(event);
+#ifdef USE_GRAPHTFT
+ cStatus::MsgOsdSetEvent(event);
+#endif /* GRAPHTFT */
if (event->Description())
cStatus::MsgOsdTextItem(event->Description());
}
@@ -1280,7 +1514,12 @@
const cChannel *channel;
bool withDate;
int timerMatch;
+#ifdef USE_LIEMIEXT
+ bool withBar;
+ cMenuScheduleItem(const cEvent *Event, cChannel *Channel = NULL, bool WithDate = false, bool WithBar = false);
+#else
cMenuScheduleItem(const cEvent *Event, cChannel *Channel = NULL, bool WithDate = false);
+#endif /* LIEMIEXT */
static void SetSortMode(eScheduleSortMode SortMode) { sortMode = SortMode; }
static void IncSortMode(void) { sortMode = eScheduleSortMode((sortMode == ssmAllAll) ? ssmAllThis : sortMode + 1); }
static eScheduleSortMode SortMode(void) { return sortMode; }
@@ -1290,12 +1529,19 @@
cMenuScheduleItem::eScheduleSortMode cMenuScheduleItem::sortMode = ssmAllThis;
+#ifdef USE_LIEMIEXT
+cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event, cChannel *Channel, bool WithDate, bool WithBar)
+#else
cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event, cChannel *Channel, bool WithDate)
+#endif /* LIEMIEXT */
{
event = Event;
channel = Channel;
withDate = WithDate;
timerMatch = tmNone;
+#ifdef USE_LIEMIEXT
+ withBar = WithBar;
+#endif /* LIEMIEXT */
Update(true);
}
@@ -1312,6 +1558,19 @@
static const char *TimerMatchChars = " tT";
+#ifdef USE_LIEMIEXT
+static const char * const ProgressBar[7] =
+{
+ "[ ]",
+ "[| ]",
+ "[|| ]",
+ "[||| ]",
+ "[|||| ]",
+ "[||||| ]",
+ "[||||||]"
+};
+#endif /* LIEMIEXT */
+
bool cMenuScheduleItem::Update(bool Force)
{
bool result = false;
@@ -1327,7 +1586,18 @@
if (channel && withDate)
buffer = cString::sprintf("%d\t%.*s\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), Utf8SymChars(csn, 6), csn, Utf8SymChars(eds, 6), *eds, *event->GetTimeString(), t, v, r, event->Title());
else if (channel)
+#ifdef USE_LIEMIEXT
+ if (Setup.ShowProgressBar && withBar) {
+ int progress = (int)roundf( (float)(time(NULL) - event->StartTime()) / (float)(event->Duration()) * 6.0 );
+ if (progress < 0) progress = 0;
+ else if (progress > 6) progress = 6;
+ buffer = cString::sprintf("%d\t%.*s\t%s\t%s\t%c%c%c\t%s", channel->Number(), Utf8SymChars(csn, 6), csn, *event->GetTimeString(), ProgressBar[progress], t, v, r, event->Title());
+ }
+ else
+ buffer = cString::sprintf("%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), Utf8SymChars(csn, 6), csn, *event->GetTimeString(), t, v, r, event->Title());
+#else
buffer = cString::sprintf("%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), Utf8SymChars(csn, 6), csn, *event->GetTimeString(), t, v, r, event->Title());
+#endif /* LIEMIEXT */
else
buffer = cString::sprintf("%.*s\t%s\t%c%c%c\t%s", Utf8SymChars(eds, 6), *eds, *event->GetTimeString(), t, v, r, event->Title());
SetText(buffer);
@@ -1355,13 +1625,21 @@
static void SetCurrentChannel(int ChannelNr) { currentChannel = ChannelNr; }
static const cEvent *ScheduleEvent(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return now ? "MenuWhatsOnNow" : "MenuWhatsOnNext"; }
+ virtual void Display(void);
+#endif /* GRAPHTFT */
};
int cMenuWhatsOn::currentChannel = 0;
const cEvent *cMenuWhatsOn::scheduleEvent = NULL;
cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr)
+#ifdef USE_LIEMIEXT
+:cOsdMenu(Now ? tr("What's on now?") : tr("What's on next?"), CHNUMWIDTH, 7, 6, 4, 4)
+#else
:cOsdMenu(Now ? tr("What's on now?") : tr("What's on next?"), CHNUMWIDTH, 7, 6, 4)
+#endif /* LIEMIEXT */
{
now = Now;
helpKeys = -1;
@@ -1373,7 +1651,11 @@
if (Schedule) {
const cEvent *Event = Now ? Schedule->GetPresentEvent() : Schedule->GetFollowingEvent();
if (Event)
+#ifdef USE_LIEMIEXT
+ Add(new cMenuScheduleItem(Event, Channel, false, Now), Channel->Number() == CurrentChannelNr);
+#else
Add(new cMenuScheduleItem(Event, Channel), Channel->Number() == CurrentChannelNr);
+#endif /* LIEMIEXT */
}
}
}
@@ -1382,6 +1664,20 @@
SetHelpKeys();
}
+#ifdef USE_GRAPHTFT
+void cMenuWhatsOn::Display(void)
+{
+ cOsdMenu::Display();
+
+ if (Count() > 0) {
+ int ni = 0;
+ for (cOsdItem *item = First(); item; item = Next(item)) {
+ cStatus::MsgOsdEventItem(((cMenuScheduleItem*)item)->event, item->Text(), ni++, Count());
+ }
+ }
+}
+#endif /* GRAPHTFT */
+
bool cMenuWhatsOn::Update(void)
{
bool result = false;
@@ -1522,6 +1818,10 @@
cMenuSchedule(void);
virtual ~cMenuSchedule();
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuSchedule"; }
+ virtual void Display(void);
+#endif /* GRAPHTFT */
};
cMenuSchedule::cMenuSchedule(void)
@@ -1547,6 +1847,20 @@
cMenuWhatsOn::ScheduleEvent(); // makes sure any posted data is cleared
}
+#ifdef USE_GRAPHTFT
+void cMenuSchedule::Display(void)
+{
+ cOsdMenu::Display();
+
+ if (Count() > 0) {
+ int ni = 0;
+ for (cOsdItem *item = First(); item; item = Next(item)) {
+ cStatus::MsgOsdEventItem(((cMenuScheduleItem*)item)->event, item->Text(), ni++, Count());
+ }
+ }
+}
+#endif /* GRAPHTFT */
+
void cMenuSchedule::PrepareScheduleAllThis(const cEvent *Event, const cChannel *Channel)
{
Clear();
@@ -1795,6 +2109,9 @@
cMenuCommands(const char *Title, cList<cNestedItem> *Commands, const char *Parameters = NULL);
virtual ~cMenuCommands();
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuCommands"; }
+#endif /* GRAPHTFT */
};
cMenuCommands::cMenuCommands(const char *Title, cList<cNestedItem> *Commands, const char *Parameters)
@@ -1918,6 +2235,9 @@
cMenuCam(cCamSlot *CamSlot);
virtual ~cMenuCam();
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuCam"; }
+#endif /* GRAPHTFT */
};
cMenuCam::cMenuCam(cCamSlot *CamSlot)
@@ -2097,6 +2417,9 @@
cMenuRecording(const cRecording *Recording, bool WithButtons = false);
virtual void Display(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuRecording"; }
+#endif /* GRAPHTFT */
};
cMenuRecording::cMenuRecording(const cRecording *Recording, bool WithButtons)
@@ -2112,6 +2435,9 @@
{
cOsdMenu::Display();
DisplayMenu()->SetRecording(recording);
+#ifdef USE_GRAPHTFT
+ cStatus::MsgOsdSetRecording(recording);
+#endif /* GRAPHTFT */
if (recording->Info()->Description())
cStatus::MsgOsdTextItem(recording->Info()->Description());
}
@@ -2172,7 +2498,11 @@
fileName = strdup(Recording->FileName());
name = NULL;
totalEntries = newEntries = 0;
+#ifdef USE_LIEMIEXT
+ SetText(Recording->Title('\t', true, Level, false));
+#else
SetText(Recording->Title('\t', true, Level));
+#endif /* LIEMIEXT */
if (*Text() == '\t')
name = strdup(Text() + 2); // 'Text() + 2' to skip the two '\t'
}
@@ -2188,13 +2518,156 @@
totalEntries++;
if (New)
newEntries++;
+#ifdef USE_LIEMIEXT
+ switch (Setup.ShowRecTime + Setup.ShowRecDate + Setup.ShowRecLength) {
+ case 0:
+ SetText(cString::sprintf("%s", name));
+ break;
+ case 1:
+ SetText(cString::sprintf("%d\t%s", totalEntries, name));
+ break;
+ case 2:
+ default:
+ SetText(cString::sprintf("%d\t%d\t%s", totalEntries, newEntries, name));
+ break;
+ case 3:
+ SetText(cString::sprintf("%d\t%d\t\t%s", totalEntries, newEntries, name));
+ break;
+ }
+}
+
+// --- cMenuRenameRecording --------------------------------------------------
+
+class cMenuRenameRecording : public cOsdMenu {
+private:
+ char name[MaxFileName];
+ char path[MaxFileName];
+ cOsdItem *marksItem, *resumeItem;
+ bool isResume, isMarks;
+ cRecording *recording;
+public:
+ cMenuRenameRecording(cRecording *Recording);
+ virtual eOSState ProcessKey(eKeys Key);
+};
+
+cMenuRenameRecording::cMenuRenameRecording(cRecording *Recording)
+:cOsdMenu(tr("Rename recording"), 12)
+{
+ cMarks marks;
+
+ recording = Recording;
+
+ const char* pname = strrchr(recording->Name(), '~');
+ if (pname) {
+ Utf8Strn0Cpy(name, pname + 1, sizeof(name));
+ Utf8Strn0Cpy(path, recording->Name(), sizeof(path));
+ char *ppath = strrchr(path, '~');
+ if (ppath)
+ ppath[0] = 0;
+ }
+ else {
+ Utf8Strn0Cpy(name, recording->Name(), sizeof(name));
+ Utf8Strn0Cpy(path, "", sizeof(path));
+ }
+ Add(new cMenuEditStrItem(tr("Name"), name, sizeof(name), tr(FileNameChars)));
+ Add(new cMenuEditRecPathItem(tr("Path"), path, sizeof(path) ));
+
+ Add(new cOsdItem("", osUnknown, false));
+
+ Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Date"), *DayDateTime(recording->start)), osUnknown, false));
+
+ cChannel *channel = Channels.GetByChannelID(((cRecordingInfo *)recording->Info())->ChannelID());
+ if (channel)
+ Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Channel"), *ChannelString(channel, 0)), osUnknown, false));
+
+ int recLen = cIndexFile::Length(recording->FileName(), recording->IsPesRecording());
+ if (recLen >= 0)
+ Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Length"), *IndexToHMSF(recLen, false, recording->FramesPerSecond())), osUnknown, false));
+ else
+ recLen = 0;
+
+ int dirSize = DirSizeMB(recording->FileName());
+ double seconds = recLen / recording->FramesPerSecond();
+ cString bitRate = seconds ? cString::sprintf(" (%.2f MBit/s)", 8.0 * dirSize / seconds) : cString("");
+ Add(new cOsdItem(cString::sprintf("%s:\t%s", tr("Format"), recording->IsPesRecording() ? tr("PES") : tr("TS")), osUnknown, false));
+ Add(new cOsdItem((dirSize > 9999) ? cString::sprintf("%s:\t%.2f GB%s", tr("Size"), dirSize / 1024.0, *bitRate) : cString::sprintf("%s:\t%d MB%s", tr("Size"), dirSize, *bitRate), osUnknown, false));
+
+ Add(new cOsdItem("", osUnknown, false));
+
+ isMarks = marks.Load(recording->FileName(), recording->FramesPerSecond(), recording->IsPesRecording()) && marks.Count();
+ marksItem = new cOsdItem(tr("Delete marks information?"), osUser1, isMarks);
+ Add(marksItem);
+
+ cResumeFile ResumeFile(recording->FileName(), recording->IsPesRecording());
+ isResume = (ResumeFile.Read() != -1);
+ resumeItem = new cOsdItem(tr("Delete resume information?"), osUser2, isResume);
+ Add(resumeItem);
+}
+
+eOSState cMenuRenameRecording::ProcessKey(eKeys Key)
+{
+ eOSState state = cOsdMenu::ProcessKey(Key);
+
+ if (state == osUnknown) {
+ if (Key == kOk) {
+ char buffer[MaxFileName];
+ if (Utf8StrLen(path))
+ snprintf(buffer, sizeof(buffer), "%s~%s", path, name);
+ else
+ snprintf(buffer, sizeof(buffer), "%s", name);
+ if (recording->Rename(buffer)) {
+ Recordings.ChangeState();
+ Recordings.TouchUpdate();
+ return osRecordings;
+ }
+ else
+ Skins.Message(mtError, tr("Error while accessing recording!"));
+ }
+ return osContinue;
+ }
+ else if (state == osUser1) {
+ if (isMarks && Interface->Confirm(tr("Delete marks information?"))) {
+ cMarks marks;
+ marks.Load(recording->FileName(), recording->FramesPerSecond(), recording->IsPesRecording());
+ cMark *mark = marks.First();
+ while (mark) {
+ cMark *nextmark = marks.Next(mark);
+ marks.Del(mark);
+ mark = nextmark;
+ }
+ marks.Save();
+ isMarks = false;
+ marksItem->SetSelectable(isMarks);
+ SetCurrent(First());
+ Display();
+ }
+ return osContinue;
+ }
+ else if (state == osUser2) {
+ if (isResume && Interface->Confirm(tr("Delete resume information?"))) {
+ cResumeFile ResumeFile(recording->FileName(), recording->IsPesRecording());
+ ResumeFile.Delete();
+ isResume = false;
+ resumeItem->SetSelectable(isResume);
+ SetCurrent(First());
+ Display();
+ }
+ return osContinue;
+ }
+ return state;
+#else
SetText(cString::sprintf("%d\t%d\t%s", totalEntries, newEntries, name));
+#endif /* LIEMIEXT */
}
// --- cMenuRecordings -------------------------------------------------------
cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
+#ifdef USE_LIEMIEXT
+:cOsdMenu(Base ? Base : tr("Recordings"), 9, 7, 7)
+#else
:cOsdMenu(Base ? Base : tr("Recordings"), 9, 7)
+#endif /* LIEMIEXT */
{
base = Base ? strdup(Base) : NULL;
level = Setup.RecordingDirs ? Level : -1;
@@ -2272,7 +2745,13 @@
for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) {
if (!base || (strstr(recording->Name(), base) == recording->Name() && recording->Name()[strlen(base)] == FOLDERDELIMCHAR)) {
cMenuRecordingItem *Item = new cMenuRecordingItem(recording, level);
+#ifdef USE_PINPLUGIN
+ if ((*Item->Text() && (!LastItem || strcmp(Item->Text(), LastItemText) != 0))
+ && (!cStatus::MsgReplayProtected(GetRecording(Item), Item->Name(), base,
+ Item->IsDirectory(), true))) { // PIN PATCH
+#else
if (*Item->Text() && (!LastItem || strcmp(Item->Text(), LastItemText) != 0)) {
+#endif /* PINPLUGIN */
Add(Item);
LastItem = Item;
free(LastItemText);
@@ -2322,6 +2801,11 @@
{
cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
if (ri) {
+#ifdef USE_PINPLUGIN
+ if (cStatus::MsgReplayProtected(GetRecording(ri), ri->Name(), base,
+ ri->IsDirectory()) == true) // PIN PATCH
+ return osContinue; // PIN PATCH
+#endif /* PINPLUGIN */
if (ri->IsDirectory())
Open();
else {
@@ -2429,6 +2913,21 @@
return osContinue;
}
+#ifdef USE_LIEMIEXT
+eOSState cMenuRecordings::Rename(void)
+{
+ if (HasSubMenu() || Count() == 0)
+ return osContinue;
+ cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
+ if (ri && !ri->IsDirectory()) {
+ cRecording *recording = GetRecording(ri);
+ if (recording)
+ return AddSubMenu(new cMenuRenameRecording(recording));
+ }
+ return osContinue;
+}
+#endif /* LIEMIEXT */
+
eOSState cMenuRecordings::ProcessKey(eKeys Key)
{
bool HadSubMenu = HasSubMenu();
@@ -2443,7 +2942,16 @@
case kYellow: return Delete();
case kInfo:
case kBlue: return Info();
+#ifdef USE_LIEMIEXT
+ case k0: DirOrderState = !DirOrderState;
+ Set(true);
+ return osContinue;
+ case k8: return Rename();
+ case k9:
+ case k1...k7: return Commands(Key);
+#else
case k1...k9: return Commands(Key);
+#endif /* LIEMIEXT */
case kNone: if (Recordings.StateChanged(recordingsState))
Set(true);
break;
@@ -2486,6 +2994,12 @@
Setup = data;
cOsdProvider::UpdateOsdSize(true);
Setup.Save();
+#ifdef USE_SORTRECORDS
+ if (Setup.SortRecords != Setup.SortRecordsHelper) {
+ Setup.SortRecordsHelper = Setup.SortRecords;
+ Recordings.Load();
+ }
+#endif /* SORTRECORDS */
}
// --- cMenuSetupOSD ---------------------------------------------------------
@@ -2508,6 +3022,9 @@
cMenuSetupOSD(void);
virtual ~cMenuSetupOSD();
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuSetupOsd"; }
+#endif /* GRAPHTFT */
};
cMenuSetupOSD::cMenuSetupOSD(void)
@@ -2570,6 +3087,9 @@
Add(new cMenuEditBoolItem(tr("Setup.OSD$Scroll wraps"), &data.MenuScrollWrap));
Add(new cMenuEditBoolItem(tr("Setup.OSD$Menu key closes"), &data.MenuKeyCloses));
Add(new cMenuEditBoolItem(tr("Setup.OSD$Recording directories"), &data.RecordingDirs));
+#ifdef USE_LIEMIEXT
+ Add(new cMenuEditBoolItem(tr("Setup.OSD$Main menu command position"), &data.MenuCmdPosition, tr("bottom"), tr("top")));
+ #endif /* LIEMIEXT */
SetCurrent(Get(current));
Display();
}
@@ -2641,12 +3161,18 @@
class cMenuSetupEPG : public cMenuSetupBase {
private:
+#ifdef USE_NOEPG
+ const char *noEPGModes[2];
+#endif /* NOEPG */
int originalNumLanguages;
int numLanguages;
void Setup(void);
public:
cMenuSetupEPG(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuSetupEpg"; }
+#endif /* GRAPHTFT */
};
cMenuSetupEPG::cMenuSetupEPG(void)
@@ -2663,11 +3189,19 @@
{
int current = Current();
+#ifdef USE_NOEPG
+ noEPGModes[0]=tr("Blacklist");
+ noEPGModes[1]=tr("Whitelist");
+#endif /* NOEPG */
+
Clear();
Add(new cMenuEditIntItem( tr("Setup.EPG$EPG scan timeout (h)"), &data.EPGScanTimeout));
Add(new cMenuEditIntItem( tr("Setup.EPG$EPG bugfix level"), &data.EPGBugfixLevel, 0, MAXEPGBUGFIXLEVEL));
Add(new cMenuEditIntItem( tr("Setup.EPG$EPG linger time (min)"), &data.EPGLinger, 0));
+#ifdef USE_LIEMIEXT
+ Add(new cMenuEditBoolItem(tr("Setup.EPG$Show progress bar"), &data.ShowProgressBar));
+#endif /* LIEMIEXT */
Add(new cMenuEditBoolItem(tr("Setup.EPG$Set system time"), &data.SetSystemTime));
if (data.SetSystemTime)
Add(new cMenuEditTranItem(tr("Setup.EPG$Use time from transponder"), &data.TimeTransponder, &data.TimeSource));
@@ -2676,6 +3210,15 @@
for (int i = 0; i < numLanguages; i++)
// TRANSLATORS: note the singular!
Add(new cMenuEditStraItem(tr("Setup.EPG$Preferred language"), &data.EPGLanguages[i], I18nLanguages()->Size(), &I18nLanguages()->At(0)));
+#ifdef USE_NOEPG
+ Add(new cMenuEditStraItem(tr("Setup.EPG$Mode noEPG-Patch"), &data.noEPGMode, 2, noEPGModes));
+#endif /* NOEPG */
+#ifdef USE_DDEPGENTRY
+ Add(new cMenuEditIntItem(tr("Setup.EPG$Period for double EPG search(min)"), &data.DoubleEpgTimeDelta));
+ Add(new cMenuEditBoolItem(tr("Setup.EPG$extern double Epg entry"), &data.DoubleEpgAction, "adjust", "delete"));
+ Add(new cMenuEditBoolItem(tr("Setup.EPG$Mix intern and extern EPG"), &data.MixEpgAction));
+ Add(new cMenuEditBoolItem(tr("Setup.EPG$Disable running VPS event"), &data.DisableVPS));
+#endif /* DDEPGENTRY */
SetCurrent(Get(current));
Display();
@@ -2742,6 +3285,9 @@
public:
cMenuSetupDVB(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuSetupDvb"; }
+#endif /* GRAPHTFT */
};
cMenuSetupDVB::cMenuSetupDVB(void)
@@ -2778,6 +3324,9 @@
Add(new cMenuEditStraItem(tr("Setup.DVB$Video display format"), &data.VideoDisplayFormat, 3, videoDisplayFormatTexts));
Add(new cMenuEditBoolItem(tr("Setup.DVB$Use Dolby Digital"), &data.UseDolbyDigital));
Add(new cMenuEditStraItem(tr("Setup.DVB$Update channels"), &data.UpdateChannels, 6, updateChannelsTexts));
+#ifdef USE_CHANNELBIND
+ Add(new cMenuEditBoolItem(tr("Setup.DVB$channel binding by Rid"),&data.ChannelBindingByRid));
+#endif /* CHANNELBIND */
Add(new cMenuEditIntItem( tr("Setup.DVB$Audio languages"), &numAudioLanguages, 0, I18nLanguages()->Size()));
for (int i = 0; i < numAudioLanguages; i++)
Add(new cMenuEditStraItem(tr("Setup.DVB$Audio language"), &data.AudioLanguages[i], I18nLanguages()->Size(), &I18nLanguages()->At(0)));
@@ -2871,6 +3420,9 @@
public:
cMenuSetupLNB(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuSetupLnb"; }
+#endif /* GRAPHTFT */
};
cMenuSetupLNB::cMenuSetupLNB(void)
@@ -2885,6 +3437,23 @@
Clear();
+#ifdef USE_LNBSHARE
+ int numSatDevices = 0;
+ for (int i = 0; i < cDevice::NumDevices(); i++) {
+ if (cDevice::GetDevice(i)->ProvidesSource(cSource::stSat)) numSatDevices++;
+ }
+ if (numSatDevices > 1) {
+ char tmp[30];
+ for (int i = 1; i <= cDevice::NumDevices(); i++) {
+ if (cDevice::GetDevice(i - 1)->ProvidesSource(cSource::stSat)) {
+ sprintf( tmp, tr("Setup.LNB$DVB device %d uses LNB No."), i);
+ Add(new cMenuEditIntItem( tmp, &data.CardUsesLNBnr[i - 1], 1, numSatDevices ));
+ }
+ }
+ }
+ Add(new cMenuEditBoolItem(tr("Setup.LNB$Log LNB usage"), &data.VerboseLNBlog));
+#endif /* LNBSHARE */
+
Add(new cMenuEditBoolItem(tr("Setup.LNB$Use DiSEqC"), &data.DiSEqC));
if (!data.DiSEqC) {
Add(new cMenuEditIntItem( tr("Setup.LNB$SLOF (MHz)"), &data.LnbSLOF));
@@ -2901,6 +3470,10 @@
int oldDiSEqC = data.DiSEqC;
eOSState state = cMenuSetupBase::ProcessKey(Key);
+#ifdef USE_LNBSHARE
+ if (Key == kOk) cDevice::SetLNBnr();
+#endif /* LNBSHARE */
+
if (Key != kNone && data.DiSEqC != oldDiSEqC)
Setup();
return state;
@@ -2951,6 +3524,9 @@
public:
cMenuSetupCAM(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuSetupCam"; }
+#endif /* GRAPHTFT */
};
cMenuSetupCAM::cMenuSetupCAM(void)
@@ -3025,17 +3601,79 @@
class cMenuSetupRecord : public cMenuSetupBase {
private:
+#ifdef USE_SORTRECORDS
+ const char *sortRecordsTexts[4];
+#endif /* SORTRECORDS */
const char *pauseKeyHandlingTexts[3];
+#ifdef USE_DELTIMESHIFTREC
+ const char *DelTimeshiftRecValues[3];
+#endif /* DELTIMESHIFTREC */
+#ifdef USE_DVLVIDPREFER
+ void Set(void);
+ int tmpNVidPrefer,
+ tmpUseVidPrefer;
+#endif /* DVLVIDPREFER */
public:
cMenuSetupRecord(void);
+#ifdef USE_DVLVIDPREFER
+ eOSState ProcessKey(eKeys key);
+#endif /* DVLVIDPREFER */
+
};
+#ifdef USE_DVLVIDPREFER
cMenuSetupRecord::cMenuSetupRecord(void)
{
+ Set();
+}
+
+eOSState cMenuSetupRecord::ProcessKey(eKeys key)
+{
+ eOSState s = cMenuSetupBase::ProcessKey(key);;
+
+ if (key != kNone) {
+ if (tmpNVidPrefer != data.nVidPrefer || tmpUseVidPrefer != data.UseVidPrefer) {
+ int cur = Current();
+
+ tmpNVidPrefer = data.nVidPrefer;
+ tmpUseVidPrefer = data.UseVidPrefer;
+
+ Clear();
+ Set();
+ SetCurrent(Get(cur));
+ Display();
+ cMenuSetupBase::ProcessKey(kNone);
+ return osContinue;
+ }
+ }
+ return s;
+}
+
+#else
+cMenuSetupRecord::cMenuSetupRecord(void)
+#endif /* DVLVIDPREFER */
+#ifdef USE_DVLVIDPREFER
+void cMenuSetupRecord::Set(void)
+#endif /* DVLVIDPREFER */
+{
+#ifdef USE_DELTIMESHIFTREC
+ DelTimeshiftRecValues[0] = tr("request");
+ DelTimeshiftRecValues[1] = tr("no");
+ DelTimeshiftRecValues[2] = tr("yes");
+#endif /* DELTIMESHIFTREC */
+#ifdef USE_SORTRECORDS
+ sortRecordsTexts[0] = "Alphabet fuer Haupt-, flexible fuer Unterverzeichnisse";
+ sortRecordsTexts[1] = "Datum fuer Haupt-, flexible fuer Unterverzeichnisse";
+ sortRecordsTexts[2] = "Alphabet fuer alle Verzeichnisse";
+ sortRecordsTexts[3] = "Datum fuer alle Verzeichnisse";
+#endif /* SORTRECORDS */
pauseKeyHandlingTexts[0] = tr("do not pause live video");
pauseKeyHandlingTexts[1] = tr("confirm pause live video");
pauseKeyHandlingTexts[2] = tr("pause live video");
SetSection(tr("Recording"));
+#ifdef USE_SORTRECORDS
+ Add(new cMenuEditStraItem( tr("Setup.Recording$Sort recordings by"), &data.SortRecords, 4, sortRecordsTexts));
+#endif /* SORTRECORDS */
Add(new cMenuEditIntItem( tr("Setup.Recording$Margin at start (min)"), &data.MarginStart));
Add(new cMenuEditIntItem( tr("Setup.Recording$Margin at stop (min)"), &data.MarginStop));
Add(new cMenuEditIntItem( tr("Setup.Recording$Primary limit"), &data.PrimaryLimit, 0, MAXPRIORITY));
@@ -3044,14 +3682,45 @@
Add(new cMenuEditStraItem(tr("Setup.Recording$Pause key handling"), &data.PauseKeyHandling, 3, pauseKeyHandlingTexts));
Add(new cMenuEditIntItem( tr("Setup.Recording$Pause priority"), &data.PausePriority, 0, MAXPRIORITY));
Add(new cMenuEditIntItem( tr("Setup.Recording$Pause lifetime (d)"), &data.PauseLifetime, 0, MAXLIFETIME));
+#ifdef USE_DVLVIDPREFER
+ tmpNVidPrefer = data.nVidPrefer;
+ tmpUseVidPrefer = data.UseVidPrefer;
+
+ Add(new cMenuEditBoolItem(tr("Setup.Recording$Video directory policy"), &data.UseVidPrefer));
+ if (data.UseVidPrefer != 0) {
+ char tmp[ 64 ];
+ Add(new cMenuEditIntItem(tr("Setup.Recording$Number of video directories"), &data.nVidPrefer, 1, DVLVIDPREFER_MAX));
+ for (int zz = 0; zz < data.nVidPrefer; zz++) {
+ sprintf(tmp, tr("Setup.Recording$Video %d priority"), zz);
+ Add(new cMenuEditIntItem(tmp, &data.VidPreferPrio[ zz ], 0, 99));
+ sprintf(tmp, tr("Setup.Recording$Video %d min. free MB"), zz);
+ Add(new cMenuEditIntItem(tmp, &data.VidPreferSize[ zz ], -1, 99999));
+ }
+ }
+#endif /* DVLVIDPREFER */
Add(new cMenuEditBoolItem(tr("Setup.Recording$Use episode name"), &data.UseSubtitle));
+#ifdef USE_DVLFRIENDLYFNAMES
+ Add(new cMenuEditBoolItem(tr("Setup.Recording$Friendly filenames"), &data.UseFriendlyFNames));
+#endif /* DVLFRIENDLYFNAMES */
Add(new cMenuEditBoolItem(tr("Setup.Recording$Use VPS"), &data.UseVps));
Add(new cMenuEditIntItem( tr("Setup.Recording$VPS margin (s)"), &data.VpsMargin, 0));
Add(new cMenuEditBoolItem(tr("Setup.Recording$Mark instant recording"), &data.MarkInstantRecord));
Add(new cMenuEditStrItem( tr("Setup.Recording$Name instant recording"), data.NameInstantRecord, sizeof(data.NameInstantRecord)));
Add(new cMenuEditIntItem( tr("Setup.Recording$Instant rec. time (min)"), &data.InstantRecordTime, 1, MAXINSTANTRECTIME));
Add(new cMenuEditIntItem( tr("Setup.Recording$Max. video file size (MB)"), &data.MaxVideoFileSize, MINVIDEOFILESIZE, MAXVIDEOFILESIZETS));
+#ifdef USE_HARDLINKCUTTER
+ Add(new cMenuEditIntItem( tr("Setup.Recording$Max. recording size (GB)"), &data.MaxRecordingSize, MINRECORDINGSIZE, MAXRECORDINGSIZE));
+ Add(new cMenuEditBoolItem(tr("Setup.Recording$Hard Link Cutter"), &data.HardLinkCutter));
+#endif /* HARDLINKCUTTER */
Add(new cMenuEditBoolItem(tr("Setup.Recording$Split edited files"), &data.SplitEditedFiles));
+#ifdef USE_DELTIMESHIFTREC
+ Add(new cMenuEditStraItem(tr("Setup.Recording$Delete timeshift recording"), &data.DelTimeshiftRec, 3, DelTimeshiftRecValues));
+#endif /* DELTIMESHIFTREC */
+#ifdef USE_LIEMIEXT
+ Add(new cMenuEditBoolItem(tr("Setup.Recording$Show date"), &data.ShowRecDate));
+ Add(new cMenuEditBoolItem(tr("Setup.Recording$Show time"), &data.ShowRecTime));
+ Add(new cMenuEditBoolItem(tr("Setup.Recording$Show length"), &data.ShowRecLength));
+#endif /* LIEMIEXT */
}
// --- cMenuSetupReplay ------------------------------------------------------
@@ -3069,6 +3738,20 @@
Add(new cMenuEditBoolItem(tr("Setup.Replay$Multi speed mode"), &data.MultiSpeedMode));
Add(new cMenuEditBoolItem(tr("Setup.Replay$Show replay mode"), &data.ShowReplayMode));
Add(new cMenuEditIntItem(tr("Setup.Replay$Resume ID"), &data.ResumeID, 0, 99));
+#ifdef USE_JUMPINGSECONDS
+ Add(new cMenuEditIntItem( tr("Setup.Recording$Jump Seconds"), &data.JumpSeconds));
+ Add(new cMenuEditIntItem( tr("Setup.Recording$Jump Seconds (Repeat)"), &data.JumpSecondsRepeat));
+#endif /* JUMPINGSECONDS */
+#ifdef USE_JUMPPLAY
+ Add(new cMenuEditBoolItem(tr("Setup.Replay$Jump&Play"), &data.JumpPlay));
+ Add(new cMenuEditBoolItem(tr("Setup.Replay$Play&Jump"), &data.PlayJump));
+ Add(new cMenuEditBoolItem(tr("Setup.Replay$Pause at last mark"), &data.PauseLastMark));
+ Add(new cMenuEditBoolItem(tr("Setup.Replay$Reload marks"), &data.ReloadMarks));
+#endif /* JUMPPLAY */
+#ifdef USE_DVDARCHIVE
+ Add(new cMenuEditBoolItem(tr("Setup.Replay$Tray open on begin"), &data.TrayOpenOnBegin));
+ Add(new cMenuEditBoolItem(tr("Setup.Replay$Tray open on end"), &data.TrayOpenOnEnd));
+#endif /* DVDARCHIVE */
}
void cMenuSetupReplay::Store(void)
@@ -3081,13 +3764,48 @@
// --- cMenuSetupMisc --------------------------------------------------------
class cMenuSetupMisc : public cMenuSetupBase {
+#ifdef USE_VOLCTRL
+private:
+ const char *lrChannelGroupsTexts[3];
+ const char *lrForwardRewindTexts[3];
+ void Setup(void);
+#endif /* VOLCTRL */
public:
cMenuSetupMisc(void);
+#ifdef USE_VOLCTRL
+ virtual eOSState ProcessKey(eKeys Key);
+#endif /* VOLCTRL */
};
cMenuSetupMisc::cMenuSetupMisc(void)
{
+#ifdef USE_VOLCTRL
+ lrChannelGroupsTexts[0] = tr("no");
+ lrChannelGroupsTexts[1] = tr("Setup.Miscellaneous$only in channelinfo");
+ lrChannelGroupsTexts[2] = tr("yes");
+ lrForwardRewindTexts[0] = tr("no");
+ lrForwardRewindTexts[1] = tr("Setup.Miscellaneous$only in progress display");
+ lrForwardRewindTexts[2] = tr("yes");
+#endif /* VOLCTRL */
SetSection(tr("Miscellaneous"));
+#ifdef USE_VOLCTRL
+ Setup();
+}
+
+eOSState cMenuSetupMisc::ProcessKey(eKeys Key)
+{
+ int newLRVolumeControl = data.LRVolumeControl;
+ eOSState state = cMenuSetupBase::ProcessKey(Key);
+ if (Key != kNone && data.LRVolumeControl != newLRVolumeControl)
+ Setup();
+ return state;
+}
+
+void cMenuSetupMisc::Setup(void)
+{
+ int current = Current();
+ Clear();
+#endif /* VOLCTRL */
Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. event timeout (min)"), &data.MinEventTimeout));
Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. user inactivity (min)"), &data.MinUserInactivity));
Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$SVDRP timeout (s)"), &data.SVDRPTimeout));
@@ -3095,8 +3813,22 @@
Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Channel entry timeout (ms)"), &data.ChannelEntryTimeout, 0));
Add(new cMenuEditChanItem(tr("Setup.Miscellaneous$Initial channel"), &data.InitialChannel, tr("Setup.Miscellaneous$as before")));
Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Initial volume"), &data.InitialVolume, -1, 255, tr("Setup.Miscellaneous$as before")));
+#ifdef USE_VOLCTRL
+ Add(new cMenuEditBoolItem(tr("Setup.Miscellaneous$Volume ctrl with left/right"), &data.LRVolumeControl));
+ if (data.LRVolumeControl) {
+ Add(new cMenuEditStraItem(tr("Setup.Miscellaneous$Channelgroups with left/right"), &data.LRChannelGroups, 3, lrChannelGroupsTexts));
+ Add(new cMenuEditStraItem(tr("Setup.Miscellaneous$Search fwd/back with left/right"), &data.LRForwardRewind, 3, lrForwardRewindTexts));
+ }
+ SetCurrent(Get(current));
+ Display();
+#endif /* VOLCTRL */
Add(new cMenuEditBoolItem(tr("Setup.Miscellaneous$Channels wrap"), &data.ChannelsWrap));
Add(new cMenuEditBoolItem(tr("Setup.Miscellaneous$Emergency exit"), &data.EmergencyExit));
+#ifdef USE_LIRCSETTINGS
+ Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Lirc repeat delay"), &data.LircRepeatDelay, 0, 1000));
+ Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Lirc repeat freq"), &data.LircRepeatFreq, 0, 1000));
+ Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Lirc repeat timeout"), &data.LircRepeatTimeout, 0, 5000));
+#endif /* LIRCSETTINGS */
}
// --- cMenuSetupPluginItem --------------------------------------------------
@@ -3121,6 +3853,9 @@
public:
cMenuSetupPlugins(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuSetupPlugins"; }
+#endif /* GRAPHTFT */
};
cMenuSetupPlugins::cMenuSetupPlugins(void)
@@ -3170,6 +3905,9 @@
public:
cMenuSetup(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuSetup"; }
+#endif /* GRAPHTFT */
};
cMenuSetup::cMenuSetup(void)
@@ -3259,24 +3997,66 @@
cMenuMain::cMenuMain(eOSState State)
:cOsdMenu("")
{
+#ifdef USE_SETUP
+ // Load Menu Configuration
+ char *menuXML = NULL;
+ asprintf(&menuXML, "%s/setup/vdr-menu.%s.xml", cPlugin::ConfigDirectory(), Setup.OSDLanguage);
+ if (access(menuXML, 04) == -1)
+ asprintf(&menuXML, "%s/setup/vdr-menu.xml", cPlugin::ConfigDirectory());
+ subMenu.LoadXml(menuXML);
+ free(menuXML);
+ nrDynamicMenuEntries=0;
+#endif /* SETUP */
replaying = false;
stopReplayItem = NULL;
cancelEditingItem = NULL;
stopRecordingItem = NULL;
recordControlsState = 0;
+
+#ifdef USE_MENUORG
+ MenuOrgPatch::EnterRootMenu();
+#endif /* MENUORG */
Set();
// Initial submenus:
+#ifdef USE_MAINMENUHOOKS
+ cOsdMenu *menu = NULL;
+#endif /* MAINMENUHOOKS */
switch (State) {
+#ifdef USE_MAINMENUHOOKS
+ case osSchedule:
+ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osSchedule", &menu))
+ menu = new cMenuSchedule;
+ break;
+ case osChannels:
+ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osChannels", &menu))
+ menu = new cMenuChannels;
+ break;
+ case osTimers:
+ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osTimers", &menu))
+ menu = new cMenuTimers;
+ break;
+ case osRecordings:
+ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osRecordings", &menu))
+ menu = new cMenuRecordings(NULL, 0, true);
+ break;
+ case osSetup: menu = new cMenuSetup; break;
+ case osCommands: menu = new cMenuCommands(tr("Commands"), &Commands); break;
+#else
case osSchedule: AddSubMenu(new cMenuSchedule); break;
case osChannels: AddSubMenu(new cMenuChannels); break;
case osTimers: AddSubMenu(new cMenuTimers); break;
case osRecordings: AddSubMenu(new cMenuRecordings(NULL, 0, true)); break;
case osSetup: AddSubMenu(new cMenuSetup); break;
case osCommands: AddSubMenu(new cMenuCommands(tr("Commands"), &Commands)); break;
+#endif /* MAINMENUHOOKS */
default: break;
}
+#ifdef USE_MAINMENUHOOKS
+ if (menu)
+ AddSubMenu(menu);
+#endif /* MAINMENUHOOKS */
}
cOsdObject *cMenuMain::PluginOsdObject(void)
@@ -3286,37 +4066,153 @@
return o;
}
+#ifdef USE_SETUP
+void cMenuMain::Set(int current)
+#else
void cMenuMain::Set(void)
+#endif /* SETUP */
{
Clear();
SetTitle("VDR");
SetHasHotkeys();
+#ifdef USE_MENUORG
+ if (MenuOrgPatch::IsCustomMenuAvailable()) {
+ MenuItemDefinitions* menuItems = MenuOrgPatch::MainMenuItems();
+ for (MenuItemDefinitions::iterator i = menuItems->begin(); i != menuItems->end(); i++) {
+ cOsdItem* osdItem = NULL;
+ if ((*i)->IsCustomOsdItem()) {
+ osdItem = (*i)->CustomOsdItem();
+ if (osdItem && !(*i)->IsSeparatorItem())
+ osdItem->SetText(hk(osdItem->Text()));
+ }
+ else if ((*i)->IsPluginItem()) {
+ const char *item = (*i)->PluginMenuEntry();
+ if (item)
+ osdItem = new cMenuPluginItem(hk(item), (*i)->PluginIndex());
+ }
+ if (osdItem) {
+ Add(osdItem);
+ if ((*i)->IsSelected())
+ SetCurrent(osdItem);
+ }
+ }
+ }
+ else {
+#endif /* MENUORG */
+#ifdef USE_SETUP
+ stopReplayItem = NULL;
+ cancelEditingItem = NULL;
+ stopRecordingItem = NULL;
+
+ // remember initial dynamic MenuEntries added
+ nrDynamicMenuEntries = Count();
+ for (cSubMenuNode *node = subMenu.GetMenuTree()->First(); node; node = subMenu.GetMenuTree()->Next(node)) {
+ cSubMenuNode::Type type = node->GetType();
+ if (type==cSubMenuNode::PLUGIN) {
+ const char *item = node->GetPluginMainMenuEntry();
+ if (item)
+ Add(new cMenuPluginItem(hk(item), node->GetPluginIndex()));
+ }
+ else if (type==cSubMenuNode::MENU) {
+ cString item = cString::sprintf("%s%s", node->GetName(), subMenu.GetMenuSuffix());
+ Add(new cOsdItem(hk(item)));
+ }
+ else if ((type==cSubMenuNode::COMMAND) || (type==cSubMenuNode::THREAD)) {
+ Add(new cOsdItem(hk(node->GetName())));
+ }
+ else if (type==cSubMenuNode::SYSTEM) {
+ const char *item = node->GetName();
+ if (strcmp(item, "Schedule") == 0)
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgMenuItemProtected("Schedule", true)) Add(new cOsdItem(hk(tr("Schedule")), osSchedule));
+#else
+ Add(new cOsdItem(hk(tr("Schedule")), osSchedule));
+#endif /* PINPLUGIN */
+ else if (strcmp(item, "Channels") == 0)
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgMenuItemProtected("Channels", true)) Add(new cOsdItem(hk(tr("Channels")), osChannels));
+#else
+ Add(new cOsdItem(hk(tr("Channels")), osChannels));
+#endif /* PINPLUGIN */
+ else if (strcmp(item, "Timers") == 0)
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgMenuItemProtected("Timers", true))
+#endif /* PINPLUGIN */
+ Add(new cOsdItem(hk(tr("Timers")), osTimers));
+ else if (strcmp(item, "Recordings") == 0)
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgMenuItemProtected("Recordings", true))
+#endif /* PINPLUGIN */
+ Add(new cOsdItem(hk(tr("Recordings")), osRecordings));
+ else if (strcmp(item, "Setup") == 0)
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgMenuItemProtected("Setup", true))
+#endif /* PINPLUGIN */
+ Add(new cOsdItem(hk(tr("Setup")), osSetup));
+ else if (strcmp(item, "Commands") == 0 && Commands.Count()>0)
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgMenuItemProtected("Commands", true))
+#endif /* PINPLUGIN */
+ Add(new cOsdItem(hk(tr("Commands")), osCommands));
+ }
+ }
+ if (current >=0 && current<Count()) {
+ SetCurrent(Get(current));
+ }
+
+#else /* NO SETUP */
+
// Basic menu items:
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgMenuItemProtected("Schedule", true)) Add(new cOsdItem(hk(tr("Schedule")), osSchedule));
+ if (!cStatus::MsgMenuItemProtected("Channels", true)) Add(new cOsdItem(hk(tr("Channels")), osChannels));
+ if (!cStatus::MsgMenuItemProtected("Timers", true)) Add(new cOsdItem(hk(tr("Timers")), osTimers));
+ if (!cStatus::MsgMenuItemProtected("Recordings", true)) Add(new cOsdItem(hk(tr("Recordings")), osRecordings));
+#else
Add(new cOsdItem(hk(tr("Schedule")), osSchedule));
Add(new cOsdItem(hk(tr("Channels")), osChannels));
Add(new cOsdItem(hk(tr("Timers")), osTimers));
Add(new cOsdItem(hk(tr("Recordings")), osRecordings));
+#endif /* PINPLUGIN */
// Plugins:
for (int i = 0; ; i++) {
cPlugin *p = cPluginManager::GetPlugin(i);
if (p) {
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgPluginProtected(p, true)) { // PIN PATCH
+#endif /* PINPLUGIN */
const char *item = p->MainMenuEntry();
if (item)
Add(new cMenuPluginItem(hk(item), i));
}
+#ifdef USE_PINPLUGIN
+ }
+#endif /* PINPLUGIN */
else
break;
}
// More basic menu items:
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgMenuItemProtected("Setup", true)) Add(new cOsdItem(hk(tr("Setup")), osSetup)); // PIN PATCH
+#else
Add(new cOsdItem(hk(tr("Setup")), osSetup));
+#endif /* PINPLUGIN */
if (Commands.Count())
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgMenuItemProtected("Commands", true)) // PIN PATCH
+#endif /* PINPLUGIN */
Add(new cOsdItem(hk(tr("Commands")), osCommands));
+#endif /* SETUP */
+
+#ifdef USE_MENUORG
+ }
+#endif /* MENUORG */
Update(true);
@@ -3326,13 +4222,29 @@
bool cMenuMain::Update(bool Force)
{
bool result = false;
+
+#ifdef USE_SETUP
+ cOsdItem *fMenu = NULL;
+ if (Force && subMenu.isTopMenu()) {
+ fMenu = First();
+ nrDynamicMenuEntries = 0;
+ }
+ if (subMenu.isTopMenu()) {
+#endif /* SETUP */
// Title with disk usage:
if (FreeDiskSpace.HasChanged(Force)) {
//XXX -> skin function!!!
SetTitle(cString::sprintf("%s - %s", tr("VDR"), FreeDiskSpace.FreeDiskSpaceString()));
result = true;
}
+#ifdef USE_SETUP
+ }
+ else {
+ SetTitle(cString::sprintf("%s - %s", tr("VDR"), subMenu.GetParentMenuTitel()));
+ result = true;
+ }
+#endif /* SETUP */
bool NewReplaying = cControl::Control() != NULL;
if (Force || NewReplaying != replaying) {
@@ -3340,6 +4252,9 @@
// Replay control:
if (replaying && !stopReplayItem)
// TRANSLATORS: note the leading blank!
+#ifdef USE_LIEMIEXT
+ if (Setup.MenuCmdPosition) Ins(stopReplayItem = new cOsdItem(tr(" Stop replaying"), osStopReplay)); else
+#endif /* LIEMIEXT */
Add(stopReplayItem = new cOsdItem(tr(" Stop replaying"), osStopReplay));
else if (stopReplayItem && !replaying) {
Del(stopReplayItem->Index());
@@ -3354,6 +4269,9 @@
bool CutterActive = cCutter::Active();
if (CutterActive && !cancelEditingItem) {
// TRANSLATORS: note the leading blank!
+#ifdef USE_LIEMIEXT
+ if (Setup.MenuCmdPosition) Ins(cancelEditingItem = new cOsdItem(tr(" Cancel editing"), osCancelEdit)); else
+#endif /* LIEMIEXT */
Add(cancelEditingItem = new cOsdItem(tr(" Cancel editing"), osCancelEdit));
result = true;
}
@@ -3374,6 +4292,9 @@
while ((s = cRecordControls::GetInstantId(s)) != NULL) {
cOsdItem *item = new cOsdItem(osStopRecord);
item->SetText(cString::sprintf("%s%s", tr(STOP_RECORDING), s));
+#ifdef USE_LIEMIEXT
+ if (Setup.MenuCmdPosition) Ins(item); else
+#endif /* LIEMIEXT */
Add(item);
if (!stopRecordingItem)
stopRecordingItem = item;
@@ -3381,6 +4302,12 @@
result = true;
}
+#ifdef USE_SETUP
+ // adjust nrDynamicMenuEntries
+ if (fMenu != NULL)
+ nrDynamicMenuEntries = fMenu->Index();
+#endif /* SETUP */
+
return result;
}
@@ -3391,13 +4318,53 @@
eOSState state = cOsdMenu::ProcessKey(Key);
HadSubMenu |= HasSubMenu();
+#ifdef USE_MAINMENUHOOKS
+ cOsdMenu *menu = NULL;
+#endif /* MAINMENUHOOKS */
+#ifdef USE_PINPLUGIN
+ cOsdItem* item = Get(Current());
+
+ if (item && item->Text() && state != osContinue && state != osUnknown && state != osBack)
+ if (cStatus::MsgMenuItemProtected(item->Text()))
+ return osContinue;
+#endif /* PINPLUGIN */
+
switch (state) {
+#ifdef USE_MAINMENUHOOKS
+ case osSchedule:
+ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osSchedule", &menu))
+ menu = new cMenuSchedule;
+ else
+ state = osContinue;
+ break;
+ case osChannels:
+ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osChannels", &menu))
+ menu = new cMenuChannels;
+ else
+ state = osContinue;
+ break;
+ case osTimers:
+ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osTimers", &menu))
+ menu = new cMenuTimers;
+ else
+ state = osContinue;
+ break;
+ case osRecordings:
+ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osRecordings", &menu))
+ menu = new cMenuRecordings;
+ else
+ state = osContinue;
+ break;
+ case osSetup: menu = new cMenuSetup; break;
+ case osCommands: menu = new cMenuCommands(tr("Commands"), &Commands); break;
+#else
case osSchedule: return AddSubMenu(new cMenuSchedule);
case osChannels: return AddSubMenu(new cMenuChannels);
case osTimers: return AddSubMenu(new cMenuTimers);
case osRecordings: return AddSubMenu(new cMenuRecordings);
case osSetup: return AddSubMenu(new cMenuSetup);
case osCommands: return AddSubMenu(new cMenuCommands(tr("Commands"), &Commands));
+#endif /* MAINMENUHOOKS */
case osStopRecord: if (Interface->Confirm(tr("Stop recording?"))) {
cOsdItem *item = Get(Current());
if (item) {
@@ -3416,6 +4383,9 @@
if (item) {
cPlugin *p = cPluginManager::GetPlugin(item->PluginIndex());
if (p) {
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgPluginProtected(p)) { // PIN PATCH
+#endif /* PINPLUGIN */
cOsdObject *menu = p->MainMenuAction();
if (menu) {
if (menu->IsMenu())
@@ -3425,11 +4395,63 @@
return osPlugin;
}
}
+#ifdef USE_PINPLUGIN
}
+#endif /* PINPLUGIN */
}
+ }
state = osEnd;
}
break;
+#ifdef USE_MENUORG
+ case osBack: {
+ if (MenuOrgPatch::IsCustomMenuAvailable())
+ {
+ bool leavingMenuSucceeded = MenuOrgPatch::LeaveSubMenu();
+ Set();
+ stopReplayItem = NULL;
+ cancelEditingItem = NULL;
+ stopRecordingItem = NULL;
+ recordControlsState = 0;
+ Update(true);
+ Display();
+ if (leavingMenuSucceeded)
+ return osContinue;
+ else
+ return osEnd;
+ }
+ }
+ break;
+ case osUser1: {
+ if (MenuOrgPatch::IsCustomMenuAvailable()) {
+ MenuOrgPatch::EnterSubMenu(Get(Current()));
+ Set();
+ return osContinue;
+ }
+ }
+ break;
+ case osUser2: {
+ if (MenuOrgPatch::IsCustomMenuAvailable()) {
+ cOsdMenu* osdMenu = MenuOrgPatch::Execute(Get(Current()));
+ if (osdMenu)
+ return AddSubMenu(osdMenu);
+ return osEnd;
+ }
+ }
+ break;
+#endif /* MENUORG */
+#ifdef USE_SETUP
+ case osBack: {
+ int newCurrent = 0;
+ if (subMenu.Up(&newCurrent)) {
+ Set(newCurrent);
+ return osContinue;
+ }
+ else
+ return osEnd;
+ }
+ break;
+#endif /* SETUP */
default: switch (Key) {
case kRecord:
case kRed: if (!HadSubMenu)
@@ -3446,9 +4468,59 @@
case kBlue: if (!HadSubMenu)
state = replaying ? osStopReplay : cReplayControl::LastReplayed() ? osReplay : osContinue;
break;
+#ifdef USE_SETUP
+ case kOk: if (state == osUnknown) {
+ cString buffer;
+ int index = Current()-nrDynamicMenuEntries;
+ cSubMenuNode *node = subMenu.GetNode(index);
+
+ if (node != NULL) {
+ if (node->GetType() == cSubMenuNode::MENU) {
+ subMenu.Down(index);
+ }
+ else if (node->GetType() == cSubMenuNode::COMMAND) {
+ bool confirmed = true;
+ if (node->CommandConfirm()) {
+ buffer = cString::sprintf("%s?", node->GetName());
+ confirmed = Interface->Confirm(buffer);
+ }
+ if (confirmed) {
+ const char *Result = subMenu.ExecuteCommand(node->GetCommand());
+ if (Result)
+ return AddSubMenu(new cMenuText(node->GetName(), Result, fontFix));
+ return osEnd;
+ }
+ }
+ else if (node->GetType() == cSubMenuNode::THREAD) {
+ bool confirmed = true;
+ if (node->CommandConfirm()) {
+ buffer = cString::sprintf("%s?", node->GetName());
+ confirmed = Interface->Confirm(buffer);
+ }
+ if (confirmed) {
+ buffer = cString::sprintf("%s", node->GetCommand());
+ cExecCmdThread *execcmd = new cExecCmdThread(node->GetCommand());
+ if (execcmd->Start())
+ dsyslog("executing command '%s'", *buffer);
+ else
+ esyslog("ERROR: can't execute command '%s'", *buffer);
+ return osEnd;
+ }
+ }
+ }
+
+ Set();
+ return osContinue;
+ }
+ break;
+#endif /* SETUP */
default: break;
}
}
+#ifdef USE_MAINMENUHOOKS
+ if (menu)
+ return AddSubMenu(menu);
+#endif /* LNBSHARE */
if (!HasSubMenu() && Update(HadSubMenu))
Display();
if (Key != kNone) {
@@ -3595,9 +4667,16 @@
if (Direction) {
while (Channel) {
Channel = Direction > 0 ? Channels.Next(Channel) : Channels.Prev(Channel);
+#ifdef USE_PINPLUGIN
+ if (cStatus::MsgChannelProtected(0, Channel) == false) // PIN PATCH
+#endif /* PINPLUGIN */
if (!Channel && Setup.ChannelsWrap)
Channel = Direction > 0 ? Channels.First() : Channels.Last();
+#ifdef USE_LNBSHARE
+ if (Channel && !Channel->GroupSep() && ((cDevice::PrimaryDevice()->ProvidesChannel(Channel, Setup.PrimaryLimit) && cDevice::PrimaryDevice()->GetMaxBadPriority(Channel) < 0) || cDevice::GetDevice(Channel, 0, true) ) )
+#else
if (Channel && !Channel->GroupSep() && cDevice::GetDevice(Channel, 0, true))
+#endif /* LNBSHARE */
return Channel;
}
}
@@ -3655,6 +4734,13 @@
case kLeft:
case kRight|k_Repeat:
case kRight:
+#ifdef USE_VOLCTRL
+ if (Setup.LRVolumeControl && !Setup.LRChannelGroups) {
+ cRemote::Put(NORMALKEY(Key) == kLeft ? kVolDn : kVolUp, true);
+ break;
+ }
+ // else fall through
+#endif /* VOLCTRL */
case kNext|k_Repeat:
case kNext:
case kPrev|k_Repeat:
@@ -3814,6 +4900,17 @@
eOSState cDisplayVolume::ProcessKey(eKeys Key)
{
switch (Key) {
+#ifdef USE_VOLCTRL
+ case kLeft|k_Repeat:
+ case kLeft:
+ case kRight|k_Repeat:
+ case kRight:
+ if (Setup.LRVolumeControl) {
+ cRemote::Put(NORMALKEY(Key) == kLeft ? kVolDn : kVolUp, true);
+ break;
+ }
+ // else fall through
+#endif /* VOLCTRL */
case kVolUp|k_Repeat:
case kVolUp:
case kVolDn|k_Repeat:
@@ -4061,8 +5158,16 @@
// --- cRecordControl --------------------------------------------------------
+#ifdef USE_ALTERNATECHANNEL
+cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause, cChannel *Channel)
+#else
cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause)
+#endif /* ALTERNATECHANNEL */
{
+#ifdef USE_DVLRECSCRIPTADDON
+ const cChannel *recChan = NULL;
+ char *chanName = NULL;
+#endif /* DVLRECSCRIPTADDON */
// We're going to manipulate an event here, so we need to prevent
// others from modifying any EPG data:
cSchedulesLock SchedulesLock;
@@ -4107,12 +5212,29 @@
return;
}
+#ifdef USE_DVLRECSCRIPTADDON
+ if (timer)
+ if ((recChan = timer->Channel()) != NULL)
+ chanName = strdup(recChan->Name());
+ if (chanName != NULL) {
+ cRecordingUserCommand::InvokeCommand(RUC_BEFORERECORDING, fileName, chanName);
+ free(chanName);
+ }
+ else
+#endif /* DVLRECSCRIPTADDON */
cRecordingUserCommand::InvokeCommand(RUC_BEFORERECORDING, fileName);
isyslog("record %s", fileName);
if (MakeDirs(fileName, true)) {
+#ifdef USE_ALTERNATECHANNEL
+ const cChannel *ch = Channel ? Channel : timer->Channel();
+ if (ch)
+ recorder = new cRecorder(fileName, ch, timer->Priority());
+ if (ch && device->AttachReceiver(recorder)) {
+#else
const cChannel *ch = timer->Channel();
- recorder = new cRecorder(fileName, ch, timer->Priority());
+ recorder = new cRecorder(fileName, ch, timer->Priority());
if (device->AttachReceiver(recorder)) {
+#endif /* ALTERNATECHANNEL */
Recording.WriteInfo();
cStatus::MsgRecording(device, Recording.Name(), Recording.FileName(), true);
if (!Timer && !cReplayControl::LastReplayed()) // an instant recording, maybe from cRecordControls::PauseLiveVideo()
@@ -4121,7 +5243,12 @@
return;
}
else
+#ifdef USE_ALTERNATECHANNEL
+ if (ch)
+ DELETENULL(recorder);
+#else
DELETENULL(recorder);
+#endif /* ALTERNATECHANNEL */
}
if (!Timer) {
Timers.Del(timer);
@@ -4169,11 +5296,25 @@
void cRecordControl::Stop(void)
{
if (timer) {
+#ifdef USE_DVLRECSCRIPTADDON
+ char *chanName = NULL;
+ const cChannel *recChan = NULL;
+
+ recChan = timer -> Channel();
+ if (recChan != NULL)
+ chanName = strdup(recChan -> Name());
+#endif /* DVLRECSCRIPTADDON */
DELETENULL(recorder);
timer->SetRecording(false);
timer = NULL;
cStatus::MsgRecording(device, NULL, fileName, false);
+#ifdef USE_DVLRECSCRIPTADDON
+ cRecordingUserCommand::InvokeCommand(RUC_AFTERRECORDING, fileName, chanName);
+ if (chanName != NULL)
+ free(chanName);
+#else
cRecordingUserCommand::InvokeCommand(RUC_AFTERRECORDING, fileName);
+#endif /* DVLRECSCRIPTADDON */
}
}
@@ -4219,7 +5360,30 @@
if (channel) {
int Priority = Timer ? Timer->Priority() : Pause ? Setup.PausePriority : Setup.DefaultPriority;
cDevice *device = cDevice::GetDevice(channel, Priority, false);
+
+#ifdef USE_ALTERNATECHANNEL
+ if (!device && channel->AlternativeChannelID().Valid()) {// check for alternatives
+ dsyslog("prepare to use alternative channel for channel %d", channel->Number());
+ channel = Channels.GetByChannelID(channel->AlternativeChannelID());
+ device = cDevice::GetDevice(channel, Priority, false);
+ if (device)
+ dsyslog("use of alternative channel %d successfully initiated", channel->Number());
+ }
+#endif /* ALTERNATECHANNEL */
+
if (device) {
+#ifdef USE_LNBSHARE
+ cDevice *tmpDevice;
+ while ((tmpDevice = device->GetBadDevice(channel))) {
+ if (tmpDevice->Replaying() == false) {
+ if (tmpDevice->IsPrimaryDevice() )
+ tmpDevice->SwitchChannelForced(channel, true);
+ else
+ tmpDevice->SwitchChannelForced(channel, false);
+ } else
+ tmpDevice->SwitchChannelForced(channel, false);
+ }
+#endif /* LNBSHARE */
dsyslog("switching device %d to channel %d", device->DeviceNumber() + 1, channel->Number());
if (!device->SwitchChannel(channel, false)) {
ShutdownHandler.RequestEmergencyExit();
@@ -4228,7 +5392,14 @@
if (!Timer || Timer->Matches()) {
for (int i = 0; i < MAXRECORDCONTROLS; i++) {
if (!RecordControls[i]) {
+#ifdef USE_ALTERNATECHANNEL
+ RecordControls[i] = new cRecordControl(device, Timer, Pause, channel);
+#else
RecordControls[i] = new cRecordControl(device, Timer, Pause);
+#endif /* ALTERNATECHANNEL */
+#ifdef USE_PINPLUGIN
+ cStatus::MsgRecordingFile(RecordControls[i]->FileName()); // PIN PATCH
+#endif /* PINPLUGIN */
return RecordControls[i]->Process(time(NULL));
}
}
@@ -4359,12 +5530,22 @@
// --- cReplayControl --------------------------------------------------------
+#ifdef USE_LIEMIEXT
+#define REPLAYCONTROLSKIPLIMIT 9 // s
+#define REPLAYCONTROLSKIPSECONDS 90 // s
+#define REPLAYCONTROLSKIPTIMEOUT 5000 // ms
+#endif /* LIEMIEXT */
+
cReplayControl *cReplayControl::currentReplayControl = NULL;
char *cReplayControl::fileName = NULL;
char *cReplayControl::title = NULL;
cReplayControl::cReplayControl(void)
+#ifdef USE_JUMPPLAY
+:cDvbPlayerControl(fileName), marks(fileName)
+#else
:cDvbPlayerControl(fileName)
+#endif /* JUMPPLAY */
{
currentReplayControl = this;
displayReplay = NULL;
@@ -4372,11 +5553,18 @@
lastCurrent = lastTotal = -1;
lastPlay = lastForward = false;
lastSpeed = -2; // an invalid value
+#ifdef USE_LIEMIEXT
+ lastSkipKey = kNone;
+ lastSkipSeconds = REPLAYCONTROLSKIPSECONDS;
+ lastSkipTimeout.Set(0);
+#endif /* LIEMIEXT */
timeoutShow = 0;
timeSearchActive = false;
cRecording Recording(fileName);
cStatus::MsgReplaying(this, Recording.Name(), Recording.FileName(), true);
+#ifndef USE_JUMPPLAY
marks.Load(fileName, Recording.FramesPerSecond(), Recording.IsPesRecording());
+#endif /* JUMPPLAY */
SetTrackDescriptions(false);
}
@@ -4389,6 +5577,58 @@
currentReplayControl = NULL;
}
+#ifdef USE_DELTIMESHIFTREC
+void cReplayControl::Stop(void)
+{
+ int dummy;
+ bool playing = GetIndex(dummy, dummy, false);
+ cRecordControl* rc = cRecordControls::GetRecordControl(fileName);
+
+ if (playing && rc && rc->InstantId()) {
+ isyslog("found Timeshiftrecording");
+
+ if ((Setup.DelTimeshiftRec != 0 ) || (Interface->Confirm(tr("Delete recording?")))) {
+ cRecordControl *rc = cRecordControls::GetRecordControl(fileName);
+ if (rc) {
+ cTimer *timer = rc->Timer();
+ if (timer) {
+ const char* reccmd_backup = cRecordingUserCommand::GetCommand();
+ cRecordingUserCommand::SetCommand(NULL);
+
+ timer->Skip();
+ cRecordControls::Process(time(NULL));
+ if (timer->IsSingleEvent()) {
+ isyslog("deleting timer %s", *timer->ToDescr());
+ Timers.Del(timer);
+ }
+ Timers.SetModified();
+
+ // restore reccmd
+ cRecordingUserCommand::SetCommand(reccmd_backup);
+ }
+ }
+ isyslog("stop replaying %s", fileName);
+ cDvbPlayerControl::Stop();
+
+ if (Setup.DelTimeshiftRec != 1) {
+ cRecording *recording = Recordings.GetByName(fileName);;
+ if (recording) {
+ if (recording->Delete()) {
+ Recordings.DelByName(fileName);
+ ClearLastReplayed(fileName);
+ return;
+ }
+ else
+ Skins.Message(mtError, tr("Error while deleting recording!"));
+ }
+ }
+ }
+ else
+ cDvbPlayerControl::Stop();
+ }
+}
+#endif /* DELTIMESHIFTREC */
+
void cReplayControl::SetRecording(const char *FileName, const char *Title)
{
free(fileName);
@@ -4604,8 +5844,16 @@
ShowTimed(2);
bool Play, Forward;
int Speed;
+#ifdef USE_JUMPPLAY
+ if (GetReplayMode(Play, Forward, Speed) && !Play) {
+#else
if (GetReplayMode(Play, Forward, Speed) && !Play)
+#endif /* JUMPPLAY */
Goto(Current, true);
+#ifdef USE_JUMPPLAY
+ displayFrames = true;
+ }
+#endif /* JUMPPLAY */
}
marks.Save();
}
@@ -4618,8 +5866,22 @@
if (GetIndex(Current, Total)) {
cMark *m = Forward ? marks.GetNext(Current) : marks.GetPrev(Current);
if (m) {
+#ifdef USE_JUMPPLAY
+ bool Play2, Forward2;
+ int Speed;
+ if (Setup.JumpPlay && GetReplayMode(Play2, Forward2, Speed) &&
+ Play2 && Forward && m->position < Total - SecondsToFrames(3, FramesPerSecond())) {
+ Goto(m->position);
+ Play();
+ }
+ else {
+ Goto(m->position, true);
+ displayFrames = true;
+ }
+#else
Goto(m->position, true);
displayFrames = true;
+#endif /* JUMPPLAY */
}
}
}
@@ -4652,7 +5914,11 @@
{
if (fileName) {
Hide();
+#ifdef USE_CUTTERQUEUE
+ if (!cCutter::Active() || Interface->Confirm(tr("Cutter already running - Add to cutting queue?"))) {
+#else
if (!cCutter::Active()) {
+#endif /* CUTTERQUEUE */
if (!marks.Count())
Skins.Message(mtError, tr("No editing marks defined!"));
else if (!cCutter::Start(fileName))
@@ -4674,7 +5940,11 @@
if (!m)
m = marks.GetNext(Current);
if (m) {
+#ifdef USE_JUMPPLAY
+ if ((m->Index() & 0x01) != 0 && !Setup.PlayJump)
+#else
if ((m->Index() & 0x01) != 0)
+#endif /* JUMPPLAY */
m = marks.Next(m);
if (m) {
Goto(m->position - SecondsToFrames(3, FramesPerSecond()));
@@ -4696,6 +5966,9 @@
{
if (!Active())
return osEnd;
+#ifdef USE_JUMPPLAY
+ marks.Reload();
+#endif /* JUMPPLAY */
if (visible) {
if (timeoutShow && time(NULL) > timeoutShow) {
Hide();
@@ -4708,12 +5981,31 @@
shown = ShowProgress(!shown) || shown;
}
bool DisplayedFrames = displayFrames;
+#ifdef USE_JUMPINGSECONDS
+ int pkw = 0;
+#endif /* JUMPINGSECONDS */
displayFrames = false;
if (timeSearchActive && Key != kNone) {
TimeSearchProcess(Key);
return osContinue;
}
bool DoShowMode = true;
+#ifdef USE_VOLCTRL
+ if (Setup.LRVolumeControl && (!Setup.LRForwardRewind || (Setup.LRForwardRewind == 1 && !visible))) {
+ switch (Key) {
+ // Left/Right volume control
+ case kLeft|k_Repeat:
+ case kLeft:
+ case kRight|k_Repeat:
+ case kRight:
+ cRemote::Put(NORMALKEY(Key) == kLeft ? kVolDn : kVolUp, true);
+ return osContinue;
+ break;
+ default:
+ break;
+ }
+ }
+#endif /* VOLCTRL */
switch (Key) {
// Positioning:
case kPlay:
@@ -4731,25 +6023,82 @@
case kFastFwd:
case kRight: Forward(); break;
case kRed: TimeSearch(); break;
+#ifdef USE_JUMPINGSECONDS
+ case kGreen|k_Repeat:
+ SkipSeconds(-(Setup.JumpSecondsRepeat)); break;
+ case kGreen: SkipSeconds(-(Setup.JumpSeconds)); break;
+ case kYellow|k_Repeat:
+ SkipSeconds(Setup.JumpSecondsRepeat); break;
+ case kYellow: SkipSeconds(Setup.JumpSeconds); break;
+#else
case kGreen|k_Repeat:
case kGreen: SkipSeconds(-60); break;
case kYellow|k_Repeat:
case kYellow: SkipSeconds( 60); break;
+#endif /* JUMPINGSECONDS */
+#ifdef USE_LIEMIEXT
+#ifdef USE_JUMPINGSECONDS
+ case k1|k_Repeat:
+ case k1:
+ displayFrames = true;
+ pkw = SkipFrames(-1);
+ Goto(pkw, true);
+ break;
+ case k3|k_Repeat:
+ case k3:
+ displayFrames = true;
+ pkw = SkipFrames( 1);
+ Goto(pkw, true);
+ break;
+#else
+ case k1|k_Repeat:
+ case k1: SkipSeconds(-20); break;
+ case k3|k_Repeat:
+ case k3: SkipSeconds( 20); break;
+#endif /* JUMPINGSECONDS */
+ case kPrev|k_Repeat:
+ case kPrev: if (lastSkipTimeout.TimedOut()) {
+ lastSkipSeconds = REPLAYCONTROLSKIPSECONDS;
+ lastSkipKey = kPrev;
+ }
+ else if (RAWKEY(lastSkipKey) != kPrev && lastSkipSeconds > (2 * REPLAYCONTROLSKIPLIMIT)) {
+ lastSkipSeconds /= 2;
+ lastSkipKey = kNone;
+ }
+ lastSkipTimeout.Set(REPLAYCONTROLSKIPTIMEOUT);
+ SkipSeconds(-lastSkipSeconds); break;
+ case kNext|k_Repeat:
+ case kNext: if (lastSkipTimeout.TimedOut()) {
+ lastSkipSeconds = REPLAYCONTROLSKIPSECONDS;
+ lastSkipKey = kNext;
+ }
+ else if (RAWKEY(lastSkipKey) != kNext && lastSkipSeconds > (2 * REPLAYCONTROLSKIPLIMIT)) {
+ lastSkipSeconds /= 2;
+ lastSkipKey = kNone;
+ }
+ lastSkipTimeout.Set(REPLAYCONTROLSKIPTIMEOUT);
+ SkipSeconds(lastSkipSeconds); break;
+#endif /* LIEMIEXT */
case kStop:
case kBlue: Hide();
Stop();
return osEnd;
+
default: {
DoShowMode = false;
switch (Key) {
// Editing:
case kMarkToggle: MarkToggle(); break;
+#ifndef USE_LIEMIEXT
case kPrev|k_Repeat:
case kPrev:
+#endif /* LIEMIEXT */
case kMarkJumpBack|k_Repeat:
case kMarkJumpBack: MarkJump(false); break;
+#ifndef USE_LIEMIEXT
case kNext|k_Repeat:
case kNext:
+#endif /* LIEMIEXT */
case kMarkJumpForward|k_Repeat:
case kMarkJumpForward: MarkJump(true); break;
case kMarkMoveBack|k_Repeat:
@@ -4769,7 +6118,16 @@
else
Show();
break;
+#ifdef USE_DELTIMESHIFTREC
+ case kBack: { cRecordControl* rc = cRecordControls::GetRecordControl(fileName);
+ if (rc && rc->InstantId())
+ return osEnd;
+ else
+ return osRecordings;
+ }
+#else
case kBack: return osRecordings;
+#endif /* DELTIMESHIFTREC */
default: return osUnknown;
}
}
diff -ruN vdr-1.7.12/menu.h vdr-1.7.12.ExtP_NG/menu.h
--- vdr-1.7.12/menu.h 2010-01-17 12:21:42.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/menu.h 2010-02-03 22:16:54.765050074 +0100
@@ -18,6 +18,9 @@
#include "menuitems.h"
#include "recorder.h"
#include "skins.h"
+#ifdef USE_SETUP
+#include "submenu.h"
+#endif /* SETUP */
class cMenuText : public cOsdMenu {
private:
@@ -51,12 +54,19 @@
cMenuFolder(const char *Title, cNestedItemList *NestedItemList, const char *Path = NULL);
cString GetFolder(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuText"; }
+#endif /* GRAPHTFT */
};
class cMenuEditTimer : public cOsdMenu {
private:
cTimer *timer;
cTimer data;
+#ifdef USE_LIEMIEXT
+ char name[MaxFileName];
+ char path[MaxFileName];
+#endif /* LIEMIEXT */
int channel;
bool addIfConfirmed;
cMenuEditStrItem *file;
@@ -68,6 +78,9 @@
cMenuEditTimer(cTimer *Timer, bool New = false);
virtual ~cMenuEditTimer();
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuTimerEdit"; }
+#endif /* GRAPHTFT */
};
class cMenuEvent : public cOsdMenu {
@@ -77,22 +90,37 @@
cMenuEvent(const cEvent *Event, bool CanSwitch = false, bool Buttons = false);
virtual void Display(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuEvent"; }
+#endif /* GRAPHTFT */
};
class cMenuMain : public cOsdMenu {
private:
+#ifdef USE_SETUP
+ int nrDynamicMenuEntries;
+#endif /* SETUP */
bool replaying;
cOsdItem *stopReplayItem;
cOsdItem *cancelEditingItem;
cOsdItem *stopRecordingItem;
int recordControlsState;
static cOsdObject *pluginOsdObject;
+#ifdef USE_SETUP
+ void Set(int current=0);
+ bool Update(bool Force = false);
+ cSubMenu subMenu;
+#else
void Set(void);
bool Update(bool Force = false);
+#endif /* SETUP */
public:
cMenuMain(eOSState State = osUnknown);
virtual eOSState ProcessKey(eKeys Key);
static cOsdObject *PluginOsdObject(void);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuMain"; }
+#endif /* GRAPHTFT */
};
class cDisplayChannel : public cOsdObject {
@@ -188,6 +216,9 @@
eOSState Delete(void);
eOSState Info(void);
eOSState Commands(eKeys Key = kNone);
+#ifdef USE_LIEMIEXT
+ eOSState Rename(void);
+#endif /* LIEMIEXT */
protected:
cRecording *GetRecording(cMenuRecordingItem *Item);
public:
@@ -206,7 +237,11 @@
char *fileName;
bool GetEvent(void);
public:
+#ifdef USE_ALTERNATECHANNEL
+ cRecordControl(cDevice *Device, cTimer *Timer = NULL, bool Pause = false, cChannel *Channel = NULL);
+#else
cRecordControl(cDevice *Device, cTimer *Timer = NULL, bool Pause = false);
+#endif /* ALTERNATECHANNEL */
virtual ~cRecordControl();
bool Process(time_t t);
cDevice *Device(void) { return device; }
@@ -237,11 +272,20 @@
class cReplayControl : public cDvbPlayerControl {
private:
cSkinDisplayReplay *displayReplay;
+#ifdef USE_JUMPPLAY
+ cMarksReload marks;
+#else
cMarks marks;
+#endif /* JUMPPLAY */
bool visible, modeOnly, shown, displayFrames;
int lastCurrent, lastTotal;
bool lastPlay, lastForward;
int lastSpeed;
+#ifdef USE_LIEMIEXT
+ int lastSkipSeconds;
+ eKeys lastSkipKey;
+ cTimeMs lastSkipTimeout;
+#endif /* LIEMIEXT */
time_t timeoutShow;
bool timeSearchActive, timeSearchHide;
int timeSearchTime, timeSearchPos;
@@ -262,6 +306,9 @@
public:
cReplayControl(void);
virtual ~cReplayControl();
+#ifdef USE_DELTIMESHIFTREC
+ void Stop(void);
+#endif /* DELTIMESHIFTREC */
virtual cOsdObject *GetInfo(void);
virtual eOSState ProcessKey(eKeys Key);
virtual void Show(void);
diff -ruN vdr-1.7.12/menuitems.c vdr-1.7.12.ExtP_NG/menuitems.c
--- vdr-1.7.12/menuitems.c 2009-12-06 12:31:20.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/menuitems.c 2010-02-03 22:16:54.784052894 +0100
@@ -33,9 +33,21 @@
free(name);
}
+#ifdef USE_VALIDINPUT
+void cMenuEditItem::SetValue(const char *Value, bool HasPre, bool HasSucc)
+#else
void cMenuEditItem::SetValue(const char *Value)
+#endif /* VALIDINPUT */
{
cString buffer = cString::sprintf("%s:\t%s", name, Value);
+#ifdef USE_VALIDINPUT
+ if (Setup.ShowValidInput) {
+ if (HasPre && HasSucc) buffer = cString::sprintf("%s:\t<%s>", name, Value);
+ else if (HasPre) buffer = cString::sprintf("%s:\t<%s", name, Value);
+ else if (HasSucc) buffer = cString::sprintf("%s:\t%s>", name, Value);
+ }
+#endif /* VALIDINPUT */
+
SetText(buffer);
cStatus::MsgOsdCurrentItem(buffer);
}
@@ -66,7 +78,11 @@
else {
char buf[16];
snprintf(buf, sizeof(buf), "%d", *value);
+#ifdef USE_VALIDINPUT
+ SetValue(buf, (*value > min), (*value < max));
+#else
SetValue(buf);
+#endif /* VALIDINPUT */
}
}
@@ -127,7 +143,11 @@
{
char buf[16];
snprintf(buf, sizeof(buf), "%s", *value ? trueString : falseString);
+#ifdef USE_VALIDINPUT
+ SetValue(buf, *value, !*value);
+#else
SetValue(buf);
+#endif /* VALIDINPUT */
}
// --- cMenuEditBitItem ------------------------------------------------------
@@ -687,6 +707,170 @@
return osContinue;
}
+#ifdef USE_LIEMIEXT
+// --- cMenuEditRecPathItem --------------------------------------------------
+
+cMenuEditRecPathItem::cMenuEditRecPathItem(const char* Name, char* Path,
+ int Length): cMenuEditStrItem(Name, Path, Length, tr(FileNameChars))
+{
+ SetBase(Path);
+}
+
+cMenuEditRecPathItem::~cMenuEditRecPathItem()
+{
+}
+
+void cMenuEditRecPathItem::SetBase(const char* Path)
+{
+ if (!Path)
+ base[0] = 0;
+ Utf8Strn0Cpy(base, Path, sizeof(base));
+ char* p = strrchr(base, '~');
+ if (p)
+ p[0] = 0;
+ else
+ base[0] = 0;
+}
+
+void cMenuEditRecPathItem::FindNextLevel()
+{
+ char item[MaxFileName];
+
+ for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording))
+ {
+ char* p;
+ Utf8Strn0Cpy(item, recording->Name(), sizeof(item));
+ stripspace(value);
+ lengthUtf8 = Utf8ToArray(value, valueUtf8, length);
+ if (!lengthUtf8)
+ p = strchr(item, '~');
+ else {
+ if (strstr(item, value) != item)
+ continue;
+ if (item[strlen(value)] != '~')
+ continue;
+ p = strchr(item + strlen(value) + 1, '~');
+ }
+ if (!p)
+ continue;
+ p[0] = 0;
+ Utf8Strn0Cpy(base, value, length);
+ Utf8Strn0Cpy(value, item, length);
+ lengthUtf8 = Utf8ToArray(value, valueUtf8, length);
+ return;
+ }
+}
+
+void cMenuEditRecPathItem::Find(bool Next)
+{
+ char item[MaxFileName];
+ char lastItem[MaxFileName] = "";
+
+ for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording))
+ {
+ const char* recName = recording->Name();
+ if (Utf8StrLen(base) && strstr(recName, base) != recName)
+ continue;
+ if (strlen(base) && recName[strlen(base)] != '~')
+ continue;
+ Utf8Strn0Cpy(item, recName, sizeof(item));
+ char* p = strchr(item + strlen(base) + 1, '~');
+ if (!p)
+ continue;
+ p[0] = 0;
+ if (!Next && (strcmp(item, value) == 0)) {
+ if (strlen(lastItem))
+ Utf8Strn0Cpy(value, lastItem, length);
+ lengthUtf8 = Utf8ToArray(value, valueUtf8, length);
+ return;
+ }
+ if (strcmp(lastItem, item) != 0) {
+ if(Next && Utf8StrLen(lastItem) && strcmp(lastItem, value) == 0) {
+ Utf8Strn0Cpy(value, item, length);
+ lengthUtf8 = Utf8ToArray(value, valueUtf8, length);
+ return;
+ }
+ Utf8Strn0Cpy(lastItem, item, sizeof(lastItem));
+ }
+ }
+}
+
+void cMenuEditRecPathItem::SetHelpKeys(void)
+{
+ cSkinDisplay::Current()->SetButtons(tr("Rename$Up"), tr("Rename$Down"), tr("Rename$Previous"), tr("Rename$Next"));
+}
+
+eOSState cMenuEditRecPathItem::ProcessKey(eKeys Key)
+{
+ switch (Key) {
+ case kLeft:
+ case kRed: // one level up
+ if (!InEditMode())
+ return cMenuEditItem::ProcessKey(Key);
+ Utf8Strn0Cpy(value, base, lengthUtf8);
+ lengthUtf8 = Utf8ToArray(value, valueUtf8, length);
+ SetBase(base);
+ pos = Utf8StrLen(base);
+ if (pos)
+ pos++;
+ if (!lengthUtf8) {
+ Utf8Strn0Cpy(value, " ", length);
+ lengthUtf8 = Utf8ToArray(value, valueUtf8, length);
+ }
+ break;
+ case kRight:
+ case kGreen: // one level down
+ if (InEditMode())
+ FindNextLevel();
+ else
+ EnterEditMode();
+ if (!lengthUtf8) {
+ Utf8Strn0Cpy(value, " ", length);
+ lengthUtf8 = Utf8ToArray(value, valueUtf8, length);
+ }
+ pos = Utf8StrLen(base);
+ if (pos)
+ pos++;
+ SetHelpKeys();
+ break;
+ case kUp|k_Repeat:
+ case kUp:
+ case kYellow|k_Repeat:
+ case kYellow: // previous directory in list
+ if (!InEditMode())
+ return cMenuEditItem::ProcessKey(Key);
+ Find(false);
+ pos = Utf8StrLen(base);
+ if (pos)
+ pos++;
+ break;
+ case kDown|k_Repeat:
+ case kDown:
+ case kBlue|k_Repeat:
+ case kBlue: // next directory in list
+ if (!InEditMode())
+ return cMenuEditItem::ProcessKey(Key);
+ Find(true);
+ pos = Utf8StrLen(base);
+ if (pos)
+ pos++;
+ break;
+ case kOk: // done
+ if (!InEditMode())
+ return cMenuEditItem::ProcessKey(Key);
+ stripspace(value);
+ lengthUtf8 = Utf8ToArray(value, valueUtf8, length);
+ cSkinDisplay::Current()->SetButtons(NULL);
+ LeaveEditMode(Key == kOk);
+ break;
+ default:
+ return cMenuEditItem::ProcessKey(Key);
+ }
+ Set();
+ return osContinue;
+}
+#endif /* LIEMIEXT */
+
// --- cMenuEditStraItem -----------------------------------------------------
cMenuEditStraItem::cMenuEditStraItem(const char *Name, int *Value, int NumStrings, const char * const *Strings)
@@ -698,7 +882,11 @@
void cMenuEditStraItem::Set(void)
{
+#ifdef USE_VALIDINPUT
+ SetValue(strings[*value], (*value > min), (*value < max));
+#else
SetValue(strings[*value]);
+#endif /* VALIDINPUT */
}
// --- cMenuEditChanItem -----------------------------------------------------
@@ -716,6 +904,9 @@
char buf[255];
cChannel *channel = Channels.GetByNumber(*value);
snprintf(buf, sizeof(buf), "%d %s", *value, channel ? channel->Name() : "");
+#ifdef USE_VALIDINPUT
+ SetValue(buf, (*value > 1), (*value < Channels.MaxNumber()));
+#endif /* VALIDINPUT */
SetValue(buf);
}
else if (noneString)
diff -ruN vdr-1.7.12/menuitems.h vdr-1.7.12.ExtP_NG/menuitems.h
--- vdr-1.7.12/menuitems.h 2009-05-03 14:50:34.000000000 +0200
+++ vdr-1.7.12.ExtP_NG/menuitems.h 2010-02-03 22:16:54.791049047 +0100
@@ -21,7 +21,11 @@
public:
cMenuEditItem(const char *Name);
~cMenuEditItem();
+#ifdef USE_VALIDINPUT
+ void cMenuEditItem::SetValue(const char *Value, bool HasPre=false, bool HasSucc=false);
+#else
void SetValue(const char *Value);
+#endif /* VALIDINPUT */
};
class cMenuEditIntItem : public cMenuEditItem {
@@ -90,26 +94,46 @@
class cMenuEditStrItem : public cMenuEditItem {
private:
+#ifdef USE_LIEMIEXT
+ int offset;
+#else
char *value;
int length;
const char *allowed;
int pos, offset;
+#endif /* LIEMIEXT */
bool insert, newchar, uppercase;
+#ifndef USE_LIEMIEXT
int lengthUtf8;
uint *valueUtf8;
+#endif /* LIEMIEXT */
uint *allowedUtf8;
uint *charMapUtf8;
uint *currentCharUtf8;
eKeys lastKey;
cTimeMs autoAdvanceTimeout;
+#ifndef USE_LIEMIEXT
void SetHelpKeys(void);
+#endif /* LIEMIEXT */
uint *IsAllowed(uint c);
void AdvancePos(void);
+#ifndef USE_LIEMIEXT
virtual void Set(void);
+#endif /* LIEMIEXT */
uint Inc(uint c, bool Up);
void Insert(void);
void Delete(void);
protected:
+#ifdef USE_LIEMIEXT
+ char *value;
+ int length;
+ uint *valueUtf8;
+ int lengthUtf8;
+ const char *allowed;
+ int pos;
+ void SetHelpKeys(void);
+ virtual void Set(void);
+#endif /* LIEMIEXT */
void EnterEditMode(void);
void LeaveEditMode(bool SaveValue = false);
bool InEditMode(void) { return valueUtf8 != NULL; }
@@ -128,6 +152,21 @@
cMenuEditStraItem(const char *Name, int *Value, int NumStrings, const char * const *Strings);
};
+#ifdef USE_LIEMIEXT
+class cMenuEditRecPathItem : public cMenuEditStrItem {
+protected:
+ char base[MaxFileName];
+ virtual void SetHelpKeys(void);
+ void SetBase(const char* Path);
+ void FindNextLevel();
+ void Find(bool Next);
+public:
+ cMenuEditRecPathItem(const char* Name, char* Path, int Length);
+ ~cMenuEditRecPathItem();
+ virtual eOSState ProcessKey(eKeys Key);
+ };
+#endif /* LIEMIEXT */
+
class cMenuEditChanItem : public cMenuEditIntItem {
protected:
const char *noneString;
@@ -197,6 +236,9 @@
cMenuSetupPage(void);
virtual eOSState ProcessKey(eKeys Key);
void SetPlugin(cPlugin *Plugin);
+#ifdef USE_GRAPHTFT
+ const char* MenuKind() { return "MenuSetupPage"; }
+#endif /* GRAPHTFT */
};
#endif //__MENUITEMS_H
diff -ruN vdr-1.7.12/menuorgpatch.h vdr-1.7.12.ExtP_NG/menuorgpatch.h
--- vdr-1.7.12/menuorgpatch.h 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/menuorgpatch.h 2010-02-03 22:16:54.811049965 +0100
@@ -0,0 +1,100 @@
+/*
+ * vdr-menuorg - A plugin for the Linux Video Disk Recorder
+ * Copyright (c) 2007 - 2008 Tobias Grimm <vdr@e-tobi.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ *
+ */
+
+#ifndef __MENUORGPATCH_H
+#define __MENUORGPATCH_H
+
+#include "mainmenuitemsprovider.h"
+
+class MenuOrgPatch
+{
+ private:
+ static IMainMenuItemsProvider* _mainMenuItemsProvider;
+
+ private:
+ static IMainMenuItemsProvider* MainMenuItemsProvider()
+ {
+ if (!_mainMenuItemsProvider)
+ {
+ IMainMenuItemsProvider* mainMenuItemsProvider;
+
+ if (cPluginManager::CallFirstService(MENU_ITEMS_PROVIDER_SERVICE_ID, &mainMenuItemsProvider))
+ {
+ _mainMenuItemsProvider = mainMenuItemsProvider;
+ }
+ }
+ return _mainMenuItemsProvider;
+ }
+
+ public:
+ static bool IsCustomMenuAvailable()
+ {
+ return (MainMenuItemsProvider() != NULL) && (MainMenuItemsProvider()->IsCustomMenuAvailable());
+ }
+
+ static void EnterRootMenu()
+ {
+ if (MainMenuItemsProvider())
+ {
+ MainMenuItemsProvider()->EnterRootMenu();
+ }
+ }
+
+ static bool LeaveSubMenu()
+ {
+ if (MainMenuItemsProvider())
+ {
+ return MainMenuItemsProvider()->LeaveSubMenu();
+ }
+ return false;
+ }
+
+ static void EnterSubMenu(cOsdItem* item)
+ {
+ if (MainMenuItemsProvider())
+ {
+ MainMenuItemsProvider()->EnterSubMenu(item);
+ }
+ }
+
+ static MenuItemDefinitions* MainMenuItems()
+ {
+ if (MainMenuItemsProvider())
+ {
+ return MainMenuItemsProvider()->MainMenuItems();
+ }
+ return NULL;
+ }
+
+ static cOsdMenu* Execute(cOsdItem* item)
+ {
+ if (MainMenuItemsProvider())
+ {
+ return MainMenuItemsProvider()->Execute(item);
+ }
+ return NULL;
+ }
+};
+
+IMainMenuItemsProvider* MenuOrgPatch::_mainMenuItemsProvider = NULL;
+
+#endif //__MENUORGPATCH_H
diff -ruN vdr-1.7.12/osd.c vdr-1.7.12.ExtP_NG/osd.c
--- vdr-1.7.12/osd.c 2010-01-22 16:58:39.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/osd.c 2010-02-03 22:16:54.875053635 +0100
@@ -743,6 +743,9 @@
int cOsd::osdWidth = 0;
int cOsd::osdHeight = 0;
cVector<cOsd *> cOsd::Osds;
+#ifdef USE_PINPLUGIN
+bool cOsd::pinValid = false; // PIN PATCH
+#endif /* PINPLUGIN */
cOsd::cOsd(int Left, int Top, uint Level)
{
@@ -753,6 +756,9 @@
width = height = 0;
level = Level;
active = false;
+#ifdef USE_YAEPG
+ vidWin.bpp = 0;
+#endif /* YAEPG */
for (int i = 0; i < Osds.Size(); i++) {
if (Osds[i]->level > level) {
Osds.Insert(this, i);
diff -ruN vdr-1.7.12/osd.h vdr-1.7.12.ExtP_NG/osd.h
--- vdr-1.7.12/osd.h 2010-01-17 14:23:50.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/osd.h 2010-02-03 22:16:54.886052862 +0100
@@ -270,6 +270,10 @@
int left, top, width, height;
uint level;
bool active;
+#ifdef USE_YAEPG
+public:
+ tArea vidWin;
+#endif /* YAEPG */
protected:
cOsd(int Left, int Top, uint Level);
///< Initializes the OSD with the given coordinates.
@@ -401,6 +405,9 @@
///< 7: vertical, falling, upper
virtual void Flush(void);
///< Actually commits all data to the OSD hardware.
+#ifdef USE_PINPLUGIN
+ static bool pinValid; // PIN PATCH
+#endif /* PINPLUGIN */
};
class cOsdProvider {
diff -ruN vdr-1.7.12/osdbase.c vdr-1.7.12.ExtP_NG/osdbase.c
--- vdr-1.7.12/osdbase.c 2010-01-17 12:36:12.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/osdbase.c 2010-02-03 22:16:54.895053465 +0100
@@ -77,6 +77,9 @@
{
isMenu = true;
digit = 0;
+#ifdef USE_LIEMIEXT
+ key_nr = -1;
+#endif /* LIEMIEXT */
hasHotkeys = false;
title = NULL;
SetTitle(Title);
@@ -97,6 +100,9 @@
free(status);
displayMenu->Clear();
cStatus::MsgOsdClear();
+#ifdef USE_GRAPHTFT
+ cStatus::MsgOsdMenuDestroy();
+#endif /* GRAPHTFT */
if (!--displayMenuCount)
DELETENULL(displayMenu);
}
@@ -119,7 +125,11 @@
digit = -1; // prevents automatic hotkeys - input already has them
if (digit >= 0) {
digit++;
+#ifdef USE_LIEMIEXT
+ buffer = cString::sprintf(" %2d%s %s", digit, (digit > 9) ? "" : " ", s);
+#else
buffer = cString::sprintf(" %c %s", (digit < 10) ? '0' + digit : ' ' , s);
+#endif /* LIEMIEXT */
s = buffer;
}
}
@@ -202,6 +212,9 @@
displayMenu->SetMessage(mtStatus, NULL);
displayMenu->Clear();
cStatus::MsgOsdClear();
+#ifdef USE_GRAPHTFT
+ cStatus::MsgOsdMenuDisplay(MenuKind());
+#endif /* GRAPHTFT */
displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX
displayMenu->SetTitle(title);
cStatus::MsgOsdTitle(title);
@@ -449,20 +462,79 @@
}
}
+#ifdef USE_LIEMIEXT
+#define MENUKEY_TIMEOUT 1500
+#endif /* LIEMIEXT */
+
eOSState cOsdMenu::HotKey(eKeys Key)
{
+#ifdef USE_LIEMIEXT
+ bool match = false;
+ bool highlight = false;
+ int item_nr;
+ int i;
+
+ if (Key == kNone) {
+ if (lastActivity.TimedOut())
+ Key = kOk;
+ else
+ return osContinue;
+ }
+ else {
+ lastActivity.Set(MENUKEY_TIMEOUT);
+ }
+ for (cOsdItem *item = Last(); item; item = Prev(item)) {
+#else
for (cOsdItem *item = First(); item; item = Next(item)) {
+#endif /* LIEMIEXT */
const char *s = item->Text();
+#ifdef USE_LIEMIEXT
+ i = 0;
+ item_nr = 0;
+ if (s && (s = skipspace(s)) != '\0' && '0' <= s[i] && s[i] <= '9') {
+ do {
+ item_nr = item_nr * 10 + (s[i] - '0');
+ }
+ while ( !((s[++i] == '\t')||(s[i] == ' ')) && (s[i] != '\0') && ('0' <= s[i]) && (s[i] <= '9'));
+ if ((Key == kOk) && (item_nr == key_nr)) {
+#else
if (s && (s = skipspace(s)) != NULL) {
if (*s == Key - k1 + '1') {
+#endif /* LIEMIEXT */
current = item->Index();
RefreshCurrent();
Display();
cRemote::Put(kOk, true);
+#ifdef USE_LIEMIEXT
+ key_nr = -1;
+#endif /* LIEMIEXT */
break;
}
+#ifdef USE_LIEMIEXT
+ else if (Key != kOk) {
+ if (!highlight && (item_nr == (Key - k0))) {
+ highlight = true;
+ current = item->Index();
+ }
+ if (!match && (key_nr == -1) && ((item_nr / 10) == (Key - k0))) {
+ match = true;
+ key_nr = (Key - k0);
+ }
+ else if (((key_nr == -1) && (item_nr == (Key - k0))) || (!match && (key_nr >= 0) && (item_nr == (10 * key_nr + Key - k0)))) {
+ current = item->Index();
+ cRemote::Put(kOk, true);
+ key_nr = -1;
+ break;
+ }
+ }
+#endif /* LIEMIEXT */
}
}
+#ifdef USE_LIEMIEXT
+ if ((!match) && (Key != kNone)) {
+ key_nr = -1;
+ }
+#endif /* LIEMIEXT */
return osContinue;
}
@@ -501,8 +573,13 @@
}
}
switch (Key) {
+#ifdef USE_LIEMIEXT
+ case kNone:
+ case k0...k9: return hasHotkeys ? HotKey(Key) : osUnknown;
+#else
case k0: return osUnknown;
case k1...k9: return hasHotkeys ? HotKey(Key) : osUnknown;
+#endif /* LIEMIEXT */
case kUp|k_Repeat:
case kUp: CursorUp(); break;
case kDown|k_Repeat:
diff -ruN vdr-1.7.12/osdbase.h vdr-1.7.12.ExtP_NG/osdbase.h
--- vdr-1.7.12/osdbase.h 2010-01-16 15:25:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/osdbase.h 2010-02-03 22:16:54.906052451 +0100
@@ -95,6 +95,10 @@
char *status;
int digit;
bool hasHotkeys;
+#ifdef USE_LIEMIEXT
+ int key_nr;
+ cTimeMs lastActivity;
+#endif /* LIEMIEXT */
protected:
void SetDisplayMenu(void);
cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; }
@@ -131,6 +135,9 @@
void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL);
virtual void Display(void);
virtual eOSState ProcessKey(eKeys Key);
+#ifdef USE_GRAPHTFT
+ virtual const char* MenuKind() { return "MenuUnknown"; }
+#endif /* GRAPHTFT */
};
#endif //__OSDBASE_H
diff -ruN vdr-1.7.12/pat.c vdr-1.7.12.ExtP_NG/pat.c
--- vdr-1.7.12/pat.c 2010-01-01 16:40:05.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/pat.c 2010-02-03 22:16:54.927054527 +0100
@@ -392,6 +392,9 @@
break;
case 5: // STREAMTYPE_13818_PRIVATE
case 6: // STREAMTYPE_13818_PES_PRIVATE
+#ifdef USE_ATSC
+ case 0x81: // ATSC AC-3
+#endif /* ATSC */
//XXX case 8: // STREAMTYPE_13818_DSMCC
{
int dpid = 0;
@@ -400,6 +403,9 @@
for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
switch (d->getDescriptorTag()) {
case SI::AC3DescriptorTag:
+#ifdef USE_ATSC
+ case 0x81: // ATSC AC-3 descriptor tag
+#endif /* ATSC */
dpid = esPid;
ProcessCaDescriptors = true;
break;
diff -ruN vdr-1.7.12/plugin.c vdr-1.7.12.ExtP_NG/plugin.c
--- vdr-1.7.12/plugin.c 2010-01-06 12:36:46.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/plugin.c 2010-02-03 22:16:54.992052686 +0100
@@ -317,6 +317,14 @@
char *p = strchr(s, ' ');
if (p)
*p = 0;
+#ifdef USE_PLUGINMISSING
+ struct stat st;
+ if (stat (cString::sprintf("%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION), &st) && errno == ENOENT) {
+ esyslog("WARN: missing plugin '%s'", s);
+ fprintf(stderr, "vdr: missing plugin '%s'\n", s);
+ }
+ else
+#endif /* PLUGINMISSING */
dlls.Add(new cDll(cString::sprintf("%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION), Args));
free(s);
}
@@ -325,7 +333,11 @@
{
for (cDll *dll = dlls.First(); dll; dll = dlls.Next(dll)) {
if (!dll->Load(Log))
+#ifdef USE_PLUGINMISSING
+ ;
+#else
return false;
+#endif /* PLUGINMISSING */
}
return true;
}
diff -ruN vdr-1.7.12/plugin.h vdr-1.7.12.ExtP_NG/plugin.h
--- vdr-1.7.12/plugin.h 2007-08-04 11:56:26.000000000 +0200
+++ vdr-1.7.12.ExtP_NG/plugin.h 2010-02-03 22:16:55.007053454 +0100
@@ -45,6 +45,9 @@
virtual const char *MainMenuEntry(void);
virtual cOsdObject *MainMenuAction(void);
+#ifdef USE_MCLI
+ virtual cOsdObject *AltMenuAction(void) { return NULL; };
+#endif /* MCLI */
virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *Name, const char *Value);
diff -ruN vdr-1.7.12/po/ca_ES.po vdr-1.7.12.ExtP_NG/po/ca_ES.po
--- vdr-1.7.12/po/ca_ES.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/ca_ES.po 2010-02-03 22:16:56.298076998 +0100
@@ -526,6 +526,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polaritzaci"
@@ -910,6 +913,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Actualitza canals"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Idiomes d'udio"
diff -ruN vdr-1.7.12/po/cs_CZ.po vdr-1.7.12.ExtP_NG/po/cs_CZ.po
--- vdr-1.7.12/po/cs_CZ.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/cs_CZ.po 2010-02-03 22:16:56.309075021 +0100
@@ -524,6 +524,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarizace"
@@ -908,6 +911,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Aktualizace kanl"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Jazyky zvuku"
diff -ruN vdr-1.7.12/po/da_DK.po vdr-1.7.12.ExtP_NG/po/da_DK.po
--- vdr-1.7.12/po/da_DK.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/da_DK.po 2010-02-03 22:16:56.320077372 +0100
@@ -523,6 +523,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarisation"
@@ -907,6 +910,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Opdatr kanaler"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Audio sprog (ant.)"
diff -ruN vdr-1.7.12/po/de_DE.po vdr-1.7.12.ExtP_NG/po/de_DE.po
--- vdr-1.7.12/po/de_DE.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/de_DE.po 2010-02-03 22:16:56.336076258 +0100
@@ -523,6 +523,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarisation"
@@ -839,6 +842,18 @@
msgid "Button$Scan"
msgstr "Scan"
+msgid "Setup.EPG$Period for double EPG search(min)"
+msgstr "Zeitspanne fr dop. EPG-Suche(min)"
+
+msgid "Setup.EPG$extern double Epg entry"
+msgstr "Doppelten externen EPG-Eintrag"
+
+msgid "Setup.EPG$Mix intern and extern EPG"
+msgstr "Internen und externen EPG mischen"
+
+msgid "Setup.EPG$Disable running VPS event"
+msgstr "Erk. des lauf. VPS-Events abschalten"
+
msgid "Setup.EPG$EPG scan timeout (h)"
msgstr "Zeit bis zur EPG-Aktualisierung (h)"
@@ -907,6 +922,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Kanle aktualisieren"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr "Kanal per Rid zuordnen"
+
msgid "Setup.DVB$Audio languages"
msgstr "Audio-Sprachen"
@@ -1036,9 +1054,27 @@
msgid "Setup.Recording$Split edited files"
msgstr "Editierte Dateien aufteilen"
+msgid "Setup.Recording$Delete timeshift recording"
+msgstr "Zeitversetzte Aufnahme lschen"
+
+msgid "request"
+msgstr "abfragen"
+
msgid "Replay"
msgstr "Wiedergabe"
+msgid "Setup.Replay$Jump&Play"
+msgstr "Wiedergabe nach Sprung"
+
+msgid "Setup.Replay$Play&Jump"
+msgstr "Sprung bei Schnittmarke"
+
+msgid "Setup.Replay$Pause at last mark"
+msgstr "Pause bei letzter Marke"
+
+msgid "Setup.Replay$Reload marks"
+msgstr "Marken aktualisieren"
+
msgid "Setup.Replay$Multi speed mode"
msgstr "Mehrstufiger Vor-/Rcklauf"
@@ -1303,3 +1339,60 @@
#, c-format
msgid "VDR will shut down in %s minutes"
msgstr "VDR wird in %s Minuten ausschalten"
+
+msgid "Rename recording"
+msgstr "Aufzeichnung umbenennen"
+
+msgid "Date"
+msgstr "Datum"
+
+msgid "Length"
+msgstr "Lnge"
+
+msgid "Size"
+msgstr "Gre"
+
+msgid "Path"
+msgstr "Pfad"
+
+msgid "Format"
+msgstr "Format"
+
+msgid "PES"
+msgstr "PES"
+
+msgid "TS"
+msgstr "TS"
+
+msgid "Rename$Up"
+msgstr "Hher"
+
+msgid "Rename$Down"
+msgstr "Tiefer"
+
+msgid "Rename$Previous"
+msgstr "Vorheriger"
+
+msgid "Rename$Next"
+msgstr "Nchster"
+
+msgid "Delete marks information?"
+msgstr "Marks lschen?"
+
+msgid "Delete resume information?"
+msgstr "Resume lschen?"
+
+msgid "Setup.OSD$Main menu command position"
+msgstr "Befehle Position im Hauptmen"
+
+msgid "Setup.EPG$Show progress bar"
+msgstr "Zeitbalken anzeigen"
+
+msgid "Setup.Recording$Show date"
+msgstr "Aufnahmedatum anzeigen"
+
+msgid "Setup.Recording$Show time"
+msgstr "AufnahmeZeit anzeigen"
+
+msgid "Setup.Recording$Show length"
+msgstr "Lnge der Aufnahme anzeigen"
diff -ruN vdr-1.7.12/po/el_GR.po vdr-1.7.12.ExtP_NG/po/el_GR.po
--- vdr-1.7.12/po/el_GR.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/el_GR.po 2010-02-03 22:16:56.349078149 +0100
@@ -523,6 +523,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr ""
@@ -907,6 +910,9 @@
msgid "Setup.DVB$Update channels"
msgstr " "
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr " "
diff -ruN vdr-1.7.12/po/es_ES.po vdr-1.7.12.ExtP_NG/po/es_ES.po
--- vdr-1.7.12/po/es_ES.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/es_ES.po 2010-02-03 22:16:56.365079108 +0100
@@ -524,6 +524,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarizacin"
@@ -908,6 +911,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Actualizar canales"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Idiomas de audio"
diff -ruN vdr-1.7.12/po/et_EE.po vdr-1.7.12.ExtP_NG/po/et_EE.po
--- vdr-1.7.12/po/et_EE.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/et_EE.po 2010-02-03 22:16:56.377075844 +0100
@@ -523,6 +523,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarisatsioon"
@@ -907,6 +910,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Kanalite uuendamine"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Audio keeli"
@@ -1303,3 +1309,60 @@
#, c-format
msgid "VDR will shut down in %s minutes"
msgstr "VDR llitub vlja %s minuti prast"
+
+msgid "Rename recording"
+msgstr "mbernimetamine"
+
+msgid "Date"
+msgstr "Kuupev"
+
+msgid "Length"
+msgstr "Kestus"
+
+msgid "Size"
+msgstr "Suurus"
+
+msgid "Path"
+msgstr "Tee"
+
+msgid "Format"
+msgstr "Formaat"
+
+msgid "PES"
+msgstr "PES"
+
+msgid "TS"
+msgstr "TS"
+
+msgid "Rename$Up"
+msgstr "les"
+
+msgid "Rename$Down"
+msgstr "Alla"
+
+msgid "Rename$Previous"
+msgstr "Eelmine"
+
+msgid "Rename$Next"
+msgstr "Jrgmine"
+
+msgid "Delete marks information?"
+msgstr "Kustutada mrkide info?"
+
+msgid "Delete resume information?"
+msgstr "Kustutada jtkamise info?"
+
+msgid "Setup.OSD$Main menu command position"
+msgstr "Ksu asukoht peamens"
+
+msgid "Setup.EPG$Show progress bar"
+msgstr "Edenemisriba"
+
+msgid "Setup.Recording$Show date"
+msgstr "Salvestuse kuupev"
+
+msgid "Setup.Recording$Show time"
+msgstr "Salvestuse kellaaeg"
+
+msgid "Setup.Recording$Show length"
+msgstr "Salvestuse kestus"
diff -ruN vdr-1.7.12/po/fi_FI.po vdr-1.7.12.ExtP_NG/po/fi_FI.po
--- vdr-1.7.12/po/fi_FI.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/fi_FI.po 2010-02-03 22:16:56.389079875 +0100
@@ -526,6 +526,9 @@
msgid "Sid"
msgstr "Palvelu-ID"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarisaatio"
@@ -910,6 +913,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Pivit kanavat"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "nen kielet"
@@ -1306,3 +1312,63 @@
#, c-format
msgid "VDR will shut down in %s minutes"
msgstr "VDR sammuu %s minuutin kuluttua"
+
+msgid "Rename recording"
+msgstr "Nime tallenne"
+
+msgid "Date"
+msgstr "Pivys"
+
+msgid "Length"
+msgstr "Pituus"
+
+msgid "Size"
+msgstr "Koko"
+
+msgid "Path"
+msgstr "Polku"
+
+msgid "Format"
+msgstr "Tiedostomuoto"
+
+msgid "PES"
+msgstr "PES"
+
+msgid "TS"
+msgstr "TS"
+
+msgid "Rename$Up"
+msgstr "Ylemms"
+
+msgid "Rename$Down"
+msgstr "Alemmas"
+
+msgid "Rename$Previous"
+msgstr "Edellinen"
+
+msgid "Rename$Next"
+msgstr "Seuraava"
+
+msgid "Delete marks information?"
+msgstr "Poista tallenteen merkinnt?"
+
+msgid "Delete resume information?"
+msgstr "Poista tallenteen paluutiedot?"
+
+msgid "Setup.OSD$Main menu command position"
+msgstr "Komentojen sijainti pvalikossa"
+
+msgid "Setup.EPG$Show progress bar"
+msgstr "Nyt aikajana"
+
+msgid "Setup.Recording$Show date"
+msgstr "Nyt tallenteen pivys"
+
+msgid "Setup.Recording$Show time"
+msgstr "Nyt tallenteen ajankohta"
+
+msgid "Setup.Recording$Show length"
+msgstr "Nyt tallenteen kesto"
+
+msgid "Parameters"
+msgstr "Parametrit"
diff -ruN vdr-1.7.12/po/fr_FR.po vdr-1.7.12.ExtP_NG/po/fr_FR.po
--- vdr-1.7.12/po/fr_FR.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/fr_FR.po 2010-02-03 22:16:56.404075101 +0100
@@ -529,6 +529,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarisation"
@@ -845,6 +848,18 @@
msgid "Button$Scan"
msgstr "Scan"
+msgid "Setup.EPG$Period for double EPG search(min)"
+msgstr "Intervalle de recherche du double EPG(min)"
+
+msgid "Setup.EPG$extern double Epg entry"
+msgstr "Entre EPG externe en double"
+
+msgid "Setup.EPG$Mix intern and extern EPG"
+msgstr "Mixer EPG interne et externe"
+
+msgid "Setup.EPG$Disable running VPS event"
+msgstr "Dsactiver vnement VPS"
+
msgid "Setup.EPG$EPG scan timeout (h)"
msgstr "Inactivit avant rech. EPG (h)"
@@ -913,6 +928,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Mettre jour les chanes"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Langues audio"
@@ -1045,6 +1063,18 @@
msgid "Replay"
msgstr "Lecture"
+msgid "Setup.Replay$Jump&Play"
+msgstr "Lecture aprs saut"
+
+msgid "Setup.Replay$Play&Jump"
+msgstr "Saut sur les marques de dcoupes"
+
+msgid "Setup.Replay$Pause at last mark"
+msgstr "Pause aprs la dernire marque"
+
+msgid "Setup.Replay$Reload marks"
+msgstr "Actualiser les marques"
+
msgid "Setup.Replay$Multi speed mode"
msgstr "Mode multi-vitesses"
@@ -1309,3 +1339,63 @@
#, c-format
msgid "VDR will shut down in %s minutes"
msgstr "VDR s'arrtera dans %s minutes"
+
+msgid "Rename recording"
+msgstr "Renommer l'enregistrement"
+
+msgid "Date"
+msgstr "Date"
+
+msgid "Length"
+msgstr "Longueur"
+
+msgid "Size"
+msgstr "Taille"
+
+msgid "Path"
+msgstr "Chemin"
+
+msgid "Format"
+msgstr "Format"
+
+msgid "PES"
+msgstr "PES"
+
+msgid "TS"
+msgstr "TS"
+
+msgid "Rename$Up"
+msgstr "Haut"
+
+msgid "Rename$Down"
+msgstr "Bas"
+
+msgid "Rename$Previous"
+msgstr "Prcdent"
+
+msgid "Rename$Next"
+msgstr "Suivant"
+
+msgid "Delete marks information?"
+msgstr "Effacer les informations de marquage"
+
+msgid "Delete resume information?"
+msgstr "Effacer les informations de reprise"
+
+msgid "Setup.OSD$Main menu command position"
+msgstr "Position des commandes dans le menu"
+
+msgid "Setup.EPG$Show progress bar"
+msgstr "Montrer la barre de progression"
+
+msgid "Setup.Recording$Show date"
+msgstr "Montrer la date d'enregistrement"
+
+msgid "Setup.Recording$Show time"
+msgstr "Montrer l'heure d'enregistrement"
+
+msgid "Setup.Recording$Show length"
+msgstr "Montrer la longueur de l'enregistrement"
+
+msgid "Parameters"
+msgstr "Paramtres"
diff -ruN vdr-1.7.12/po/hr_HR.po vdr-1.7.12.ExtP_NG/po/hr_HR.po
--- vdr-1.7.12/po/hr_HR.po 2010-01-23 16:15:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/hr_HR.po 2010-02-03 22:16:56.423075217 +0100
@@ -525,6 +525,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarizacija"
@@ -909,6 +912,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Aktualiziraj programe"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Audio jezici"
diff -ruN vdr-1.7.12/po/hu_HU.po vdr-1.7.12.ExtP_NG/po/hu_HU.po
--- vdr-1.7.12/po/hu_HU.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/hu_HU.po 2010-02-03 22:16:56.436076235 +0100
@@ -526,6 +526,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarizci"
@@ -910,6 +913,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Adk aktualizlsa"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Audio nyelvek"
diff -ruN vdr-1.7.12/po/it_IT.po vdr-1.7.12.ExtP_NG/po/it_IT.po
--- vdr-1.7.12/po/it_IT.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/it_IT.po 2010-02-03 22:16:56.454080664 +0100
@@ -530,6 +530,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarizzazione"
@@ -914,6 +917,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Aggiornamento canali"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Lingue audio"
diff -ruN vdr-1.7.12/po/nl_NL.po vdr-1.7.12.ExtP_NG/po/nl_NL.po
--- vdr-1.7.12/po/nl_NL.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/nl_NL.po 2010-02-03 22:16:56.491079753 +0100
@@ -527,6 +527,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarisatie"
@@ -911,6 +914,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Kanalen actualiseren"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Audio talen"
diff -ruN vdr-1.7.12/po/nn_NO.po vdr-1.7.12.ExtP_NG/po/nn_NO.po
--- vdr-1.7.12/po/nn_NO.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/nn_NO.po 2010-02-03 22:16:56.505076826 +0100
@@ -524,6 +524,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarisasjon"
@@ -908,6 +911,9 @@
msgid "Setup.DVB$Update channels"
msgstr ""
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr ""
diff -ruN vdr-1.7.12/po/pl_PL.po vdr-1.7.12.ExtP_NG/po/pl_PL.po
--- vdr-1.7.12/po/pl_PL.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/pl_PL.po 2010-02-03 22:16:56.521080941 +0100
@@ -524,6 +524,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polaryzacja"
@@ -908,6 +911,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Aktualizuj kanay"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Jzykw dwiku"
diff -ruN vdr-1.7.12/po/pt_PT.po vdr-1.7.12.ExtP_NG/po/pt_PT.po
--- vdr-1.7.12/po/pt_PT.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/pt_PT.po 2010-02-03 22:16:56.537079213 +0100
@@ -523,6 +523,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarizao"
@@ -907,6 +910,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Actualizar canais"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Idiomas de audio"
diff -ruN vdr-1.7.12/po/ro_RO.po vdr-1.7.12.ExtP_NG/po/ro_RO.po
--- vdr-1.7.12/po/ro_RO.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/ro_RO.po 2010-02-03 22:16:56.554078978 +0100
@@ -526,6 +526,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarizare"
@@ -910,6 +913,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Actualizare canale"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Limbi sunet"
diff -ruN vdr-1.7.12/po/ru_RU.po vdr-1.7.12.ExtP_NG/po/ru_RU.po
--- vdr-1.7.12/po/ru_RU.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/ru_RU.po 2010-02-03 22:16:56.567082953 +0100
@@ -524,6 +524,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr ""
@@ -908,6 +911,9 @@
msgid "Setup.DVB$Update channels"
msgstr " "
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr " ()"
@@ -1304,3 +1310,60 @@
#, c-format
msgid "VDR will shut down in %s minutes"
msgstr "VDR %s "
+
+msgid "Rename recording"
+msgstr " "
+
+msgid "Date"
+msgstr ""
+
+msgid "Length"
+msgstr ""
+
+msgid "Size"
+msgstr ""
+
+msgid "Path"
+msgstr ""
+
+msgid "Format"
+msgstr ""
+
+msgid "PES"
+msgstr ""
+
+msgid "TS"
+msgstr ""
+
+msgid "Rename$Up"
+msgstr ""
+
+msgid "Rename$Down"
+msgstr ""
+
+msgid "Rename$Previous"
+msgstr ""
+
+msgid "Rename$Next"
+msgstr ""
+
+msgid "Delete marks information?"
+msgstr ""
+
+msgid "Delete resume information?"
+msgstr ""
+
+msgid "Setup.OSD$Main menu command position"
+msgstr " "
+
+msgid "Setup.EPG$Show progress bar"
+msgstr ""
+
+msgid "Setup.Recording$Show date"
+msgstr " "
+
+msgid "Setup.Recording$Show time"
+msgstr " "
+
+msgid "Setup.Recording$Show length"
+msgstr " "
diff -ruN vdr-1.7.12/po/sl_SI.po vdr-1.7.12.ExtP_NG/po/sl_SI.po
--- vdr-1.7.12/po/sl_SI.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/sl_SI.po 2010-02-03 22:16:56.602078291 +0100
@@ -524,6 +524,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarizacija"
@@ -908,6 +911,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Posodobi kanale"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Jeziki za zvok"
diff -ruN vdr-1.7.12/po/sv_SE.po vdr-1.7.12.ExtP_NG/po/sv_SE.po
--- vdr-1.7.12/po/sv_SE.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/sv_SE.po 2010-02-03 22:16:56.615078727 +0100
@@ -526,6 +526,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Polarisation"
@@ -910,6 +913,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Uppdatera kanaler"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Antal ljudsprk"
diff -ruN vdr-1.7.12/po/tr_TR.po vdr-1.7.12.ExtP_NG/po/tr_TR.po
--- vdr-1.7.12/po/tr_TR.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/tr_TR.po 2010-02-03 22:16:56.631081017 +0100
@@ -523,6 +523,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Kutuplama"
@@ -907,6 +910,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Kanallar yenile"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Audio dilleri"
diff -ruN vdr-1.7.12/po/uk_UA.po vdr-1.7.12.ExtP_NG/po/uk_UA.po
--- vdr-1.7.12/po/uk_UA.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/uk_UA.po 2010-02-03 22:16:56.650079033 +0100
@@ -523,6 +523,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "Поляризація"
@@ -907,6 +910,9 @@
msgid "Setup.DVB$Update channels"
msgstr "Оновлювати настройки каналів"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "Бажані мови (звук)"
diff -ruN vdr-1.7.12/po/zh_CN.po vdr-1.7.12.ExtP_NG/po/zh_CN.po
--- vdr-1.7.12/po/zh_CN.po 2010-01-23 16:15:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/po/zh_CN.po 2010-02-03 22:16:56.662080380 +0100
@@ -526,6 +526,9 @@
msgid "Sid"
msgstr "Sid"
+msgid "Rid"
+msgstr "Rid"
+
msgid "Polarization"
msgstr "极化方式"
@@ -910,6 +913,9 @@
msgid "Setup.DVB$Update channels"
msgstr "更新频道"
+msgid "Setup.DVB$channel binding by Rid"
+msgstr ""
+
msgid "Setup.DVB$Audio languages"
msgstr "声道语言"
diff -ruN vdr-1.7.12/receiver.c vdr-1.7.12.ExtP_NG/receiver.c
--- vdr-1.7.12/receiver.c 2010-01-30 11:25:38.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/receiver.c 2010-02-03 22:16:55.149055758 +0100
@@ -81,7 +81,11 @@
return AddPid(Channel->Vpid()) &&
(Channel->Ppid() == Channel->Vpid() || AddPid(Channel->Ppid())) &&
AddPids(Channel->Apids()) &&
+#ifdef USE_DOLBYINREC
+ AddPids(Channel->Dpids()) &&
+#else
(!Setup.UseDolbyDigital || AddPids(Channel->Dpids())) &&
+#endif /* DOLBYINREC */
AddPids(Channel->Spids());
}
return true;
diff -ruN vdr-1.7.12/recorder.c vdr-1.7.12.ExtP_NG/recorder.c
--- vdr-1.7.12/recorder.c 2010-01-29 17:37:22.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/recorder.c 2010-02-03 22:16:55.177055218 +0100
@@ -87,7 +87,11 @@
bool cRecorder::NextFile(void)
{
if (recordFile && frameDetector->IndependentFrame()) { // every file shall start with an independent frame
+#ifdef USE_HARDLINKCUTTER
+ if (fileSize > fileName->MaxFileSize() || RunningLowOnDiskSpace()) {
+#else
if (fileSize > MEGABYTE(off_t(Setup.MaxVideoFileSize)) || RunningLowOnDiskSpace()) {
+#endif /* HARDLINKCUTTER */
recordFile = fileName->NextFile();
fileSize = 0;
}
diff -ruN vdr-1.7.12/recording.c vdr-1.7.12.ExtP_NG/recording.c
--- vdr-1.7.12/recording.c 2010-01-16 12:18:30.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/recording.c 2010-02-03 22:16:55.214071925 +0100
@@ -66,7 +66,13 @@
#define MAX_LINK_LEVEL 6
bool VfatFileSystem = false;
+#ifdef USE_LIEMIEXT
+bool DirOrderState = false;
+#endif /* LIEMIEXT */
int InstanceId = 0;
+#ifdef USE_DVLFRIENDLYFNAMES
+char *MakeFriendlyFilename(char **buf);
+#endif /* DVLFRIENDLYFNAMES */
cRecordings DeletedRecordings(true);
@@ -641,6 +647,11 @@
break;
}
if (Timer->IsSingleEvent()) {
+#ifdef USE_DVLFRIENDLYFNAMES
+ if (Setup.UseFriendlyFNames == 1)
+ Timer -> SetFile(MakeFriendlyFilename(&name));
+ else
+#endif /* DVLFRIENDLYFNAMES */
Timer->SetFile(name); // this was an instant recording, so let's set the actual data
Timers.SetModified();
}
@@ -651,6 +662,10 @@
name = strdup(cString::sprintf("%s~%s", Timer->File(), Subtitle));
// substitute characters that would cause problems in file names:
strreplace(name, '\n', ' ');
+#ifdef USE_DVLFRIENDLYFNAMES
+ if (Setup.UseFriendlyFNames == 1)
+ MakeFriendlyFilename(&name);
+#endif /* DVLFRIENDLYFNAMES */
start = Timer->StartTime();
priority = Timer->Priority();
lifetime = Timer->Lifetime();
@@ -796,7 +811,12 @@
}
t++;
}
+#ifdef USE_SORTRECORDS
+ *s1 = 255;
+ if (s1 && s2 && (s1 == s && (Setup.SortRecords & 1) || s1 !=s && (Setup.SortRecords == 3 || Setup.SortRecords != 2 && !strchr(".-$", *(s1 - 1)))))
+#else
if (s1 && s2)
+#endif /* SORTRECORDS */
memmove(s1 + 1, s2, t - s2 + 1);
return s;
}
@@ -804,7 +824,11 @@
char *cRecording::SortName(void) const
{
if (!sortBuffer) {
+#ifdef USE_SORTRECORDS
+ char *s = StripEpisodeName(strdup(FileName() + strlen(VideoDirectory)));
+#else
char *s = StripEpisodeName(strdup(FileName() + strlen(VideoDirectory) + 1));
+#endif /* SORTRECORDS */
strreplace(s, '/', 'a'); // some locales ignore '/' when sorting
int l = strxfrm(NULL, s, 0) + 1;
sortBuffer = MALLOC(char, l);
@@ -826,6 +850,10 @@
int cRecording::Compare(const cListObject &ListObject) const
{
cRecording *r = (cRecording *)&ListObject;
+#ifdef USE_LIEMIEXT
+ if (DirOrderState)
+ return strcasecmp(FileName(), r->FileName());
+#endif /* LIEMIEXT */
return strcasecmp(SortName(), r->SortName());
}
@@ -844,7 +872,11 @@
return fileName;
}
+#ifdef USE_LIEMIEXT
+const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level, bool Original) const
+#else
const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level) const
+#endif /* LIEMIEXT */
{
char New = NewIndicator && IsNew() ? '*' : ' ';
free(titleBuffer);
@@ -857,6 +889,9 @@
s++;
else
s = name;
+#ifdef USE_LIEMIEXT
+ if (Original) {
+#endif /* LIEMIEXT */
titleBuffer = strdup(cString::sprintf("%02d.%02d.%02d%c%02d:%02d%c%c%s",
t->tm_mday,
t->tm_mon + 1,
@@ -867,6 +902,29 @@
New,
Delimiter,
s));
+#ifdef USE_LIEMIEXT
+ }
+ else {
+ cString RecLength("---");
+ if (Setup.ShowRecLength && FileName()) {
+ int length = cIndexFile::Length(FileName(), IsPesRecording());
+ if (length >= 0)
+ RecLength = cString::sprintf("%d'", length / SecondsToFrames(60, framesPerSecond));
+ }
+ cString RecDate = cString::sprintf("%02d.%02d.%02d", t->tm_mday, t->tm_mon + 1, t->tm_year % 100);
+ cString RecTime = cString::sprintf("%02d:%02d", t->tm_hour, t->tm_min);
+ cString RecDelimiter = cString::sprintf("%c", Delimiter);
+ titleBuffer = strdup(cString::sprintf("%s%s%s%c%s%s%s%s",
+ (Setup.ShowRecDate ? *RecDate : ""),
+ (Setup.ShowRecDate && Setup.ShowRecTime ? *RecDelimiter : ""),
+ (Setup.ShowRecTime ? *RecTime : ""),
+ New,
+ (Setup.ShowRecTime || Setup.ShowRecDate ? *RecDelimiter : ""),
+ (Setup.ShowRecLength ? *RecLength : ""),
+ (Setup.ShowRecLength ? *RecDelimiter : ""),
+ s));
+ }
+#endif /* LIEMIEXT */
// let's not display a trailing FOLDERDELIMCHAR:
if (!NewIndicator)
stripspace(titleBuffer);
@@ -895,6 +953,17 @@
return titleBuffer;
}
+#ifdef USE_CUTTIME
+void cRecording::SetStartTime(time_t Start)
+{
+ start=Start;
+ if (fileName) {
+ free(fileName);
+ fileName = NULL;
+ }
+}
+#endif /* CUTTIME */
+
const char *cRecording::PrefixFileName(char Prefix)
{
cString p = PrefixVideoFileName(FileName(), Prefix);
@@ -1003,6 +1072,44 @@
resume = RESUME_NOT_INITIALIZED;
}
+#ifdef USE_LIEMIEXT
+bool cRecording::Rename(const char *newName)
+{
+ bool result = false;
+ struct tm tm_r;
+ struct tm *t = localtime_r(&start, &tm_r);
+ char *localNewName = ExchangeChars(strdup(newName), true);
+ const char *fmt = isPesRecording ? NAMEFORMATPES : NAMEFORMATTS;
+ int ch = isPesRecording ? priority : channel;
+ int ri = isPesRecording ? lifetime : instanceId;
+ char *newFileName = strdup(cString::sprintf(fmt, VideoDirectory, localNewName, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, ch, ri));
+ free(localNewName);
+ if (strcmp(FileName(), newFileName)) {
+ if (access(newFileName, F_OK) == 0) {
+ isyslog("recording %s already exists", newFileName);
+ }
+ else {
+ isyslog("renaming recording %s to %s", FileName(), newFileName);
+ result = MakeDirs(newFileName, true);
+ if (result)
+ result = RenameVideoFile(FileName(), newFileName);
+ if (result) {
+ free(fileName);
+ fileName = strdup(newFileName);
+ free(name);
+ name = strdup(newName);
+ free(sortBuffer);
+ sortBuffer = NULL;
+ free(titleBuffer);
+ titleBuffer = NULL;
+ }
+ }
+ }
+ free(newFileName);
+ return result;
+}
+#endif /* LIEMIEXT */
+
// --- cRecordings -----------------------------------------------------------
cRecordings Recordings;
@@ -1301,14 +1408,74 @@
return NULL;
}
+#ifdef USE_JUMPPLAY
+// --- cMarksReload ----------------------------------------------------------
+
+#define MARKS_RELOAD_MS 10000
+
+time_t cMarksReload::lastsavetime = 0;
+
+cMarksReload::cMarksReload(const char *RecordingFileName)
+:recDir(RecordingFileName)
+{
+ struct stat sbuf;
+ cRecording rec(recDir);
+ if (Load(recDir, rec.FramesPerSecond(), rec.IsPesRecording()) &&
+ stat(FileName(), &sbuf) == 0)
+ lastmodtime = sbuf.st_mtime;
+ else
+ lastmodtime = 0;
+ nextreload.Set(MARKS_RELOAD_MS - cTimeMs::Now() % MARKS_RELOAD_MS);
+}
+
+bool cMarksReload::Reload(void)
+{
+ // Check the timestamp of marks.vdr in 10 seconds intervals
+ // Independent but synchronized reloading of marks in two threads
+ if ((Setup.ReloadMarks && nextreload.TimedOut()) ||
+ lastsavetime > lastmodtime) {
+ nextreload.Set(MARKS_RELOAD_MS - cTimeMs::Now() % MARKS_RELOAD_MS);
+ struct stat sbuf;
+ if (stat(FileName(), &sbuf) == 0 && sbuf.st_mtime != lastmodtime) {
+ lastmodtime = sbuf.st_mtime;
+ cRecording rec(recDir);
+ if (Load(recDir, rec.FramesPerSecond(), rec.IsPesRecording()))
+ return true;
+ }
+ }
+ return false;
+}
+
+bool cMarksReload::Save(void)
+{
+ bool ok = cMarks::Save();
+ struct stat sbuf;
+ if (ok && stat(FileName(), &sbuf) == 0)
+ lastsavetime = lastmodtime = sbuf.st_mtime;
+ return ok;
+}
+#endif /* JUMPPLAY */
+
// --- cRecordingUserCommand -------------------------------------------------
const char *cRecordingUserCommand::command = NULL;
+#ifdef USE_DVLRECSCRIPTADDON
+void cRecordingUserCommand::InvokeCommand(const char *State, const char *RecordingFileName, char *chanName)
+#else
void cRecordingUserCommand::InvokeCommand(const char *State, const char *RecordingFileName)
+#endif /* DVLRECSCRIPTADDON */
{
if (command) {
+#ifdef USE_DVLRECSCRIPTADDON
+ cString cmd;
+ if (chanName != NULL)
+ cmd = cString::sprintf("%s %s \"%s\" \"%s\"", command, State, *strescape(RecordingFileName, "\\\"$"), chanName);
+ else
+ cmd = cString::sprintf("%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\\\"$"));
+#else
cString cmd = cString::sprintf("%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\\\"$"));
+#endif /* DVLRECSCRIPTADDON */
isyslog("executing '%s'", *cmd);
SystemExec(cmd);
}
@@ -1780,6 +1947,17 @@
return false;
}
+#ifdef USE_LIEMIEXT
+int cIndexFile::Length(const char *FileName, bool IsPesRecording)
+{
+ struct stat buf;
+ cString fullname = cString::sprintf("%s%s", FileName, IsPesRecording ? INDEXFILESUFFIX ".vdr" : INDEXFILESUFFIX);
+ if (FileName && *fullname && access(fullname, R_OK) == 0 && stat(fullname, &buf) == 0)
+ return buf.st_size ? (buf.st_size - 1) / sizeof(tIndexTs) + 1 : 0;
+ return -1;
+}
+#endif /* LIEMIEXT */
+
// --- cFileName -------------------------------------------------------------
#define MAXFILESPERRECORDINGPES 255
@@ -1874,6 +2052,98 @@
LOG_ERROR_STR(fileName);
}
else {
+#ifdef USE_DVDARCHIVE
+ isOnDVD = false;
+
+ if (access(fileName, R_OK)) { // fileName="/video0/Blumen_des_Schreckens/2004-05-10.12:25.50.99.rec/001.vdr"
+ if (errno == ENOENT) {
+ register char *p, *p1;
+ register int n = 1;
+ auto bool ok = false;
+ auto char fn[BUFSIZ], fn2[BUFSIZ], msg[BUFSIZ], cmd[BUFSIZ], s[BUFSIZ];
+ auto FILE *f, *f1;
+ cReadLine ReadLine;
+
+ strcpy(fn, fileName);
+
+ if ((p = strrchr(fn, '.'))) {
+ memcpy(p - 3, "dvd", 3); // fn="/video0/Blumen_des_Schreckens/2004-05-10.12:25.50.99.rec/dvd.vdr"
+
+ if ((f = fopen(fn, "r")) != (FILE *)NULL) {
+ if (fgets(s, sizeof s, f)) {
+ if ((p1 = strchr(s, '\n')))
+ *p1 = 0;
+ sprintf(msg, tr("Please mount DVD %s"), s);
+
+ do {
+ if (Setup.TrayOpenOnBegin)
+ SystemExec("umount /dev/cdrom; eject /dev/cdrom");
+ else
+ SystemExec("umount /dev/cdrom");
+
+ if (Interface->Confirm(msg)) {
+
+ SystemExec("eject -t /dev/cdrom; mkdir -p /tmp/vdr.dvd; mount -o ro /dev/cdrom /tmp/vdr.dvd");
+ isOnDVD = true;
+
+ *(p - 4) = 0;
+ sprintf(cmd, "find /tmp/vdr.dvd -name '%s'", p - 30); // fn="2004-05-10.12:25.50.99.rec"
+
+ if ((f1 = popen(cmd, "r")) != (FILE *)NULL) {
+
+ if ((p1 = ReadLine.Read(f1)) != NULL) {
+
+ if ((p = strrchr(fileName, '/')))
+ *p = 0;
+
+ do {
+ sprintf(fn2, "%s/%03d.vdr", p1, n);
+
+ if (!access(fn2, R_OK)) {
+ sprintf(s, "ln -sf '%s' '%s/%03d.vdr'", fn2, fileName, n);
+ SystemExec(s);
+ dsyslog(s);
+ }
+ else
+ break;
+ }
+ while (++n < MAXFILESPERRECORDING);
+
+ sprintf(fn2, "%s/index.vdr", p1);
+
+ if (!access(fn2, R_OK)) {
+ sprintf(s, "ln -sf '%s' '%s/index.vdr'", fn2, fileName);
+ SystemExec(s);
+ dsyslog(s);
+ }
+
+ *p = '/';
+
+ ok = true;
+ }
+ pclose(f1);
+ }
+
+ if (!ok) {
+#if VDRVERSNUM >= 10307
+ Skins.Message(mtError, tr("Wrong DVD!"));
+#else
+ Interface->Error(tr("Wrong DVD!"));
+#endif
+ isOnDVD = false;
+ }
+ }
+ else
+ break;
+ } while (!ok);
+ }
+ fclose(f);
+ }
+ }
+ }
+ }
+#endif /* DVDARCHIVE */
+
if (access(fileName, R_OK) == 0) {
dsyslog("playing '%s'", fileName);
file = cUnbufferedFile::Create(fileName, O_RDONLY | O_LARGEFILE | BlockingFlag);
@@ -1893,6 +2163,15 @@
if (CloseVideoFile(file) < 0)
LOG_ERROR_STR(fileName);
file = NULL;
+#ifdef USE_DVDARCHIVE
+ if (isOnDVD) {
+ if (Setup.TrayOpenOnEnd)
+ SystemExec("umount /dev/cdrom; eject /dev/cdrom");
+ else
+ SystemExec("umount /dev/cdrom");
+ isOnDVD = false;
+ }
+#endif /* DVDARCHIVE */
}
}
@@ -1938,6 +2217,22 @@
return NULL;
}
+#ifdef USE_HARDLINKCUTTER
+off_t cFileName::MaxFileSize() {
+ const int maxVideoFileSize = isPesRecording ? MAXVIDEOFILESIZEPES : MAXVIDEOFILESIZETS;
+ const int setupMaxVideoFileSize = min(maxVideoFileSize, Setup.MaxVideoFileSize);
+ const int maxFileNumber = isPesRecording ? 255 : 65535;
+
+ const off_t smallFiles = (maxFileNumber * off_t(maxVideoFileSize) - 1024 * Setup.MaxRecordingSize)
+ / max(maxVideoFileSize - setupMaxVideoFileSize, 1);
+
+ if (fileNumber <= smallFiles)
+ return MEGABYTE(off_t(setupMaxVideoFileSize));
+
+ return MEGABYTE(off_t(maxVideoFileSize));
+}
+#endif /* HARDLINKCUTTER */
+
cUnbufferedFile *cFileName::NextFile(void)
{
return SetOffset(fileNumber + 1);
@@ -1989,3 +2284,113 @@
LOG_ERROR;
return r;
}
+
+#ifdef USE_DVLFRIENDLYFNAMES
+char *MakeFriendlyFilename(char **buf)
+{
+ char *b, *x, *y;
+
+ if (buf == NULL || *buf == NULL)
+ return(NULL);
+
+ b = (char *)malloc(strlen(*buf) * 2);
+ x = *buf;
+ y = b;
+
+ while (*x != 0) {
+ switch (*x) {
+ case '':
+ *y = 'A';
+ y++;
+ *y = 'e';
+ y++; x++;
+ break;
+
+ case '':
+ *y = 'a';
+ y++;
+ *y = 'e';
+ y++; x++;
+ break;
+
+ case '':
+ *y = 'O';
+ y++;
+ *y = 'e';
+ y++; x++;
+ break;
+
+ case '':
+ *y = 'o';
+ y++;
+ *y = 'e';
+ y++; x++;
+ break;
+
+ case '':
+ *y = 'U';
+ y++;
+ *y = 'e';
+ y++; x++;
+ break;
+
+ case '':
+ *y = 'u';
+ y++;
+ *y = 'e';
+ y++; x++;
+ break;
+
+ case '':
+ *y = 's';
+ y++;
+ *y = 's';
+ y++; x++;
+ break;
+
+ // chars to replace
+ case ':':
+ case ';':
+ case '?':
+ case ' ':
+ case '\t':
+ *y = '_';
+ y++; x++;
+ break;
+
+ // chars to simply strip
+ case '\"':
+ case '*':
+ case '{':
+ case '}':
+ case '[':
+ case ']':
+ case '=':
+ case '<':
+ case '>':
+ case '#':
+ case '`':
+ case '|':
+ case '\\':
+ case '\n':
+ case '\r':
+ x++;
+ break;
+
+ default:
+ *y = *x;
+ y++; x++;
+ break;
+ }
+ }
+ *y = 0;
+
+ x = strdup(b);
+ free(b);
+
+ free(*buf);
+ *buf = x;
+
+ return(*buf);
+}
+#endif /* DVLFRIENDLYFNAMES */
diff -ruN vdr-1.7.12/recording.h vdr-1.7.12.ExtP_NG/recording.h
--- vdr-1.7.12/recording.h 2010-01-16 12:16:20.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/recording.h 2010-02-03 22:16:55.224056249 +0100
@@ -21,6 +21,9 @@
#define FOLDERDELIMCHAR '~'
extern bool VfatFileSystem;
+#ifdef USE_LIEMIEXT
+extern bool DirOrderState;
+#endif /* LIEMIEXT */
extern int InstanceId;
void RemoveDeletedRecordings(void);
@@ -65,6 +68,9 @@
const cEvent *GetEvent(void) const { return event; }
const char *Title(void) const { return event->Title(); }
const char *ShortText(void) const { return event->ShortText(); }
+#ifdef USE_GRAPHTFT
+ tEventID EventID(void) const { return event->EventID(); }
+#endif /* GRAPHTFT */
const char *Description(void) const { return event->Description(); }
const cComponents *Components(void) const { return event->Components(); }
const char *Aux(void) const { return aux; }
@@ -106,8 +112,15 @@
virtual int Compare(const cListObject &ListObject) const;
const char *Name(void) const { return name; }
const char *FileName(void) const;
+#ifdef USE_LIEMIEXT
+ const char *Title(char Delimiter = ' ', bool NewIndicator = false, int Level = -1, bool Original = true) const;
+#else
const char *Title(char Delimiter = ' ', bool NewIndicator = false, int Level = -1) const;
+#endif /* LIEMIEXT */
const cRecordingInfo *Info(void) const { return info; }
+#ifdef USE_CUTTIME
+ void SetStartTime(time_t Start);
+#endif /* CUTTIME */
const char *PrefixFileName(char Prefix);
int HierarchyLevels(void) const;
void ResetResume(void) const;
@@ -126,6 +139,11 @@
// Changes the file name so that it will be visible in the "Recordings" menu again and
// not processed by cRemoveDeletedRecordingsThread.
// Returns false in case of error
+#ifdef USE_LIEMIEXT
+ bool Rename(const char *newName);
+ // Changes the file name
+ // Returns false in case of error
+#endif /* LIEMIEXT */
};
class cRecordings : public cList<cRecording>, public cThread {
@@ -196,6 +214,21 @@
cMark *GetNext(int Position);
};
+#ifdef USE_JUMPPLAY
+class cMarksReload : public cMarks {
+private:
+ cString recDir;
+ cTimeMs nextreload;
+ time_t lastmodtime;
+ static time_t lastsavetime;
+public:
+ cMarksReload(const char *RecordingFileName);
+ bool Reload(void);
+ bool Save(void);
+ };
+
+#endif /* JUMPPLAY */
+
#define RUC_BEFORERECORDING "before"
#define RUC_AFTERRECORDING "after"
#define RUC_EDITEDRECORDING "edited"
@@ -204,8 +237,15 @@
private:
static const char *command;
public:
+#ifdef USE_DELTIMESHIFTREC
+ static const char *GetCommand(void) { return command; }
+#endif /* DELTIMESHIFTREC */
static void SetCommand(const char *Command) { command = Command; }
+#ifdef USE_DVLRECSCRIPTADDON
+ static void InvokeCommand(const char *State, const char *RecordingFileName, char *chanName = NULL);
+#else
static void InvokeCommand(const char *State, const char *RecordingFileName);
+#endif /* DVLRECSCRIPTADDON */
};
// The maximum size of a single frame (up to HDTV 1920x1080):
@@ -218,9 +258,23 @@
// before the next independent frame, to have a complete Group Of Pictures):
#define MAXVIDEOFILESIZETS 1048570 // MB
#define MAXVIDEOFILESIZEPES 2000 // MB
+#ifdef USE_HARDLINKCUTTER
+#define MINVIDEOFILESIZE 1 // MB
+#else
#define MINVIDEOFILESIZE 100 // MB
+#endif /* HARDLINKCUTTER */
#define MAXVIDEOFILESIZEDEFAULT MAXVIDEOFILESIZEPES
+#ifdef USE_HARDLINKCUTTER
+#define MINRECORDINGSIZE 25 // GB
+#define MAXRECORDINGSIZE 500 // GB
+#define DEFAULTRECORDINGSIZE 100 // GB
+// Dynamic recording size:
+// Keep recording file size at Setup.MaxVideoFileSize for as long as possible,
+// but switch to MAXVIDEOFILESIZE early enough, so that Setup.MaxRecordingSize
+// will be reached, before recording to file 65535.vdr
+#endif /* HARDLINKCUTTER */
+
struct tIndexTs;
class cIndexFileGenerator;
@@ -250,6 +304,10 @@
bool StoreResume(int Index) { return resumeFile.Save(Index); }
bool IsStillRecording(void);
void Delete(void);
+#ifdef USE_LIEMIEXT
+ static int Length(const char *FileName, bool IsPesRecording = false);
+ ///< Calculates the recording length without reading the index.
+#endif /* LIEMIEXT */
};
class cFileName {
@@ -259,6 +317,9 @@
char *fileName, *pFileNumber;
bool record;
bool blocking;
+#ifdef USE_DVDARCHIVE
+ bool isOnDVD;
+#endif /* DVDARCHIVE */
bool isPesRecording;
public:
cFileName(const char *FileName, bool Record, bool Blocking = false, bool IsPesRecording = false);
@@ -269,6 +330,10 @@
cUnbufferedFile *Open(void);
void Close(void);
cUnbufferedFile *SetOffset(int Number, off_t Offset = 0); // yes, Number is int for easier internal calculating
+#ifdef USE_HARDLINKCUTTER
+ off_t MaxFileSize();
+ // Dynamic file size for this file
+#endif /* HARDLINKCUTTER */
cUnbufferedFile *NextFile(void);
};
diff -ruN vdr-1.7.12/remux.c vdr-1.7.12.ExtP_NG/remux.c
--- vdr-1.7.12/remux.c 2010-01-30 11:43:12.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/remux.c 2010-02-03 22:16:55.267055992 +0100
@@ -330,7 +330,6 @@
i += MakeStream(buf + i, 0x06, Channel->Spid(n));
i += MakeSubtitlingDescriptor(buf + i, Channel->Slang(n), Channel->SubtitlingType(n), Channel->CompositionPageId(n), Channel->AncillaryPageId(n));
}
-
int sl = i - SectionLength - 2 + 4; // -2 = SectionLength storage, +4 = length of CRC
buf[SectionLength] |= (sl >> 8) & 0x0F;
buf[SectionLength + 1] = sl;
@@ -544,6 +543,9 @@
}
break;
case 0x06: // STREAMTYPE_13818_PES_PRIVATE
+#ifdef USE_ATSC
+ case 0x81: // ATSC AC-3
+#endif /* ATSC */
{
int dpid = 0;
char lang[MAXLANGCODE1] = "";
@@ -551,6 +553,9 @@
for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
switch (d->getDescriptorTag()) {
case SI::AC3DescriptorTag:
+#ifdef USE_ATSC
+ case 0x81: // ATSC AC-3 descriptor tag
+#endif /* ATSC */
dbgpatpmt(" AC3");
dpid = stream.getPid();
break;
diff -ruN vdr-1.7.12/sections.c vdr-1.7.12.ExtP_NG/sections.c
--- vdr-1.7.12/sections.c 2007-10-14 14:52:07.000000000 +0200
+++ vdr-1.7.12.ExtP_NG/sections.c 2010-02-03 22:16:55.367058320 +0100
@@ -198,7 +198,11 @@
if (fh) {
// Read section data:
unsigned char buf[4096]; // max. allowed size for any EIT section
+#ifdef USE_MCLI
+ int r = device->ReadFilter(fh->handle, buf, sizeof(buf));
+#else
int r = safe_read(fh->handle, buf, sizeof(buf));
+#endif /* MCLI */
if (!DeviceHasLock)
continue; // we do the read anyway, to flush any data that might have come from a different transponder
if (r > 3) { // minimum number of bytes necessary to get section length
diff -ruN vdr-1.7.12/skins.c vdr-1.7.12.ExtP_NG/skins.c
--- vdr-1.7.12/skins.c 2009-06-06 17:12:31.000000000 +0200
+++ vdr-1.7.12.ExtP_NG/skins.c 2010-02-03 22:16:55.467060224 +0100
@@ -238,7 +238,11 @@
}
cSkinDisplay::Current()->SetMessage(Type, s);
cSkinDisplay::Current()->Flush();
+#ifdef USE_STATUS_EXTENSION
+ cStatus::MsgOsdStatusMessage(Type, s);
+#else
cStatus::MsgOsdStatusMessage(s);
+#endif /* STATUS_EXTENSION */
eKeys k = kNone;
if (Type != mtStatus) {
k = Interface->Wait(Seconds);
diff -ruN vdr-1.7.12/sources.c vdr-1.7.12.ExtP_NG/sources.c
--- vdr-1.7.12/sources.c 2008-02-10 15:07:26.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/sources.c 2010-02-03 22:16:55.523060521 +0100
@@ -37,6 +37,9 @@
char buffer[16];
char *q = buffer;
switch (Code & st_Mask) {
+#ifdef USE_PLUGINPARAM
+ case stPlug: *q++ = 'P'; break;
+#endif /* PLUGINPARAM */
case stCable: *q++ = 'C'; break;
case stSat: *q++ = 'S';
{
@@ -56,6 +59,9 @@
{
int type = stNone;
switch (toupper(*s)) {
+#ifdef USE_PLUGINPARAM
+ case 'P': type = stPlug; break;
+#endif /* PLUGINPARAM */
case 'C': type = stCable; break;
case 'S': type = stSat; break;
case 'T': type = stTerr; break;
@@ -68,7 +74,11 @@
int pos = 0;
bool dot = false;
bool neg = false;
+#ifdef USE_SOURCECAPS
+ while (*++s && !isblank(*s)) {
+#else
while (*++s) {
+#endif /* SOURCECAPS */
switch (toupper(*s)) {
case '0' ... '9': pos *= 10;
pos += *s - '0';
diff -ruN vdr-1.7.12/sources.conf vdr-1.7.12.ExtP_NG/sources.conf
--- vdr-1.7.12/sources.conf 2009-12-23 15:35:49.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/sources.conf 2010-02-03 22:16:55.542063250 +0100
@@ -195,3 +195,7 @@
# Terrestrial
T Terrestrial
+
+# Plugin
+
+P Plugin
diff -ruN vdr-1.7.12/sources.h vdr-1.7.12.ExtP_NG/sources.h
--- vdr-1.7.12/sources.h 2005-05-14 11:30:41.000000000 +0200
+++ vdr-1.7.12.ExtP_NG/sources.h 2010-02-03 22:16:55.553064059 +0100
@@ -16,10 +16,17 @@
public:
enum eSourceType {
stNone = 0x0000,
+#ifdef USE_PLUGINPARAM
+ stPlug = 0x2000,
+#endif /* PLUGINPARAM */
stCable = 0x4000,
stSat = 0x8000,
stTerr = 0xC000,
+#ifdef USE_PLUGINPARAM
+ st_Mask = 0xE000,
+#else
st_Mask = 0xC000,
+#endif /* PLUGINPARAM */
st_Neg = 0x0800,
st_Pos = 0x07FF,
};
@@ -35,6 +42,9 @@
static cString ToString(int Code);
static int FromString(const char *s);
static int FromData(eSourceType SourceType, int Position = 0, bool East = false);
+#ifdef USE_PLUGINPARAM
+ static bool IsPlug(int Code) { return (Code & st_Mask) == stPlug; }
+#endif /* PLUGINPARAM */
static bool IsCable(int Code) { return (Code & st_Mask) == stCable; }
static bool IsSat(int Code) { return (Code & st_Mask) == stSat; }
static bool IsTerr(int Code) { return (Code & st_Mask) == stTerr; }
diff -ruN vdr-1.7.12/status.c vdr-1.7.12.ExtP_NG/status.c
--- vdr-1.7.12/status.c 2008-02-16 15:46:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/status.c 2010-02-03 22:16:55.597062431 +0100
@@ -83,11 +83,22 @@
sm->OsdTitle(Title);
}
+#ifdef USE_STATUS_EXTENSION
+void cStatus::MsgOsdStatusMessage(eMessageType type, const char *Message)
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ {
+ sm->OsdStatusMessage(type, Message);
+ sm->OsdStatusMessage(Message); // For comaptibilty
+ }
+}
+#else
void cStatus::MsgOsdStatusMessage(const char *Message)
{
for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
sm->OsdStatusMessage(Message);
}
+#endif /* STATUS_EXTENSION */
void cStatus::MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
@@ -124,3 +135,88 @@
for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
sm->OsdProgramme(PresentTime, PresentTitle, PresentSubtitle, FollowingTime, FollowingTitle, FollowingSubtitle);
}
+#ifdef USE_GRAPHTFT
+
+void cStatus::MsgOsdSetEvent(const cEvent* event)
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ sm->OsdSetEvent(event);
+}
+
+void cStatus::MsgOsdSetRecording(const cRecording* recording)
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ sm->OsdSetRecording(recording);
+}
+
+void cStatus::MsgOsdMenuDisplay(const char* kind)
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ sm->OsdMenuDisplay(kind);
+}
+
+void cStatus::MsgOsdMenuDestroy()
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ sm->OsdMenuDestroy();
+}
+void cStatus::MsgOsdEventItem(const cEvent* Event, const char *Text, int Index, int Count)
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ sm->OsdEventItem(Event, Text, Index, Count);
+}
+#endif /* GRAPHTFT */
+#ifdef USE_PINPLUGIN
+
+bool cStatus::MsgChannelProtected(const cDevice* Device, const cChannel* Channel) // PIN PATCH
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ if (sm->ChannelProtected(Device, Channel) == true)
+ return true;
+
+ return false;
+}
+
+bool cStatus::MsgReplayProtected(const cRecording* Recording, const char* Name,
+ const char* Base, bool isDirectory, int menuView) // PIN PATCH
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ if (sm->ReplayProtected(Recording, Name, Base, isDirectory, menuView) == true)
+ return true;
+ return false;
+}
+
+void cStatus::MsgRecordingFile(const char* FileName)
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) // PIN PATCH
+ sm->RecordingFile(FileName);
+}
+
+void cStatus::MsgTimerCreation(cTimer* Timer, const cEvent *Event)
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) // PIN PATCH
+ sm->TimerCreation(Timer, Event);
+}
+
+bool cStatus::MsgPluginProtected(cPlugin* Plugin, int menuView) // PIN PATCH
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ if (sm->PluginProtected(Plugin, menuView) == true)
+ return true;
+ return false;
+}
+
+void cStatus::MsgUserAction(const eKeys key, const cOsdObject* Interact) // PIN PATCH
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ sm->UserAction(key, Interact);
+}
+
+bool cStatus::MsgMenuItemProtected(const char* Name, int menuView) // PIN PATCH
+{
+ for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
+ if (sm->MenuItemProtected(Name, menuView) == true)
+ return true;
+ return false;
+}
+#endif /* PINPLUGIN */
diff -ruN vdr-1.7.12/status.h vdr-1.7.12.ExtP_NG/status.h
--- vdr-1.7.12/status.h 2008-02-16 16:00:33.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/status.h 2010-02-03 22:16:55.613062646 +0100
@@ -14,6 +14,9 @@
#include "device.h"
#include "player.h"
#include "tools.h"
+#ifdef USE_PINPLUGIN
+#include "plugin.h"
+#endif
enum eTimerChange { tcMod, tcAdd, tcDel };
@@ -64,6 +67,11 @@
virtual void OsdStatusMessage(const char *Message) {}
// Message has been displayed in the status line of the menu.
// If Message is NULL, the status line has been cleared.
+#ifdef USE_STATUS_EXTENSION
+ virtual void OsdStatusMessage(eMessageType type, const char *Message) {}
+ // Message has been displayed in the status line of the menu.
+ // If Message is NULL, the status line has been cleared.
+#endif /* STATUS_EXTENSION */
virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue) {}
// The help keys have been set to the given values (may be NULL).
virtual void OsdItem(const char *Text, int Index) {}
@@ -80,6 +88,38 @@
// The OSD displays the single line Text with the current channel information.
virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle) {}
// The OSD displays the given programme information.
+#ifdef USE_GRAPHTFT
+ virtual void OsdSetRecording(const cRecording* recording) {}
+ // The OSD displays the recording information.
+ virtual void OsdSetEvent(const cEvent* event) {}
+ // The OSD displays the event information.
+ virtual void OsdMenuDisplay(const char* kind) {}
+ // report menu creation
+ virtual void OsdMenuDestroy() {}
+ // report menu destruvtion
+ virtual void OsdEventItem(const cEvent* Event, const char *Text, int Index, int Count) {}
+ // The OSD displays the given single line Event as menu item at Index.
+#endif /* GRAPHTFT */
+#ifdef USE_PINPLUGIN
+ virtual bool ChannelProtected(const cDevice *Device, const cChannel* Channel) { return false; } // PIN PATCH
+ // Checks if a channel is protected.
+ virtual bool ReplayProtected(const cRecording* Recording, const char* Name,
+ const char* Base, bool isDirectory, int menuView = false) { return false; } // PIN PATCH
+ // Checks if a recording is protected.
+ virtual void RecordingFile(const char* FileName) {} // PIN PATCH
+ // The given DVB device has started recording to FileName. FileName is the name of the
+ // recording directory
+ virtual void TimerCreation(cTimer* Timer, const cEvent *Event) {} // PIN PATCH
+ // The given timer is created
+ virtual bool PluginProtected(cPlugin* Plugin, int menuView = false) { return false; } // PIN PATCH
+ // Checks if a plugin is protected.
+ virtual void UserAction(const eKeys key, const cOsdObject* Interact) {} // PIN PATCH
+ // report user action
+ virtual bool MenuItemProtected(const char* Name, int menuView = false) { return false; } // PIN PATCH
+ // Checks if a menu entry is protected.
+#endif /* PINPLUGIn */
+
+
public:
cStatus(void);
virtual ~cStatus();
@@ -94,13 +134,34 @@
static void MsgSetSubtitleTrack(int Index, const char * const *Tracks);
static void MsgOsdClear(void);
static void MsgOsdTitle(const char *Title);
+#ifdef USE_STATUS_EXTENSION
+ static void MsgOsdStatusMessage(eMessageType type, const char *Message);
+#else
static void MsgOsdStatusMessage(const char *Message);
+#endif /* STATUS_EXTENSION */
static void MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue);
static void MsgOsdItem(const char *Text, int Index);
static void MsgOsdCurrentItem(const char *Text);
static void MsgOsdTextItem(const char *Text, bool Scroll = false);
static void MsgOsdChannel(const char *Text);
static void MsgOsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
+#ifdef USE_GRAPHTFT
+ static void MsgOsdSetEvent(const cEvent* event);
+ static void MsgOsdSetRecording(const cRecording* recording);
+ static void MsgOsdMenuDisplay(const char* kind);
+ static void MsgOsdMenuDestroy();
+ static void MsgOsdEventItem(const cEvent* Event, const char *Text, int Index, int Count);
+#endif /* GRAPHTFT */
+#ifdef USE_PINPLUGIN
+ static bool MsgChannelProtected(const cDevice* Device, const cChannel* Channel); // PIN PATCH
+ static bool MsgReplayProtected(const cRecording* Recording, const char* Name,
+ const char* Base, bool isDirectory, int menuView = false); // PIN PATCH
+ static void MsgRecordingFile(const char* FileName); // PIN PATCH
+ static void MsgTimerCreation(cTimer* Timer, const cEvent *Event); // PIN PATCH
+ static bool MsgPluginProtected(cPlugin* Plugin, int menuView = false); // PIN PATCH
+ static void MsgUserAction(const eKeys key, const cOsdObject* Interact);
+ static bool MsgMenuItemProtected(const char* Name, int menuView = false); // PIN PATCH
+#endif /* PINPLUGIN */
};
#endif //__STATUS_H
diff -ruN vdr-1.7.12/submenu.c vdr-1.7.12.ExtP_NG/submenu.c
--- vdr-1.7.12/submenu.c 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/submenu.c 2010-02-03 22:16:55.637064155 +0100
@@ -0,0 +1,928 @@
+#ifdef USE_SETUP
+/****************************************************************************
+ * DESCRIPTION:
+ * Submenu
+ *
+ * $Id: vdr-1.3.44-Setup-0.3.0.diff,v 1.1 2006/03/04 09:58:47 ralf Exp $
+ *
+ * Contact: ranga@teddycats.de
+ *
+ * Copyright (C) 2004, 2005 by Ralf Dotzert
+ *
+ * modified for the VDR Extensions Patch by zulu @vdr-portal
+ *
+ ****************************************************************************/
+
+#ifndef SUBMENU_H
+#include "submenu.h"
+#include "plugin.h"
+
+static const char* TAG_SYSTEM = "system";
+static const char* TAG_PLUGIN = "plugin";
+static const char* TAG_COMMAND = "command";
+static const char* TAG_THREAD = "thread";
+static const char* TAG_MENU = "menu";
+static const char* TAG_UNDEFINED = "undefined";
+static const char* TRUE_STR = "yes";
+
+
+//################################################################################
+//# SubMenuNode
+//################################################################################
+
+cSubMenuNode::cSubMenuNode(TiXmlElement * xml, int level, cSubMenuNodes *currentMenu, cSubMenuNodes *parentMenu)
+{
+ init();
+ _parentMenu = parentMenu;
+ _currentMenu = currentMenu;
+ _level = level;
+
+ if (xml != NULL && xml->Type() == TiXmlNode::ELEMENT) {
+ const char *tag = xml->Value();
+
+ if (cSubMenuNode::IsType(tag) != cSubMenuNode::UNDEFINED) {
+ SetType(tag);
+ SetName(xml->Attribute("name"));
+ if ((_type == COMMAND) || (_type == THREAD)) {
+ SetCommand(xml->Attribute("execute"));
+ const char * confirmStr = xml->Attribute("confirm");
+ if (confirmStr != NULL && strcmp(confirmStr, TRUE_STR) == 0)
+ _commandConfirm = true;
+ }
+ else if (_type == PLUGIN) { // Add Plugin Index
+ SetCustomTitle(xml->Attribute("title"));
+ SetPlugin();
+ }
+ else if (_type == MENU && xml->NoChildren() == false) {
+ xml = xml->FirstChildElement();
+ do {
+ cSubMenuNode *node = new cSubMenuNode(xml, level+1, &_subMenus, currentMenu);
+ _subMenus.Add(node);
+ } while ((xml=xml->NextSiblingElement()) != NULL);
+ }
+ }
+ }
+ else
+ throw "Invalid XML Node";
+}
+
+/**
+ * Construct new Node empty Node
+ *
+ *
+ */
+cSubMenuNode::cSubMenuNode(cSubMenuNodes *currentMenu, cSubMenuNodes *parentMenu)
+{
+ init();
+ _parentMenu = parentMenu;
+ _currentMenu = currentMenu;
+
+}
+
+
+/**
+ *
+ */
+void cSubMenuNode::init()
+{
+ _name = NULL;
+ _command = NULL;
+ _title = NULL;
+ _pluginMainMenuEntry = NULL;
+ _type = UNDEFINED;
+ _level = 0;
+ _parentMenu = NULL;
+ _currentMenu = NULL;
+ _pluginIndex = 0;
+ _commandConfirm = false;
+}
+
+
+cSubMenuNode::~ cSubMenuNode()
+{
+ if (_name != NULL)
+ free((void*)_name);
+ if (_command != NULL)
+ free((void*)_command);
+ if (_title != NULL)
+ free((void*)_title);
+ if (_pluginMainMenuEntry != NULL)
+ free((void*)_pluginMainMenuEntry);
+}
+
+/**
+ *
+ */
+void cSubMenuNode::SetPlugin()
+{
+ bool found = false;
+ for (int i = 0; ; i++) {
+ cPlugin *p = cPluginManager::GetPlugin(i);
+ if (p) {
+ if (strcmp(_name, p->Name()) == 0 && p->MainMenuEntry() != NULL) {
+ SetPluginMainMenuEntry(p->MainMenuEntry());
+ _pluginIndex = i;
+ found = true;
+ break;
+ }
+ }
+ else
+ break;
+ }
+
+ if (!found)
+ _type = UNDEFINED;
+}
+
+
+bool cSubMenuNode::SaveXml(TiXmlElement * root)
+{
+ bool ok = true;
+
+ if (root!=NULL) {
+ TiXmlElement *e = NULL;
+ switch(_type) {
+ case SYSTEM:
+ e = new TiXmlElement(TAG_SYSTEM);
+ e->SetAttribute("name", GetName());
+ break;
+ case COMMAND:
+ e = new TiXmlElement(TAG_COMMAND);
+ e->SetAttribute("name", GetName());
+ e->SetAttribute("execute", GetCommand());
+ if (_commandConfirm)
+ e->SetAttribute("confirm", TRUE_STR);
+ break;
+ case THREAD:
+ e = new TiXmlElement(TAG_THREAD);
+ e->SetAttribute("name", GetName());
+ e->SetAttribute("execute", GetCommand());
+ if (_commandConfirm)
+ e->SetAttribute("confirm", TRUE_STR);
+ break;
+ case PLUGIN:
+ e = new TiXmlElement(TAG_PLUGIN);
+ e->SetAttribute("name", GetName());
+ if (GetCustomTitle() != NULL && strcmp(GetCustomTitle(), "") != 0)
+ e->SetAttribute("title", GetCustomTitle());
+ break;
+ case MENU:
+ e = new TiXmlElement(TAG_MENU);
+ e->SetAttribute("name", GetName());
+ break;
+ case UNDEFINED:
+ default:
+ ok = false;
+ break;
+ }
+ if (ok) {
+ root->LinkEndChild(e);
+ if (HasSubMenus())
+ for (cSubMenuNode *node = _subMenus.First(); node; node = _subMenus.Next(node))
+ node->SaveXml(e);
+ }
+ }
+
+ return(ok);
+}
+
+
+cSubMenuNode::Type cSubMenuNode::IsType(const char *name)
+{
+ Type type = UNDEFINED;
+
+ if (strcmp(name ,TAG_SYSTEM) == 0)
+ type = cSubMenuNode::SYSTEM;
+ else if (strcmp(name ,TAG_PLUGIN) == 0)
+ type = cSubMenuNode::PLUGIN;
+ else if (strcmp(name ,TAG_COMMAND) == 0)
+ type = cSubMenuNode::COMMAND;
+ else if (strcmp(name ,TAG_THREAD) == 0)
+ type = cSubMenuNode::THREAD;
+ else if (strcmp(name ,TAG_MENU) == 0)
+ type = cSubMenuNode::MENU;
+
+ return(type);
+}
+
+void cSubMenuNode::SetType(const char * name)
+{
+ _type = IsType(name);
+}
+
+void cSubMenuNode::SetType(enum Type type)
+{
+ _type = type;
+}
+
+
+cSubMenuNode::Type cSubMenuNode::GetType()
+{
+ return(_type);
+}
+
+const char * cSubMenuNode::GetTypeAsString()
+{
+ const char *str=NULL;
+ switch(_type) {
+ case SYSTEM:
+ str = TAG_SYSTEM;
+ break;
+ case COMMAND:
+ str = TAG_COMMAND;
+ break;
+ case THREAD:
+ str = TAG_THREAD;
+ break;
+ case PLUGIN:
+ str = TAG_PLUGIN;
+ break;
+ case MENU:
+ str = TAG_MENU;
+ break;
+ case UNDEFINED:
+ str = TAG_UNDEFINED;
+ default:
+ break;
+ }
+
+ return(str);
+}
+
+void cSubMenuNode::SetCommand(const char * command)
+{
+ if (_command != NULL)
+ free((void*)_command);
+
+ if (command != NULL)
+ _command = strdup(command);
+ else
+ _command = NULL;
+}
+
+const char * cSubMenuNode::GetCommand()
+{
+ return(_command);
+}
+
+bool cSubMenuNode::CommandConfirm()
+{
+ return(_commandConfirm);
+}
+
+void cSubMenuNode::SetCommandConfirm(int val)
+{
+ if (val == 1)
+ _commandConfirm = true;
+ else
+ _commandConfirm = false;
+}
+
+void cSubMenuNode::SetCustomTitle(const char * title)
+{
+ if (_title != NULL)
+ free((void*)_title);
+
+ if (title != NULL)
+ _title = strdup(title);
+ else
+ _title = NULL;
+}
+
+const char * cSubMenuNode::GetCustomTitle()
+{
+ return(_title);
+}
+
+void cSubMenuNode::SetName(const char * name)
+{
+ if (_name)
+ free ((void*)_name);
+
+ if (name != NULL)
+ _name = strdup(name);
+ else
+ _name = NULL;
+}
+
+const char * cSubMenuNode::GetName()
+{
+ return(_name);
+}
+
+int cSubMenuNode::GetLevel()
+{
+ return(_level);
+}
+
+void cSubMenuNode::SetLevel(int level)
+{
+ _level = level;
+ if (HasSubMenus()) { //Adjust Levels of Subnodes
+ for (cSubMenuNode *node = _subMenus.First(); node; node = _subMenus.Next(node))
+ node->SetLevel(level+1);
+ }
+}
+
+int cSubMenuNode::GetPluginIndex()
+{
+ return(_pluginIndex);
+}
+
+void cSubMenuNode::SetPluginIndex(int index)
+{
+ _pluginIndex = index;
+}
+
+void cSubMenuNode::SetPluginMainMenuEntry(const char * mainMenuEntry)
+{
+ if (_pluginMainMenuEntry != NULL)
+ free((void*)_pluginMainMenuEntry);
+
+ if (_title != NULL && strcmp(_title, "") != 0)
+ _pluginMainMenuEntry = strdup(_title);
+ else if (mainMenuEntry != NULL)
+ _pluginMainMenuEntry = strdup(mainMenuEntry);
+ else
+ _pluginMainMenuEntry = NULL;
+}
+
+const char * cSubMenuNode::GetPluginMainMenuEntry()
+{
+ return(_pluginMainMenuEntry);
+}
+
+
+
+cSubMenuNodes * cSubMenuNode::GetParentMenu()
+{
+ return(_parentMenu);
+}
+
+void cSubMenuNode::SetParentMenu(cSubMenuNodes * parent)
+{
+ _parentMenu = parent;
+}
+
+cSubMenuNodes * cSubMenuNode::GetCurrentMenu()
+{
+ return(_currentMenu);
+}
+
+void cSubMenuNode::SetCurrentMenu(cSubMenuNodes * current)
+{
+ _currentMenu = current;
+}
+
+
+cSubMenuNodes * cSubMenuNode::GetSubMenus()
+{
+ return(&_subMenus);
+}
+
+bool cSubMenuNode::HasSubMenus()
+{
+ if (_subMenus.Count() > 0)
+ return(true);
+ else
+ return(false);
+}
+
+
+void cSubMenuNode::Print(int index)
+{
+ for (int i = 0; i < index; i++)
+ printf(" ");
+
+ printf("Name=%s Type=%s Level=%d", _name, GetTypeAsString(), _level);
+ if (_type == COMMAND || _type == THREAD)
+ printf(" Command=%s", _command);
+ else if (_type == PLUGIN && _title != NULL)
+ printf(" Title=%s", _title);
+ printf("\n");
+
+ for (cSubMenuNode *node = _subMenus.First(); node; node = _subMenus.Next(node))
+ node->Print(index+4);
+}
+
+
+//################################################################################
+//#
+//################################################################################
+cSubMenu::cSubMenu()
+{
+ _menuSuffix = NULL;
+ _fname = NULL;
+ _commandResult = NULL;
+ _currentMenuTree = &_menuTree;
+ _currentParentMenuTree = NULL;
+ _nodeArray = NULL;
+ _nrNodes = 0;
+}
+
+
+cSubMenu::~cSubMenu()
+{
+ if (_menuSuffix)
+ free(_menuSuffix);
+ if (_fname)
+ free(_fname);
+ if (_commandResult)
+ free(_commandResult);
+ if (_nodeArray)
+ free(_nodeArray);
+ _nrNodes = 0;
+}
+
+
+bool cSubMenu::LoadXml(char *fname)
+{
+ TiXmlDocument xmlDoc = TiXmlDocument(fname);
+ TiXmlElement *root = NULL;
+ cSubMenuNode *node = NULL;
+
+ bool ok = true;
+ //Clear previously loaded Menu
+ if (_fname != NULL)
+ free(_fname);
+ _menuTree.Clear();
+ _fname = strdup(fname);
+
+ if ((ok = xmlDoc.LoadFile())) {
+ if ((root = xmlDoc.FirstChildElement("menus")) != NULL) {
+ char *tmp = NULL;
+ if ((tmp = (char*)root->Attribute("suffix")) == NULL)
+ asprintf(&_menuSuffix, " "); // set default menuSuffix // asprintf(&_menuSuffix, " ...");
+ else
+ asprintf(&_menuSuffix, tmp);
+
+ if ((root = root->FirstChildElement()) != NULL) {
+ do {
+ try {
+ node = new cSubMenuNode(root, 0, &_menuTree, NULL);
+ _menuTree.Add(node);
+ }
+ catch (char *message) {
+ esyslog("ERROR: while decoding XML Node");
+ ok = false;
+ }
+ } while (ok == true && (root = root->NextSiblingElement()) != NULL);
+ addMissingPlugins();
+ removeUndefinedNodes();
+ }
+ }
+ else {
+ esyslog("ERROR: in %s, missing Tag <menus>\n", fname);
+ ok = false;
+ }
+ }
+ else {
+ esyslog("ERROR: in %s : %s Col=%d Row=%d\n",
+ fname,
+ xmlDoc.ErrorDesc(),
+ xmlDoc.ErrorCol(),
+ xmlDoc.ErrorRow());
+ ok = false;
+ }
+
+ return(ok);
+}
+
+
+bool cSubMenu::SaveXml()
+{
+ return(SaveXml(_fname));
+}
+
+
+bool cSubMenu::SaveXml(char *fname)
+{
+ bool ok = true;
+
+ if (_fname != NULL) {
+ TiXmlDocument xml = TiXmlDocument(fname);
+ TiXmlComment comment;
+ comment.SetValue("\n\
+- VDR Menu-Configuration File\n\
+-\n\
+-\n\
+- Example:\n\
+-\n\
+ <menus>\n\
+ <system name=\"Schedule\" />\n\
+ <system name=\"Channels\" />\n\
+ <system name=\"Timers\" />\n\
+ <system name=\"Recordings\" />\n\
+ <menu name=\"System\">\n\
+ <system name=\"Setup\" />\n\
+ <system name=\"Commands\" />\n\
+ <plugin name=\"setup\" title=\"My Setup\" />\n\
+ <command name=\"myCommand1\" execute=\"/usr/bin/mycommand1\" />\n\
+ <command name=\"myCommand2\" execute=\"/usr/bin/mycommand2\" confirm=\"yes\" />\n\
+ <thread name=\"myCommand3\" execute=\"/usr/bin/mycommand3\" confirm=\"yes\" />\n\
+ <plugin name=\"epgsearch\" title=\"myProgram\" />\n\
+ <menu name=\"mySubSubMenu\">\n\
+ ...\n\
+ </menu>\n\
+ </menu>\n\
+ <menu name=\"Suche\">\n\
+ <plugin name=\"epgsearch\" />\n\
+ ...\n\
+ </menu>\n\
+ </menus>\n\
+");
+
+ TiXmlElement root("menus");
+ root.SetAttribute("suffix", _menuSuffix);
+ for (cSubMenuNode *node = _menuTree.First(); node; node = _menuTree.Next(node))
+ node->SaveXml(&root);
+
+ if (xml.InsertEndChild(comment) != NULL && xml.InsertEndChild(root) != NULL)
+ ok = xml.SaveFile(fname);
+ }
+ else
+ ok = false;
+
+ return(ok);
+}
+
+
+
+cSubMenuNodes * cSubMenu::GetMenuTree()
+{
+ return(_currentMenuTree);
+}
+
+
+void cSubMenu::PrintMenuTree()
+{
+ for (cSubMenuNode *node = _menuTree.First(); node; node = _menuTree.Next(node))
+ node->Print();
+}
+
+
+int cSubMenu::GetNrOfNodes()
+{
+ if (_nrNodes == 0) {
+ if ((_nrNodes = countNodes(&_menuTree)) > 0) {
+ _nodeArray = (cSubMenuNode**) malloc(sizeof(cSubMenuNode*)*_nrNodes);
+ int index = 0;
+ tree2Array(&_menuTree, index);
+ }
+ }
+
+ return(_nrNodes);
+}
+
+
+/**
+ * returns the specified node within the current menu
+ * @param index position in the current menu
+ * @return node or null if not found
+ */
+cSubMenuNode * cSubMenu::GetNode(int index)
+{
+ cSubMenuNode *node = NULL;
+ if (_currentMenuTree == NULL || (node=_currentMenuTree->Get(index)) == NULL)
+ esyslog("ERROR: illegal call of cSubMenu::GetNode(%d)", index);
+
+ return(node);
+}
+
+
+/**
+ * Get the specified Node
+ * @param index specfies the absolut indes in the list of all nodes
+ * @return node or NULL if not found
+ */
+cSubMenuNode * cSubMenu::GetAbsNode(int index)
+{
+ cSubMenuNode *node = NULL;
+ GetNrOfNodes();
+ if (_nrNodes > 0 && index >= 0 && index < _nrNodes)
+ node = _nodeArray[index];
+
+ return(node);
+}
+
+
+bool cSubMenu::Down(int index)
+{
+ bool ok = true;
+ cSubMenuNode *node = NULL;
+
+ if (_currentMenuTree != NULL && (node=_currentMenuTree->Get(index)) != NULL && node->GetType() == cSubMenuNode::MENU) {
+ _currentParentMenuTree = _currentMenuTree;
+ _currentMenuTree = node->GetSubMenus();
+ }
+ else {
+ ok = false;
+ esyslog("ERROR: illegal call of cSubMenu::Down(%d)", index);
+ }
+
+ return(ok);
+}
+
+bool cSubMenu::Up(int *parentIndex)
+{
+ bool ok = true;
+
+ if (_currentMenuTree != NULL && parentIndex != NULL) {
+ cSubMenuNode *node = NULL;
+ *parentIndex = 0;
+ if (_currentParentMenuTree != NULL)
+ for (int i = 0; (node = _currentParentMenuTree->Get(i)) != NULL; i++) {
+ if (_currentMenuTree == node->GetSubMenus()) {
+ *parentIndex = i;
+ break;
+ }
+ }
+
+ _currentMenuTree = _currentParentMenuTree;
+ if (_currentMenuTree != NULL)
+ _currentParentMenuTree = _currentMenuTree->Get(0)->GetParentMenu();
+ else
+ ok = false;
+ }
+ else {
+ ok = false;
+ esyslog("ERROR: illegal call of cSubMenu::Up()");
+ }
+
+ return(ok);
+}
+
+const char * cSubMenu::ExecuteCommand(const char * cmd)
+{
+ free(_commandResult);
+ _commandResult = NULL;
+
+ dsyslog("executing command '%s'", cmd);
+ FILE *p = popen(cmd, "r");
+ if (p) {
+ int l = 0;
+ int c;
+ while ((c = fgetc(p)) != EOF) {
+ if (l % 20 == 0)
+ _commandResult = (char *)realloc(_commandResult, l + 21);
+ _commandResult[l++] = c;
+ }
+ if (_commandResult)
+ _commandResult[l] = 0;
+ pclose(p);
+ }
+ else
+ esyslog("ERROR: can't open pipe for command '%s'", cmd);
+
+ return _commandResult;
+}
+
+/**
+ * Move Menu Entry to new Position
+ * @param index index of menu entry to move
+ * @param toIndex index of destination
+ * @param where After ore before the destination index
+ */
+void cSubMenu::MoveMenu(int index, int toIndex, enum Where where)
+{
+ if (index < 0 || index > _nrNodes || // invalid index is ignored
+ toIndex < 0 || toIndex > _nrNodes || index == toIndex)
+ return;
+
+ cSubMenuNode *srcNode = GetAbsNode(index);
+ cSubMenuNode *destNode = GetAbsNode(toIndex);
+
+ if (where == cSubMenu::INTO && destNode->GetType() != cSubMenuNode::MENU)
+ return;
+
+ if (where == cSubMenu::INTO) {
+ if (destNode->GetType() == cSubMenuNode::MENU) {
+ srcNode->GetCurrentMenu()->Del(srcNode, false);
+ srcNode->SetLevel(destNode->GetLevel()+1);
+ srcNode->SetParentMenu(destNode->GetCurrentMenu());
+ srcNode->SetCurrentMenu(destNode->GetSubMenus());
+
+ destNode->GetSubMenus()->Add(srcNode);
+ reloadNodeArray();
+ }
+ }
+ else {
+ srcNode->GetCurrentMenu()->Del(srcNode, false);
+ srcNode->SetLevel(destNode->GetLevel());
+ srcNode->SetParentMenu(destNode->GetParentMenu());
+ srcNode->SetCurrentMenu(destNode->GetCurrentMenu());
+
+ if (where == cSubMenu::BEHIND) {
+ destNode->GetCurrentMenu()->Add(srcNode, GetAbsNode(toIndex));
+ reloadNodeArray();
+ }
+ else {
+ destNode->GetCurrentMenu()->Ins(srcNode, GetAbsNode(toIndex));
+ reloadNodeArray();
+ }
+ }
+}
+
+/**
+ * Create a new Menu Entry
+ * @param index index of destination
+ * @param menuTitle Titel of new Menu entry
+ */
+void cSubMenu::CreateMenu(int index, const char * menuTitle)
+{
+ if (index >= 0 && index < _nrNodes) {
+ cSubMenuNode *srcNode = GetAbsNode(index);
+ if (srcNode != NULL) {
+ cSubMenuNode *newNode = new cSubMenuNode(srcNode->GetParentMenu(), srcNode->GetCurrentMenu());
+ newNode->SetLevel(srcNode->GetLevel());
+ newNode->SetName(menuTitle);
+ newNode->SetType(cSubMenuNode::MENU);
+ newNode->SetParentMenu(srcNode->GetParentMenu());
+ newNode->SetCurrentMenu(srcNode->GetCurrentMenu());
+
+ srcNode->GetCurrentMenu()->Add(newNode, GetAbsNode(index));
+ reloadNodeArray();
+ }
+ }
+}
+
+/**
+ * delete the specified entry, or subtree if the specified entry is a menu
+ * @param index destion index
+ */
+void cSubMenu::DeleteMenu(int index)
+{
+ if (index >= 0 && index < _nrNodes) {
+ cSubMenuNode *srcNode = GetAbsNode(index);
+ srcNode->GetCurrentMenu()->Del(srcNode, true);
+ reloadNodeArray();
+ }
+}
+
+
+// Private Methods
+
+int cSubMenu::countNodes(cSubMenuNodes * tree)
+{
+ int count = 0;
+ if (tree != NULL) {
+ for (cSubMenuNode *node = tree->First(); node; node = tree->Next(node)) {
+ count++;
+ if (node->HasSubMenus())
+ count += countNodes(node->GetSubMenus());
+ }
+ }
+ return(count);
+}
+
+
+void cSubMenu::tree2Array(cSubMenuNodes * tree, int &index)
+{
+ if (tree != NULL) {
+ for (cSubMenuNode *node = tree->First(); node; node = tree->Next(node)) {
+ _nodeArray[index++]=node;
+ if (node->HasSubMenus())
+ tree2Array(node->GetSubMenus(), index);
+ }
+ }
+
+}
+
+bool cSubMenu::IsPluginInMenu(const char * name)
+{
+ bool found = false;
+ for (int i = 0; i < _nrNodes && found == false; i++) {
+ cSubMenuNode *node = GetAbsNode(i);
+ if (node != NULL && node->GetType() == cSubMenuNode::PLUGIN && strcmp(name, node->GetName()) == 0)
+ found = true;
+ }
+ return(found);
+}
+
+/**
+ * Adds the given plugin to the Menu-Tree if not allready in List
+ * @param name specifies the name of the plugin
+ */
+void cSubMenu::AddPlugin(const char * name)
+{
+ if (! IsPluginInMenu(name)) {
+ cSubMenuNode *node = new cSubMenuNode(&_menuTree, NULL);
+ node->SetName(name);
+ node->SetType("plugin");
+ node->SetPlugin();
+ _menuTree.Add(node);
+ }
+}
+
+void cSubMenu::addMissingPlugins()
+{
+ _nrNodes = GetNrOfNodes();
+ for (int i = 0; ; i++) {
+ cPlugin *p = cPluginManager::GetPlugin(i);
+ if (p)
+ AddPlugin(p->Name());
+ else
+ break;
+ }
+ reloadNodeArray();
+}
+
+/**
+ * Adds the given command to the Menu-Tree
+ * @param name specifies the name of the command
+ */
+void cSubMenu::CreateCommand(int index, const char * name, const char * execute, int confirm)
+{
+ if (index >= 0 && index < _nrNodes) {
+ cSubMenuNode *srcNode = GetAbsNode(index);
+ if (srcNode != NULL) {
+ cSubMenuNode *newNode = new cSubMenuNode(srcNode->GetParentMenu(), srcNode->GetCurrentMenu());
+ newNode->SetLevel(srcNode->GetLevel());
+ newNode->SetName(name);
+ newNode->SetType("command");
+ newNode->SetCommand(execute);
+ newNode->SetCommandConfirm(confirm);
+ newNode->SetParentMenu(srcNode->GetParentMenu());
+ newNode->SetCurrentMenu(srcNode->GetCurrentMenu());
+
+ srcNode->GetCurrentMenu()->Add(newNode, GetAbsNode(index));
+ reloadNodeArray();
+ }
+ }
+}
+
+void cSubMenu::CreateThread(int index, const char * name, const char * execute, int confirm)
+{
+ if (index >= 0 && index < _nrNodes) {
+ cSubMenuNode *srcNode = GetAbsNode(index);
+ if (srcNode != NULL) {
+ cSubMenuNode *newNode = new cSubMenuNode(srcNode->GetParentMenu(), srcNode->GetCurrentMenu());
+ newNode->SetLevel(srcNode->GetLevel());
+ newNode->SetName(name);
+ newNode->SetType("thread");
+ newNode->SetCommand(execute);
+ newNode->SetCommandConfirm(confirm);
+ newNode->SetParentMenu(srcNode->GetParentMenu());
+ newNode->SetCurrentMenu(srcNode->GetCurrentMenu());
+
+ srcNode->GetCurrentMenu()->Add(newNode, GetAbsNode(index));
+ reloadNodeArray();
+ }
+ }
+}
+
+/**
+ * reloads the internal Array of Nodes
+ */
+void cSubMenu::reloadNodeArray()
+{
+ if (_nrNodes > 0)
+ free(_nodeArray);
+ _nodeArray = NULL;
+ _nrNodes = 0;
+ _nrNodes = GetNrOfNodes();
+}
+
+/**
+ * remove Undefined Nodes
+ */
+void cSubMenu::removeUndefinedNodes()
+{
+ bool remove = false;
+
+ reloadNodeArray();
+ for (int i = 0; i < _nrNodes; i++) {
+ cSubMenuNode *node = GetAbsNode(i);
+ if (node != NULL && node->GetType() == cSubMenuNode::UNDEFINED) {
+ cSubMenuNodes *pMenu = node->GetCurrentMenu();
+ pMenu->Del(node, true);
+ remove = true;
+ }
+ }
+ if (remove)
+ reloadNodeArray();
+}
+
+
+/**
+* Retrieves the Menutitel of the parent Menu
+*/
+const char *cSubMenu::GetParentMenuTitel()
+{
+ const char * result = "";
+
+ if (_currentMenuTree != NULL && _currentParentMenuTree != NULL) {
+ cSubMenuNode *node = NULL;
+ for (int i = 0; (node = _currentParentMenuTree->Get(i)) != NULL; i++) {
+ if (_currentMenuTree == node->GetSubMenus()) {
+ result = node->GetName();
+ break;
+ }
+ }
+ }
+
+ return(result);
+}
+
+#endif
+#endif /* SETUP */
diff -ruN vdr-1.7.12/submenu.h vdr-1.7.12.ExtP_NG/submenu.h
--- vdr-1.7.12/submenu.h 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/submenu.h 2010-02-03 22:16:55.646064199 +0100
@@ -0,0 +1,154 @@
+#ifdef USE_SETUP
+/****************************************************************************
+ * DESCRIPTION:
+ * Submenu
+ *
+ * $Id: vdr-1.3.44-Setup-0.3.0.diff,v 1.1 2006/03/04 09:58:47 ralf Exp $
+ *
+ * Contact: ranga@teddycats.de
+ *
+ * Copyright (C) 2004, 2005 by Ralf Dotzert
+ *
+ * modified for the VDR Extensions Patch by zulu @vdr-portal
+ *
+ ****************************************************************************/
+
+#ifndef SUBMENU_H
+#define SUBMENU_H
+
+#include "thread.h"
+#include "tools.h"
+#include "tinystr.h"
+
+class cSubMenuNode;
+class cSubMenuNodes;
+class cSubMenu;
+
+
+class cSubMenuNodes : public cList<cSubMenuNode> {};
+
+// execute cmd thread
+class cExecCmdThread : public cThread {
+private:
+ char *ExecCmd;
+protected:
+ virtual void Action(void) {
+ if (system(ExecCmd) == 0)
+ esyslog("%s - finished", ExecCmd);
+ delete(this);
+ };
+public:
+ cExecCmdThread(char *cmd) {
+ asprintf(&ExecCmd, "%s", cmd);
+ }
+ cExecCmdThread(const char *cmd) {
+ asprintf(&ExecCmd, "%s", cmd);
+ }
+ ~cExecCmdThread() {
+ free(ExecCmd);
+ };
+ };
+
+//################################################################################
+//# SubMenuNode
+//################################################################################
+class cSubMenuNode : public cListObject {
+public:
+ enum Type { UNDEFINED, SYSTEM, COMMAND, THREAD, PLUGIN, MENU };
+ cSubMenuNode(TiXmlElement * xml, int level, cSubMenuNodes *currentMenu, cSubMenuNodes *parentMenu);
+ cSubMenuNode(cSubMenuNodes *currentMenu, cSubMenuNodes *parentMenu);
+ ~cSubMenuNode();
+ bool SaveXml(TiXmlElement * root);
+ static cSubMenuNode::Type IsType(const char *name);
+ void SetType(const char *name);
+ void SetType(enum Type type);
+ void SetPlugin();
+ cSubMenuNode::Type GetType();
+ const char *GetTypeAsString();
+ void SetCommand(const char *command);
+ bool CommandConfirm();
+ void SetCommandConfirm(int val);
+ const char *GetCommand();
+ void SetCustomTitle(const char *title);
+ const char *GetCustomTitle();
+ void SetName(const char *name);
+ const char*GetName();
+ int GetLevel();
+ void SetLevel(int level);
+ int GetPluginIndex();
+ void SetPluginIndex(int index);
+ void SetPluginMainMenuEntry(const char *mainMenuEntry);
+ const char *GetPluginMainMenuEntry();
+ cSubMenuNodes *GetParentMenu();
+ void SetParentMenu(cSubMenuNodes *parent);
+ cSubMenuNodes *GetCurrentMenu();
+ void SetCurrentMenu(cSubMenuNodes *current);
+ cSubMenuNodes *GetSubMenus();
+ bool HasSubMenus();
+ void Print(int index = 0);
+private:
+ Type _type;
+ int _level;
+ // Plugin Variables
+ int _pluginIndex;
+ const char *_pluginMainMenuEntry;
+ // common
+ const char *_name;
+ const char *_command;
+ bool _commandConfirm;
+ const char *_title;
+ cSubMenuNodes _subMenus;
+ cSubMenuNodes *_parentMenu;
+ cSubMenuNodes *_currentMenu;
+ void init();
+ };
+
+
+//################################################################################
+//# SubMenu Class
+//################################################################################
+class cSubMenu {
+public:
+ cSubMenu();
+ ~cSubMenu();
+ enum Where { BEFORE, BEHIND, INTO};
+ bool LoadXml(char *fname);
+ bool SaveXml(char *fname);
+ bool SaveXml();
+ cSubMenuNodes *GetMenuTree();
+ bool Up(int *ParentIndex);
+ bool Down(int index);
+ int GetNrOfNodes();
+ cSubMenuNode* GetAbsNode(int index);
+ cSubMenuNode* GetNode(int index);
+ void PrintMenuTree();
+ bool IsPluginInMenu(const char *name);
+ void AddPlugin(const char *name);
+ void CreateCommand(int index, const char *name, const char *execute, int confirm);
+ void CreateThread(int index, const char *name, const char *execute, int confirm);
+ const char *ExecuteCommand(const char *command);
+ void MoveMenu(int index, int toindex, enum Where);
+ void CreateMenu(int index, const char *menuTitle);
+ void DeleteMenu(int index);
+ char *GetMenuSuffix() { return _menuSuffix; }
+ void SetMenuSuffix(char *suffix) { if (_menuSuffix) free(_menuSuffix); asprintf(&_menuSuffix, suffix); }
+ bool isTopMenu() { return (_currentParentMenuTree == NULL); }
+ const char *GetParentMenuTitel();
+private:
+ cSubMenuNodes _menuTree;
+ cSubMenuNodes *_currentMenuTree;
+ cSubMenuNodes *_currentParentMenuTree;
+ char *_fname;
+ char *_commandResult;
+ int _nrNodes;
+ cSubMenuNode **_nodeArray;
+ char *_menuSuffix;
+ int countNodes(cSubMenuNodes *tree);
+ void tree2Array(cSubMenuNodes *tree, int &index);
+ void addMissingPlugins();
+ void reloadNodeArray();
+ void removeUndefinedNodes();
+ };
+
+#endif //__SUBMENU_H
+#endif /* SETUP */
diff -ruN vdr-1.7.12/svdrp.c vdr-1.7.12.ExtP_NG/svdrp.c
--- vdr-1.7.12/svdrp.c 2010-01-17 13:23:31.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/svdrp.c 2010-02-03 22:16:55.690066076 +0100
@@ -304,6 +304,10 @@
"REMO [ on | off ]\n"
" Turns the remote control on or off. Without a parameter, the current\n"
" status of the remote control is reported.",
+#ifdef USE_LIEMIEXT
+ "RENR <number> <new name>\n"
+ " Rename recording. Number must be the Number as returned by LSTR command.",
+#endif /* LIEMIEXT */
"SCAN\n"
" Forces an EPG scan. If this is a single DVB device system, the scan\n"
" will be done on the primary device unless it is currently recording.",
@@ -1493,6 +1497,39 @@
Reply(250, "EPG scan triggered");
}
+#ifdef USE_LIEMIEXT
+void cSVDRP::CmdRENR(const char *Option)
+{
+ bool recordings = Recordings.Update(true);
+ if (recordings) {
+ if (*Option) {
+ char *tail;
+ int n = strtol(Option, &tail, 10);
+ cRecording *recording = Recordings.Get(n - 1);
+ if (recording && tail && tail != Option) {
+ char *oldName = strdup(recording->Name());
+ tail = skipspace(tail);
+ if (recording->Rename(tail)) {
+ Reply(250, "Renamed \"%s\" to \"%s\"", oldName, recording->Name());
+ Recordings.ChangeState();
+ Recordings.TouchUpdate();
+ }
+ else
+ Reply(501, "Renaming \"%s\" to \"%s\" failed", oldName, tail);
+ free(oldName);
+ }
+ else
+ Reply(501, "Recording not found or wrong syntax");
+ }
+ else
+ Reply(501, "Missing Input settings");
+ }
+ else
+ Reply(550, "No recordings available");
+}
+
+#endif /* LIEMIEXT */
+
void cSVDRP::CmdSTAT(const char *Option)
{
if (*Option) {
@@ -1608,6 +1645,9 @@
else if (CMD("PLUG")) CmdPLUG(s);
else if (CMD("PUTE")) CmdPUTE(s);
else if (CMD("REMO")) CmdREMO(s);
+#ifdef USE_LIEMIEXT
+ else if (CMD("RENR")) CmdRENR(s);
+#endif /* LIEMIEXT */
else if (CMD("SCAN")) CmdSCAN(s);
else if (CMD("STAT")) CmdSTAT(s);
else if (CMD("UPDT")) CmdUPDT(s);
diff -ruN vdr-1.7.12/svdrp.h vdr-1.7.12.ExtP_NG/svdrp.h
--- vdr-1.7.12/svdrp.h 2007-04-30 14:28:28.000000000 +0200
+++ vdr-1.7.12.ExtP_NG/svdrp.h 2010-02-03 22:16:55.697065943 +0100
@@ -79,6 +79,9 @@
void CmdPLUG(const char *Option);
void CmdPUTE(const char *Option);
void CmdREMO(const char *Option);
+#ifdef USE_LIEMIEXT
+ void CmdRENR(const char *Option);
+#endif /* LIEMIEXT */
void CmdSCAN(const char *Option);
void CmdSTAT(const char *Option);
void CmdUPDT(const char *Option);
diff -ruN vdr-1.7.12/timers.c vdr-1.7.12.ExtP_NG/timers.c
--- vdr-1.7.12/timers.c 2010-01-16 12:18:53.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/timers.c 2010-02-03 22:16:55.787065068 +0100
@@ -46,6 +46,9 @@
stop -= 2400;
priority = Pause ? Setup.PausePriority : Setup.DefaultPriority;
lifetime = Pause ? Setup.PauseLifetime : Setup.DefaultLifetime;
+#ifdef USE_PINPLUGIN
+ fskProtection = 0; // PIN PATCH
+#endif /* PINPLUGIN */
*file = 0;
aux = NULL;
event = NULL;
@@ -84,6 +87,9 @@
stop -= 2400;
priority = Setup.DefaultPriority;
lifetime = Setup.DefaultLifetime;
+#ifdef USE_PINPLUGIN
+ fskProtection = 0; // PIN PATCH
+#endif /* PINPLUGIN */
*file = 0;
const char *Title = Event->Title();
if (!isempty(Title))
@@ -95,6 +101,9 @@
}
aux = NULL;
event = NULL; // let SetEvent() be called to get a log message
+#ifdef USE_PINPLUGIN
+ cStatus::MsgTimerCreation(this, Event); // PIN PATCH
+#endif /* PINPLUGIN */
}
cTimer::cTimer(const cTimer &Timer)
@@ -129,6 +138,9 @@
stop = Timer.stop;
priority = Timer.priority;
lifetime = Timer.lifetime;
+#ifdef USE_PINPLUGIN
+ fskProtection = Timer.fskProtection; // PIN PATCH
+#endif /* PINPLUGIN */
strncpy(file, Timer.file, sizeof(file));
free(aux);
aux = Timer.aux ? strdup(Timer.aux) : NULL;
@@ -323,6 +335,9 @@
result = false;
}
}
+#ifdef USE_PINPLUGIN
+ fskProtection = aux && strstr(aux, "<pin-plugin><protected>yes</protected></pin-plugin>"); // PIN PATCH
+#endif /* PINPLUGIN */
free(channelbuffer);
free(daybuffer);
free(filebuffer);
@@ -632,6 +647,35 @@
Matches(); // refresh start and end time
}
+#ifdef USE_PINPLUGIN
+void cTimer::SetFskProtection(int aFlag) // PIN PATCH
+{
+ char* p;
+ char* tmp = 0;
+
+ fskProtection = aFlag;
+
+ if (fskProtection && (!aux || !strstr(aux, "<pin-plugin><protected>yes</protected></pin-plugin>")))
+ {
+ // add protection info to aux
+
+ if (aux) { tmp = strdup(aux); free(aux); }
+ asprintf(&aux,"%s<pin-plugin><protected>yes</protected></pin-plugin>", tmp ? tmp : "");
+ }
+ else if (!fskProtection && aux && (p = strstr(aux, "<pin-plugin><protected>yes</protected></pin-plugin>")))
+ {
+ // remove protection info to aux
+
+ asprintf(&tmp, "%.*s%s", p-aux, aux, p+strlen("<pin-plugin><protected>yes</protected></pin-plugin>"));
+ free(aux);
+ aux = strdup(tmp);
+ }
+
+ if (tmp)
+ free(tmp);
+}
+#endif /* PINPLUGIN */
+
// --- cTimers ---------------------------------------------------------------
cTimers Timers;
diff -ruN vdr-1.7.12/timers.h vdr-1.7.12.ExtP_NG/timers.h
--- vdr-1.7.12/timers.h 2008-02-16 15:33:23.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/timers.h 2010-02-03 22:16:55.797066021 +0100
@@ -37,6 +37,9 @@
int start;
int stop;
int priority;
+#ifdef USE_PINPLUGIN
+ int fskProtection; // PIN PATCH
+#endif /* PINPLUGIN */
int lifetime;
mutable char file[MaxFileName];
char *aux;
@@ -58,6 +61,9 @@
int Start(void) const { return start; }
int Stop(void) const { return stop; }
int Priority(void) const { return priority; }
+#ifdef USE_PINPLUGIN
+ int FskProtection(void) const { return fskProtection; } // PIN PATCH
+#endif /* PINPLUGIN */
int Lifetime(void) const { return lifetime; }
const char *File(void) const { return file; }
time_t FirstDay(void) const { return weekdays ? day : 0; }
@@ -86,6 +92,9 @@
void SetInVpsMargin(bool InVpsMargin);
void SetPriority(int Priority);
void SetFlags(uint Flags);
+#ifdef USE_PINPLUGIN
+ void SetFskProtection(int aFlag); // PIN PATCH
+#endif /* PINPLUGIN */
void ClrFlags(uint Flags);
void InvFlags(uint Flags);
bool HasFlags(uint Flags) const;
diff -ruN vdr-1.7.12/tinystr.c vdr-1.7.12.ExtP_NG/tinystr.c
--- vdr-1.7.12/tinystr.c 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/tinystr.c 2010-02-03 22:16:55.811066159 +0100
@@ -0,0 +1,301 @@
+#ifdef USE_SETUP
+/*
+www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+
+#ifndef TIXML_USE_STL
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "tinystr.h"
+
+// TiXmlString constructor, based on a C string
+TiXmlString::TiXmlString (const char* instring)
+{
+ unsigned newlen;
+ char * newstring;
+
+ if (!instring)
+ {
+ allocated = 0;
+ cstring = NULL;
+ current_length = 0;
+ return;
+ }
+ newlen = strlen (instring) + 1;
+ newstring = new char [newlen];
+ memcpy (newstring, instring, newlen);
+ // strcpy (newstring, instring);
+ allocated = newlen;
+ cstring = newstring;
+ current_length = newlen - 1;
+}
+
+// TiXmlString copy constructor
+TiXmlString::TiXmlString (const TiXmlString& copy)
+{
+ unsigned newlen;
+ char * newstring;
+
+ // Prevent copy to self!
+ if ( © == this )
+ return;
+
+ if (! copy . allocated)
+ {
+ allocated = 0;
+ cstring = NULL;
+ current_length = 0;
+ return;
+ }
+ newlen = copy . length () + 1;
+ newstring = new char [newlen];
+ // strcpy (newstring, copy . cstring);
+ memcpy (newstring, copy . cstring, newlen);
+ allocated = newlen;
+ cstring = newstring;
+ current_length = newlen - 1;
+}
+
+// TiXmlString = operator. Safe when assign own content
+void TiXmlString ::operator = (const char * content)
+{
+ unsigned newlen;
+ char * newstring;
+
+ if (! content)
+ {
+ empty_it ();
+ return;
+ }
+ newlen = strlen (content) + 1;
+ newstring = new char [newlen];
+ // strcpy (newstring, content);
+ memcpy (newstring, content, newlen);
+ empty_it ();
+ allocated = newlen;
+ cstring = newstring;
+ current_length = newlen - 1;
+}
+
+// = operator. Safe when assign own content
+void TiXmlString ::operator = (const TiXmlString & copy)
+{
+ unsigned newlen;
+ char * newstring;
+
+ if (! copy . length ())
+ {
+ empty_it ();
+ return;
+ }
+ newlen = copy . length () + 1;
+ newstring = new char [newlen];
+ // strcpy (newstring, copy . c_str ());
+ memcpy (newstring, copy . c_str (), newlen);
+ empty_it ();
+ allocated = newlen;
+ cstring = newstring;
+ current_length = newlen - 1;
+}
+
+
+// append a const char * to an existing TiXmlString
+void TiXmlString::append( const char* str, int len )
+{
+ char * new_string;
+ unsigned new_alloc, new_size, size_suffix;
+
+ // don't use strlen - it can overrun the len passed in!
+ const char* p = str;
+ size_suffix = 0;
+
+ while ( *p && size_suffix < (unsigned)len )
+ {
+ ++p;
+ ++size_suffix;
+ }
+ if ( !size_suffix)
+ return;
+
+ new_size = length () + size_suffix + 1;
+ // check if we need to expand
+ if (new_size > allocated)
+ {
+ // compute new size
+ new_alloc = assign_new_size (new_size);
+
+ // allocate new buffer
+ new_string = new char [new_alloc];
+ new_string [0] = 0;
+
+ // copy the previous allocated buffer into this one
+ if (allocated && cstring)
+ // strcpy (new_string, cstring);
+ memcpy (new_string, cstring, length ());
+
+ // append the suffix. It does exist, otherwize we wouldn't be expanding
+ // strncat (new_string, str, len);
+ memcpy (new_string + length (),
+ str,
+ size_suffix);
+
+ // return previsously allocated buffer if any
+ if (allocated && cstring)
+ delete [] cstring;
+
+ // update member variables
+ cstring = new_string;
+ allocated = new_alloc;
+ }
+ else
+ {
+ // we know we can safely append the new string
+ // strncat (cstring, str, len);
+ memcpy (cstring + length (),
+ str,
+ size_suffix);
+ }
+ current_length = new_size - 1;
+ cstring [current_length] = 0;
+}
+
+
+// append a const char * to an existing TiXmlString
+void TiXmlString::append( const char * suffix )
+{
+ char * new_string;
+ unsigned new_alloc, new_size;
+
+ new_size = length () + strlen (suffix) + 1;
+ // check if we need to expand
+ if (new_size > allocated)
+ {
+ // compute new size
+ new_alloc = assign_new_size (new_size);
+
+ // allocate new buffer
+ new_string = new char [new_alloc];
+ new_string [0] = 0;
+
+ // copy the previous allocated buffer into this one
+ if (allocated && cstring)
+ memcpy (new_string, cstring, 1 + length ());
+ // strcpy (new_string, cstring);
+
+ // append the suffix. It does exist, otherwize we wouldn't be expanding
+ // strcat (new_string, suffix);
+ memcpy (new_string + length (),
+ suffix,
+ strlen (suffix) + 1);
+
+ // return previsously allocated buffer if any
+ if (allocated && cstring)
+ delete [] cstring;
+
+ // update member variables
+ cstring = new_string;
+ allocated = new_alloc;
+ }
+ else
+ {
+ // we know we can safely append the new string
+ // strcat (cstring, suffix);
+ memcpy (cstring + length (),
+ suffix,
+ strlen (suffix) + 1);
+ }
+ current_length = new_size - 1;
+}
+
+// Check for TiXmlString equuivalence
+//bool TiXmlString::operator == (const TiXmlString & compare) const
+//{
+// return (! strcmp (c_str (), compare . c_str ()));
+//}
+
+//unsigned TiXmlString::length () const
+//{
+// if (allocated)
+// // return strlen (cstring);
+// return current_length;
+// return 0;
+//}
+
+
+unsigned TiXmlString::find (char tofind, unsigned offset) const
+{
+ char * lookup;
+
+ if (offset >= length ())
+ return (unsigned) notfound;
+ for (lookup = cstring + offset; * lookup; lookup++)
+ if (* lookup == tofind)
+ return lookup - cstring;
+ return (unsigned) notfound;
+}
+
+
+bool TiXmlString::operator == (const TiXmlString & compare) const
+{
+ if ( allocated && compare.allocated )
+ {
+ assert( cstring );
+ assert( compare.cstring );
+ return ( strcmp( cstring, compare.cstring ) == 0 );
+ }
+ return false;
+}
+
+
+bool TiXmlString::operator < (const TiXmlString & compare) const
+{
+ if ( allocated && compare.allocated )
+ {
+ assert( cstring );
+ assert( compare.cstring );
+ return ( strcmp( cstring, compare.cstring ) > 0 );
+ }
+ return false;
+}
+
+
+bool TiXmlString::operator > (const TiXmlString & compare) const
+{
+ if ( allocated && compare.allocated )
+ {
+ assert( cstring );
+ assert( compare.cstring );
+ return ( strcmp( cstring, compare.cstring ) < 0 );
+ }
+ return false;
+}
+
+
+#endif // TIXML_USE_STL
+#endif /* SETUP */
diff -ruN vdr-1.7.12/tinystr.h vdr-1.7.12.ExtP_NG/tinystr.h
--- vdr-1.7.12/tinystr.h 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/tinystr.h 2010-02-03 22:16:55.829066864 +0100
@@ -0,0 +1,244 @@
+#ifdef USE_SETUP
+/*
+www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+
+
+#ifndef TIXML_USE_STL
+
+#ifndef TIXML_STRING_INCLUDED
+#define TIXML_STRING_INCLUDED
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4786 ) // Debugger truncating names.
+#endif
+
+#include <assert.h>
+
+/*
+ TiXmlString is an emulation of the std::string template.
+ Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
+ Only the member functions relevant to the TinyXML project have been implemented.
+ The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
+ a string and there's no more room, we allocate a buffer twice as big as we need.
+*/
+class TiXmlString
+{
+ public :
+ // TiXmlString constructor, based on a string
+ TiXmlString (const char * instring);
+
+ // TiXmlString empty constructor
+ TiXmlString ()
+ {
+ allocated = 0;
+ cstring = NULL;
+ current_length = 0;
+ }
+
+ // TiXmlString copy constructor
+ TiXmlString (const TiXmlString& copy);
+
+ // TiXmlString destructor
+ ~ TiXmlString ()
+ {
+ empty_it ();
+ }
+
+ // Convert a TiXmlString into a classical char *
+ const char * c_str () const
+ {
+ if (allocated)
+ return cstring;
+ return "";
+ }
+
+ // Return the length of a TiXmlString
+ unsigned length () const
+ {
+ return ( allocated ) ? current_length : 0;
+ }
+
+ // TiXmlString = operator
+ void operator = (const char * content);
+
+ // = operator
+ void operator = (const TiXmlString & copy);
+
+ // += operator. Maps to append
+ TiXmlString& operator += (const char * suffix)
+ {
+ append (suffix);
+ return *this;
+ }
+
+ // += operator. Maps to append
+ TiXmlString& operator += (char single)
+ {
+ append (single);
+ return *this;
+ }
+
+ // += operator. Maps to append
+ TiXmlString& operator += (TiXmlString & suffix)
+ {
+ append (suffix);
+ return *this;
+ }
+ bool operator == (const TiXmlString & compare) const;
+ bool operator < (const TiXmlString & compare) const;
+ bool operator > (const TiXmlString & compare) const;
+
+ // Checks if a TiXmlString is empty
+ bool empty () const
+ {
+ return length () ? false : true;
+ }
+
+ // single char extraction
+ const char& at (unsigned index) const
+ {
+ assert( index < length ());
+ return cstring [index];
+ }
+
+ // find a char in a string. Return TiXmlString::notfound if not found
+ unsigned find (char lookup) const
+ {
+ return find (lookup, 0);
+ }
+
+ // find a char in a string from an offset. Return TiXmlString::notfound if not found
+ unsigned find (char tofind, unsigned offset) const;
+
+ /* Function to reserve a big amount of data when we know we'll need it. Be aware that this
+ function clears the content of the TiXmlString if any exists.
+ */
+ void reserve (unsigned size)
+ {
+ empty_it ();
+ if (size)
+ {
+ allocated = size;
+ cstring = new char [size];
+ cstring [0] = 0;
+ current_length = 0;
+ }
+ }
+
+ // [] operator
+ char& operator [] (unsigned index) const
+ {
+ assert( index < length ());
+ return cstring [index];
+ }
+
+ // Error value for find primitive
+ enum { notfound = 0xffffffff,
+ npos = notfound };
+
+ void append (const char *str, int len );
+
+ protected :
+
+ // The base string
+ char * cstring;
+ // Number of chars allocated
+ unsigned allocated;
+ // Current string size
+ unsigned current_length;
+
+ // New size computation. It is simplistic right now : it returns twice the amount
+ // we need
+ unsigned assign_new_size (unsigned minimum_to_allocate)
+ {
+ return minimum_to_allocate * 2;
+ }
+
+ // Internal function that clears the content of a TiXmlString
+ void empty_it ()
+ {
+ if (cstring)
+ delete [] cstring;
+ cstring = NULL;
+ allocated = 0;
+ current_length = 0;
+ }
+
+ void append (const char *suffix );
+
+ // append function for another TiXmlString
+ void append (const TiXmlString & suffix)
+ {
+ append (suffix . c_str ());
+ }
+
+ // append for a single char.
+ void append (char single)
+ {
+ if ( cstring && current_length < (allocated-1) )
+ {
+ cstring[ current_length ] = single;
+ ++current_length;
+ cstring[ current_length ] = 0;
+ }
+ else
+ {
+ char smallstr [2];
+ smallstr [0] = single;
+ smallstr [1] = 0;
+ append (smallstr);
+ }
+ }
+
+} ;
+
+/*
+ TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
+ Only the operators that we need for TinyXML have been developped.
+*/
+class TiXmlOutStream : public TiXmlString
+{
+public :
+ TiXmlOutStream () : TiXmlString () {}
+
+ // TiXmlOutStream << operator. Maps to TiXmlString::append
+ TiXmlOutStream & operator << (const char * in)
+ {
+ append (in);
+ return (* this);
+ }
+
+ // TiXmlOutStream << operator. Maps to TiXmlString::append
+ TiXmlOutStream & operator << (const TiXmlString & in)
+ {
+ append (in . c_str ());
+ return (* this);
+ }
+} ;
+
+#endif // TIXML_STRING_INCLUDED
+#endif // TIXML_USE_STL
+#endif /* SETUP */
diff -ruN vdr-1.7.12/tinyxml.c vdr-1.7.12.ExtP_NG/tinyxml.c
--- vdr-1.7.12/tinyxml.c 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/tinyxml.c 2010-02-03 22:16:55.846069724 +0100
@@ -0,0 +1,1429 @@
+#ifdef USE_SETUP
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include <ctype.h>
+#include "tinyxml.h"
+
+#ifdef TIXML_USE_STL
+#include <sstream>
+#endif
+
+
+bool TiXmlBase::condenseWhiteSpace = true;
+
+void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_OSTREAM* stream )
+{
+ TIXML_STRING buffer;
+ PutString( str, &buffer );
+ (*stream) << buffer;
+}
+
+void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
+{
+ int i=0;
+
+ while( i<(int)str.length() )
+ {
+ unsigned char c = (unsigned char) str[i];
+
+ if ( c == '&'
+ && i < ( (int)str.length() - 2 )
+ && str[i+1] == '#'
+ && str[i+2] == 'x' )
+ {
+ // Hexadecimal character reference.
+ // Pass through unchanged.
+ // © -- copyright symbol, for example.
+ //
+ // The -1 is a bug fix from Rob Laveaux. It keeps
+ // an overflow from happening if there is no ';'.
+ // There are actually 2 ways to exit this loop -
+ // while fails (error case) and break (semicolon found).
+ // However, there is no mechanism (currently) for
+ // this function to return an error.
+ while ( i<(int)str.length()-1 )
+ {
+ outString->append( str.c_str() + i, 1 );
+ ++i;
+ if ( str[i] == ';' )
+ break;
+ }
+ }
+ else if ( c == '&' )
+ {
+ outString->append( entity[0].str, entity[0].strLength );
+ ++i;
+ }
+ else if ( c == '<' )
+ {
+ outString->append( entity[1].str, entity[1].strLength );
+ ++i;
+ }
+ else if ( c == '>' )
+ {
+ outString->append( entity[2].str, entity[2].strLength );
+ ++i;
+ }
+ else if ( c == '\"' )
+ {
+ outString->append( entity[3].str, entity[3].strLength );
+ ++i;
+ }
+ else if ( c == '\'' )
+ {
+ outString->append( entity[4].str, entity[4].strLength );
+ ++i;
+ }
+ else if ( c < 32 )
+ {
+ // Easy pass at non-alpha/numeric/symbol
+ // Below 32 is symbolic.
+ char buf[ 32 ];
+ sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
+ outString->append( buf, strlen( buf ) );
+ ++i;
+ }
+ else
+ {
+ //char realc = (char) c;
+ //outString->append( &realc, 1 );
+ *outString += (char) c; // somewhat more efficient function call.
+ ++i;
+ }
+ }
+}
+
+
+// <-- Strange class for a bug fix. Search for STL_STRING_BUG
+TiXmlBase::StringToBuffer::StringToBuffer( const TIXML_STRING& str )
+{
+ buffer = new char[ str.length()+1 ];
+ if ( buffer )
+ {
+ strcpy( buffer, str.c_str() );
+ }
+}
+
+
+TiXmlBase::StringToBuffer::~StringToBuffer()
+{
+ delete [] buffer;
+}
+// End strange bug fix. -->
+
+
+TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase()
+{
+ parent = 0;
+ type = _type;
+ firstChild = 0;
+ lastChild = 0;
+ prev = 0;
+ next = 0;
+}
+
+
+TiXmlNode::~TiXmlNode()
+{
+ TiXmlNode* node = firstChild;
+ TiXmlNode* temp = 0;
+
+ while ( node )
+ {
+ temp = node;
+ node = node->next;
+ delete temp;
+ }
+}
+
+
+void TiXmlNode::CopyTo( TiXmlNode* target ) const
+{
+ target->SetValue (value.c_str() );
+ target->userData = userData;
+}
+
+
+void TiXmlNode::Clear()
+{
+ TiXmlNode* node = firstChild;
+ TiXmlNode* temp = 0;
+
+ while ( node )
+ {
+ temp = node;
+ node = node->next;
+ delete temp;
+ }
+
+ firstChild = 0;
+ lastChild = 0;
+}
+
+
+TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
+{
+ node->parent = this;
+
+ node->prev = lastChild;
+ node->next = 0;
+
+ if ( lastChild )
+ lastChild->next = node;
+ else
+ firstChild = node; // it was an empty list.
+
+ lastChild = node;
+ return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
+{
+ TiXmlNode* node = addThis.Clone();
+ if ( !node )
+ return 0;
+
+ return LinkEndChild( node );
+}
+
+
+TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
+{
+ if ( !beforeThis || beforeThis->parent != this )
+ return 0;
+
+ TiXmlNode* node = addThis.Clone();
+ if ( !node )
+ return 0;
+ node->parent = this;
+
+ node->next = beforeThis;
+ node->prev = beforeThis->prev;
+ if ( beforeThis->prev )
+ {
+ beforeThis->prev->next = node;
+ }
+ else
+ {
+ assert( firstChild == beforeThis );
+ firstChild = node;
+ }
+ beforeThis->prev = node;
+ return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
+{
+ if ( !afterThis || afterThis->parent != this )
+ return 0;
+
+ TiXmlNode* node = addThis.Clone();
+ if ( !node )
+ return 0;
+ node->parent = this;
+
+ node->prev = afterThis;
+ node->next = afterThis->next;
+ if ( afterThis->next )
+ {
+ afterThis->next->prev = node;
+ }
+ else
+ {
+ assert( lastChild == afterThis );
+ lastChild = node;
+ }
+ afterThis->next = node;
+ return node;
+}
+
+
+TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
+{
+ if ( replaceThis->parent != this )
+ return 0;
+
+ TiXmlNode* node = withThis.Clone();
+ if ( !node )
+ return 0;
+
+ node->next = replaceThis->next;
+ node->prev = replaceThis->prev;
+
+ if ( replaceThis->next )
+ replaceThis->next->prev = node;
+ else
+ lastChild = node;
+
+ if ( replaceThis->prev )
+ replaceThis->prev->next = node;
+ else
+ firstChild = node;
+
+ delete replaceThis;
+ node->parent = this;
+ return node;
+}
+
+
+bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
+{
+ if ( removeThis->parent != this )
+ {
+ assert( 0 );
+ return false;
+ }
+
+ if ( removeThis->next )
+ removeThis->next->prev = removeThis->prev;
+ else
+ lastChild = removeThis->prev;
+
+ if ( removeThis->prev )
+ removeThis->prev->next = removeThis->next;
+ else
+ firstChild = removeThis->next;
+
+ delete removeThis;
+ return true;
+}
+
+TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const
+{
+ TiXmlNode* node;
+ for ( node = firstChild; node; node = node->next )
+ {
+ if ( node->SValue() == TIXML_STRING( _value ))
+ return node;
+ }
+ return 0;
+}
+
+TiXmlNode* TiXmlNode::LastChild( const char * _value ) const
+{
+ TiXmlNode* node;
+ for ( node = lastChild; node; node = node->prev )
+ {
+ if ( node->SValue() == TIXML_STRING (_value))
+ return node;
+ }
+ return 0;
+}
+
+TiXmlNode* TiXmlNode::IterateChildren( TiXmlNode* previous ) const
+{
+ if ( !previous )
+ {
+ return FirstChild();
+ }
+ else
+ {
+ assert( previous->parent == this );
+ return previous->NextSibling();
+ }
+}
+
+TiXmlNode* TiXmlNode::IterateChildren( const char * val, TiXmlNode* previous ) const
+{
+ if ( !previous )
+ {
+ return FirstChild( val );
+ }
+ else
+ {
+ assert( previous->parent == this );
+ return previous->NextSibling( val );
+ }
+}
+
+TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const
+{
+ TiXmlNode* node;
+ for ( node = next; node; node = node->next )
+ {
+ if ( node->SValue() == TIXML_STRING (_value))
+ return node;
+ }
+ return 0;
+}
+
+
+TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const
+{
+ TiXmlNode* node;
+ for ( node = prev; node; node = node->prev )
+ {
+ if ( node->SValue() == TIXML_STRING (_value))
+ return node;
+ }
+ return 0;
+}
+
+void TiXmlElement::RemoveAttribute( const char * name )
+{
+ TiXmlAttribute* node = attributeSet.Find( name );
+ if ( node )
+ {
+ attributeSet.Remove( node );
+ delete node;
+ }
+}
+
+TiXmlElement* TiXmlNode::FirstChildElement() const
+{
+ TiXmlNode* node;
+
+ for ( node = FirstChild();
+ node;
+ node = node->NextSibling() )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const
+{
+ TiXmlNode* node;
+
+ for ( node = FirstChild( _value );
+ node;
+ node = node->NextSibling( _value ) )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+
+TiXmlElement* TiXmlNode::NextSiblingElement() const
+{
+ TiXmlNode* node;
+
+ for ( node = NextSibling();
+ node;
+ node = node->NextSibling() )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const
+{
+ TiXmlNode* node;
+
+ for ( node = NextSibling( _value );
+ node;
+ node = node->NextSibling( _value ) )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+
+
+TiXmlDocument* TiXmlNode::GetDocument() const
+{
+ const TiXmlNode* node;
+
+ for( node = this; node; node = node->parent )
+ {
+ if ( node->ToDocument() )
+ return node->ToDocument();
+ }
+ return 0;
+}
+
+
+TiXmlElement::TiXmlElement (const char * _value)
+ : TiXmlNode( TiXmlNode::ELEMENT )
+{
+ firstChild = lastChild = 0;
+ value = _value;
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlElement::TiXmlElement( const std::string& _value )
+ : TiXmlNode( TiXmlNode::ELEMENT )
+{
+ firstChild = lastChild = 0;
+ value = _value;
+}
+#endif
+
+
+TiXmlElement::TiXmlElement( const TiXmlElement& copy)
+ : TiXmlNode( TiXmlNode::ELEMENT )
+{
+ firstChild = lastChild = 0;
+ copy.CopyTo( this );
+}
+
+
+void TiXmlElement::operator=( const TiXmlElement& base )
+{
+ ClearThis();
+ base.CopyTo( this );
+}
+
+
+TiXmlElement::~TiXmlElement()
+{
+ ClearThis();
+}
+
+
+void TiXmlElement::ClearThis()
+{
+ Clear();
+ while( attributeSet.First() )
+ {
+ TiXmlAttribute* node = attributeSet.First();
+ attributeSet.Remove( node );
+ delete node;
+ }
+}
+
+
+const char * TiXmlElement::Attribute( const char * name ) const
+{
+ TiXmlAttribute* node = attributeSet.Find( name );
+
+ if ( node )
+ return node->Value();
+
+ return 0;
+}
+
+
+const char * TiXmlElement::Attribute( const char * name, int* i ) const
+{
+ const char * s = Attribute( name );
+ if ( i )
+ {
+ if ( s )
+ *i = atoi( s );
+ else
+ *i = 0;
+ }
+ return s;
+}
+
+
+const char * TiXmlElement::Attribute( const char * name, double* d ) const
+{
+ const char * s = Attribute( name );
+ if ( d )
+ {
+ if ( s )
+ *d = atof( s );
+ else
+ *d = 0;
+ }
+ return s;
+}
+
+
+int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
+{
+ TiXmlAttribute* node = attributeSet.Find( name );
+ if ( !node )
+ return TIXML_NO_ATTRIBUTE;
+
+ return node->QueryIntValue( ival );
+}
+
+
+int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const
+{
+ TiXmlAttribute* node = attributeSet.Find( name );
+ if ( !node )
+ return TIXML_NO_ATTRIBUTE;
+
+ return node->QueryDoubleValue( dval );
+}
+
+
+void TiXmlElement::SetAttribute( const char * name, int val )
+{
+ char buf[64];
+ sprintf( buf, "%d", val );
+ SetAttribute( name, buf );
+}
+
+
+void TiXmlElement::SetDoubleAttribute( const char * name, double val )
+{
+ char buf[128];
+ sprintf( buf, "%f", val );
+ SetAttribute( name, buf );
+}
+
+
+void TiXmlElement::SetAttribute( const char * name, const char * _value )
+{
+ TiXmlAttribute* node = attributeSet.Find( name );
+ if ( node )
+ {
+ node->SetValue( _value );
+ return;
+ }
+
+ TiXmlAttribute* attrib = new TiXmlAttribute( name, _value );
+ if ( attrib )
+ {
+ attributeSet.Add( attrib );
+ }
+ else
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ }
+}
+
+void TiXmlElement::Print( FILE* cfile, int depth ) const
+{
+ int i;
+ for ( i=0; i<depth; i++ )
+ {
+ fprintf( cfile, " " );
+ }
+
+ fprintf( cfile, "<%s", value.c_str() );
+
+ TiXmlAttribute* attrib;
+ for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+ {
+ fprintf( cfile, " " );
+ attrib->Print( cfile, depth );
+ }
+
+ // There are 3 different formatting approaches:
+ // 1) An element without children is printed as a <foo /> node
+ // 2) An element with only a text child is printed as <foo> text </foo>
+ // 3) An element with children is printed on multiple lines.
+ TiXmlNode* node;
+ if ( !firstChild )
+ {
+ fprintf( cfile, " />" );
+ }
+ else if ( firstChild == lastChild && firstChild->ToText() )
+ {
+ fprintf( cfile, ">" );
+ firstChild->Print( cfile, depth + 1 );
+ fprintf( cfile, "</%s>", value.c_str() );
+ }
+ else
+ {
+ fprintf( cfile, ">" );
+
+ for ( node = firstChild; node; node=node->NextSibling() )
+ {
+ if ( !node->ToText() )
+ {
+ fprintf( cfile, "\n" );
+ }
+ node->Print( cfile, depth+1 );
+ }
+ fprintf( cfile, "\n" );
+ for( i=0; i<depth; ++i )
+ fprintf( cfile, " " );
+ fprintf( cfile, "</%s>", value.c_str() );
+ }
+}
+
+void TiXmlElement::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ (*stream) << "<" << value;
+
+ TiXmlAttribute* attrib;
+ for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+ {
+ (*stream) << " ";
+ attrib->StreamOut( stream );
+ }
+
+ // If this node has children, give it a closing tag. Else
+ // make it an empty tag.
+ TiXmlNode* node;
+ if ( firstChild )
+ {
+ (*stream) << ">";
+
+ for ( node = firstChild; node; node=node->NextSibling() )
+ {
+ node->StreamOut( stream );
+ }
+ (*stream) << "</" << value << ">";
+ }
+ else
+ {
+ (*stream) << " />";
+ }
+}
+
+
+void TiXmlElement::CopyTo( TiXmlElement* target ) const
+{
+ // superclass:
+ TiXmlNode::CopyTo( target );
+
+ // Element class:
+ // Clone the attributes, then clone the children.
+ TiXmlAttribute* attribute = 0;
+ for( attribute = attributeSet.First();
+ attribute;
+ attribute = attribute->Next() )
+ {
+ target->SetAttribute( attribute->Name(), attribute->Value() );
+ }
+
+ TiXmlNode* node = 0;
+ for ( node = firstChild; node; node = node->NextSibling() )
+ {
+ target->LinkEndChild( node->Clone() );
+ }
+}
+
+
+TiXmlNode* TiXmlElement::Clone() const
+{
+ TiXmlElement* clone = new TiXmlElement( Value() );
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+ tabsize = 4;
+ ClearError();
+}
+
+TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+ tabsize = 4;
+ value = documentName;
+ ClearError();
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+ tabsize = 4;
+ value = documentName;
+ ClearError();
+}
+#endif
+
+
+TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+ copy.CopyTo( this );
+}
+
+
+void TiXmlDocument::operator=( const TiXmlDocument& copy )
+{
+ Clear();
+ copy.CopyTo( this );
+}
+
+
+bool TiXmlDocument::LoadFile( TiXmlEncoding encoding )
+{
+ // See STL_STRING_BUG below.
+ StringToBuffer buf( value );
+
+ if ( buf.buffer && LoadFile( buf.buffer, encoding ) )
+ return true;
+
+ return false;
+}
+
+
+bool TiXmlDocument::SaveFile() const
+{
+ // See STL_STRING_BUG below.
+ StringToBuffer buf( value );
+
+ if ( buf.buffer && SaveFile( buf.buffer ) )
+ return true;
+
+ return false;
+}
+
+bool TiXmlDocument::LoadFile( const char* filename, TiXmlEncoding encoding )
+{
+ // Delete the existing data:
+ Clear();
+ location.Clear();
+
+ // There was a really terrifying little bug here. The code:
+ // value = filename
+ // in the STL case, cause the assignment method of the std::string to
+ // be called. What is strange, is that the std::string had the same
+ // address as it's c_str() method, and so bad things happen. Looks
+ // like a bug in the Microsoft STL implementation.
+ // See STL_STRING_BUG above.
+ // Fixed with the StringToBuffer class.
+ value = filename;
+
+ FILE* file = fopen( value.c_str (), "r" );
+
+ if ( file )
+ {
+ // Get the file size, so we can pre-allocate the string. HUGE speed impact.
+ long length = 0;
+ fseek( file, 0, SEEK_END );
+ length = ftell( file );
+ fseek( file, 0, SEEK_SET );
+
+ // Strange case, but good to handle up front.
+ if ( length == 0 )
+ {
+ fclose( file );
+ return false;
+ }
+
+ // If we have a file, assume it is all one big XML file, and read it in.
+ // The document parser may decide the document ends sooner than the entire file, however.
+ TIXML_STRING data;
+ data.reserve( length );
+
+ const int BUF_SIZE = 2048;
+ char buf[BUF_SIZE];
+
+ while( fgets( buf, BUF_SIZE, file ) )
+ {
+ data += buf;
+ }
+ fclose( file );
+
+ Parse( data.c_str(), 0, encoding );
+
+ if ( Error() )
+ return false;
+ else
+ return true;
+ }
+ SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return false;
+}
+
+bool TiXmlDocument::SaveFile( const char * filename ) const
+{
+ // The old c stuff lives on...
+ FILE* fp = fopen( filename, "w" );
+ if ( fp )
+ {
+ Print( fp, 0 );
+ fclose( fp );
+ return true;
+ }
+ return false;
+}
+
+
+void TiXmlDocument::CopyTo( TiXmlDocument* target ) const
+{
+ TiXmlNode::CopyTo( target );
+
+ target->error = error;
+ target->errorDesc = errorDesc.c_str ();
+
+ TiXmlNode* node = 0;
+ for ( node = firstChild; node; node = node->NextSibling() )
+ {
+ target->LinkEndChild( node->Clone() );
+ }
+}
+
+
+TiXmlNode* TiXmlDocument::Clone() const
+{
+ TiXmlDocument* clone = new TiXmlDocument();
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+void TiXmlDocument::Print( FILE* cfile, int depth ) const
+{
+ TiXmlNode* node;
+ for ( node=FirstChild(); node; node=node->NextSibling() )
+ {
+ node->Print( cfile, depth );
+ fprintf( cfile, "\n" );
+ }
+}
+
+void TiXmlDocument::StreamOut( TIXML_OSTREAM * out ) const
+{
+ TiXmlNode* node;
+ for ( node=FirstChild(); node; node=node->NextSibling() )
+ {
+ node->StreamOut( out );
+
+ // Special rule for streams: stop after the root element.
+ // The stream in code will only read one element, so don't
+ // write more than one.
+ if ( node->ToElement() )
+ break;
+ }
+}
+
+
+TiXmlAttribute* TiXmlAttribute::Next() const
+{
+ // We are using knowledge of the sentinel. The sentinel
+ // have a value or name.
+ if ( next->value.empty() && next->name.empty() )
+ return 0;
+ return next;
+}
+
+
+TiXmlAttribute* TiXmlAttribute::Previous() const
+{
+ // We are using knowledge of the sentinel. The sentinel
+ // have a value or name.
+ if ( prev->value.empty() && prev->name.empty() )
+ return 0;
+ return prev;
+}
+
+
+void TiXmlAttribute::Print( FILE* cfile, int /*depth*/ ) const
+{
+ TIXML_STRING n, v;
+
+ PutString( name, &n );
+ PutString( value, &v );
+
+ if (value.find ('\"') == TIXML_STRING::npos)
+ fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
+ else
+ fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
+}
+
+
+void TiXmlAttribute::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ if (value.find( '\"' ) != TIXML_STRING::npos)
+ {
+ PutString( name, stream );
+ (*stream) << "=" << "'";
+ PutString( value, stream );
+ (*stream) << "'";
+ }
+ else
+ {
+ PutString( name, stream );
+ (*stream) << "=" << "\"";
+ PutString( value, stream );
+ (*stream) << "\"";
+ }
+}
+
+int TiXmlAttribute::QueryIntValue( int* ival ) const
+{
+ if ( sscanf( value.c_str(), "%d", ival ) == 1 )
+ return TIXML_SUCCESS;
+ return TIXML_WRONG_TYPE;
+}
+
+int TiXmlAttribute::QueryDoubleValue( double* dval ) const
+{
+ if ( sscanf( value.c_str(), "%lf", dval ) == 1 )
+ return TIXML_SUCCESS;
+ return TIXML_WRONG_TYPE;
+}
+
+void TiXmlAttribute::SetIntValue( int _value )
+{
+ char buf [64];
+ sprintf (buf, "%d", _value);
+ SetValue (buf);
+}
+
+void TiXmlAttribute::SetDoubleValue( double _value )
+{
+ char buf [64];
+ sprintf (buf, "%lf", _value);
+ SetValue (buf);
+}
+
+const int TiXmlAttribute::IntValue() const
+{
+ return atoi (value.c_str ());
+}
+
+const double TiXmlAttribute::DoubleValue() const
+{
+ return atof (value.c_str ());
+}
+
+
+TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::COMMENT )
+{
+ copy.CopyTo( this );
+}
+
+
+void TiXmlComment::operator=( const TiXmlComment& base )
+{
+ Clear();
+ base.CopyTo( this );
+}
+
+
+void TiXmlComment::Print( FILE* cfile, int depth ) const
+{
+ for ( int i=0; i<depth; i++ )
+ {
+ fputs( " ", cfile );
+ }
+ fprintf( cfile, "<!--%s-->", value.c_str() );
+}
+
+void TiXmlComment::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ (*stream) << "<!--";
+ //PutString( value, stream );
+ (*stream) << value;
+ (*stream) << "-->";
+}
+
+
+void TiXmlComment::CopyTo( TiXmlComment* target ) const
+{
+ TiXmlNode::CopyTo( target );
+}
+
+
+TiXmlNode* TiXmlComment::Clone() const
+{
+ TiXmlComment* clone = new TiXmlComment();
+
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+void TiXmlText::Print( FILE* cfile, int /*depth*/ ) const
+{
+ TIXML_STRING buffer;
+ PutString( value, &buffer );
+ fprintf( cfile, "%s", buffer.c_str() );
+}
+
+
+void TiXmlText::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ PutString( value, stream );
+}
+
+
+void TiXmlText::CopyTo( TiXmlText* target ) const
+{
+ TiXmlNode::CopyTo( target );
+}
+
+
+TiXmlNode* TiXmlText::Clone() const
+{
+ TiXmlText* clone = 0;
+ clone = new TiXmlText( "" );
+
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+TiXmlDeclaration::TiXmlDeclaration( const char * _version,
+ const char * _encoding,
+ const char * _standalone )
+ : TiXmlNode( TiXmlNode::DECLARATION )
+{
+ version = _version;
+ encoding = _encoding;
+ standalone = _standalone;
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlDeclaration::TiXmlDeclaration( const std::string& _version,
+ const std::string& _encoding,
+ const std::string& _standalone )
+ : TiXmlNode( TiXmlNode::DECLARATION )
+{
+ version = _version;
+ encoding = _encoding;
+ standalone = _standalone;
+}
+#endif
+
+
+TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
+ : TiXmlNode( TiXmlNode::DECLARATION )
+{
+ copy.CopyTo( this );
+}
+
+
+void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
+{
+ Clear();
+ copy.CopyTo( this );
+}
+
+
+void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/ ) const
+{
+ fprintf (cfile, "<?xml ");
+
+ if ( !version.empty() )
+ fprintf (cfile, "version=\"%s\" ", version.c_str ());
+ if ( !encoding.empty() )
+ fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ());
+ if ( !standalone.empty() )
+ fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ());
+ fprintf (cfile, "?>");
+}
+
+void TiXmlDeclaration::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ (*stream) << "<?xml ";
+
+ if ( !version.empty() )
+ {
+ (*stream) << "version=\"";
+ PutString( version, stream );
+ (*stream) << "\" ";
+ }
+ if ( !encoding.empty() )
+ {
+ (*stream) << "encoding=\"";
+ PutString( encoding, stream );
+ (*stream ) << "\" ";
+ }
+ if ( !standalone.empty() )
+ {
+ (*stream) << "standalone=\"";
+ PutString( standalone, stream );
+ (*stream) << "\" ";
+ }
+ (*stream) << "?>";
+}
+
+
+void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const
+{
+ TiXmlNode::CopyTo( target );
+
+ target->version = version;
+ target->encoding = encoding;
+ target->standalone = standalone;
+}
+
+
+TiXmlNode* TiXmlDeclaration::Clone() const
+{
+ TiXmlDeclaration* clone = new TiXmlDeclaration();
+
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+void TiXmlUnknown::Print( FILE* cfile, int depth ) const
+{
+ for ( int i=0; i<depth; i++ )
+ fprintf( cfile, " " );
+ fprintf( cfile, "<%s>", value.c_str() );
+}
+
+
+void TiXmlUnknown::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ (*stream) << "<" << value << ">"; // Don't use entities here! It is unknown.
+}
+
+
+void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const
+{
+ TiXmlNode::CopyTo( target );
+}
+
+
+TiXmlNode* TiXmlUnknown::Clone() const
+{
+ TiXmlUnknown* clone = new TiXmlUnknown();
+
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+TiXmlAttributeSet::TiXmlAttributeSet()
+{
+ sentinel.next = &sentinel;
+ sentinel.prev = &sentinel;
+}
+
+
+TiXmlAttributeSet::~TiXmlAttributeSet()
+{
+ assert( sentinel.next == &sentinel );
+ assert( sentinel.prev == &sentinel );
+}
+
+
+void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
+{
+ assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set.
+
+ addMe->next = &sentinel;
+ addMe->prev = sentinel.prev;
+
+ sentinel.prev->next = addMe;
+ sentinel.prev = addMe;
+}
+
+void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
+{
+ TiXmlAttribute* node;
+
+ for( node = sentinel.next; node != &sentinel; node = node->next )
+ {
+ if ( node == removeMe )
+ {
+ node->prev->next = node->next;
+ node->next->prev = node->prev;
+ node->next = 0;
+ node->prev = 0;
+ return;
+ }
+ }
+ assert( 0 ); // we tried to remove a non-linked attribute.
+}
+
+TiXmlAttribute* TiXmlAttributeSet::Find( const char * name ) const
+{
+ TiXmlAttribute* node;
+
+ for( node = sentinel.next; node != &sentinel; node = node->next )
+ {
+ if ( node->name == name )
+ return node;
+ }
+ return 0;
+}
+
+
+#ifdef TIXML_USE_STL
+TIXML_ISTREAM & operator >> (TIXML_ISTREAM & in, TiXmlNode & base)
+{
+ TIXML_STRING tag;
+ tag.reserve( 8 * 1000 );
+ base.StreamIn( &in, &tag );
+
+ base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING );
+ return in;
+}
+#endif
+
+
+TIXML_OSTREAM & operator<< (TIXML_OSTREAM & out, const TiXmlNode & base)
+{
+ base.StreamOut (& out);
+ return out;
+}
+
+
+#ifdef TIXML_USE_STL
+std::string & operator<< (std::string& out, const TiXmlNode& base )
+{
+ std::ostringstream os_stream( std::ostringstream::out );
+ base.StreamOut( &os_stream );
+
+ out.append( os_stream.str() );
+ return out;
+}
+#endif
+
+
+TiXmlHandle TiXmlHandle::FirstChild() const
+{
+ if ( node )
+ {
+ TiXmlNode* child = node->FirstChild();
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const
+{
+ if ( node )
+ {
+ TiXmlNode* child = node->FirstChild( value );
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::FirstChildElement() const
+{
+ if ( node )
+ {
+ TiXmlElement* child = node->FirstChildElement();
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const
+{
+ if ( node )
+ {
+ TiXmlElement* child = node->FirstChildElement( value );
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::Child( int count ) const
+{
+ if ( node )
+ {
+ int i;
+ TiXmlNode* child = node->FirstChild();
+ for ( i=0;
+ child && i<count;
+ child = child->NextSibling(), ++i )
+ {
+ // nothing
+ }
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const
+{
+ if ( node )
+ {
+ int i;
+ TiXmlNode* child = node->FirstChild( value );
+ for ( i=0;
+ child && i<count;
+ child = child->NextSibling( value ), ++i )
+ {
+ // nothing
+ }
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::ChildElement( int count ) const
+{
+ if ( node )
+ {
+ int i;
+ TiXmlElement* child = node->FirstChildElement();
+ for ( i=0;
+ child && i<count;
+ child = child->NextSiblingElement(), ++i )
+ {
+ // nothing
+ }
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const
+{
+ if ( node )
+ {
+ int i;
+ TiXmlElement* child = node->FirstChildElement( value );
+ for ( i=0;
+ child && i<count;
+ child = child->NextSiblingElement( value ), ++i )
+ {
+ // nothing
+ }
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+#endif /* SETUP */
diff -ruN vdr-1.7.12/tinyxml.h vdr-1.7.12.ExtP_NG/tinyxml.h
--- vdr-1.7.12/tinyxml.h 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/tinyxml.h 2010-02-03 22:16:55.862072589 +0100
@@ -0,0 +1,1372 @@
+#ifdef USE_SETUP
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+
+#ifndef TINYXML_INCLUDED
+#define TINYXML_INCLUDED
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4530 )
+#pragma warning( disable : 4786 )
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+// Help out windows:
+#if defined( _DEBUG ) && !defined( DEBUG )
+#define DEBUG
+#endif
+
+#if defined( DEBUG ) && defined( _MSC_VER )
+#include <windows.h>
+#define TIXML_LOG OutputDebugString
+#else
+#define TIXML_LOG printf
+#endif
+
+#ifdef TIXML_USE_STL
+ #include <string>
+ #include <iostream>
+ #define TIXML_STRING std::string
+ #define TIXML_ISTREAM std::istream
+ #define TIXML_OSTREAM std::ostream
+#else
+ #include "tinystr.h"
+ #define TIXML_STRING TiXmlString
+ #define TIXML_OSTREAM TiXmlOutStream
+#endif
+
+class TiXmlDocument;
+class TiXmlElement;
+class TiXmlComment;
+class TiXmlUnknown;
+class TiXmlAttribute;
+class TiXmlText;
+class TiXmlDeclaration;
+class TiXmlParsingData;
+
+const int TIXML_MAJOR_VERSION = 2;
+const int TIXML_MINOR_VERSION = 3;
+const int TIXML_PATCH_VERSION = 2;
+
+/* Internal structure for tracking location of items
+ in the XML file.
+*/
+struct TiXmlCursor
+{
+ TiXmlCursor() { Clear(); }
+ void Clear() { row = col = -1; }
+
+ int row; // 0 based.
+ int col; // 0 based.
+};
+
+
+// Only used by Attribute::Query functions
+enum
+{
+ TIXML_SUCCESS,
+ TIXML_NO_ATTRIBUTE,
+ TIXML_WRONG_TYPE
+};
+
+
+// Used by the parsing routines.
+enum TiXmlEncoding
+{
+ TIXML_ENCODING_UNKNOWN,
+ TIXML_ENCODING_UTF8,
+ TIXML_ENCODING_LEGACY
+};
+
+const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
+
+/** TiXmlBase is a base class for every class in TinyXml.
+ It does little except to establish that TinyXml classes
+ can be printed and provide some utility functions.
+
+ In XML, the document and elements can contain
+ other elements and other types of nodes.
+
+ @verbatim
+ A Document can contain: Element (container or leaf)
+ Comment (leaf)
+ Unknown (leaf)
+ Declaration( leaf )
+
+ An Element can contain: Element (container or leaf)
+ Text (leaf)
+ Attributes (not on tree)
+ Comment (leaf)
+ Unknown (leaf)
+
+ A Decleration contains: Attributes (not on tree)
+ @endverbatim
+*/
+class TiXmlBase
+{
+ friend class TiXmlNode;
+ friend class TiXmlElement;
+ friend class TiXmlDocument;
+
+public:
+ TiXmlBase() : userData(0) {}
+ virtual ~TiXmlBase() {}
+
+ /** All TinyXml classes can print themselves to a filestream.
+ This is a formatted print, and will insert tabs and newlines.
+
+ (For an unformatted stream, use the << operator.)
+ */
+ virtual void Print( FILE* cfile, int depth ) const = 0;
+
+ /** The world does not agree on whether white space should be kept or
+ not. In order to make everyone happy, these global, static functions
+ are provided to set whether or not TinyXml will condense all white space
+ into a single space or not. The default is to condense. Note changing this
+ values is not thread safe.
+ */
+ static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; }
+
+ /// Return the current white space setting.
+ static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
+
+ /** Return the position, in the original source file, of this node or attribute.
+ The row and column are 1-based. (That is the first row and first column is
+ 1,1). If the returns values are 0 or less, then the parser does not have
+ a row and column value.
+
+ Generally, the row and column value will be set when the TiXmlDocument::Load(),
+ TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set
+ when the DOM was created from operator>>.
+
+ The values reflect the initial load. Once the DOM is modified programmatically
+ (by adding or changing nodes and attributes) the new values will NOT update to
+ reflect changes in the document.
+
+ There is a minor performance cost to computing the row and column. Computation
+ can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value.
+
+ @sa TiXmlDocument::SetTabSize()
+ */
+ int Row() const { return location.row + 1; }
+ int Column() const { return location.col + 1; } ///< See Row()
+
+ void SetUserData( void* user ) { userData = user; }
+ void* GetUserData() { return userData; }
+
+ // Table that returs, for a given lead byte, the total number of bytes
+ // in the UTF-8 sequence.
+ static const int utf8ByteTable[256];
+
+ virtual const char* Parse( const char* p,
+ TiXmlParsingData* data,
+ TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
+
+protected:
+
+ // See STL_STRING_BUG
+ // Utility class to overcome a bug.
+ class StringToBuffer
+ {
+ public:
+ StringToBuffer( const TIXML_STRING& str );
+ ~StringToBuffer();
+ char* buffer;
+ };
+
+ static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
+ inline static bool IsWhiteSpace( char c )
+ {
+ return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
+ }
+
+ virtual void StreamOut (TIXML_OSTREAM *) const = 0;
+
+ #ifdef TIXML_USE_STL
+ static bool StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
+ #endif
+
+ /* Reads an XML name into the string provided. Returns
+ a pointer just past the last character of the name,
+ or 0 if the function has an error.
+ */
+ static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
+
+ /* Reads text. Returns a pointer past the given end tag.
+ Wickedly complex options, but it keeps the (sensitive) code in one place.
+ */
+ static const char* ReadText( const char* in, // where to start
+ TIXML_STRING* text, // the string read
+ bool ignoreWhiteSpace, // whether to keep the white space
+ const char* endTag, // what ends this text
+ bool ignoreCase, // whether to ignore case in the end tag
+ TiXmlEncoding encoding ); // the current encoding
+
+ // If an entity has been found, transform it into a character.
+ static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
+
+ // Get a character, while interpreting entities.
+ // The length can be from 0 to 4 bytes.
+ inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
+ {
+ assert( p );
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ *length = utf8ByteTable[ *((unsigned char*)p) ];
+ assert( *length >= 0 && *length < 5 );
+ }
+ else
+ {
+ *length = 1;
+ }
+
+ if ( *length == 1 )
+ {
+ if ( *p == '&' )
+ return GetEntity( p, _value, length, encoding );
+ *_value = *p;
+ return p+1;
+ }
+ else if ( *length )
+ {
+ strncpy( _value, p, *length );
+ return p + (*length);
+ }
+ else
+ {
+ // Not valid text.
+ return 0;
+ }
+ }
+
+ // Puts a string to a stream, expanding entities as it goes.
+ // Note this should not contian the '<', '>', etc, or they will be transformed into entities!
+ static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
+
+ static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
+
+ // Return true if the next characters in the stream are any of the endTag sequences.
+ // Ignore case only works for english, and should only be relied on when comparing
+ // to Engilish words: StringEqual( p, "version", true ) is fine.
+ static bool StringEqual( const char* p,
+ const char* endTag,
+ bool ignoreCase,
+ TiXmlEncoding encoding );
+
+
+ enum
+ {
+ TIXML_NO_ERROR = 0,
+ TIXML_ERROR,
+ TIXML_ERROR_OPENING_FILE,
+ TIXML_ERROR_OUT_OF_MEMORY,
+ TIXML_ERROR_PARSING_ELEMENT,
+ TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
+ TIXML_ERROR_READING_ELEMENT_VALUE,
+ TIXML_ERROR_READING_ATTRIBUTES,
+ TIXML_ERROR_PARSING_EMPTY,
+ TIXML_ERROR_READING_END_TAG,
+ TIXML_ERROR_PARSING_UNKNOWN,
+ TIXML_ERROR_PARSING_COMMENT,
+ TIXML_ERROR_PARSING_DECLARATION,
+ TIXML_ERROR_DOCUMENT_EMPTY,
+ TIXML_ERROR_EMBEDDED_NULL,
+
+ TIXML_ERROR_STRING_COUNT
+ };
+ static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
+
+ TiXmlCursor location;
+
+ /// Field containing a generic user pointer
+ void* userData;
+
+ // None of these methods are reliable for any language except English.
+ // Good for approximation, not great for accuracy.
+ static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
+ static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
+ inline static int ToLower( int v, TiXmlEncoding encoding )
+ {
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ if ( v < 128 ) return tolower( v );
+ return v;
+ }
+ else
+ {
+ return tolower( v );
+ }
+ }
+ static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
+
+private:
+ TiXmlBase( const TiXmlBase& ); // not implemented.
+ void operator=( const TiXmlBase& base ); // not allowed.
+
+ struct Entity
+ {
+ const char* str;
+ unsigned int strLength;
+ char chr;
+ };
+ enum
+ {
+ NUM_ENTITY = 5,
+ MAX_ENTITY_LENGTH = 6
+
+ };
+ static Entity entity[ NUM_ENTITY ];
+ static bool condenseWhiteSpace;
+};
+
+
+/** The parent class for everything in the Document Object Model.
+ (Except for attributes).
+ Nodes have siblings, a parent, and children. A node can be
+ in a document, or stand on its own. The type of a TiXmlNode
+ can be queried, and it can be cast to its more defined type.
+*/
+class TiXmlNode : public TiXmlBase
+{
+ friend class TiXmlDocument;
+ friend class TiXmlElement;
+
+public:
+ #ifdef TIXML_USE_STL
+
+ /** An input stream operator, for every class. Tolerant of newlines and
+ formatting, but doesn't expect them.
+ */
+ friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
+
+ /** An output stream operator, for every class. Note that this outputs
+ without any newlines or formatting, as opposed to Print(), which
+ includes tabs and new lines.
+
+ The operator<< and operator>> are not completely symmetric. Writing
+ a node to a stream is very well defined. You'll get a nice stream
+ of output, without any extra whitespace or newlines.
+
+ But reading is not as well defined. (As it always is.) If you create
+ a TiXmlElement (for example) and read that from an input stream,
+ the text needs to define an element or junk will result. This is
+ true of all input streams, but it's worth keeping in mind.
+
+ A TiXmlDocument will read nodes until it reads a root element, and
+ all the children of that root element.
+ */
+ friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
+
+ /// Appends the XML node or attribute to a std::string.
+ friend std::string& operator<< (std::string& out, const TiXmlNode& base );
+
+ #else
+ // Used internally, not part of the public API.
+ friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base);
+ #endif
+
+ /** The types of XML nodes supported by TinyXml. (All the
+ unsupported types are picked up by UNKNOWN.)
+ */
+ enum NodeType
+ {
+ DOCUMENT,
+ ELEMENT,
+ COMMENT,
+ UNKNOWN,
+ TEXT,
+ DECLARATION,
+ TYPECOUNT
+ };
+
+ virtual ~TiXmlNode();
+
+ /** The meaning of 'value' changes for the specific type of
+ TiXmlNode.
+ @verbatim
+ Document: filename of the xml file
+ Element: name of the element
+ Comment: the comment text
+ Unknown: the tag contents
+ Text: the text string
+ @endverbatim
+
+ The subclasses will wrap this function.
+ */
+ const char * Value() const { return value.c_str (); }
+
+ /** Changes the value of the node. Defined as:
+ @verbatim
+ Document: filename of the xml file
+ Element: name of the element
+ Comment: the comment text
+ Unknown: the tag contents
+ Text: the text string
+ @endverbatim
+ */
+ void SetValue(const char * _value) { value = _value;}
+
+ #ifdef TIXML_USE_STL
+ /// STL std::string form.
+ void SetValue( const std::string& _value )
+ {
+ StringToBuffer buf( _value );
+ SetValue( buf.buffer ? buf.buffer : "" );
+ }
+ #endif
+
+ /// Delete all the children of this node. Does not affect 'this'.
+ void Clear();
+
+ /// One step up the DOM.
+ TiXmlNode* Parent() const { return parent; }
+
+ TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children.
+ TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found.
+
+ TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children.
+ TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
+
+ #ifdef TIXML_USE_STL
+ TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form.
+ TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form.
+ #endif
+
+ /** An alternate way to walk the children of a node.
+ One way to iterate over nodes is:
+ @verbatim
+ for( child = parent->FirstChild(); child; child = child->NextSibling() )
+ @endverbatim
+
+ IterateChildren does the same thing with the syntax:
+ @verbatim
+ child = 0;
+ while( child = parent->IterateChildren( child ) )
+ @endverbatim
+
+ IterateChildren takes the previous child as input and finds
+ the next one. If the previous child is null, it returns the
+ first. IterateChildren will return null when done.
+ */
+ TiXmlNode* IterateChildren( TiXmlNode* previous ) const;
+
+ /// This flavor of IterateChildren searches for children with a particular 'value'
+ TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous ) const;
+
+ #ifdef TIXML_USE_STL
+ TiXmlNode* IterateChildren( const std::string& _value, TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form.
+ #endif
+
+ /** Add a new node related to this. Adds a child past the LastChild.
+ Returns a pointer to the new object or NULL if an error occured.
+ */
+ TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
+
+
+ /** Add a new node related to this. Adds a child past the LastChild.
+
+ NOTE: the node to be added is passed by pointer, and will be
+ henceforth owned (and deleted) by tinyXml. This method is efficient
+ and avoids an extra copy, but should be used with care as it
+ uses a different memory model than the other insert functions.
+
+ @sa InsertEndChild
+ */
+ TiXmlNode* LinkEndChild( TiXmlNode* addThis );
+
+ /** Add a new node related to this. Adds a child before the specified child.
+ Returns a pointer to the new object or NULL if an error occured.
+ */
+ TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
+
+ /** Add a new node related to this. Adds a child after the specified child.
+ Returns a pointer to the new object or NULL if an error occured.
+ */
+ TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis );
+
+ /** Replace a child of this node.
+ Returns a pointer to the new object or NULL if an error occured.
+ */
+ TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
+
+ /// Delete a child of this node.
+ bool RemoveChild( TiXmlNode* removeThis );
+
+ /// Navigate to a sibling node.
+ TiXmlNode* PreviousSibling() const { return prev; }
+
+ /// Navigate to a sibling node.
+ TiXmlNode* PreviousSibling( const char * ) const;
+
+ #ifdef TIXML_USE_STL
+ TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form.
+ TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form.
+ #endif
+
+ /// Navigate to a sibling node.
+ TiXmlNode* NextSibling() const { return next; }
+
+ /// Navigate to a sibling node with the given 'value'.
+ TiXmlNode* NextSibling( const char * ) const;
+
+ /** Convenience function to get through elements.
+ Calls NextSibling and ToElement. Will skip all non-Element
+ nodes. Returns 0 if there is not another element.
+ */
+ TiXmlElement* NextSiblingElement() const;
+
+ /** Convenience function to get through elements.
+ Calls NextSibling and ToElement. Will skip all non-Element
+ nodes. Returns 0 if there is not another element.
+ */
+ TiXmlElement* NextSiblingElement( const char * ) const;
+
+ #ifdef TIXML_USE_STL
+ TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form.
+ #endif
+
+ /// Convenience function to get through elements.
+ TiXmlElement* FirstChildElement() const;
+
+ /// Convenience function to get through elements.
+ TiXmlElement* FirstChildElement( const char * value ) const;
+
+ #ifdef TIXML_USE_STL
+ TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form.
+ #endif
+
+ /** Query the type (as an enumerated value, above) of this node.
+ The possible types are: DOCUMENT, ELEMENT, COMMENT,
+ UNKNOWN, TEXT, and DECLARATION.
+ */
+ virtual int Type() const { return type; }
+
+ /** Return a pointer to the Document this node lives in.
+ Returns null if not in a document.
+ */
+ TiXmlDocument* GetDocument() const;
+
+ /// Returns true if this node has no children.
+ bool NoChildren() const { return !firstChild; }
+
+ TiXmlDocument* ToDocument() const { return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlElement* ToElement() const { return ( this && type == ELEMENT ) ? (TiXmlElement*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlComment* ToComment() const { return ( this && type == COMMENT ) ? (TiXmlComment*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlUnknown* ToUnknown() const { return ( this && type == UNKNOWN ) ? (TiXmlUnknown*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlText* ToText() const { return ( this && type == TEXT ) ? (TiXmlText*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlDeclaration* ToDeclaration() const { return ( this && type == DECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+
+ /** Create an exact duplicate of this node and return it. The memory must be deleted
+ by the caller.
+ */
+ virtual TiXmlNode* Clone() const = 0;
+
+protected:
+ TiXmlNode( NodeType _type );
+
+ // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
+ // and the assignment operator.
+ void CopyTo( TiXmlNode* target ) const;
+
+ #ifdef TIXML_USE_STL
+ // The real work of the input operator.
+ virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) = 0;
+ #endif
+
+ // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
+ TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
+
+ // Internal Value function returning a TIXML_STRING
+ const TIXML_STRING& SValue() const { return value ; }
+
+ TiXmlNode* parent;
+ NodeType type;
+
+ TiXmlNode* firstChild;
+ TiXmlNode* lastChild;
+
+ TIXML_STRING value;
+
+ TiXmlNode* prev;
+ TiXmlNode* next;
+
+private:
+ TiXmlNode( const TiXmlNode& ); // not implemented.
+ void operator=( const TiXmlNode& base ); // not allowed.
+};
+
+
+/** An attribute is a name-value pair. Elements have an arbitrary
+ number of attributes, each with a unique name.
+
+ @note The attributes are not TiXmlNodes, since they are not
+ part of the tinyXML document object model. There are other
+ suggested ways to look at this problem.
+*/
+class TiXmlAttribute : public TiXmlBase
+{
+ friend class TiXmlAttributeSet;
+
+public:
+ /// Construct an empty attribute.
+ TiXmlAttribute() : TiXmlBase()
+ {
+ document = 0;
+ prev = next = 0;
+ }
+
+ #ifdef TIXML_USE_STL
+ /// std::string constructor.
+ TiXmlAttribute( const std::string& _name, const std::string& _value )
+ {
+ name = _name;
+ value = _value;
+ document = 0;
+ prev = next = 0;
+ }
+ #endif
+
+ /// Construct an attribute with a name and value.
+ TiXmlAttribute( const char * _name, const char * _value )
+ {
+ name = _name;
+ value = _value;
+ document = 0;
+ prev = next = 0;
+ }
+
+ const char* Name() const { return name.c_str (); } ///< Return the name of this attribute.
+ const char* Value() const { return value.c_str (); } ///< Return the value of this attribute.
+ const int IntValue() const; ///< Return the value of this attribute, converted to an integer.
+ const double DoubleValue() const; ///< Return the value of this attribute, converted to a double.
+
+ /** QueryIntValue examines the value string. It is an alternative to the
+ IntValue() method with richer error checking.
+ If the value is an integer, it is stored in 'value' and
+ the call returns TIXML_SUCCESS. If it is not
+ an integer, it returns TIXML_WRONG_TYPE.
+
+ A specialized but useful call. Note that for success it returns 0,
+ which is the opposite of almost all other TinyXml calls.
+ */
+ int QueryIntValue( int* value ) const;
+ /// QueryDoubleValue examines the value string. See QueryIntValue().
+ int QueryDoubleValue( double* value ) const;
+
+ void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute.
+ void SetValue( const char* _value ) { value = _value; } ///< Set the value.
+
+ void SetIntValue( int value ); ///< Set the value from an integer.
+ void SetDoubleValue( double value ); ///< Set the value from a double.
+
+ #ifdef TIXML_USE_STL
+ /// STL std::string form.
+ void SetName( const std::string& _name )
+ {
+ StringToBuffer buf( _name );
+ SetName ( buf.buffer ? buf.buffer : "error" );
+ }
+ /// STL std::string form.
+ void SetValue( const std::string& _value )
+ {
+ StringToBuffer buf( _value );
+ SetValue( buf.buffer ? buf.buffer : "error" );
+ }
+ #endif
+
+ /// Get the next sibling attribute in the DOM. Returns null at end.
+ TiXmlAttribute* Next() const;
+ /// Get the previous sibling attribute in the DOM. Returns null at beginning.
+ TiXmlAttribute* Previous() const;
+
+ bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
+ bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
+ bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; }
+
+ /* Attribute parsing starts: first letter of the name
+ returns: the next char after the value end quote
+ */
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+ // Prints this Attribute to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ virtual void StreamOut( TIXML_OSTREAM * out ) const;
+ // [internal use]
+ // Set the document pointer so the attribute can report errors.
+ void SetDocument( TiXmlDocument* doc ) { document = doc; }
+
+private:
+ TiXmlAttribute( const TiXmlAttribute& ); // not implemented.
+ void operator=( const TiXmlAttribute& base ); // not allowed.
+
+ TiXmlDocument* document; // A pointer back to a document, for error reporting.
+ TIXML_STRING name;
+ TIXML_STRING value;
+ TiXmlAttribute* prev;
+ TiXmlAttribute* next;
+};
+
+
+/* A class used to manage a group of attributes.
+ It is only used internally, both by the ELEMENT and the DECLARATION.
+
+ The set can be changed transparent to the Element and Declaration
+ classes that use it, but NOT transparent to the Attribute
+ which has to implement a next() and previous() method. Which makes
+ it a bit problematic and prevents the use of STL.
+
+ This version is implemented with circular lists because:
+ - I like circular lists
+ - it demonstrates some independence from the (typical) doubly linked list.
+*/
+class TiXmlAttributeSet
+{
+public:
+ TiXmlAttributeSet();
+ ~TiXmlAttributeSet();
+
+ void Add( TiXmlAttribute* attribute );
+ void Remove( TiXmlAttribute* attribute );
+
+ TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
+ TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
+ TiXmlAttribute* Find( const char * name ) const;
+
+private:
+ TiXmlAttribute sentinel;
+};
+
+
+/** The element is a container class. It has a value, the element name,
+ and can contain other elements, text, comments, and unknowns.
+ Elements also contain an arbitrary number of attributes.
+*/
+class TiXmlElement : public TiXmlNode
+{
+public:
+ /// Construct an element.
+ TiXmlElement (const char * in_value);
+
+ #ifdef TIXML_USE_STL
+ /// std::string constructor.
+ TiXmlElement( const std::string& _value );
+ #endif
+
+ TiXmlElement( const TiXmlElement& );
+
+ void operator=( const TiXmlElement& base );
+
+ virtual ~TiXmlElement();
+
+ /** Given an attribute name, Attribute() returns the value
+ for the attribute of that name, or null if none exists.
+ */
+ const char* Attribute( const char* name ) const;
+
+ /** Given an attribute name, Attribute() returns the value
+ for the attribute of that name, or null if none exists.
+ If the attribute exists and can be converted to an integer,
+ the integer value will be put in the return 'i', if 'i'
+ is non-null.
+ */
+ const char* Attribute( const char* name, int* i ) const;
+
+ /** Given an attribute name, Attribute() returns the value
+ for the attribute of that name, or null if none exists.
+ If the attribute exists and can be converted to an double,
+ the double value will be put in the return 'd', if 'd'
+ is non-null.
+ */
+ const char* Attribute( const char* name, double* d ) const;
+
+ /** QueryIntAttribute examines the attribute - it is an alternative to the
+ Attribute() method with richer error checking.
+ If the attribute is an integer, it is stored in 'value' and
+ the call returns TIXML_SUCCESS. If it is not
+ an integer, it returns TIXML_WRONG_TYPE. If the attribute
+ does not exist, then TIXML_NO_ATTRIBUTE is returned.
+ */
+ int QueryIntAttribute( const char* name, int* value ) const;
+ /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
+ int QueryDoubleAttribute( const char* name, double* value ) const;
+
+ /** Sets an attribute of name to a given value. The attribute
+ will be created if it does not exist, or changed if it does.
+ */
+ void SetAttribute( const char* name, const char * value );
+
+ #ifdef TIXML_USE_STL
+ const char* Attribute( const std::string& name ) const { return Attribute( name.c_str() ); }
+ const char* Attribute( const std::string& name, int* i ) const { return Attribute( name.c_str(), i ); }
+ const char* Attribute( const std::string& name, double* d ) const { return Attribute( name.c_str(), d ); }
+ int QueryIntAttribute( const std::string& name, int* value ) const { return QueryIntAttribute( name.c_str(), value ); }
+ int QueryDoubleAttribute( const std::string& name, double* value ) const { return QueryDoubleAttribute( name.c_str(), value ); }
+
+ /// STL std::string form.
+ void SetAttribute( const std::string& name, const std::string& _value )
+ {
+ StringToBuffer n( name );
+ StringToBuffer v( _value );
+ if ( n.buffer && v.buffer )
+ SetAttribute (n.buffer, v.buffer );
+ }
+ ///< STL std::string form.
+ void SetAttribute( const std::string& name, int _value )
+ {
+ StringToBuffer n( name );
+ if ( n.buffer )
+ SetAttribute (n.buffer, _value);
+ }
+ #endif
+
+ /** Sets an attribute of name to a given value. The attribute
+ will be created if it does not exist, or changed if it does.
+ */
+ void SetAttribute( const char * name, int value );
+
+ /** Sets an attribute of name to a given value. The attribute
+ will be created if it does not exist, or changed if it does.
+ */
+ void SetDoubleAttribute( const char * name, double value );
+
+ /** Deletes an attribute with the given name.
+ */
+ void RemoveAttribute( const char * name );
+ #ifdef TIXML_USE_STL
+ void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form.
+ #endif
+
+ TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element.
+ TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element.
+
+ /// Creates a new Element and returns it - the returned element is a copy.
+ virtual TiXmlNode* Clone() const;
+ // Print the Element to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ /* Attribtue parsing starts: next char past '<'
+ returns: next char past '>'
+ */
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected:
+
+ void CopyTo( TiXmlElement* target ) const;
+ void ClearThis(); // like clear, but initializes 'this' object as well
+
+ // Used to be public [internal use]
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+ virtual void StreamOut( TIXML_OSTREAM * out ) const;
+
+ /* [internal use]
+ Reads the "value" of the element -- another element, or text.
+ This should terminate with the current end tag.
+ */
+ const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
+
+private:
+
+ TiXmlAttributeSet attributeSet;
+};
+
+
+/** An XML comment.
+*/
+class TiXmlComment : public TiXmlNode
+{
+public:
+ /// Constructs an empty comment.
+ TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
+ TiXmlComment( const TiXmlComment& );
+ void operator=( const TiXmlComment& base );
+
+ virtual ~TiXmlComment() {}
+
+ /// Returns a copy of this Comment.
+ virtual TiXmlNode* Clone() const;
+ /// Write this Comment to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ /* Attribtue parsing starts: at the ! of the !--
+ returns: next char past '>'
+ */
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected:
+ void CopyTo( TiXmlComment* target ) const;
+
+ // used to be public
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+ virtual void StreamOut( TIXML_OSTREAM * out ) const;
+
+private:
+
+};
+
+
+/** XML text. Contained in an element.
+*/
+class TiXmlText : public TiXmlNode
+{
+ friend class TiXmlElement;
+public:
+ /// Constructor.
+ TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT)
+ {
+ SetValue( initValue );
+ }
+ virtual ~TiXmlText() {}
+
+ #ifdef TIXML_USE_STL
+ /// Constructor.
+ TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
+ {
+ SetValue( initValue );
+ }
+ #endif
+
+ TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT ) { copy.CopyTo( this ); }
+ void operator=( const TiXmlText& base ) { base.CopyTo( this ); }
+
+ /// Write this text object to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected :
+ /// [internal use] Creates a new Element and returns it.
+ virtual TiXmlNode* Clone() const;
+ void CopyTo( TiXmlText* target ) const;
+
+ virtual void StreamOut ( TIXML_OSTREAM * out ) const;
+ bool Blank() const; // returns true if all white space and new lines
+ // [internal use]
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+
+private:
+};
+
+
+/** In correct XML the declaration is the first entry in the file.
+ @verbatim
+ <?xml version="1.0" standalone="yes"?>
+ @endverbatim
+
+ TinyXml will happily read or write files without a declaration,
+ however. There are 3 possible attributes to the declaration:
+ version, encoding, and standalone.
+
+ Note: In this version of the code, the attributes are
+ handled as special cases, not generic attributes, simply
+ because there can only be at most 3 and they are always the same.
+*/
+class TiXmlDeclaration : public TiXmlNode
+{
+public:
+ /// Construct an empty declaration.
+ TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {}
+
+#ifdef TIXML_USE_STL
+ /// Constructor.
+ TiXmlDeclaration( const std::string& _version,
+ const std::string& _encoding,
+ const std::string& _standalone );
+#endif
+
+ /// Construct.
+ TiXmlDeclaration( const char* _version,
+ const char* _encoding,
+ const char* _standalone );
+
+ TiXmlDeclaration( const TiXmlDeclaration& copy );
+ void operator=( const TiXmlDeclaration& copy );
+
+ virtual ~TiXmlDeclaration() {}
+
+ /// Version. Will return an empty string if none was found.
+ const char *Version() const { return version.c_str (); }
+ /// Encoding. Will return an empty string if none was found.
+ const char *Encoding() const { return encoding.c_str (); }
+ /// Is this a standalone document?
+ const char *Standalone() const { return standalone.c_str (); }
+
+ /// Creates a copy of this Declaration and returns it.
+ virtual TiXmlNode* Clone() const;
+ /// Print this declaration to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected:
+ void CopyTo( TiXmlDeclaration* target ) const;
+ // used to be public
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+ virtual void StreamOut ( TIXML_OSTREAM * out) const;
+
+private:
+
+ TIXML_STRING version;
+ TIXML_STRING encoding;
+ TIXML_STRING standalone;
+};
+
+
+/** Any tag that tinyXml doesn't recognize is saved as an
+ unknown. It is a tag of text, but should not be modified.
+ It will be written back to the XML, unchanged, when the file
+ is saved.
+
+ DTD tags get thrown into TiXmlUnknowns.
+*/
+class TiXmlUnknown : public TiXmlNode
+{
+public:
+ TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
+ virtual ~TiXmlUnknown() {}
+
+ TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN ) { copy.CopyTo( this ); }
+ void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); }
+
+ /// Creates a copy of this Unknown and returns it.
+ virtual TiXmlNode* Clone() const;
+ /// Print this Unknown to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected:
+ void CopyTo( TiXmlUnknown* target ) const;
+
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+ virtual void StreamOut ( TIXML_OSTREAM * out ) const;
+
+private:
+
+};
+
+
+/** Always the top level node. A document binds together all the
+ XML pieces. It can be saved, loaded, and printed to the screen.
+ The 'value' of a document node is the xml file name.
+*/
+class TiXmlDocument : public TiXmlNode
+{
+public:
+ /// Create an empty document, that has no name.
+ TiXmlDocument();
+ /// Create a document with a name. The name of the document is also the filename of the xml.
+ TiXmlDocument( const char * documentName );
+
+ #ifdef TIXML_USE_STL
+ /// Constructor.
+ TiXmlDocument( const std::string& documentName );
+ #endif
+
+ TiXmlDocument( const TiXmlDocument& copy );
+ void operator=( const TiXmlDocument& copy );
+
+ virtual ~TiXmlDocument() {}
+
+ /** Load a file using the current document value.
+ Returns true if successful. Will delete any existing
+ document data before loading.
+ */
+ bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+ /// Save a file using the current document value. Returns true if successful.
+ bool SaveFile() const;
+ /// Load a file using the given filename. Returns true if successful.
+ bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+ /// Save a file using the given filename. Returns true if successful.
+ bool SaveFile( const char * filename ) const;
+
+ #ifdef TIXML_USE_STL
+ bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version.
+ {
+ StringToBuffer f( filename );
+ return ( f.buffer && LoadFile( f.buffer, encoding ));
+ }
+ bool SaveFile( const std::string& filename ) const ///< STL std::string version.
+ {
+ StringToBuffer f( filename );
+ return ( f.buffer && SaveFile( f.buffer ));
+ }
+ #endif
+
+ /** Parse the given null terminated block of xml data. Passing in an encoding to this
+ method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml
+ to use that encoding, regardless of what TinyXml might otherwise try to detect.
+ */
+ virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+
+ /** Get the root element -- the only top level element -- of the document.
+ In well formed XML, there should only be one. TinyXml is tolerant of
+ multiple elements at the document level.
+ */
+ TiXmlElement* RootElement() const { return FirstChildElement(); }
+
+ /** If an error occurs, Error will be set to true. Also,
+ - The ErrorId() will contain the integer identifier of the error (not generally useful)
+ - The ErrorDesc() method will return the name of the error. (very useful)
+ - The ErrorRow() and ErrorCol() will return the location of the error (if known)
+ */
+ bool Error() const { return error; }
+
+ /// Contains a textual (english) description of the error if one occurs.
+ const char * ErrorDesc() const { return errorDesc.c_str (); }
+
+ /** Generally, you probably want the error string ( ErrorDesc() ). But if you
+ prefer the ErrorId, this function will fetch it.
+ */
+ const int ErrorId() const { return errorId; }
+
+ /** Returns the location (if known) of the error. The first column is column 1,
+ and the first row is row 1. A value of 0 means the row and column wasn't applicable
+ (memory errors, for example, have no row/column) or the parser lost the error. (An
+ error in the error reporting, in that case.)
+
+ @sa SetTabSize, Row, Column
+ */
+ int ErrorRow() { return errorLocation.row+1; }
+ int ErrorCol() { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow()
+
+ /** By calling this method, with a tab size
+ greater than 0, the row and column of each node and attribute is stored
+ when the file is loaded. Very useful for tracking the DOM back in to
+ the source file.
+
+ The tab size is required for calculating the location of nodes. If not
+ set, the default of 4 is used. The tabsize is set per document. Setting
+ the tabsize to 0 disables row/column tracking.
+
+ Note that row and column tracking is not supported when using operator>>.
+
+ The tab size needs to be enabled before the parse or load. Correct usage:
+ @verbatim
+ TiXmlDocument doc;
+ doc.SetTabSize( 8 );
+ doc.Load( "myfile.xml" );
+ @endverbatim
+
+ @sa Row, Column
+ */
+ void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
+
+ int TabSize() const { return tabsize; }
+
+ /** If you have handled the error, it can be reset with this call. The error
+ state is automatically cleared if you Parse a new XML block.
+ */
+ void ClearError() { error = false;
+ errorId = 0;
+ errorDesc = "";
+ errorLocation.row = errorLocation.col = 0;
+ //errorLocation.last = 0;
+ }
+
+ /** Dump the document to standard out. */
+ void Print() const { Print( stdout, 0 ); }
+
+ /// Print this Document to a FILE stream.
+ virtual void Print( FILE* cfile, int depth = 0 ) const;
+ // [internal use]
+ void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
+
+protected :
+ virtual void StreamOut ( TIXML_OSTREAM * out) const;
+ // [internal use]
+ virtual TiXmlNode* Clone() const;
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+
+private:
+ void CopyTo( TiXmlDocument* target ) const;
+
+ bool error;
+ int errorId;
+ TIXML_STRING errorDesc;
+ int tabsize;
+ TiXmlCursor errorLocation;
+};
+
+
+/**
+ A TiXmlHandle is a class that wraps a node pointer with null checks; this is
+ an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml
+ DOM structure. It is a separate utility class.
+
+ Take an example:
+ @verbatim
+ <Document>
+ <Element attributeA = "valueA">
+ <Child attributeB = "value1" />
+ <Child attributeB = "value2" />
+ </Element>
+ <Document>
+ @endverbatim
+
+ Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
+ easy to write a *lot* of code that looks like:
+
+ @verbatim
+ TiXmlElement* root = document.FirstChildElement( "Document" );
+ if ( root )
+ {
+ TiXmlElement* element = root->FirstChildElement( "Element" );
+ if ( element )
+ {
+ TiXmlElement* child = element->FirstChildElement( "Child" );
+ if ( child )
+ {
+ TiXmlElement* child2 = child->NextSiblingElement( "Child" );
+ if ( child2 )
+ {
+ // Finally do something useful.
+ @endverbatim
+
+ And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity
+ of such code. A TiXmlHandle checks for null pointers so it is perfectly safe
+ and correct to use:
+
+ @verbatim
+ TiXmlHandle docHandle( &document );
+ TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).Element();
+ if ( child2 )
+ {
+ // do something useful
+ @endverbatim
+
+ Which is MUCH more concise and useful.
+
+ It is also safe to copy handles - internally they are nothing more than node pointers.
+ @verbatim
+ TiXmlHandle handleCopy = handle;
+ @endverbatim
+
+ What they should not be used for is iteration:
+
+ @verbatim
+ int i=0;
+ while ( true )
+ {
+ TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).Element();
+ if ( !child )
+ break;
+ // do something
+ ++i;
+ }
+ @endverbatim
+
+ It seems reasonable, but it is in fact two embedded while loops. The Child method is
+ a linear walk to find the element, so this code would iterate much more than it needs
+ to. Instead, prefer:
+
+ @verbatim
+ TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).Element();
+
+ for( child; child; child=child->NextSiblingElement() )
+ {
+ // do something
+ }
+ @endverbatim
+*/
+class TiXmlHandle
+{
+public:
+ /// Create a handle from any node (at any depth of the tree.) This can be a null pointer.
+ TiXmlHandle( TiXmlNode* node ) { this->node = node; }
+ /// Copy constructor
+ TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
+ TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
+
+ /// Return a handle to the first child node.
+ TiXmlHandle FirstChild() const;
+ /// Return a handle to the first child node with the given name.
+ TiXmlHandle FirstChild( const char * value ) const;
+ /// Return a handle to the first child element.
+ TiXmlHandle FirstChildElement() const;
+ /// Return a handle to the first child element with the given name.
+ TiXmlHandle FirstChildElement( const char * value ) const;
+
+ /** Return a handle to the "index" child with the given name.
+ The first child is 0, the second 1, etc.
+ */
+ TiXmlHandle Child( const char* value, int index ) const;
+ /** Return a handle to the "index" child.
+ The first child is 0, the second 1, etc.
+ */
+ TiXmlHandle Child( int index ) const;
+ /** Return a handle to the "index" child element with the given name.
+ The first child element is 0, the second 1, etc. Note that only TiXmlElements
+ are indexed: other types are not counted.
+ */
+ TiXmlHandle ChildElement( const char* value, int index ) const;
+ /** Return a handle to the "index" child element.
+ The first child element is 0, the second 1, etc. Note that only TiXmlElements
+ are indexed: other types are not counted.
+ */
+ TiXmlHandle ChildElement( int index ) const;
+
+ #ifdef TIXML_USE_STL
+ TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
+ TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
+
+ TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
+ TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
+ #endif
+
+ /// Return the handle as a TiXmlNode. This may return null.
+ TiXmlNode* Node() const { return node; }
+ /// Return the handle as a TiXmlElement. This may return null.
+ TiXmlElement* Element() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
+ /// Return the handle as a TiXmlText. This may return null.
+ TiXmlText* Text() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
+ /// Return the handle as a TiXmlUnknown. This may return null;
+ TiXmlUnknown* Unknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
+
+private:
+ TiXmlNode* node;
+};
+
+
+#endif
+#endif /* SETUP */
diff -ruN vdr-1.7.12/tinyxmlerror.c vdr-1.7.12.ExtP_NG/tinyxmlerror.c
--- vdr-1.7.12/tinyxmlerror.c 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/tinyxmlerror.c 2010-02-03 22:16:55.868069142 +0100
@@ -0,0 +1,53 @@
+#ifdef USE_SETUP
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+
+// The goal of the seperate error file is to make the first
+// step towards localization. tinyxml (currently) only supports
+// latin-1, but at least the error messages could now be translated.
+//
+// It also cleans up the code a bit.
+//
+
+const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
+{
+ "No error",
+ "Error",
+ "Failed to open file",
+ "Memory allocation failed.",
+ "Error parsing Element.",
+ "Failed to read Element name",
+ "Error reading Element value.",
+ "Error reading Attributes.",
+ "Error: empty tag.",
+ "Error reading end tag.",
+ "Error parsing Unknown.",
+ "Error parsing Comment.",
+ "Error parsing Declaration.",
+ "Error document empty.",
+ "Error null (0) or unexpected EOF found in input stream.",
+};
+#endif /* SETUP */
diff -ruN vdr-1.7.12/tinyxmlparser.c vdr-1.7.12.ExtP_NG/tinyxmlparser.c
--- vdr-1.7.12/tinyxmlparser.c 1970-01-01 01:00:00.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/tinyxmlparser.c 2010-02-03 22:16:55.889069913 +0100
@@ -0,0 +1,1494 @@
+#ifdef USE_SETUP
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+#include <ctype.h>
+
+//#define DEBUG_PARSER
+
+// Note tha "PutString" hardcodes the same list. This
+// is less flexible than it appears. Changing the entries
+// or order will break putstring.
+TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
+{
+ { "&", 5, '&' },
+ { "<", 4, '<' },
+ { ">", 4, '>' },
+ { """, 6, '\"' },
+ { "'", 6, '\'' }
+};
+
+// Bunch of unicode info at:
+// http://www.unicode.org/faq/utf_bom.html
+// Including the basic of this table, which determines the #bytes in the
+// sequence from the lead byte. 1 placed for invalid sequences --
+// although the result will be junk, pass it through as much as possible.
+// Beware of the non-characters in UTF-8:
+// ef bb bf (Microsoft "lead bytes")
+// ef bf be
+// ef bf bf
+
+
+
+const int TiXmlBase::utf8ByteTable[256] =
+{
+ // 0 1 2 3 4 5 6 7 8 9 a b c d e f
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0
+ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte
+ 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid
+};
+
+
+void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length )
+{
+ const unsigned long BYTE_MASK = 0xBF;
+ const unsigned long BYTE_MARK = 0x80;
+ const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+ if (input < 0x80)
+ *length = 1;
+ else if ( input < 0x800 )
+ *length = 2;
+ else if ( input < 0x10000 )
+ *length = 3;
+ else if ( input < 0x200000 )
+ *length = 4;
+ else
+ { *length = 0; return; } // This code won't covert this correctly anyway.
+
+ output += *length;
+
+ // Scary scary fall throughs.
+ switch (*length)
+ {
+ case 4:
+ --output;
+ *output = (char)((input | BYTE_MARK) & BYTE_MASK);
+ input >>= 6;
+ case 3:
+ --output;
+ *output = (char)((input | BYTE_MARK) & BYTE_MASK);
+ input >>= 6;
+ case 2:
+ --output;
+ *output = (char)((input | BYTE_MARK) & BYTE_MASK);
+ input >>= 6;
+ case 1:
+ --output;
+ *output = (char)(input | FIRST_BYTE_MARK[*length]);
+ }
+}
+
+
+/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding encoding )
+{
+ // This will only work for low-ascii, everything else is assumed to be a valid
+ // letter. I'm not sure this is the best approach, but it is quite tricky trying
+ // to figure out alhabetical vs. not across encoding. So take a very
+ // conservative approach.
+
+// if ( encoding == TIXML_ENCODING_UTF8 )
+// {
+ if ( anyByte < 127 )
+ return isalpha( anyByte );
+ else
+ return 1; // What else to do? The unicode set is huge...get the english ones right.
+// }
+// else
+// {
+// return isalpha( anyByte );
+// }
+}
+
+
+/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding )
+{
+ // This will only work for low-ascii, everything else is assumed to be a valid
+ // letter. I'm not sure this is the best approach, but it is quite tricky trying
+ // to figure out alhabetical vs. not across encoding. So take a very
+ // conservative approach.
+
+// if ( encoding == TIXML_ENCODING_UTF8 )
+// {
+ if ( anyByte < 127 )
+ return isalnum( anyByte );
+ else
+ return 1; // What else to do? The unicode set is huge...get the english ones right.
+// }
+// else
+// {
+// return isalnum( anyByte );
+// }
+}
+
+
+class TiXmlParsingData
+{
+ friend class TiXmlDocument;
+ public:
+ void Stamp( const char* now, TiXmlEncoding encoding );
+
+ const TiXmlCursor& Cursor() { return cursor; }
+
+ private:
+ // Only used by the document!
+ TiXmlParsingData( const char* start, int _tabsize, int row, int col )
+ {
+ assert( start );
+ stamp = start;
+ tabsize = _tabsize;
+ cursor.row = row;
+ cursor.col = col;
+ }
+
+ TiXmlCursor cursor;
+ const char* stamp;
+ int tabsize;
+};
+
+
+void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
+{
+ assert( now );
+
+ // Do nothing if the tabsize is 0.
+ if ( tabsize < 1 )
+ {
+ return;
+ }
+
+ // Get the current row, column.
+ int row = cursor.row;
+ int col = cursor.col;
+ const char* p = stamp;
+ assert( p );
+
+ while ( p < now )
+ {
+ // Code contributed by Fletcher Dunn: (modified by lee)
+ switch (*p) {
+ case 0:
+ // We *should* never get here, but in case we do, don't
+ // advance past the terminating null character, ever
+ return;
+
+ case '\r':
+ // bump down to the next line
+ ++row;
+ col = 0;
+ // Eat the character
+ ++p;
+
+ // Check for \r\n sequence, and treat this as a single character
+ if (*p == '\n') {
+ ++p;
+ }
+ break;
+
+ case '\n':
+ // bump down to the next line
+ ++row;
+ col = 0;
+
+ // Eat the character
+ ++p;
+
+ // Check for \n\r sequence, and treat this as a single
+ // character. (Yes, this bizarre thing does occur still
+ // on some arcane platforms...)
+ if (*p == '\r') {
+ ++p;
+ }
+ break;
+
+ case '\t':
+ // Eat the character
+ ++p;
+
+ // Skip to next tab stop
+ col = (col / tabsize + 1) * tabsize;
+ break;
+
+ case (char)(0xef):
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ if ( *(p+1) && *(p+2) )
+ {
+ // In these cases, don't advance the column. These are
+ // 0-width spaces.
+ if ( *(p+1)==(char)(0xbb) && *(p+2)==(char)(0xbf) )
+ p += 3;
+ else if ( *(p+1)==(char)(0xbf) && *(p+2)==(char)(0xbe) )
+ p += 3;
+ else if ( *(p+1)==(char)(0xbf) && *(p+2)==(char)(0xbf) )
+ p += 3;
+ else
+ { p +=3; ++col; } // A normal character.
+ }
+ }
+ else
+ {
+ ++p;
+ ++col;
+ }
+ break;
+
+ default:
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ // Eat the 1 to 4 byte utf8 character.
+ int step = TiXmlBase::utf8ByteTable[*((unsigned char*)p)];
+ if ( step == 0 )
+ step = 1; // Error case from bad encoding, but handle gracefully.
+ p += step;
+
+ // Just advance one column, of course.
+ ++col;
+ }
+ else
+ {
+ ++p;
+ ++col;
+ }
+ break;
+ }
+ }
+ cursor.row = row;
+ cursor.col = col;
+ assert( cursor.row >= -1 );
+ assert( cursor.col >= -1 );
+ stamp = p;
+ assert( stamp );
+}
+
+
+const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
+{
+ if ( !p || !*p )
+ {
+ return 0;
+ }
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ while ( *p )
+ {
+ // Skip the stupid Microsoft UTF-8 Byte order marks
+ if ( *(p+0)==(char) 0xef
+ && *(p+1)==(char) 0xbb
+ && *(p+2)==(char) 0xbf )
+ {
+ p += 3;
+ continue;
+ }
+ else if(*(p+0)==(char) 0xef
+ && *(p+1)==(char) 0xbf
+ && *(p+2)==(char) 0xbe )
+ {
+ p += 3;
+ continue;
+ }
+ else if(*(p+0)==(char) 0xef
+ && *(p+1)==(char) 0xbf
+ && *(p+2)==(char) 0xbf )
+ {
+ p += 3;
+ continue;
+ }
+
+ if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space.
+ ++p;
+ else
+ break;
+ }
+ }
+ else
+ {
+ while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
+ ++p;
+ }
+
+ return p;
+}
+
+#ifdef TIXML_USE_STL
+/*static*/ bool TiXmlBase::StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ for( ;; )
+ {
+ if ( !in->good() ) return false;
+
+ int c = in->peek();
+ // At this scope, we can't get to a document. So fail silently.
+ if ( !IsWhiteSpace( c ) || c <= 0 )
+ return true;
+
+ *tag += (char) in->get();
+ }
+}
+
+/*static*/ bool TiXmlBase::StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag )
+{
+ //assert( character > 0 && character < 128 ); // else it won't work in utf-8
+ while ( in->good() )
+ {
+ int c = in->peek();
+ if ( c == character )
+ return true;
+ if ( c <= 0 ) // Silent failure: can't get document at this scope
+ return false;
+
+ in->get();
+ *tag += (char) c;
+ }
+ return false;
+}
+#endif
+
+const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding )
+{
+ *name = "";
+ assert( p );
+
+ // Names start with letters or underscores.
+ // Of course, in unicode, tinyxml has no idea what a letter *is*. The
+ // algorithm is generous.
+ //
+ // After that, they can be letters, underscores, numbers,
+ // hyphens, or colons. (Colons are valid ony for namespaces,
+ // but tinyxml can't tell namespaces from names.)
+ if ( p && *p
+ && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
+ {
+ while( p && *p
+ && ( IsAlphaNum( (unsigned char ) *p, encoding )
+ || *p == '_'
+ || *p == '-'
+ || *p == '.'
+ || *p == ':' ) )
+ {
+ (*name) += *p;
+ ++p;
+ }
+ return p;
+ }
+ return 0;
+}
+
+const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding )
+{
+ // Presume an entity, and pull it out.
+ TIXML_STRING ent;
+ int i;
+ *length = 0;
+
+ if ( *(p+1) && *(p+1) == '#' && *(p+2) )
+ {
+ unsigned long ucs = 0;
+ unsigned delta = 0;
+ unsigned mult = 1;
+
+ if ( *(p+2) == 'x' )
+ {
+ // Hexadecimal.
+ if ( !*(p+3) ) return 0;
+
+ const char* q = p+3;
+ q = strchr( q, ';' );
+
+ if ( !q || !*q ) return 0;
+
+ delta = q-p;
+ --q;
+
+ while ( *q != 'x' )
+ {
+ if ( *q >= '0' && *q <= '9' )
+ ucs += mult * (*q - '0');
+ else if ( *q >= 'a' && *q <= 'f' )
+ ucs += mult * (*q - 'a' + 10);
+ else if ( *q >= 'A' && *q <= 'F' )
+ ucs += mult * (*q - 'A' + 10 );
+ else
+ return 0;
+ mult *= 16;
+ --q;
+ }
+ }
+ else
+ {
+ // Decimal.
+ if ( !*(p+2) ) return 0;
+
+ const char* q = p+2;
+ q = strchr( q, ';' );
+
+ if ( !q || !*q ) return 0;
+
+ delta = q-p;
+ --q;
+
+ while ( *q != '#' )
+ {
+ if ( *q >= '0' && *q <= '9' )
+ ucs += mult * (*q - '0');
+ else
+ return 0;
+ mult *= 10;
+ --q;
+ }
+ }
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ // convert the UCS to UTF-8
+ ConvertUTF32ToUTF8( ucs, value, length );
+ }
+ else
+ {
+ *value = (char)ucs;
+ *length = 1;
+ }
+ return p + delta + 1;
+ }
+
+ // Now try to match it.
+ for( i=0; i<NUM_ENTITY; ++i )
+ {
+ if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
+ {
+ assert( strlen( entity[i].str ) == entity[i].strLength );
+ *value = entity[i].chr;
+ *length = 1;
+ return ( p + entity[i].strLength );
+ }
+ }
+
+ // So it wasn't an entity, its unrecognized, or something like that.
+ *value = *p; // Don't put back the last one, since we return it!
+ return p+1;
+}
+
+
+bool TiXmlBase::StringEqual( const char* p,
+ const char* tag,
+ bool ignoreCase,
+ TiXmlEncoding encoding )
+{
+ assert( p );
+ assert( tag );
+ if ( !p || !*p )
+ {
+ assert( 0 );
+ return false;
+ }
+
+ const char* q = p;
+
+ if ( ignoreCase )
+ {
+ while ( *q && *tag && ToLower( *q, encoding ) == ToLower( *tag, encoding ) )
+ {
+ ++q;
+ ++tag;
+ }
+
+ if ( *tag == 0 )
+ return true;
+ }
+ else
+ {
+ while ( *q && *tag && *q == *tag )
+ {
+ ++q;
+ ++tag;
+ }
+
+ if ( *tag == 0 ) // Have we found the end of the tag, and everything equal?
+ return true;
+ }
+ return false;
+}
+
+const char* TiXmlBase::ReadText( const char* p,
+ TIXML_STRING * text,
+ bool trimWhiteSpace,
+ const char* endTag,
+ bool caseInsensitive,
+ TiXmlEncoding encoding )
+{
+ *text = "";
+ if ( !trimWhiteSpace // certain tags always keep whitespace
+ || !condenseWhiteSpace ) // if true, whitespace is always kept
+ {
+ // Keep all the white space.
+ while ( p && *p
+ && !StringEqual( p, endTag, caseInsensitive, encoding )
+ )
+ {
+ int len;
+ char cArr[4] = { 0, 0, 0, 0 };
+ p = GetChar( p, cArr, &len, encoding );
+ text->append( cArr, len );
+ }
+ }
+ else
+ {
+ bool whitespace = false;
+
+ // Remove leading white space:
+ p = SkipWhiteSpace( p, encoding );
+ while ( p && *p
+ && !StringEqual( p, endTag, caseInsensitive, encoding ) )
+ {
+ if ( *p == '\r' || *p == '\n' )
+ {
+ whitespace = true;
+ ++p;
+ }
+ else if ( IsWhiteSpace( *p ) )
+ {
+ whitespace = true;
+ ++p;
+ }
+ else
+ {
+ // If we've found whitespace, add it before the
+ // new character. Any whitespace just becomes a space.
+ if ( whitespace )
+ {
+ (*text) += ' ';
+ whitespace = false;
+ }
+ int len;
+ char cArr[4] = { 0, 0, 0, 0 };
+ p = GetChar( p, cArr, &len, encoding );
+ if ( len == 1 )
+ (*text) += cArr[0]; // more efficient
+ else
+ text->append( cArr, len );
+ }
+ }
+ }
+ return p + strlen( endTag );
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ // The basic issue with a document is that we don't know what we're
+ // streaming. Read something presumed to be a tag (and hope), then
+ // identify it, and call the appropriate stream method on the tag.
+ //
+ // This "pre-streaming" will never read the closing ">" so the
+ // sub-tag can orient itself.
+
+ if ( !StreamTo( in, '<', tag ) )
+ {
+ SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+
+ while ( in->good() )
+ {
+ int tagIndex = (int) tag->length();
+ while ( in->good() && in->peek() != '>' )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ break;
+ }
+ (*tag) += (char) c;
+ }
+
+ if ( in->good() )
+ {
+ // We now have something we presume to be a node of
+ // some sort. Identify it, and call the node to
+ // continue streaming.
+ TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING );
+
+ if ( node )
+ {
+ node->StreamIn( in, tag );
+ bool isElement = node->ToElement() != 0;
+ delete node;
+ node = 0;
+
+ // If this is the root element, we're done. Parsing will be
+ // done by the >> operator.
+ if ( isElement )
+ {
+ return;
+ }
+ }
+ else
+ {
+ SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ }
+ }
+ // We should have returned sooner.
+ SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
+}
+
+#endif
+
+const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
+{
+ ClearError();
+
+ // Parse away, at the document level. Since a document
+ // contains nothing but other tags, most of what happens
+ // here is skipping white space.
+ if ( !p || !*p )
+ {
+ SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return 0;
+ }
+
+ // Note that, for a document, this needs to come
+ // before the while space skip, so that parsing
+ // starts from the pointer we are given.
+ location.Clear();
+ if ( prevData )
+ {
+ location.row = prevData->cursor.row;
+ location.col = prevData->cursor.col;
+ }
+ else
+ {
+ location.row = 0;
+ location.col = 0;
+ }
+ TiXmlParsingData data( p, TabSize(), location.row, location.col );
+ location = data.Cursor();
+
+ if ( encoding == TIXML_ENCODING_UNKNOWN )
+ {
+ // Check for the Microsoft UTF-8 lead bytes.
+ if ( *(p+0) && *(p+0) == (char)(0xef)
+ && *(p+1) && *(p+1) == (char)(0xbb)
+ && *(p+2) && *(p+2) == (char)(0xbf) )
+ {
+ encoding = TIXML_ENCODING_UTF8;
+ }
+ }
+
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p )
+ {
+ SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return 0;
+ }
+
+ while ( p && *p )
+ {
+ TiXmlNode* node = Identify( p, encoding );
+ if ( node )
+ {
+ p = node->Parse( p, &data, encoding );
+ LinkEndChild( node );
+ }
+ else
+ {
+ break;
+ }
+
+ // Did we get encoding info?
+ if ( encoding == TIXML_ENCODING_UNKNOWN
+ && node->ToDeclaration() )
+ {
+ TiXmlDeclaration* dec = node->ToDeclaration();
+ const char* enc = dec->Encoding();
+ assert( enc );
+
+ if ( *enc == 0 )
+ encoding = TIXML_ENCODING_UTF8;
+ else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) )
+ encoding = TIXML_ENCODING_UTF8;
+ else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) )
+ encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice
+ else
+ encoding = TIXML_ENCODING_LEGACY;
+ }
+
+ p = SkipWhiteSpace( p, encoding );
+ }
+
+ // All is well.
+ return p;
+}
+
+void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ // The first error in a chain is more accurate - don't set again!
+ if ( error )
+ return;
+
+ assert( err > 0 && err < TIXML_ERROR_STRING_COUNT );
+ error = true;
+ errorId = err;
+ errorDesc = errorString[ errorId ];
+
+ errorLocation.Clear();
+ if ( pError && data )
+ {
+ //TiXmlParsingData data( pError, prevData );
+ data->Stamp( pError, encoding );
+ errorLocation = data->Cursor();
+ }
+}
+
+
+TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
+{
+ TiXmlNode* returnNode = 0;
+
+ p = SkipWhiteSpace( p, encoding );
+ if( !p || !*p || *p != '<' )
+ {
+ return 0;
+ }
+
+ TiXmlDocument* doc = GetDocument();
+ p = SkipWhiteSpace( p, encoding );
+
+ if ( !p || !*p )
+ {
+ return 0;
+ }
+
+ // What is this thing?
+ // - Elements start with a letter or underscore, but xml is reserved.
+ // - Comments: <!--
+ // - Decleration: <?xml
+ // - Everthing else is unknown to tinyxml.
+ //
+
+ const char* xmlHeader = { "<?xml" };
+ const char* commentHeader = { "<!--" };
+ const char* dtdHeader = { "<!" };
+
+ if ( StringEqual( p, xmlHeader, true, encoding ) )
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Declaration\n" );
+ #endif
+ returnNode = new TiXmlDeclaration();
+ }
+ else if ( StringEqual( p, commentHeader, false, encoding ) )
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Comment\n" );
+ #endif
+ returnNode = new TiXmlComment();
+ }
+ else if ( StringEqual( p, dtdHeader, false, encoding ) )
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Unknown(1)\n" );
+ #endif
+ returnNode = new TiXmlUnknown();
+ }
+ else if ( IsAlpha( *(p+1), encoding )
+ || *(p+1) == '_' )
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Element\n" );
+ #endif
+ returnNode = new TiXmlElement( "" );
+ }
+ else
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Unknown(2)\n" );
+ #endif
+ returnNode = new TiXmlUnknown();
+ }
+
+ if ( returnNode )
+ {
+ // Set the parent, so it can report errors
+ returnNode->parent = this;
+ }
+ else
+ {
+ if ( doc )
+ doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ }
+ return returnNode;
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
+{
+ // We're called with some amount of pre-parsing. That is, some of "this"
+ // element is in "tag". Go ahead and stream to the closing ">"
+ while( in->good() )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ (*tag) += (char) c ;
+
+ if ( c == '>' )
+ break;
+ }
+
+ if ( tag->length() < 3 ) return;
+
+ // Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
+ // If not, identify and stream.
+
+ if ( tag->at( tag->length() - 1 ) == '>'
+ && tag->at( tag->length() - 2 ) == '/' )
+ {
+ // All good!
+ return;
+ }
+ else if ( tag->at( tag->length() - 1 ) == '>' )
+ {
+ // There is more. Could be:
+ // text
+ // closing tag
+ // another node.
+ for ( ;; )
+ {
+ StreamWhiteSpace( in, tag );
+
+ // Do we have text?
+ if ( in->good() && in->peek() != '<' )
+ {
+ // Yep, text.
+ TiXmlText text( "" );
+ text.StreamIn( in, tag );
+
+ // What follows text is a closing tag or another node.
+ // Go around again and figure it out.
+ continue;
+ }
+
+ // We now have either a closing tag...or another node.
+ // We should be at a "<", regardless.
+ if ( !in->good() ) return;
+ assert( in->peek() == '<' );
+ int tagIndex = tag->length();
+
+ bool closingTag = false;
+ bool firstCharFound = false;
+
+ for( ;; )
+ {
+ if ( !in->good() )
+ return;
+
+ int c = in->peek();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+
+ if ( c == '>' )
+ break;
+
+ *tag += (char) c;
+ in->get();
+
+ if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
+ {
+ firstCharFound = true;
+ if ( c == '/' )
+ closingTag = true;
+ }
+ }
+ // If it was a closing tag, then read in the closing '>' to clean up the input stream.
+ // If it was not, the streaming will be done by the tag.
+ if ( closingTag )
+ {
+ if ( !in->good() )
+ return;
+
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ assert( c == '>' );
+ *tag += (char) c;
+
+ // We are done, once we've found our closing tag.
+ return;
+ }
+ else
+ {
+ // If not a closing tag, id it, and stream.
+ const char* tagloc = tag->c_str() + tagIndex;
+ TiXmlNode* node = Identify( tagloc, TIXML_DEFAULT_ENCODING );
+ if ( !node )
+ return;
+ node->StreamIn( in, tag );
+ delete node;
+ node = 0;
+
+ // No return: go around from the beginning: text, closing tag, or node.
+ }
+ }
+ }
+}
+#endif
+
+const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ p = SkipWhiteSpace( p, encoding );
+ TiXmlDocument* document = GetDocument();
+
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding );
+ return 0;
+ }
+
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+
+ if ( *p != '<' )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding );
+ return 0;
+ }
+
+ p = SkipWhiteSpace( p+1, encoding );
+
+ // Read the name.
+ const char* pErr = p;
+
+ p = ReadName( p, &value, encoding );
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding );
+ return 0;
+ }
+
+ TIXML_STRING endTag ("</");
+ endTag += value;
+ endTag += ">";
+
+ // Check for and read attributes. Also look for an empty
+ // tag or an end tag.
+ while ( p && *p )
+ {
+ pErr = p;
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
+ return 0;
+ }
+ if ( *p == '/' )
+ {
+ ++p;
+ // Empty tag.
+ if ( *p != '>' )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );
+ return 0;
+ }
+ return (p+1);
+ }
+ else if ( *p == '>' )
+ {
+ // Done with attributes (if there were any.)
+ // Read the value -- which can include other
+ // elements -- read the end tag, and return.
+ ++p;
+ p = ReadValue( p, data, encoding ); // Note this is an Element method, and will set the error if one happens.
+ if ( !p || !*p )
+ return 0;
+
+ // We should find the end tag now
+ if ( StringEqual( p, endTag.c_str(), false, encoding ) )
+ {
+ p += endTag.length();
+ return p;
+ }
+ else
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
+ return 0;
+ }
+ }
+ else
+ {
+ // Try to read an attribute:
+ TiXmlAttribute* attrib = new TiXmlAttribute();
+ if ( !attrib )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding );
+ return 0;
+ }
+
+ attrib->SetDocument( document );
+ const char* pErr = p;
+ p = attrib->Parse( p, data, encoding );
+
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
+ delete attrib;
+ return 0;
+ }
+
+ // Handle the strange case of double attributes:
+ TiXmlAttribute* node = attributeSet.Find( attrib->Name() );
+ if ( node )
+ {
+ node->SetValue( attrib->Value() );
+ delete attrib;
+ return 0;
+ }
+
+ attributeSet.Add( attrib );
+ }
+ }
+ return p;
+}
+
+
+const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ TiXmlDocument* document = GetDocument();
+
+ const char* pWithWhiteSpace = p;
+ // Read in text and elements in any order.
+ p = SkipWhiteSpace( p, encoding );
+ while ( p && *p )
+ {
+ if ( *p != '<' )
+ {
+ // Take what we have, make a text element.
+ TiXmlText* textNode = new TiXmlText( "" );
+
+ if ( !textNode )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding );
+ return 0;
+ }
+
+ if ( TiXmlBase::IsWhiteSpaceCondensed() )
+ {
+ p = textNode->Parse( p, data, encoding );
+ }
+ else
+ {
+ // Special case: we want to keep the white space
+ // so that leading spaces aren't removed.
+ p = textNode->Parse( pWithWhiteSpace, data, encoding );
+ }
+
+ if ( !textNode->Blank() )
+ LinkEndChild( textNode );
+ else
+ delete textNode;
+ }
+ else
+ {
+ // We hit a '<'
+ // Have we hit a new element or an end tag?
+ if ( StringEqual( p, "</", false, encoding ) )
+ {
+ return p;
+ }
+ else
+ {
+ TiXmlNode* node = Identify( p, encoding );
+ if ( node )
+ {
+ p = node->Parse( p, data, encoding );
+ LinkEndChild( node );
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+ p = SkipWhiteSpace( p, encoding );
+ }
+
+ if ( !p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding );
+ }
+ return p;
+}
+
+
+#ifdef TIXML_USE_STL
+void TiXmlUnknown::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ while ( in->good() )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ (*tag) += (char) c;
+
+ if ( c == '>' )
+ {
+ // All is well.
+ return;
+ }
+ }
+}
+#endif
+
+
+const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ TiXmlDocument* document = GetDocument();
+ p = SkipWhiteSpace( p, encoding );
+
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+ if ( !p || !*p || *p != '<' )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding );
+ return 0;
+ }
+ ++p;
+ value = "";
+
+ while ( p && *p && *p != '>' )
+ {
+ value += *p;
+ ++p;
+ }
+
+ if ( !p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
+ }
+ if ( *p == '>' )
+ return p+1;
+ return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlComment::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ while ( in->good() )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+
+ (*tag) += (char) c;
+
+ if ( c == '>'
+ && tag->at( tag->length() - 2 ) == '-'
+ && tag->at( tag->length() - 3 ) == '-' )
+ {
+ // All is well.
+ return;
+ }
+ }
+}
+#endif
+
+
+const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ TiXmlDocument* document = GetDocument();
+ value = "";
+
+ p = SkipWhiteSpace( p, encoding );
+
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+ const char* startTag = "<!--";
+ const char* endTag = "-->";
+
+ if ( !StringEqual( p, startTag, false, encoding ) )
+ {
+ document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
+ return 0;
+ }
+ p += strlen( startTag );
+ p = ReadText( p, &value, false, endTag, false, encoding );
+ return p;
+}
+
+
+const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p || !*p ) return 0;
+
+ int tabsize = 4;
+ if ( document )
+ tabsize = document->TabSize();
+
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+ // Read the name, the '=' and the value.
+ const char* pErr = p;
+ p = ReadName( p, &name, encoding );
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
+ return 0;
+ }
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p || !*p || *p != '=' )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
+ return 0;
+ }
+
+ ++p; // skip '='
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
+ return 0;
+ }
+
+ const char* end;
+
+ if ( *p == '\'' )
+ {
+ ++p;
+ end = "\'";
+ p = ReadText( p, &value, false, end, false, encoding );
+ }
+ else if ( *p == '"' )
+ {
+ ++p;
+ end = "\"";
+ p = ReadText( p, &value, false, end, false, encoding );
+ }
+ else
+ {
+ // All attribute values should be in single or double quotes.
+ // But this is such a common error that the parser will try
+ // its best, even without them.
+ value = "";
+ while ( p && *p // existence
+ && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace
+ && *p != '/' && *p != '>' ) // tag end
+ {
+ value += *p;
+ ++p;
+ }
+ }
+ return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlText::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ while ( in->good() )
+ {
+ int c = in->peek();
+ if ( c == '<' )
+ return;
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+
+ (*tag) += (char) c;
+ in->get();
+ }
+}
+#endif
+
+const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ value = "";
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+ bool ignoreWhite = true;
+
+ const char* end = "<";
+ p = ReadText( p, &value, ignoreWhite, end, false, encoding );
+ if ( p )
+ return p-1; // don't truncate the '<'
+ return 0;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlDeclaration::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ while ( in->good() )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ (*tag) += (char) c;
+
+ if ( c == '>' )
+ {
+ // All is well.
+ return;
+ }
+ }
+}
+#endif
+
+const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding )
+{
+ p = SkipWhiteSpace( p, _encoding );
+ // Find the beginning, find the end, and look for
+ // the stuff in-between.
+ TiXmlDocument* document = GetDocument();
+ if ( !p || !*p || !StringEqual( p, "<?xml", true, _encoding ) )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
+ return 0;
+ }
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, _encoding );
+ location = data->Cursor();
+ }
+ p += 5;
+
+ version = "";
+ encoding = "";
+ standalone = "";
+
+ while ( p && *p )
+ {
+ if ( *p == '>' )
+ {
+ ++p;
+ return p;
+ }
+
+ p = SkipWhiteSpace( p, _encoding );
+ if ( StringEqual( p, "version", true, _encoding ) )
+ {
+ TiXmlAttribute attrib;
+ p = attrib.Parse( p, data, _encoding );
+ version = attrib.Value();
+ }
+ else if ( StringEqual( p, "encoding", true, _encoding ) )
+ {
+ TiXmlAttribute attrib;
+ p = attrib.Parse( p, data, _encoding );
+ encoding = attrib.Value();
+ }
+ else if ( StringEqual( p, "standalone", true, _encoding ) )
+ {
+ TiXmlAttribute attrib;
+ p = attrib.Parse( p, data, _encoding );
+ standalone = attrib.Value();
+ }
+ else
+ {
+ // Read over whatever it is.
+ while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
+ ++p;
+ }
+ }
+ return 0;
+}
+
+bool TiXmlText::Blank() const
+{
+ for ( unsigned i=0; i<value.length(); i++ )
+ if ( !IsWhiteSpace( value[i] ) )
+ return false;
+ return true;
+}
+#endif /* SETUP */
diff -ruN vdr-1.7.12/vdr.c vdr-1.7.12.ExtP_NG/vdr.c
--- vdr-1.7.12/vdr.c 2010-01-31 12:14:40.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/vdr.c 2010-02-03 22:16:56.046073917 +0100
@@ -586,9 +586,14 @@
RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"));
SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true);
Keys.Load(AddDirectory(ConfigDirectory, "remote.conf"));
+#ifdef USE_ALTERNATECHANNEL
+ KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true) &&
+ Channels.LoadAlternativeChannels(AddDirectory(ConfigDirectory, "channel_alternative.conf"));
+#else
KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true);
- Folders.Load(AddDirectory(ConfigDirectory, "folders.conf"));
+ Folders.Load(AddDirectory(ConfigDirectory, "folders.conf"));
+#endif /* ALTERNATECHANNEL */
if (!*cFont::GetFontFileName(Setup.FontOsd)) {
const char *msg = "no fonts available - OSD will not show any text!";
fprintf(stderr, "vdr: %s\n", msg);
@@ -918,6 +923,21 @@
Recordings.Update();
DeletedRecordings.Update();
}
+#ifdef USE_MCLI
+ cPlugin *mcliPlugin = cPluginManager::GetPlugin("mcli");
+ if (mcliPlugin) {
+ if (!ShutdownHandler.countdown) { // if kPower has been pressed, cMenuShutdown takes precedence over other menus
+ cOsdObject *MyMenu = mcliPlugin->AltMenuAction();
+ if (MyMenu) { // is there any cam-menu waiting?
+ DELETE_MENU;
+ if (cControl::Control())
+ cControl::Control()->Hide();
+ Menu = MyMenu;
+ Menu->Show();
+ }
+ }
+ }
+#endif /* MCLI */
// CAM control:
if (!Menu && !cOsd::IsOpen())
Menu = CamControl();
@@ -928,6 +948,9 @@
cOsdObject *Interact = Menu ? Menu : cControl::Control();
eKeys key = Interface->GetKey(!Interact || !Interact->NeedsFastResponse());
if (ISREALKEY(key)) {
+#ifdef USE_PINPLUGIN
+ cStatus::MsgUserAction(key, Interact); // PIN PATCH
+#endif /* PINPLUGIN */
EITScanner.Activity();
// Cancel shutdown countdown:
if (ShutdownHandler.countdown)
@@ -1000,10 +1023,16 @@
cControl::Control()->Hide();
cPlugin *plugin = cPluginManager::GetPlugin(PluginName);
if (plugin) {
+#ifdef USE_PINPLUGIN
+ if (!cStatus::MsgPluginProtected(plugin)) {
+#endif /* PINPLUGIN */
Menu = plugin->MainMenuAction();
if (Menu)
Menu->Show();
}
+#ifdef USE_PINPLUGIN
+ }
+#endif /* PINPLUGIN */
else
esyslog("ERROR: unknown plugin '%s'", PluginName);
}
@@ -1193,13 +1222,26 @@
Channels.SwitchTo(PreviousChannel[PreviousChannelIndex ^= 1]);
break;
}
+#ifdef USE_VOLCTRL
+ // Left/Right volume control
+#else
// Direct Channel Select:
case k1 ... k9:
// Left/Right rotates through channel groups:
+#endif /* VOLCTRL */
case kLeft|k_Repeat:
case kLeft:
case kRight|k_Repeat:
case kRight:
+#ifdef USE_VOLCTRL
+ if (Setup.LRVolumeControl && Setup.LRChannelGroups < 2) {
+ cRemote::Put(NORMALKEY(key) == kLeft ? kVolDn : kVolUp, true);
+ break;
+ }
+ // else fall through
+ // Direct Channel Select:
+ case k1 ... k9:
+#endif /* VOLCTRL */
// Previous/Next rotates through channel groups:
case kPrev|k_Repeat:
case kPrev:
@@ -1217,9 +1259,15 @@
// Instant resume of the last viewed recording:
case kPlay:
if (cReplayControl::LastReplayed()) {
+#ifdef USE_PINPLUGIN
+ if (cStatus::MsgReplayProtected(0, cReplayControl::LastReplayed(), 0, false) == false) { // PIN PATCH
+#endif /* PINPLUGIN */
cControl::Shutdown();
cControl::Launch(new cReplayControl);
}
+#ifdef USE_PINPLUGIN
+ }
+#endif /* PINPLUGIN */
break;
default: break;
}
diff -ruN vdr-1.7.12/videodir.c vdr-1.7.12.ExtP_NG/videodir.c
--- vdr-1.7.12/videodir.c 2008-02-16 14:00:03.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/videodir.c 2010-02-03 22:16:56.056070506 +0100
@@ -36,6 +36,11 @@
bool Next(void);
void Store(void);
const char *Adjust(const char *FileName);
+#ifdef USE_DVLVIDPREFER
+ char *GetVidPath(int nVid);
+ bool GetPreferedVideoDir(void);
+ bool IsVidDirOK(int nVid, int *freeMB = NULL);
+#endif /* DVLVIDPREFER */
};
cVideoDirectory::cVideoDirectory(void)
@@ -117,6 +122,9 @@
if ((Flags & O_CREAT) != 0) {
cVideoDirectory Dir;
if (Dir.IsDistributed()) {
+#ifdef USE_DVLVIDPREFER
+ if (Setup.UseVidPrefer == 0) {
+#endif /* DVLVIDPREFER */
// Find the directory with the most free space:
int MaxFree = Dir.FreeMB();
while (Dir.Next()) {
@@ -126,14 +134,24 @@
MaxFree = Free;
}
}
+#ifdef USE_DVLVIDPREFER
+ }
+ else Dir.GetPreferedVideoDir();
+#endif /* DVLVIDPREFER */
if (Dir.Stored()) {
ActualFileName = Dir.Adjust(FileName);
if (!MakeDirs(ActualFileName, false))
return NULL; // errno has been set by MakeDirs()
+#ifdef USE_DVLVIDPREFER
+ if (strcmp(ActualFileName, FileName) != 0) {
+#endif /* DVLVIDPREFER */
if (symlink(ActualFileName, FileName) < 0) {
LOG_ERROR_STR(FileName);
return NULL;
}
+#ifdef USE_DVLVIDPREFER
+ }
+#endif /* DVLVIDPREFER */
ActualFileName = strdup(ActualFileName); // must survive Dir!
}
}
@@ -168,6 +186,123 @@
return RemoveFileOrDir(FileName, true);
}
+#ifdef USE_HARDLINKCUTTER
+static bool StatNearestDir(const char *FileName, struct stat *Stat)
+{
+ cString Name(FileName);
+ char *p;
+ while ((p = strrchr((char*)(const char*)Name + 1, '/')) != NULL) {
+ *p = 0; // truncate at last '/'
+ if (stat(Name, Stat) == 0) {
+ isyslog("StatNearestDir: Stating %s", (const char*)Name);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool HardLinkVideoFile(const char *OldName, const char *NewName)
+{
+ // Incoming name must be in base video directory:
+ if (strstr(OldName, VideoDirectory) != OldName) {
+ esyslog("ERROR: %s not in %s", OldName, VideoDirectory);
+ return false;
+ }
+ if (strstr(NewName, VideoDirectory) != NewName) {
+ esyslog("ERROR: %s not in %s", NewName, VideoDirectory);
+ return false;
+ }
+
+ const char *ActualNewName = NewName;
+ cString ActualOldName(ReadLink(OldName), true);
+
+ // Some safety checks:
+ struct stat StatOldName;
+ if (lstat(ActualOldName, &StatOldName) == 0) {
+ if (S_ISLNK(StatOldName.st_mode)) {
+ esyslog("HardLinkVideoFile: Failed to resolve symbolic link %s", (const char*)ActualOldName);
+ return false;
+ }
+ }
+ else {
+ esyslog("HardLinkVideoFile: lstat failed on %s", (const char*)ActualOldName);
+ return false;
+ }
+ isyslog("HardLinkVideoFile: %s is on %i", (const char*)ActualOldName, (int)StatOldName.st_dev);
+
+ // Find the video directory where ActualOldName is located
+
+ cVideoDirectory Dir;
+ struct stat StatDir;
+ if (!StatNearestDir(NewName, &StatDir)) {
+ esyslog("HardLinkVideoFile: stat failed on %s", NewName);
+ return false;
+ }
+
+ isyslog("HardLinkVideoFile: %s is on %i", NewName, (int)StatDir.st_dev);
+ if (StatDir.st_dev != StatOldName.st_dev) {
+ // Not yet found.
+
+ if (!Dir.IsDistributed()) {
+ esyslog("HardLinkVideoFile: No matching video folder to hard link %s", (const char*)ActualOldName);
+ return false;
+ }
+
+ // Search in video01 and upwards
+ bool found = false;
+ while (Dir.Next()) {
+ Dir.Store();
+ const char *TmpNewName = Dir.Adjust(NewName);
+ if (StatNearestDir(TmpNewName, &StatDir) && StatDir.st_dev == StatOldName.st_dev) {
+ isyslog("HardLinkVideoFile: %s is on %i (match)", TmpNewName, (int)StatDir.st_dev);
+ ActualNewName = TmpNewName;
+ found = true;
+ break;
+ }
+ isyslog("HardLinkVideoFile: %s is on %i", TmpNewName, (int)StatDir.st_dev);
+ }
+ if (ActualNewName == NewName) {
+ esyslog("HardLinkVideoFile: No matching video folder to hard link %s", (const char*)ActualOldName);
+ return false;
+ }
+
+ // Looking good, we have a match. Create necessary folders.
+ if (!MakeDirs(ActualNewName, false))
+ return false;
+ // There's no guarantee that the directory of ActualNewName
+ // is on the same device as the dir that StatNearestDir found.
+ // But worst case is that the link fails.
+ }
+
+#ifdef HARDLINK_TEST_ONLY
+ // Do the hard link to *.vdr_ for testing only
+ char *name = NULL;
+ asprintf(&name, "%s_",ActualNewName);
+ link(ActualOldName, name);
+ free(name);
+ return false;
+#endif // HARDLINK_TEST_ONLY
+
+ // Try creating the hard link
+ if (link(ActualOldName, ActualNewName) != 0) {
+ // Failed to hard link. Maybe not allowed on file system.
+ LOG_ERROR_STR(ActualNewName);
+ isyslog("HardLinkVideoFile: failed to hard link from %s to %s", (const char*)ActualOldName, ActualNewName);
+ return false;
+ }
+
+ if (ActualNewName != NewName) {
+ // video01 and up. Do the remaining symlink
+ if (symlink(ActualNewName, NewName) < 0) {
+ LOG_ERROR_STR(NewName);
+ return false;
+ }
+ }
+ return true;
+}
+
+#endif /* HARDLINKCUTTER */
+
bool VideoFileSpaceAvailable(int SizeMB)
{
cVideoDirectory Dir;
@@ -232,6 +367,129 @@
} while (Dir.Next());
}
+#ifdef USE_DVLVIDPREFER
+// returns path to nVid'th video directory or NULL if not existing
+char *cVideoDirectory::GetVidPath(int nVid)
+{
+ char *b = strdup(VideoDirectory);
+ int l = strlen(b), di, n;
+
+ while (l-- > 0 && isdigit(b[ l ]));
+
+ l++;
+ di = strlen(b) - l;
+
+ // di == number of digits
+ n = atoi(&b[ l ]);
+ if (n != 0)
+ return NULL;
+
+ // add requested number to dir name
+ sprintf(&b[ l ], "%0*d", di, nVid);
+
+ if (DirectoryOk(b) == true)
+ return b;
+
+ free(b);
+ return NULL;
+}
+
+// checks if a video dir is 'valid'
+bool cVideoDirectory::IsVidDirOK(int nVid, int *freeMB)
+{
+ char *dn;
+ int fMB;
+
+ if (nVid >= Setup.nVidPrefer)
+ return false;
+
+ if (Setup.VidPreferSize[ nVid ] == -1)
+ return false;
+
+ dn = GetVidPath(nVid);
+ if (dn == NULL)
+ return false;
+
+ fMB = FreeDiskSpaceMB(dn, NULL);
+ if (freeMB != NULL)
+ *freeMB = fMB;
+
+ free(dn);
+
+ if (Setup.VidPreferSize[ nVid ] >= fMB)
+ return false;
+ return true;
+}
+
+
+// calculates which video dir to use
+bool cVideoDirectory::GetPreferedVideoDir(void)
+{
+ cVideoDirectory d;
+ int nDirs = 1,
+ vidUse = Setup.nVidPrefer;
+ int i, top, topFree, x;
+
+ if (name == NULL)
+ return(false);
+
+ // count available video dirs
+ while (d.Next() == true)
+ nDirs++;
+
+ if (vidUse > nDirs)
+ vidUse = nDirs;
+
+ // check for prefered video dir
+ for (i = 0, top = -1, topFree = 0; i < vidUse; i++) {
+ if (IsVidDirOK(i, &x) == true) {
+ if (top == -1) {
+ // nothing set yet, use first 'ok' dir
+ top = i;
+ topFree = x;
+ }
+ else {
+ // check if we got a higher priority
+ if (Setup.VidPreferPrio[ i ] >= Setup.VidPreferPrio[ top ]) {
+ top = i;
+ topFree = x;
+ }
+ // check if we got same priority but more space
+ else if (Setup.VidPreferPrio[ i ] == Setup.VidPreferPrio[ top ] && x >= topFree) {
+ top = i;
+ topFree = x;
+ }
+ }
+ }
+ }
+
+ if (top == -1) {
+ isyslog("VidPrefer: no prefered video directory could be determined!");
+
+ // something went wrong here...
+ // let VDR determine the video directory
+ int MaxFree = FreeMB();
+
+ while (Next()) {
+ int Free = FreeDiskSpaceMB(Name());
+
+ if (Free > MaxFree) {
+ Store();
+ MaxFree = Free;
+ }
+ }
+ }
+ else {
+ isyslog("VidPrefer: prefered video directory '%d' set.", top);
+ if (stored != NULL)
+ free(stored);
+ stored = GetVidPath(top);
+ }
+
+ return true;
+}
+#endif /* DVLVIDPREFER */
+
bool IsOnVideoDirectoryFileSystem(const char *FileName)
{
cVideoDirectory Dir;
diff -ruN vdr-1.7.12/videodir.h vdr-1.7.12.ExtP_NG/videodir.h
--- vdr-1.7.12/videodir.h 2008-02-16 13:53:11.000000000 +0100
+++ vdr-1.7.12.ExtP_NG/videodir.h 2010-02-03 22:16:56.067072252 +0100
@@ -19,6 +19,9 @@
int CloseVideoFile(cUnbufferedFile *File);
bool RenameVideoFile(const char *OldName, const char *NewName);
bool RemoveVideoFile(const char *FileName);
+#ifdef USE_HARDLINKCUTTER
+bool HardLinkVideoFile(const char *OldName, const char *NewName);
+#endif /* HARDLINKCUTTER */
bool VideoFileSpaceAvailable(int SizeMB);
int VideoDiskSpace(int *FreeMB = NULL, int *UsedMB = NULL); // returns the used disk space in percent
cString PrefixVideoFileName(const char *FileName, char Prefix);
|