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
|
diff --git a/ci.c b/ci.c
index 9a4a829..88b50e7 100644
--- a/ci.c
+++ b/ci.c
@@ -1571,6 +1571,8 @@ cCamSlot::cCamSlot(cCiAdapter *CiAdapter)
cCamSlot::~cCamSlot()
{
+ if (ciAdapter && ciAdapter->assignedDevice)
+ ciAdapter->assignedDevice->SetCamSlot(NULL);
CamSlots.Del(this, false);
DeleteAllConnections();
}
diff --git a/ci.h b/ci.h
index 74e0270..818ea29 100644
--- a/ci.h
+++ b/ci.h
@@ -72,6 +72,7 @@ public:
};
class cDevice;
+class cTSBufferBase;
class cCamSlot;
enum eModuleStatus { msNone, msReset, msPresent, msReady };
@@ -115,6 +116,13 @@ public:
///< The derived class must call Cancel(3) in its destructor.
virtual bool Ready(void);
///< Returns 'true' if all present CAMs in this adapter are ready.
+#define EXTERNALCI_PATCH
+ virtual cTSBufferBase *GetTSBuffer(int FdDvr) { return NULL; }
+ ///< Derived classes can return a special TS buffer with features
+ ///< like rerouting the stream through an external ci.
+ ///< The caller must delete the buffer.
+ virtual bool SetIdle(bool Idle, bool TestOnly) { return false; }
+ virtual bool IsIdle(void) const { return false; }
};
class cTPDU;
diff --git a/device.c b/device.c
index e0fe84a..44122aa 100644
--- a/device.c
+++ b/device.c
@@ -69,12 +69,22 @@ int cDevice::currentChannel = 1;
cDevice *cDevice::device[MAXDEVICES] = { NULL };
cDevice *cDevice::primaryDevice = NULL;
cList<cDeviceHook> cDevice::deviceHooks;
-
-cDevice::cDevice(void)
+cDevice *cDevice::nextParentDevice = NULL;
+
+cDevice::cDevice(cDevice *ParentDevice)
:patPmtParser(true)
-{
- cardIndex = nextCardIndex++;
- dsyslog("new device number %d", CardIndex() + 1);
+,isIdle(false)
+,parentDevice(ParentDevice)
+,subDevice(NULL)
+{
+ if (!ParentDevice)
+ parentDevice = nextParentDevice;
+ cDevice::nextParentDevice = NULL;
+ if (parentDevice)
+ cardIndex = parentDevice->cardIndex;
+ else
+ cardIndex = nextCardIndex++;
+ dsyslog("new %sdevice number %d", parentDevice ? "sub-" : "", CardIndex() + 1);
SetDescription("receiver on device %d", CardIndex() + 1);
@@ -106,10 +116,14 @@ cDevice::cDevice(void)
for (int i = 0; i < MAXRECEIVERS; i++)
receiver[i] = NULL;
- if (numDevices < MAXDEVICES)
- device[numDevices++] = this;
+ if (!parentDevice) {
+ if (numDevices < MAXDEVICES)
+ device[numDevices++] = this;
+ else
+ esyslog("ERROR: too many devices or \"dynamite\"-unpatched device creator!");
+ }
else
- esyslog("ERROR: too many devices!");
+ parentDevice->subDevice = this;
}
cDevice::~cDevice()
@@ -118,6 +132,29 @@ cDevice::~cDevice()
DetachAllReceivers();
delete liveSubtitle;
delete dvbSubtitleConverter;
+ if (parentDevice && (parentDevice->subDevice == this))
+ parentDevice->subDevice = NULL;
+}
+
+bool cDevice::SetIdle(bool Idle)
+{
+ if (parentDevice)
+ return parentDevice->SetIdle(Idle);
+ if (isIdle == Idle)
+ return true;
+ if (Receiving(false))
+ return false;
+ if (Idle) {
+ Detach(player);
+ DetachAllReceivers();
+ }
+ if (!SetIdleDevice(Idle, true))
+ return false;
+ isIdle = Idle;
+ if (SetIdleDevice(Idle, false))
+ return true;
+ isIdle = !Idle;
+ return false;
}
bool cDevice::WaitForAllDevicesReady(int Timeout)
@@ -156,6 +193,8 @@ int cDevice::NextCardIndex(int n)
int cDevice::DeviceNumber(void) const
{
+ if (parentDevice)
+ return parentDevice->DeviceNumber();
for (int i = 0; i < numDevices; i++) {
if (device[i] == this)
return i;
@@ -356,6 +395,8 @@ bool cDevice::HasCi(void)
void cDevice::SetCamSlot(cCamSlot *CamSlot)
{
+ if (parentDevice)
+ return parentDevice->SetCamSlot(CamSlot);
camSlot = CamSlot;
}
@@ -568,6 +609,10 @@ void cDevice::DelLivePids(void)
void cDevice::StartSectionHandler(void)
{
+ if (parentDevice) {
+ parentDevice->StartSectionHandler();
+ return;
+ }
if (!sectionHandler) {
sectionHandler = new cSectionHandler(this);
AttachFilter(eitFilter = new cEitFilter);
@@ -579,6 +624,10 @@ void cDevice::StartSectionHandler(void)
void cDevice::StopSectionHandler(void)
{
+ if (parentDevice) {
+ parentDevice->StopSectionHandler();
+ return;
+ }
if (sectionHandler) {
delete nitFilter;
delete sdtFilter;
@@ -610,12 +659,17 @@ void cDevice::CloseFilter(int Handle)
void cDevice::AttachFilter(cFilter *Filter)
{
+ if (parentDevice)
+ return parentDevice->AttachFilter(Filter);
+ SetIdle(false);
if (sectionHandler)
sectionHandler->Attach(Filter);
}
void cDevice::Detach(cFilter *Filter)
{
+ if (parentDevice)
+ return parentDevice->Detach(Filter);
if (sectionHandler)
sectionHandler->Detach(Filter);
}
@@ -777,6 +831,7 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
sectionHandler->SetStatus(false);
sectionHandler->SetChannel(NULL);
}
+ SetIdle(false);
// Tell the camSlot about the channel switch and add all PIDs of this
// channel to it, for possible later decryption:
if (camSlot)
@@ -823,19 +878,27 @@ void cDevice::ForceTransferMode(void)
{
if (!cTransferControl::ReceiverDevice()) {
cChannel *Channel = Channels.GetByNumber(CurrentChannel());
- if (Channel)
+ if (Channel) {
+ SetIdle(false);
SetChannelDevice(Channel, false); // this implicitly starts Transfer Mode
+ }
}
}
int cDevice::Occupied(void) const
{
+ if (parentDevice)
+ return parentDevice->Occupied();
int Seconds = occupiedTimeout - time(NULL);
return Seconds > 0 ? Seconds : 0;
}
void cDevice::SetOccupied(int Seconds)
{
+ if (parentDevice) {
+ parentDevice->SetOccupied(Seconds);
+ return;
+ }
if (Seconds >= 0)
occupiedTimeout = time(NULL) + min(Seconds, MAXOCCUPIEDTIMEOUT);
}
@@ -1216,7 +1279,10 @@ bool cDevice::Transferring(void) const
bool cDevice::AttachPlayer(cPlayer *Player)
{
+ if (parentDevice)
+ return parentDevice->AttachPlayer(Player);
if (CanReplay()) {
+ SetIdle(false);
if (player)
Detach(player);
DELETENULL(liveSubtitle);
@@ -1235,6 +1301,8 @@ bool cDevice::AttachPlayer(cPlayer *Player)
void cDevice::Detach(cPlayer *Player)
{
+ if (parentDevice)
+ return parentDevice->Detach(Player);
if (Player && player == Player) {
cPlayer *p = player;
player = NULL; // avoids recursive calls to Detach()
@@ -1254,6 +1322,8 @@ void cDevice::Detach(cPlayer *Player)
void cDevice::StopReplay(void)
{
+ if (parentDevice)
+ return parentDevice->StopReplay();
if (player) {
Detach(player);
if (IsPrimaryDevice())
@@ -1534,6 +1604,8 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly)
int cDevice::Priority(void) const
{
+ if (parentDevice)
+ return parentDevice->Priority();
int priority = IDLEPRIORITY;
if (IsPrimaryDevice() && !Replaying() && HasProgramme())
priority = TRANSFERPRIORITY; // we use the same value here, no matter whether it's actual Transfer Mode or real live viewing
@@ -1552,6 +1624,8 @@ bool cDevice::Ready(void)
bool cDevice::Receiving(bool Dummy) const
{
+ if (parentDevice)
+ return parentDevice->Receiving(Dummy);
cMutexLock MutexLock(&mutexReceiver);
for (int i = 0; i < MAXRECEIVERS; i++) {
if (receiver[i])
@@ -1632,10 +1706,13 @@ bool cDevice::GetTSPacket(uchar *&Data)
bool cDevice::AttachReceiver(cReceiver *Receiver)
{
+ if (parentDevice)
+ return parentDevice->AttachReceiver(Receiver);
if (!Receiver)
return false;
if (Receiver->device == this)
return true;
+ SetIdle(false);
// activate the following line if you need it - actually the driver should be fixed!
//#define WAIT_FOR_TUNER_LOCK
#ifdef WAIT_FOR_TUNER_LOCK
@@ -1674,6 +1751,8 @@ bool cDevice::AttachReceiver(cReceiver *Receiver)
void cDevice::Detach(cReceiver *Receiver)
{
+ if (parentDevice)
+ return parentDevice->Detach(Receiver);
if (!Receiver || Receiver->device != this)
return;
bool receiversLeft = false;
@@ -1699,6 +1778,8 @@ void cDevice::Detach(cReceiver *Receiver)
void cDevice::DetachAll(int Pid)
{
+ if (parentDevice)
+ return parentDevice->DetachAll(Pid);
if (Pid) {
cMutexLock MutexLock(&mutexReceiver);
for (int i = 0; i < MAXRECEIVERS; i++) {
@@ -1783,3 +1864,25 @@ uchar *cTSBuffer::Get(void)
}
return NULL;
}
+
+// --- cDynamicDeviceProbe -------------------------------------------------------
+
+cList<cDynamicDeviceProbe> DynamicDeviceProbes;
+
+cList<cDynamicDeviceProbe::cDynamicDeviceProbeItem> cDynamicDeviceProbe::commandQueue;
+
+void cDynamicDeviceProbe::QueueDynamicDeviceCommand(eDynamicDeviceProbeCommand Cmd, const char *DevPath)
+{
+ if (DevPath)
+ commandQueue.Add(new cDynamicDeviceProbeItem(Cmd, new cString(DevPath)));
+}
+
+cDynamicDeviceProbe::cDynamicDeviceProbe(void)
+{
+ DynamicDeviceProbes.Add(this);
+}
+
+cDynamicDeviceProbe::~cDynamicDeviceProbe()
+{
+ DynamicDeviceProbes.Del(this, false);
+}
diff --git a/device.h b/device.h
index fd010d4..ed3b1da 100644
--- a/device.h
+++ b/device.h
@@ -24,6 +24,7 @@
#include "spu.h"
#include "thread.h"
#include "tools.h"
+#include <linux/dvb/frontend.h>
#define MAXDEVICES 16 // the maximum number of devices in the system
#define MAXPIDHANDLES 64 // the maximum number of different PIDs per device
@@ -169,7 +170,6 @@ private:
static int nextCardIndex;
int cardIndex;
protected:
- cDevice(void);
virtual ~cDevice();
virtual bool Ready(void);
///< Returns true if this device is ready. Devices with conditional
@@ -196,9 +196,6 @@ protected:
///< A derived class must call the MakePrimaryDevice() function of its
///< base class.
public:
- bool IsPrimaryDevice(void) const { return this == primaryDevice; }
- int CardIndex(void) const { return cardIndex; }
- ///< Returns the card index of this device (0 ... MAXDEVICES - 1).
int DeviceNumber(void) const;
///< Returns the number of this device (0 ... numDevices).
virtual cString DeviceType(void) const;
@@ -338,6 +335,7 @@ public:
///< Returns true if the device is currently showing any programme to
///< the user, either through replaying or live.
+ virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd) {return false;}
// PID handle facilities
private:
@@ -423,9 +421,6 @@ public:
///< shall check whether the channel can be decrypted.
void SetCamSlot(cCamSlot *CamSlot);
///< Sets the given CamSlot to be used with this device.
- cCamSlot *CamSlot(void) const { return camSlot; }
- ///< Returns the CAM slot that is currently used with this device,
- ///< or NULL if no CAM slot is in use.
// Image Grab facilities
@@ -586,9 +581,6 @@ private:
cTsToPes tsToPesSubtitle;
bool isPlayingVideo;
protected:
- const cPatPmtParser *PatPmtParser(void) const { return &patPmtParser; }
- ///< Returns a pointer to the patPmtParser, so that a derived device
- ///< can use the stream information from it.
virtual bool CanReplay(void) const;
///< Returns true if this device can currently start a replay session.
virtual bool SetPlayMode(ePlayMode PlayMode);
@@ -802,6 +794,38 @@ public:
///< Detaches all receivers from this device for this pid.
virtual void DetachAllReceivers(void);
///< Detaches all receivers from this device.
+
+// --- dynamite subdevice patch start ---
+ friend class cDynamicDevice;
+private:
+ static cDevice *nextParentDevice;
+ ///< Holds the parent device for the next subdevice
+ ///< so the dynamite-plugin can work with unpatched plugins
+ bool isIdle;
+protected:
+ cDevice *parentDevice;
+ cDevice *subDevice;
+ cDevice(cDevice *ParentDevice = NULL);
+ const cPatPmtParser *PatPmtParser(void) const { if (parentDevice) return parentDevice->PatPmtParser(); return &patPmtParser; }
+ ///< Returns a pointer to the patPmtParser, so that a derived device
+ ///< can use the stream information from it.
+public:
+ bool IsPrimaryDevice(void) const { if (parentDevice) return parentDevice->IsPrimaryDevice(); return this == primaryDevice; }
+ int CardIndex(void) const { if (parentDevice) return parentDevice->cardIndex; return cardIndex; }
+ ///< Returns the card index of this device (0 ... MAXDEVICES - 1).
+ cCamSlot *CamSlot(void) const { if (parentDevice) return parentDevice->CamSlot(); return camSlot; }
+ ///< Returns the CAM slot that is currently used with this device,
+ ///< or NULL if no CAM slot is in use.
+ bool IsSubDevice(void) const { return (parentDevice != NULL); }
+ bool HasSubDevice(void) const { return (subDevice != NULL); }
+ cDevice *SubDevice(void) const { return subDevice; }
+ bool IsIdle(void) const { if (parentDevice) return parentDevice->IsIdle(); return isIdle; }
+ bool SetIdle(bool Idle);
+ virtual bool SetIdleDevice(bool Idle, bool TestOnly) { return false; }
+ ///< Called by SetIdle
+ ///< if TestOnly, don't do anything, just return, if the device
+ ///< can be set to the new idle state
+ // --- dynamite subdevice patch end ---
};
/// Derived cDevice classes that can receive channels will have to provide
@@ -812,7 +836,14 @@ public:
/// sure the returned data points to a TS packet and automatically
/// re-synchronizes after broken packets.
-class cTSBuffer : public cThread {
+class cTSBufferBase {
+public:
+ cTSBufferBase() {}
+ virtual ~cTSBufferBase() {}
+ virtual uchar *Get(void) = 0;
+ };
+
+class cTSBuffer : public cTSBufferBase, public cThread {
private:
int f;
int cardIndex;
@@ -821,8 +852,51 @@ private:
virtual void Action(void);
public:
cTSBuffer(int File, int Size, int CardIndex);
- ~cTSBuffer();
- uchar *Get(void);
+ virtual ~cTSBuffer();
+ virtual uchar *Get(void);
+ };
+
+/// A plugin that want to create devices handled by the dynamite-plugin needs to create
+/// a cDynamicDeviceProbe derived object on the heap in order to have its Probe()
+/// function called, where it can actually create the appropriate device.
+/// The cDynamicDeviceProbe object must be created in the plugin's constructor,
+/// and deleted in its destructor.
+/// The "DevPath" hasn't to be a physical device or a path in the filesystem.
+/// It can be any string a plugin may react on.
+
+#define __DYNAMIC_DEVICE_PROBE
+
+enum eDynamicDeviceProbeCommand { ddpcAttach, ddpcDetach, ddpcService };
+
+class cDynamicDeviceProbe : public cListObject {
+ friend class cDynamicDevice;
+private:
+ class cDynamicDeviceProbeItem : public cListObject {
+ public:
+ eDynamicDeviceProbeCommand cmd;
+ cString *devpath;
+ cDynamicDeviceProbeItem(eDynamicDeviceProbeCommand Cmd, cString *DevPath):cmd(Cmd),devpath(DevPath) {}
+ virtual ~cDynamicDeviceProbeItem() { if (devpath) delete devpath; }
+ };
+ static cList<cDynamicDeviceProbeItem> commandQueue;
+ ///< A list where all attach/detach commands are queued
+ ///< so they can be processed in the MainThreadHook of
+ ///< the dynamite plugin.
+public:
+ static void QueueDynamicDeviceCommand(eDynamicDeviceProbeCommand Cmd, const char *DevPath);
+ ///< Plugins which support cDynamicDeviceProbe must use this function
+ ///< to queue the devices they normally create in their Initialize method.
+ ///< These devices are created as subdevices in the Start-method of the dynamite-plugin.
+ cDynamicDeviceProbe(void);
+ virtual ~cDynamicDeviceProbe();
+ virtual cDevice *Attach(cDevice *ParentDevice, const char *DevPath) = 0;
+ ///< Probes for a device at the given device-path like /dev/dvb/adapter0/frontend0
+ ///< or /dev/video0 etc. and creates the appropriate
+ ///< object derived from cDevice if applicable.
+ ///< Returns the device that has been created or NULL if not.
+ ///< The dynamite-plugin will delete the device if it is detached.
};
+extern cList<cDynamicDeviceProbe> DynamicDeviceProbes;
+
#endif //__DEVICE_H
diff --git a/dvbci.c b/dvbci.c
index 5289bbd..baa70bc 100644
--- a/dvbci.c
+++ b/dvbci.c
@@ -10,41 +10,70 @@
#include "dvbci.h"
#include <linux/dvb/ca.h>
#include <sys/ioctl.h>
-#include "device.h"
+#include "dvbdevice.h"
// --- cDvbCiAdapter ---------------------------------------------------------
-cDvbCiAdapter::cDvbCiAdapter(cDevice *Device, int Fd)
+cDvbCiAdapter::cDvbCiAdapter(cDevice *Device, int Fd, int Adapter, int Frontend)
{
device = Device;
SetDescription("CI adapter on device %d", device->DeviceNumber());
fd = Fd;
- ca_caps_t Caps;
- if (ioctl(fd, CA_GET_CAP, &Caps) == 0) {
- if ((Caps.slot_type & CA_CI_LINK) != 0) {
- int NumSlots = Caps.slot_num;
- if (NumSlots > 0) {
- for (int i = 0; i < NumSlots; i++)
- new cCamSlot(this);
- Start();
- }
- else
- esyslog("ERROR: no CAM slots found on device %d", device->DeviceNumber());
- }
- else
- isyslog("device %d doesn't support CI link layer interface", device->DeviceNumber());
- }
- else
- esyslog("ERROR: can't get CA capabilities on device %d", device->DeviceNumber());
+ adapter = Adapter;
+ frontend = Frontend;
+ idle = false;
+ GetNumCamSlots(Device, Fd, this);
+ Start();
}
cDvbCiAdapter::~cDvbCiAdapter()
{
Cancel(3);
+ if (device->IsSubDevice() || device->HasSubDevice())
+ CloseCa();
+}
+
+bool cDvbCiAdapter::OpenCa(void)
+{
+ if (fd >= 0)
+ return true;
+ fd = cDvbDevice::DvbOpen(DEV_DVB_CA, adapter, frontend, O_RDWR);
+ return (fd >= 0);
+}
+
+void cDvbCiAdapter::CloseCa(void)
+{
+ if (fd < 0)
+ return;
+ close(fd);
+ fd = -1;
+}
+
+bool cDvbCiAdapter::SetIdle(bool Idle, bool TestOnly)
+{
+ if ((adapter < 0) || (frontend < 0))
+ return false;
+ if (TestOnly || (idle == Idle))
+ return true;
+ if (Idle)
+ CloseCa();
+ else
+ OpenCa();
+ idle = Idle;
+ return true;
+}
+
+cTSBufferBase *cDvbCiAdapter::GetTSBuffer(int FdDvr)
+{
+ if (device)
+ return new cTSBuffer(FdDvr, MEGABYTE(5), device->CardIndex() + 1);
+ return NULL;
}
int cDvbCiAdapter::Read(uint8_t *Buffer, int MaxLength)
{
+ if (idle || (fd < 0))
+ return 0;
if (Buffer && MaxLength > 0) {
struct pollfd pfd[1];
pfd[0].fd = fd;
@@ -61,6 +90,8 @@ int cDvbCiAdapter::Read(uint8_t *Buffer, int MaxLength)
void cDvbCiAdapter::Write(const uint8_t *Buffer, int Length)
{
+ if (idle || (fd < 0))
+ return;
if (Buffer && Length > 0) {
if (safe_write(fd, Buffer, Length) != Length)
esyslog("ERROR: can't write to CI adapter on device %d: %m", device->DeviceNumber());
@@ -69,6 +100,8 @@ void cDvbCiAdapter::Write(const uint8_t *Buffer, int Length)
bool cDvbCiAdapter::Reset(int Slot)
{
+ if (idle || (fd < 0))
+ return false;
if (ioctl(fd, CA_RESET, 1 << Slot) != -1)
return true;
else
@@ -78,6 +111,8 @@ bool cDvbCiAdapter::Reset(int Slot)
eModuleStatus cDvbCiAdapter::ModuleStatus(int Slot)
{
+ if (idle || (fd < 0))
+ return msNone;
ca_slot_info_t sinfo;
sinfo.num = Slot;
if (ioctl(fd, CA_GET_SLOT_INFO, &sinfo) != -1) {
@@ -99,10 +134,60 @@ bool cDvbCiAdapter::Assign(cDevice *Device, bool Query)
return true;
}
-cDvbCiAdapter *cDvbCiAdapter::CreateCiAdapter(cDevice *Device, int Fd)
+int cDvbCiAdapter::GetNumCamSlots(cDevice *Device, int Fd, cCiAdapter *CiAdapter)
{
- // TODO check whether a CI is actually present?
- if (Device)
- return new cDvbCiAdapter(Device, Fd);
- return NULL;
+ int NumSlots = -1;
+ if (Fd >= 0) {
+ ca_caps_t Caps;
+ if (ioctl(Fd, CA_GET_CAP, &Caps) == 0) {
+ if ((Caps.slot_type & CA_CI_LINK) != 0) {
+ NumSlots = Caps.slot_num;
+ if (NumSlots == 0)
+ esyslog("ERROR: no CAM slots found on device %d", Device->DeviceNumber());
+ else if (CiAdapter != NULL) {
+ for (int i = 0; i < NumSlots; i++)
+ new cCamSlot(CiAdapter);
+ }
+ else
+ return NumSlots;
+ }
+ else
+ isyslog("device %d doesn't support CI link layer interface", Device->DeviceNumber());
+ }
+ else
+ esyslog("ERROR: can't get CA capabilities on device %d", Device->DeviceNumber());
+ }
+ return -1;
+}
+
+cDvbCiAdapter *cDvbCiAdapter::CreateCiAdapter(cDevice *Device, int Fd, int Adapter, int Frontend)
+{
+ // don't create a ci-adapter if it's not useable
+ if (Device && (Fd >= 0) && (GetNumCamSlots(Device, Fd, NULL) > 0))
+ return new cDvbCiAdapter(Device, Fd, Adapter, Frontend);
+
+ if (Fd >= 0)
+ close(Fd);
+
+ // try to find an external ci-adapter
+ for (cDvbCiAdapterProbe *cp = DvbCiAdapterProbes.First(); cp; cp = DvbCiAdapterProbes.Next(cp)) {
+ cDvbCiAdapter *ca = cp->Probe(Device);
+ if (ca)
+ return ca;
+ }
+ return NULL;
+}
+
+// --- cDvbCiAdapterProbe -------------------------------------------------------
+
+cList<cDvbCiAdapterProbe> DvbCiAdapterProbes;
+
+cDvbCiAdapterProbe::cDvbCiAdapterProbe(void)
+{
+ DvbCiAdapterProbes.Add(this);
+}
+
+cDvbCiAdapterProbe::~cDvbCiAdapterProbe()
+{
+ DvbCiAdapterProbes.Del(this, false);
}
diff --git a/dvbci.h b/dvbci.h
index adbe40d..d908b2f 100644
--- a/dvbci.h
+++ b/dvbci.h
@@ -16,16 +16,48 @@ class cDvbCiAdapter : public cCiAdapter {
private:
cDevice *device;
int fd;
+ int adapter;
+ int frontend;
+ bool idle;
+
+ bool OpenCa(void);
+ void CloseCa(void);
protected:
virtual int Read(uint8_t *Buffer, int MaxLength);
virtual void Write(const uint8_t *Buffer, int Length);
virtual bool Reset(int Slot);
virtual eModuleStatus ModuleStatus(int Slot);
virtual bool Assign(cDevice *Device, bool Query = false);
- cDvbCiAdapter(cDevice *Device, int Fd);
+ cDvbCiAdapter(cDevice *Device, int Fd, int Adapter = -1, int Frontend = -1);
public:
virtual ~cDvbCiAdapter();
- static cDvbCiAdapter *CreateCiAdapter(cDevice *Device, int Fd);
+ virtual cTSBufferBase *GetTSBuffer(int FdDvr);
+ static int GetNumCamSlots(cDevice *Device, int Fd, cCiAdapter *CiAdapter);
+ ///< Tests if the CA device is usable for vdr.
+ ///< If CiAdapter is not NULL it will create the CamSlots for the given ci-adapter.
+ virtual bool SetIdle(bool Idle, bool TestOnly);
+ virtual bool IsIdle(void) const { return idle; }
+ static cDvbCiAdapter *CreateCiAdapter(cDevice *Device, int Fd, int Adapter = -1, int Frontend = -1);
+ };
+
+// A plugin that implements an external DVB ci-adapter derived from cDvbCiAdapter needs to create
+// a cDvbCiAdapterProbe derived object on the heap in order to have its Probe()
+// function called, where it can actually create the appropriate ci-adapter.
+// The cDvbCiAdapterProbe object must be created in the plugin's constructor,
+// and deleted in its destructor.
+// Every plugin has to track its own list of already used device nodes.
+// The Probes are always called if the base cDvbCiAdapter can't create a ci-adapter on its own.
+
+class cDvbCiAdapterProbe : public cListObject {
+public:
+ cDvbCiAdapterProbe(void);
+ virtual ~cDvbCiAdapterProbe();
+ virtual cDvbCiAdapter *Probe(cDevice *Device) = 0;
+ ///< Probes for a DVB ci-adapter for the given Device and creates the appropriate
+ ///< object derived from cDvbCiAdapter if applicable.
+ ///< Returns NULL if no adapter has been created.
};
+extern cList<cDvbCiAdapterProbe> DvbCiAdapterProbes;
+
#endif //__DVBCI_H
diff --git a/dvbdevice.c b/dvbdevice.c
index 2e19925..bf55cf0 100644
--- a/dvbdevice.c
+++ b/dvbdevice.c
@@ -285,9 +285,10 @@ class cDvbTuner : public cThread {
private:
static cMutex bondMutex;
enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
+ bool SendDiseqc;
int frontendType;
const cDvbDevice *device;
- int fd_frontend;
+ mutable int fd_frontend;
int adapter, frontend;
uint32_t subsystemId;
int tuneTimeout;
@@ -298,7 +299,7 @@ private:
const cScr *scr;
bool lnbPowerTurnedOn;
eTunerStatus tunerStatus;
- cMutex mutex;
+ mutable cMutex mutex;
cCondVar locked;
cCondVar newSet;
cDvbTuner *bondedTuner;
@@ -308,11 +309,16 @@ private:
cDvbTuner *GetBondedMaster(void);
bool IsBondedMaster(void) const { return !bondedTuner || bondedMaster; }
void ClearEventQueue(void) const;
+ dvb_diseqc_master_cmd diseqc_cmd;
bool GetFrontendStatus(fe_status_t &Status) const;
void ExecuteDiseqc(const cDiseqc *Diseqc, unsigned int *Frequency);
void ResetToneAndVoltage(void);
bool SetFrontend(void);
virtual void Action(void);
+
+ mutable bool isIdle;
+ bool OpenFrontend(void) const;
+ bool CloseFrontend(void);
public:
cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int Frontend);
virtual ~cDvbTuner();
@@ -324,9 +330,13 @@ public:
uint32_t SubsystemId(void) const { return subsystemId; }
bool IsTunedTo(const cChannel *Channel) const;
void SetChannel(const cChannel *Channel);
+ bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
bool Locked(int TimeoutMs = 0);
int GetSignalStrength(void) const;
int GetSignalQuality(void) const;
+
+ bool SetIdle(bool Idle);
+ bool IsIdle(void) const { return isIdle; }
};
cMutex cDvbTuner::bondMutex;
@@ -336,6 +346,7 @@ cDvbTuner::cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int
frontendType = SYS_UNDEFINED;
device = Device;
fd_frontend = Fd_Frontend;
+ SendDiseqc=false;
adapter = Adapter;
frontend = Frontend;
subsystemId = cDvbDeviceProbe::GetSubsystemId(adapter, frontend);
@@ -348,6 +359,7 @@ cDvbTuner::cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int
tunerStatus = tsIdle;
bondedTuner = NULL;
bondedMaster = false;
+ isIdle = false;
SetDescription("tuner on frontend %d/%d", adapter, frontend);
Start();
}
@@ -365,6 +377,8 @@ cDvbTuner::~cDvbTuner()
ExecuteDiseqc(lastDiseqc, &Frequency);
}
*/
+ if (device && device->IsSubDevice())
+ CloseFrontend();
}
bool cDvbTuner::Bond(cDvbTuner *Tuner)
@@ -509,6 +523,8 @@ bool cDvbTuner::Locked(int TimeoutMs)
void cDvbTuner::ClearEventQueue(void) const
{
+ if (!OpenFrontend())
+ return;
cPoller Poller(fd_frontend);
if (Poller.Poll(TUNER_POLL_TIMEOUT)) {
dvb_frontend_event Event;
@@ -717,8 +733,28 @@ static int GetRequiredDeliverySystem(const cChannel *Channel, const cDvbTranspon
return ds;
}
+bool cDvbTuner::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
+{
+ cMutexLock MutexLock(&mutex);
+ cDvbTransponderParameters dtp(channel.Parameters());
+
+ // Determine the required frontend type:
+ int frontendType = GetRequiredDeliverySystem(&channel, &dtp);
+
+ if ((frontendType!=SYS_DVBS2 && frontendType!=SYS_DVBS) || SendDiseqc)
+ return false;
+ if (!OpenFrontend())
+ return false;
+ diseqc_cmd=cmd;
+ SendDiseqc=true;
+ newSet.Broadcast();
+ return true;
+}
+
bool cDvbTuner::SetFrontend(void)
{
+ if (!OpenFrontend())
+ return false;
#define MAXFRONTENDCMDS 16
#define SETCMD(c, d) { Frontend[CmdSeq.num].cmd = (c);\
Frontend[CmdSeq.num].u.data = (d);\
@@ -870,10 +906,16 @@ void cDvbTuner::Action(void)
bool LostLock = false;
fe_status_t Status = (fe_status_t)0;
while (Running()) {
- fe_status_t NewStatus;
- if (GetFrontendStatus(NewStatus))
- Status = NewStatus;
+ if (!isIdle) {
+ fe_status_t NewStatus;
+ if (GetFrontendStatus(NewStatus))
+ Status = NewStatus;
+ }
cMutexLock MutexLock(&mutex);
+ if (SendDiseqc) {
+ CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &diseqc_cmd));
+ SendDiseqc=false;
+ }
int WaitTime = 1000;
switch (tunerStatus) {
case tsIdle:
@@ -925,6 +967,40 @@ void cDvbTuner::Action(void)
}
}
+bool cDvbTuner::SetIdle(bool Idle)
+{
+ if (isIdle == Idle)
+ return true;
+ isIdle = Idle;
+ if (Idle)
+ return CloseFrontend();
+ return OpenFrontend();
+}
+
+bool cDvbTuner::OpenFrontend(void) const
+{
+ if (fd_frontend >= 0)
+ return true;
+ cMutexLock MutexLock(&mutex);
+ fd_frontend = cDvbDevice::DvbOpen(DEV_DVB_FRONTEND, adapter, frontend, O_RDWR | O_NONBLOCK);
+ if (fd_frontend < 0)
+ return false;
+ isIdle = false;
+ return true;
+}
+
+bool cDvbTuner::CloseFrontend(void)
+{
+ if (fd_frontend < 0)
+ return true;
+ cMutexLock MutexLock(&mutex);
+ tunerStatus = tsIdle;
+ newSet.Broadcast();
+ close(fd_frontend);
+ fd_frontend = -1;
+ return true;
+}
+
// --- cDvbSourceParam -------------------------------------------------------
class cDvbSourceParam : public cSourceParam {
@@ -1010,7 +1086,8 @@ const char *DeliverySystemNames[] = {
NULL
};
-cDvbDevice::cDvbDevice(int Adapter, int Frontend)
+cDvbDevice::cDvbDevice(int Adapter, int Frontend, cDevice *ParentDevice)
+:cDevice(ParentDevice)
{
adapter = Adapter;
frontend = Frontend;
@@ -1028,9 +1105,8 @@ cDvbDevice::cDvbDevice(int Adapter, int Frontend)
// Common Interface:
- fd_ca = DvbOpen(DEV_DVB_CA, adapter, frontend, O_RDWR);
- if (fd_ca >= 0)
- ciAdapter = cDvbCiAdapter::CreateCiAdapter(this, fd_ca);
+ int fd_ca = DvbOpen(DEV_DVB_CA, adapter, frontend, O_RDWR);
+ ciAdapter = cDvbCiAdapter::CreateCiAdapter(parentDevice ? parentDevice : this, fd_ca, adapter, frontend);
// The DVR device (will be opened and closed as needed):
@@ -1274,7 +1350,11 @@ bool cDvbDevice::BondDevices(const char *Bondings)
if (d >= 0) {
int ErrorDevice = 0;
if (cDevice *Device1 = cDevice::GetDevice(i)) {
+ if (Device1->HasSubDevice())
+ Device1 = Device1->SubDevice();
if (cDevice *Device2 = cDevice::GetDevice(d)) {
+ if (Device2->HasSubDevice())
+ Device2 = Device2->SubDevice();
if (cDvbDevice *DvbDevice1 = dynamic_cast<cDvbDevice *>(Device1)) {
if (cDvbDevice *DvbDevice2 = dynamic_cast<cDvbDevice *>(Device2)) {
if (!DvbDevice1->Bond(DvbDevice2))
@@ -1308,7 +1388,10 @@ bool cDvbDevice::BondDevices(const char *Bondings)
void cDvbDevice::UnBondDevices(void)
{
for (int i = 0; i < cDevice::NumDevices(); i++) {
- if (cDvbDevice *d = dynamic_cast<cDvbDevice *>(cDevice::GetDevice(i)))
+ cDevice *dev = cDevice::GetDevice(i);
+ if (dev && dev->HasSubDevice())
+ dev = dev->SubDevice();
+ if (cDvbDevice *d = dynamic_cast<cDvbDevice *>(dev))
d->UnBond();
}
}
@@ -1362,6 +1445,26 @@ bool cDvbDevice::BondingOk(const cChannel *Channel, bool ConsiderOccupied) const
return true;
}
+bool cDvbDevice::SetIdleDevice(bool Idle, bool TestOnly)
+{
+ if (TestOnly) {
+ if (ciAdapter)
+ return ciAdapter->SetIdle(Idle, true);
+ return true;
+ }
+ if (!dvbTuner->SetIdle(Idle))
+ return false;
+ if (ciAdapter && !ciAdapter->SetIdle(Idle, false)) {
+ dvbTuner->SetIdle(!Idle);
+ return false;
+ }
+ if (Idle)
+ StopSectionHandler();
+ else
+ StartSectionHandler();
+ return true;
+}
+
bool cDvbDevice::HasCi(void)
{
return ciAdapter;
@@ -1531,7 +1634,7 @@ bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *Ne
bool cDvbDevice::ProvidesEIT(void) const
{
- return dvbTuner != NULL;
+ return !IsIdle() && (dvbTuner != NULL) && !dvbTuner->IsIdle() && ((ciAdapter == NULL) || !ciAdapter->IsIdle());
}
int cDvbDevice::NumProvidedSystems(void) const
@@ -1576,6 +1679,11 @@ bool cDvbDevice::HasLock(int TimeoutMs) const
return dvbTuner ? dvbTuner->Locked(TimeoutMs) : false;
}
+bool cDvbDevice::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
+{
+ return dvbTuner->SendDiseqcCmd(cmd);
+}
+
void cDvbDevice::SetTransferModeForDolbyDigital(int Mode)
{
setTransferModeForDolbyDigital = Mode;
@@ -1585,8 +1693,12 @@ bool cDvbDevice::OpenDvr(void)
{
CloseDvr();
fd_dvr = DvbOpen(DEV_DVB_DVR, adapter, frontend, O_RDONLY | O_NONBLOCK, true);
- if (fd_dvr >= 0)
- tsBuffer = new cTSBuffer(fd_dvr, MEGABYTE(5), CardIndex() + 1);
+ if (fd_dvr >= 0) {
+ if (ciAdapter)
+ tsBuffer = ciAdapter->GetTSBuffer(fd_dvr);
+ if (tsBuffer == NULL)
+ tsBuffer = new cTSBuffer(fd_dvr, MEGABYTE(5), CardIndex() + 1);
+ }
return fd_dvr >= 0;
}
diff --git a/dvbdevice.h b/dvbdevice.h
index 76b8665..ba35328 100644
--- a/dvbdevice.h
+++ b/dvbdevice.h
@@ -156,7 +156,7 @@ class cDvbTuner;
/// The cDvbDevice implements a DVB device which can be accessed through the Linux DVB driver API.
class cDvbDevice : public cDevice {
-protected:
+public:
static cString DvbName(const char *Name, int Adapter, int Frontend);
static int DvbOpen(const char *Name, int Adapter, int Frontend, int Mode, bool ReportError = false);
private:
@@ -176,19 +176,20 @@ private:
int deliverySystems[MAXDELIVERYSYSTEMS];
int numDeliverySystems;
int numModulations;
- int fd_dvr, fd_ca;
+ int fd_dvr;
static cMutex bondMutex;
cDvbDevice *bondedDevice;
mutable bool needsDetachBondedReceivers;
bool QueryDeliverySystems(int fd_frontend);
public:
- cDvbDevice(int Adapter, int Frontend);
+ cDvbDevice(int Adapter, int Frontend, cDevice *ParentDevice = NULL);
virtual ~cDvbDevice();
int Adapter(void) const { return adapter; }
int Frontend(void) const { return frontend; }
virtual bool Ready(void);
virtual cString DeviceType(void) const;
virtual cString DeviceName(void) const;
+ virtual bool SetIdleDevice(bool Idle, bool TestOnly);
static bool BondDevices(const char *Bondings);
///< Bonds the devices as defined in the given Bondings string.
///< A bonding is a sequence of device numbers (starting at 1),
@@ -242,6 +243,7 @@ protected:
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
public:
virtual bool HasLock(int TimeoutMs = 0) const;
+ virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
// PID handle facilities
@@ -274,7 +276,7 @@ public:
// Receiver facilities
private:
- cTSBuffer *tsBuffer;
+ cTSBufferBase *tsBuffer;
protected:
virtual bool OpenDvr(void);
virtual void CloseDvr(void);
diff --git a/menu.c b/menu.c
index f43dec5..67cfb60 100644
--- a/menu.c
+++ b/menu.c
@@ -2321,6 +2321,19 @@ cString cMenuRecordings::DirectoryName(void)
char *s = ExchangeChars(strdup(base), true);
d = AddDirectory(d, s);
free(s);
+ if (!DirectoryOk(*d, false, true)) {
+ cString e;
+ if (LockExtraVideoDirectories(true)) {
+ for (int i = 0; i < ExtraVideoDirectories.Size(); i++) {
+ e = AddDirectory(ExtraVideoDirectories.At(i), s);
+ if (DirectoryOk(*e, false, true)) {
+ UnlockExtraVideoDirectories();
+ return e;
+ }
+ }
+ UnlockExtraVideoDirectories();
+ }
+ }
}
return d;
}
@@ -2348,7 +2361,7 @@ eOSState cMenuRecordings::Play(void)
if (ri->IsDirectory())
Open();
else {
- cReplayControl::SetRecording(ri->Recording()->FileName());
+ cReplayControl::SetRecording(ri->Recording()->FileName(), ri->Recording()->VideoDir());
return osReplay;
}
}
@@ -4488,6 +4501,7 @@ bool cRecordControls::StateChanged(int &State)
cReplayControl *cReplayControl::currentReplayControl = NULL;
cString cReplayControl::fileName;
+cString cReplayControl::videoDir;
cReplayControl::cReplayControl(bool PauseLive)
:cDvbPlayerControl(fileName, PauseLive)
@@ -4502,7 +4516,7 @@ cReplayControl::cReplayControl(bool PauseLive)
lastSpeed = -2; // an invalid value
timeoutShow = 0;
timeSearchActive = false;
- cRecording Recording(fileName);
+ cRecording Recording(fileName, videoDir);
cStatus::MsgReplaying(this, Recording.Name(), Recording.FileName(), true);
marks.Load(fileName, Recording.FramesPerSecond(), Recording.IsPesRecording());
SetTrackDescriptions(false);
@@ -4552,9 +4566,12 @@ void cReplayControl::Stop(void)
cDvbPlayerControl::Stop();
}
-void cReplayControl::SetRecording(const char *FileName)
+void cReplayControl::SetRecording(const char *FileName, const char *VideoDir)
{
fileName = FileName;
+ videoDir = VideoDir;
+ if ((FileName != NULL) && (VideoDir == NULL))
+ videoDir = FindMatchingExtraVideoDirectory(FileName);
}
const char *cReplayControl::NowReplaying(void)
diff --git a/menu.h b/menu.h
index 196c038..487a3f8 100644
--- a/menu.h
+++ b/menu.h
@@ -273,6 +273,7 @@ private:
void ShowTimed(int Seconds = 0);
static cReplayControl *currentReplayControl;
static cString fileName;
+ static cString videoDir;
void ShowMode(void);
bool ShowProgress(bool Initial);
void MarkToggle(void);
@@ -290,7 +291,7 @@ public:
virtual void Show(void);
virtual void Hide(void);
bool Visible(void) { return visible; }
- static void SetRecording(const char *FileName);
+ static void SetRecording(const char *FileName, const char *VideoDir = NULL);
static const char *NowReplaying(void);
static const char *LastReplayed(void);
static void ClearLastReplayed(const char *FileName);
diff --git a/recording.c b/recording.c
index b1ca9c5..6bfbc9b 100644
--- a/recording.c
+++ b/recording.c
@@ -726,6 +726,7 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event)
resume = RESUME_NOT_INITIALIZED;
titleBuffer = NULL;
sortBufferName = sortBufferTime = NULL;
+ videoDir = VideoDirectory;
fileName = NULL;
name = NULL;
fileSizeMB = -1; // unknown
@@ -778,7 +779,7 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event)
info->lifetime = lifetime;
}
-cRecording::cRecording(const char *FileName)
+cRecording::cRecording(const char *FileName, const char *VideoDir)
{
resume = RESUME_NOT_INITIALIZED;
fileSizeMB = -1; // unknown
@@ -793,11 +794,20 @@ cRecording::cRecording(const char *FileName)
deleted = 0;
titleBuffer = NULL;
sortBufferName = sortBufferTime = NULL;
+ if (VideoDir == NULL) {
+ cString extraVideoDir = FindMatchingExtraVideoDirectory(FileName);
+ if (*extraVideoDir == NULL)
+ videoDir = VideoDirectory;
+ else
+ videoDir = strdup(*extraVideoDir);
+ }
+ else
+ videoDir = strdup(VideoDir);
FileName = fileName = strdup(FileName);
if (*(fileName + strlen(fileName) - 1) == '/')
*(fileName + strlen(fileName) - 1) = 0;
- if (strstr(FileName, VideoDirectory) == FileName)
- FileName += strlen(VideoDirectory) + 1;
+ if (strstr(FileName, videoDir) == FileName)
+ FileName += strlen(videoDir) + 1;
const char *p = strrchr(FileName, '/');
name = NULL;
@@ -904,6 +914,8 @@ cRecording::cRecording(const char *FileName)
cRecording::~cRecording()
{
+ if (videoDir != VideoDirectory)
+ free((char*)videoDir);
free(titleBuffer);
free(sortBufferName);
free(sortBufferTime);
@@ -945,7 +957,7 @@ char *cRecording::SortName(void) const
{
char **sb = (RecordingsSortMode == rsmName) ? &sortBufferName : &sortBufferTime;
if (!*sb) {
- char *s = strdup(FileName() + strlen(VideoDirectory));
+ char *s = strdup(FileName() + strlen(videoDir));
if (RecordingsSortMode != rsmName || Setup.AlwaysSortFoldersFirst)
s = StripEpisodeName(s, RecordingsSortMode != rsmName);
strreplace(s, '/', '0'); // some locales ignore '/' when sorting
@@ -986,11 +998,11 @@ const char *cRecording::FileName(void) const
const char *fmt = isPesRecording ? NAMEFORMATPES : NAMEFORMATTS;
int ch = isPesRecording ? priority : channel;
int ri = isPesRecording ? lifetime : instanceId;
- char *Name = LimitNameLengths(strdup(name), DirectoryPathMax - strlen(VideoDirectory) - 1 - 42, DirectoryNameMax); // 42 = length of an actual recording directory name (generated with DATAFORMATTS) plus some reserve
+ char *Name = LimitNameLengths(strdup(name), DirectoryPathMax - strlen(videoDir) - 1 - 42, DirectoryNameMax); // 42 = length of an actual recording directory name (generated with DATAFORMATTS) plus some reserve
if (strcmp(Name, name) != 0)
dsyslog("recording file name '%s' truncated to '%s'", name, Name);
Name = ExchangeChars(Name, true);
- fileName = strdup(cString::sprintf(fmt, VideoDirectory, Name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, ch, ri));
+ fileName = strdup(cString::sprintf(fmt, videoDir, Name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, ch, ri));
free(Name);
}
return fileName;
@@ -1258,9 +1270,14 @@ void cRecordings::Refresh(bool Foreground)
ChangeState();
Unlock();
ScanVideoDir(VideoDirectory, Foreground);
+ if (LockExtraVideoDirectories()) {
+ for (int i = 0; i < ExtraVideoDirectories.Size(); i++)
+ ScanVideoDir(ExtraVideoDirectories.At(i), Foreground, 0, ExtraVideoDirectories.At(i));
+ UnlockExtraVideoDirectories();
+ }
}
-void cRecordings::ScanVideoDir(const char *DirName, bool Foreground, int LinkLevel)
+void cRecordings::ScanVideoDir(const char *DirName, bool Foreground, int LinkLevel, const char *BaseVideoDir)
{
cReadDir d(DirName);
struct dirent *e;
@@ -1280,7 +1297,7 @@ void cRecordings::ScanVideoDir(const char *DirName, bool Foreground, int LinkLev
}
if (S_ISDIR(st.st_mode)) {
if (endswith(buffer, deleted ? DELEXT : RECEXT)) {
- cRecording *r = new cRecording(buffer);
+ cRecording *r = new cRecording(buffer, BaseVideoDir);
if (r->Name()) {
r->NumFrames(); // initializes the numFrames member
r->FileSizeMB(); // initializes the fileSizeMB member
@@ -1295,7 +1312,7 @@ void cRecordings::ScanVideoDir(const char *DirName, bool Foreground, int LinkLev
delete r;
}
else
- ScanVideoDir(buffer, Foreground, LinkLevel + Link);
+ ScanVideoDir(buffer, Foreground, LinkLevel + Link, BaseVideoDir);
}
}
}
diff --git a/recording.h b/recording.h
index ff3119d..9d24a98 100644
--- a/recording.h
+++ b/recording.h
@@ -105,9 +105,10 @@ private:
int priority;
int lifetime;
time_t deleted;
+ const char *videoDir;
public:
cRecording(cTimer *Timer, const cEvent *Event);
- cRecording(const char *FileName);
+ cRecording(const char *FileName, const char *VideoDir = NULL);
virtual ~cRecording();
time_t Start(void) const { return start; }
int Priority(void) const { return priority; }
@@ -116,6 +117,7 @@ public:
virtual int Compare(const cListObject &ListObject) const;
const char *Name(void) const { return name; }
const char *FileName(void) const;
+ const char *VideoDir(void) const { return videoDir; }
const char *Title(char Delimiter = ' ', bool NewIndicator = false, int Level = -1) const;
const cRecordingInfo *Info(void) const { return info; }
const char *PrefixFileName(char Prefix);
@@ -164,7 +166,7 @@ private:
int state;
const char *UpdateFileName(void);
void Refresh(bool Foreground = false);
- void ScanVideoDir(const char *DirName, bool Foreground = false, int LinkLevel = 0);
+ void ScanVideoDir(const char *DirName, bool Foreground = false, int LinkLevel = 0, const char *BaseVideoDir = NULL);
protected:
void Action(void);
public:
diff --git a/svdrp.c b/svdrp.c
index 8a50dae..d7039d3 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -323,6 +323,14 @@ const char *HelpPages[] = {
" be turned up or down, respectively. The option 'mute' will toggle the\n"
" audio muting. If no option is given, the current audio volume level will\n"
" be returned.",
+ "AXVD directory\n"
+ " add directory to extra video directory list",
+ "CXVD\n"
+ " clear extra video directory list",
+ "DXVD directory\n"
+ " delete directory from extra video directory list",
+ "LXVD\n"
+ " list extra video directories",
"QUIT\n"
" Exit vdr (SVDRP).\n"
" You can also hit Ctrl-D to exit.",
@@ -1409,7 +1417,7 @@ void cSVDRP::CmdPLAY(const char *Option)
else
resume.Save(pos);
}
- cReplayControl::SetRecording(recording->FileName());
+ cReplayControl::SetRecording(recording->FileName(), recording->VideoDir());
cControl::Launch(new cReplayControl);
cControl::Attach();
Reply(250, "Playing recording \"%s\" [%s]", num, recording->Title());
@@ -1620,6 +1628,62 @@ void cSVDRP::CmdVOLU(const char *Option)
Reply(250, "Audio volume is %d", cDevice::CurrentVolume());
}
+void cSVDRP::CmdAXVD(const char *Option)
+{
+ if (*Option) {
+ if (!LockExtraVideoDirectories(false)) {
+ Reply(550, "Unable to lock extra video directory list");
+ return;
+ }
+ AddExtraVideoDirectory(Option);
+ UnlockExtraVideoDirectories();
+ Reply(250, "added '%s' to extra video directory list", Option);
+ return;
+ }
+ Reply(501, "Missing directory name");
+}
+
+void cSVDRP::CmdCXVD(const char *Option)
+{
+ if (!LockExtraVideoDirectories(false)) {
+ Reply(550, "Unable to lock extra video directory list");
+ return;
+ }
+ ExtraVideoDirectories.Clear();
+ UnlockExtraVideoDirectories();
+ Reply(250, "cleared extra video directory list");
+}
+
+void cSVDRP::CmdDXVD(const char *Option)
+{
+ if (*Option) {
+ if (!LockExtraVideoDirectories(false)) {
+ Reply(550, "Unable to lock extra video directory list");
+ return;
+ }
+ DelExtraVideoDirectory(Option);
+ UnlockExtraVideoDirectories();
+ Reply(250, "removed '%s' from extra video directory list", Option);
+ return;
+ }
+ Reply(501, "Missing directory name");
+}
+
+void cSVDRP::CmdLXVD(const char *Option)
+{
+ if (!LockExtraVideoDirectories(false)) {
+ Reply(550, "Unable to lock extra video directory list");
+ return;
+ }
+ if (ExtraVideoDirectories.Size() == 0)
+ Reply(550, "no extra video directories in list");
+ else {
+ for (int i = 0; i < ExtraVideoDirectories.Size(); i++)
+ Reply(i < ExtraVideoDirectories.Size() - 1 ? -250 : 250, "%s", ExtraVideoDirectories.At(i));
+ }
+ UnlockExtraVideoDirectories();
+}
+
#define CMD(c) (strcasecmp(Cmd, c) == 0)
void cSVDRP::Execute(char *Cmd)
@@ -1671,6 +1735,10 @@ void cSVDRP::Execute(char *Cmd)
else if (CMD("UPDR")) CmdUPDR(s);
else if (CMD("UPDT")) CmdUPDT(s);
else if (CMD("VOLU")) CmdVOLU(s);
+ else if (CMD("AXVD")) CmdAXVD(s);
+ else if (CMD("CXVD")) CmdCXVD(s);
+ else if (CMD("DXVD")) CmdDXVD(s);
+ else if (CMD("LXVD")) CmdLXVD(s);
else if (CMD("QUIT")) Close(true);
else Reply(500, "Command unrecognized: \"%s\"", Cmd);
}
diff --git a/svdrp.h b/svdrp.h
index 5ec9bc7..74f137d 100644
--- a/svdrp.h
+++ b/svdrp.h
@@ -83,6 +83,10 @@ private:
void CmdUPDT(const char *Option);
void CmdUPDR(const char *Option);
void CmdVOLU(const char *Option);
+ void CmdAXVD(const char *Option);
+ void CmdCXVD(const char *Option);
+ void CmdDXVD(const char *Option);
+ void CmdLXVD(const char *Option);
void Execute(char *Cmd);
public:
cSVDRP(int Port);
diff --git a/tools.c b/tools.c
index ab46d02..c2ac5ab 100644
--- a/tools.c
+++ b/tools.c
@@ -375,12 +375,15 @@ int FreeDiskSpaceMB(const char *Directory, int *UsedMB)
return Free;
}
-bool DirectoryOk(const char *DirName, bool LogErrors)
+bool DirectoryOk(const char *DirName, bool LogErrors, bool JustReadOnly)
{
+ int mode = R_OK;
+ if (!JustReadOnly)
+ mode |= W_OK | X_OK;
struct stat ds;
if (stat(DirName, &ds) == 0) {
if (S_ISDIR(ds.st_mode)) {
- if (access(DirName, R_OK | W_OK | X_OK) == 0)
+ if (access(DirName, mode) == 0)
return true;
else if (LogErrors)
esyslog("ERROR: can't access %s", DirName);
diff --git a/tools.h b/tools.h
index d6a778e..6cf9b01 100644
--- a/tools.h
+++ b/tools.h
@@ -228,7 +228,7 @@ cString itoa(int n);
cString AddDirectory(const char *DirName, const char *FileName);
bool EntriesOnSameFileSystem(const char *File1, const char *File2);
int FreeDiskSpaceMB(const char *Directory, int *UsedMB = NULL);
-bool DirectoryOk(const char *DirName, bool LogErrors = false);
+bool DirectoryOk(const char *DirName, bool LogErrors = false, bool JustReadOnly = false);
bool MakeDirs(const char *FileName, bool IsDirectory = false);
bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks = false);
bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis = false, const char *IgnoreFiles[] = NULL);
diff --git a/vdr.c b/vdr.c
index c63eeca..bf04658 100644
--- a/vdr.c
+++ b/vdr.c
@@ -198,6 +198,7 @@ int main(int argc, char *argv[])
int SVDRPport = DEFAULTSVDRPPORT;
const char *AudioCommand = NULL;
const char *VideoDirectory = DEFAULTVIDEODIR;
+ const char *ExtraVideoDirectory = NULL;
const char *ConfigDirectory = NULL;
const char *CacheDirectory = NULL;
const char *ResourceDirectory = NULL;
@@ -257,6 +258,7 @@ int main(int argc, char *argv[])
{ "version", no_argument, NULL, 'V' },
{ "vfat", no_argument, NULL, 'v' | 0x100 },
{ "video", required_argument, NULL, 'v' },
+ { "extravideo", required_argument, NULL, 'v' | 0x200 },
{ "watchdog", required_argument, NULL, 'w' },
{ NULL, no_argument, NULL, 0 }
};
@@ -444,6 +446,12 @@ int main(int argc, char *argv[])
while (optarg && *optarg && optarg[strlen(optarg) - 1] == '/')
optarg[strlen(optarg) - 1] = 0;
break;
+ case 'v' | 0x200:
+ ExtraVideoDirectory = optarg;
+ while (optarg && *optarg && optarg[strlen(optarg) - 1] == '/')
+ optarg[strlen(optarg) - 1] = 0;
+ AddExtraVideoDirectory(ExtraVideoDirectory);
+ break;
case 'w': if (isnumber(optarg)) {
int t = atoi(optarg);
if (t >= 0) {
@@ -538,6 +546,8 @@ int main(int argc, char *argv[])
" root\n"
" --userdump allow coredumps if -u is given (debugging)\n"
" -v DIR, --video=DIR use DIR as video directory (default: %s)\n"
+ " --extravideo=DIR use DIR as an additional readonly video directory\n"
+ " can be used multiple times\n"
" -V, --version print version information and exit\n"
" --vfat for backwards compatibility (same as\n"
" --dirnames=250,40,1\n"
diff --git a/videodir.c b/videodir.c
index d39ab05..fe97b63 100644
--- a/videodir.c
+++ b/videodir.c
@@ -19,6 +19,65 @@
#include "recording.h"
#include "tools.h"
+cStringList ExtraVideoDirectories;
+bool ExtraVideoDirectoriesIsLocked = false;
+cMutex ExtraVideoDirectoriesMutex;
+
+bool LockExtraVideoDirectories(bool Wait)
+{
+ if (!Wait && ExtraVideoDirectoriesIsLocked)
+ return false;
+ ExtraVideoDirectoriesMutex.Lock();
+ ExtraVideoDirectoriesIsLocked = true;
+ return true;
+}
+
+void UnlockExtraVideoDirectories(void)
+{
+ ExtraVideoDirectoriesIsLocked = false;
+ ExtraVideoDirectoriesMutex.Unlock();
+}
+
+void AddExtraVideoDirectory(const char *Directory)
+{
+ if ((Directory != NULL) && (ExtraVideoDirectories.Find(Directory) < 0))
+ ExtraVideoDirectories.Append(strdup(Directory));
+}
+
+void DelExtraVideoDirectory(const char *Directory)
+{
+ if (Directory != NULL) {
+ int index = ExtraVideoDirectories.Find(Directory);
+ if (index < 0)
+ return;
+ char *dir = ExtraVideoDirectories.At(index);
+ ExtraVideoDirectories.Remove(index);
+ free(dir);
+ }
+}
+
+cString FindMatchingExtraVideoDirectory(const char *FileName)
+{
+ if (FileName == NULL)
+ return cString(NULL);
+ uint fileLen = strlen(FileName);
+ if ((strlen(VideoDirectory) < fileLen) && startswith(FileName, VideoDirectory))
+ return cString(NULL);
+ if (!LockExtraVideoDirectories())
+ return cString(NULL);
+ int i = 0;
+ cString videoDir(NULL);
+ while (i < ExtraVideoDirectories.Size()) {
+ if ((strlen(ExtraVideoDirectories.At(i)) < fileLen) && startswith(FileName, ExtraVideoDirectories.At(i))) {
+ videoDir = ExtraVideoDirectories.At(i);
+ break;
+ }
+ i++;
+ }
+ UnlockExtraVideoDirectories();
+ return videoDir;
+}
+
const char *VideoDirectory = VIDEODIR;
void SetVideoDirectory(const char *Directory)
@@ -28,13 +87,13 @@ void SetVideoDirectory(const char *Directory)
class cVideoDirectory {
private:
- char *name, *stored, *adjusted;
+ char *videoDir, *name, *stored, *adjusted;
int length, number, digits;
public:
- cVideoDirectory(void);
+ cVideoDirectory(const char *VideoDir = NULL);
~cVideoDirectory();
int FreeMB(int *UsedMB = NULL);
- const char *Name(void) { return name ? name : VideoDirectory; }
+ const char *Name(void) { return name ? name : videoDir; }
const char *Stored(void) { return stored; }
int Length(void) { return length; }
bool IsDistributed(void) { return name != NULL; }
@@ -43,10 +102,14 @@ public:
const char *Adjust(const char *FileName);
};
-cVideoDirectory::cVideoDirectory(void)
+cVideoDirectory::cVideoDirectory(const char *VideoDir)
{
- length = strlen(VideoDirectory);
- name = (VideoDirectory[length - 1] == '0') ? strdup(VideoDirectory) : NULL;
+ if (VideoDir == NULL)
+ videoDir = strdup(VideoDirectory);
+ else
+ videoDir = strdup(VideoDir);
+ length = strlen(videoDir);
+ name = (videoDir[length - 1] == '0') ? strdup(videoDir) : NULL;
stored = adjusted = NULL;
number = -1;
digits = 0;
@@ -54,6 +117,7 @@ cVideoDirectory::cVideoDirectory(void)
cVideoDirectory::~cVideoDirectory()
{
+ free(videoDir);
free(name);
free(stored);
free(adjusted);
@@ -61,7 +125,7 @@ cVideoDirectory::~cVideoDirectory()
int cVideoDirectory::FreeMB(int *UsedMB)
{
- return FreeDiskSpaceMB(name ? name : VideoDirectory, UsedMB);
+ return FreeDiskSpaceMB(name ? name : videoDir, UsedMB);
}
bool cVideoDirectory::Next(void)
@@ -113,14 +177,18 @@ cUnbufferedFile *OpenVideoFile(const char *FileName, int Flags)
const char *ActualFileName = FileName;
// Incoming name must be in base video directory:
+ cString extraVideoDir;
if (strstr(FileName, VideoDirectory) != FileName) {
- esyslog("ERROR: %s not in %s", FileName, VideoDirectory);
- errno = ENOENT; // must set 'errno' - any ideas for a better value?
- return NULL;
+ extraVideoDir = FindMatchingExtraVideoDirectory(FileName);
+ if (*extraVideoDir == NULL) {
+ esyslog("ERROR: %s not in %s", FileName, VideoDirectory);
+ errno = ENOENT; // must set 'errno' - any ideas for a better value?
+ return NULL;
+ }
}
// Are we going to create a new file?
if ((Flags & O_CREAT) != 0) {
- cVideoDirectory Dir;
+ cVideoDirectory Dir(*extraVideoDir);
if (Dir.IsDistributed()) {
// Find the directory with the most free space:
int MaxFree = Dir.FreeMB();
diff --git a/videodir.h b/videodir.h
index a25ac31..bee76c3 100644
--- a/videodir.h
+++ b/videodir.h
@@ -13,6 +13,16 @@
#include <stdlib.h>
#include "tools.h"
+#define EXTRA_VIDEO_DIRECTORIES_PATCH 1
+
+extern cStringList ExtraVideoDirectories;
+
+bool LockExtraVideoDirectories(bool Wait = true);
+void UnlockExtraVideoDirectories(void);
+void AddExtraVideoDirectory(const char *Directory);
+void DelExtraVideoDirectory(const char *Directory);
+cString FindMatchingExtraVideoDirectory(const char *FileName);
+
extern const char *VideoDirectory;
void SetVideoDirectory(const char *Directory);
|