forked from aiolos/sasc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevice.h
157 lines (142 loc) · 4.15 KB
/
device.h
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
/*
* Softcam plugin to VDR (C++)
*
* This code 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 code 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
#ifndef ___DEVICE_H
#define ___DEVICE_H
#include <linux/dvb/ca.h>
#include <vdr/dvbdevice.h>
#include <vdr/thread.h>
#include "misc.h"
typedef int caid_t;
class cCam;
class cDeCSA;
class cDeCsaTSBuffer;
class cScCiAdapter;
// ----------------------------------------------------------------
class cCaDescr {
private:
unsigned char *descr;
int len;
public:
cCaDescr(void);
cCaDescr(const cCaDescr &arg);
~cCaDescr();
const unsigned char *Get(int &l) const;
void Set(const cCaDescr *d);
void Set(const unsigned char *de, int l);
void Clear(void);
bool operator== (const cCaDescr &arg) const;
void Join(const cCaDescr *cd, bool rev=false);
cString ToString(void);
};
// ----------------------------------------------------------------
class cPrgPid : public cSimpleItem {
private:
bool proc;
public:
int type, pid;
cCaDescr caDescr;
//
cPrgPid(int Type, int Pid) { type=Type; pid=Pid; proc=false; }
bool Proc(void) const { return proc; }
void Proc(bool is) { proc=is; };
};
// ----------------------------------------------------------------
class cPrg : public cSimpleItem {
private:
bool isUpdate, pidCaDescr;
//
void Setup(void);
public:
int sid, source, transponder;
cSimpleList<cPrgPid> pids;
cCaDescr caDescr;
//
cPrg(void);
cPrg(int Sid, bool IsUpdate);
bool IsUpdate(void) const { return isUpdate; }
bool HasPidCaDescr(void) const { return pidCaDescr; }
void SetPidCaDescr(bool val) { pidCaDescr=val; }
bool SimplifyCaDescr(void);
void DumpCaDescr(int c);
};
// ----------------------------------------------------------------
class cScDevices : public cDvbDevice {
private:
static int budget;
public:
#if APIVERSNUM >= 10711 // make compiler happy. These are never used!
cScDevices(void):cDvbDevice(0,0) {}
#else
cScDevices(void):cDvbDevice(0) {}
#endif
static void OnPluginLoad(void);
static void OnPluginUnload(void);
static bool Initialize(void);
static void Startup(void);
static void Shutdown(void);
static void SetForceBudget(int n);
static bool ForceBudget(int n);
static void DvbName(const char *Name, int a, int f, char *buffer, int len);
static int DvbOpen(const char *Name, int a, int f, int Mode, bool ReportError=false);
};
// ----------------------------------------------------------------
class cScDevice : public cDvbDevice {
friend class cScDevices;
private:
cDeCSA *decsa;
cDeCsaTSBuffer *tsBuffer;
cMutex tsMutex;
cScCiAdapter *ciadapter;
cCiAdapter *hwciadapter;
cCam *cam;
int fd_dvr, fd_ca, fd_ca2;
bool softcsa, fullts;
cMutex cafdMutex;
cTimeMs lastDump;
//
#ifndef SASC
void LateInit(void);
void EarlyShutdown(void);
bool ScActive(void);
#endif //SASC
//
protected:
#ifndef SASC
virtual bool Ready(void);
virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
virtual bool OpenDvr(void);
virtual void CloseDvr(void);
virtual bool GetTSPacket(uchar *&Data);
#endif //SASC
public:
cScDevice(int Adapter, int Frontend, int cafd);
~cScDevice();
#ifndef SASC
virtual bool HasCi(void);
#endif //SASC
virtual bool SetCaDescr(ca_descr_t *ca_descr, bool initial);
virtual bool SetCaPid(ca_pid_t *ca_pid);
int FilterHandle(void);
void DumpAV7110(void);
cCam *Cam(void) { return cam; }
bool SoftCSA(bool live);
void CaidsChanged(void);
};
#endif // ___DEVICE_H