vdr
1.7.31
Main Page
Namespaces
Classes
Files
File List
File Members
dvbdevice.h
Go to the documentation of this file.
1
/*
2
* dvbdevice.h: The DVB device tuner interface
3
*
4
* See the main source file 'vdr.c' for copyright information and
5
* how to reach the author.
6
*
7
* $Id: dvbdevice.h 2.26 2012/03/31 11:13:31 kls Exp $
8
*/
9
10
#ifndef __DVBDEVICE_H
11
#define __DVBDEVICE_H
12
13
#include <linux/dvb/frontend.h>
14
#include <linux/dvb/version.h>
15
#include "
device.h
"
16
17
#if (DVB_API_VERSION << 8 | DVB_API_VERSION_MINOR) < 0x0503
18
#error VDR requires Linux DVB driver API version 5.3 or higher!
19
#endif
20
21
#define MAXDVBDEVICES 8
22
#define MAXDELIVERYSYSTEMS 8
23
24
#define DEV_VIDEO "/dev/video"
25
#define DEV_DVB_BASE "/dev/dvb"
26
#define DEV_DVB_ADAPTER "adapter"
27
#define DEV_DVB_OSD "osd"
28
#define DEV_DVB_FRONTEND "frontend"
29
#define DEV_DVB_DVR "dvr"
30
#define DEV_DVB_DEMUX "demux"
31
#define DEV_DVB_VIDEO "video"
32
#define DEV_DVB_AUDIO "audio"
33
#define DEV_DVB_CA "ca"
34
35
struct
tDvbParameterMap
{
36
int
userValue
;
37
int
driverValue
;
38
const
char
*
userString
;
39
};
40
41
const
char
*
MapToUserString
(
int
Value,
const
tDvbParameterMap
*Map);
42
int
MapToUser
(
int
Value,
const
tDvbParameterMap
*Map,
const
char
**String = NULL);
43
int
MapToDriver
(
int
Value,
const
tDvbParameterMap
*Map);
44
int
UserIndex
(
int
Value,
const
tDvbParameterMap
*Map);
45
int
DriverIndex
(
int
Value,
const
tDvbParameterMap
*Map);
46
47
extern
const
tDvbParameterMap
InversionValues
[];
48
extern
const
tDvbParameterMap
BandwidthValues
[];
49
extern
const
tDvbParameterMap
CoderateValues
[];
50
extern
const
tDvbParameterMap
ModulationValues
[];
51
extern
const
tDvbParameterMap
SystemValuesSat
[];
52
extern
const
tDvbParameterMap
SystemValuesTerr
[];
53
extern
const
tDvbParameterMap
TransmissionValues
[];
54
extern
const
tDvbParameterMap
GuardValues
[];
55
extern
const
tDvbParameterMap
HierarchyValues
[];
56
extern
const
tDvbParameterMap
RollOffValues
[];
57
58
class
cDvbTransponderParameters
{
59
friend
class
cDvbSourceParam
;
60
private
:
61
char
polarization
;
62
int
inversion
;
63
int
bandwidth
;
64
int
coderateH
;
65
int
coderateL
;
66
int
modulation
;
67
int
system
;
68
int
transmission
;
69
int
guard
;
70
int
hierarchy
;
71
int
rollOff
;
72
int
plpId
;
73
int
PrintParameter
(
char
*p,
char
Name,
int
Value)
const
;
74
const
char
*
ParseParameter
(
const
char
*s,
int
&Value,
const
tDvbParameterMap
*Map = NULL);
75
public
:
76
cDvbTransponderParameters
(
const
char
*Parameters = NULL);
77
char
Polarization
(
void
)
const
{
return
polarization
; }
78
int
Inversion
(
void
)
const
{
return
inversion
; }
79
int
Bandwidth
(
void
)
const
{
return
bandwidth
; }
80
int
CoderateH
(
void
)
const
{
return
coderateH
; }
81
int
CoderateL
(
void
)
const
{
return
coderateL
; }
82
int
Modulation
(
void
)
const
{
return
modulation
; }
83
int
System
(
void
)
const
{
return
system
; }
84
int
Transmission
(
void
)
const
{
return
transmission
; }
85
int
Guard
(
void
)
const
{
return
guard
; }
86
int
Hierarchy
(
void
)
const
{
return
hierarchy
; }
87
int
RollOff
(
void
)
const
{
return
rollOff
; }
88
int
PlpId
(
void
)
const
{
return
plpId
; }
89
void
SetPolarization
(
char
Polarization
) {
polarization
=
Polarization
; }
90
void
SetInversion
(
int
Inversion
) {
inversion
=
Inversion
; }
91
void
SetBandwidth
(
int
Bandwidth
) {
bandwidth
=
Bandwidth
; }
92
void
SetCoderateH
(
int
CoderateH
) {
coderateH
=
CoderateH
; }
93
void
SetCoderateL
(
int
CoderateL
) {
coderateL
=
CoderateL
; }
94
void
SetModulation
(
int
Modulation
) {
modulation
=
Modulation
; }
95
void
SetSystem
(
int
System
) {
system
=
System
; }
96
void
SetTransmission
(
int
Transmission
) {
transmission
=
Transmission
; }
97
void
SetGuard
(
int
Guard
) {
guard
=
Guard
; }
98
void
SetHierarchy
(
int
Hierarchy
) {
hierarchy
=
Hierarchy
; }
99
void
SetRollOff
(
int
RollOff
) {
rollOff
=
RollOff
; }
100
void
SetPlpId
(
int
PlpId
) {
plpId
=
PlpId
; }
101
cString
ToString
(
char
Type)
const
;
102
bool
Parse
(
const
char
*s);
103
};
104
105
class
cDvbTuner
;
106
108
109
class
cDvbDevice
:
public
cDevice
{
110
protected
:
111
static
cString
DvbName
(
const
char
*Name,
int
Adapter
,
int
Frontend
);
112
static
int
DvbOpen
(
const
char
*Name,
int
Adapter,
int
Frontend,
int
Mode,
bool
ReportError =
false
);
113
private
:
114
static
bool
Exists
(
int
Adapter,
int
Frontend);
116
static
bool
Probe
(
int
Adapter,
int
Frontend);
118
public
:
119
static
bool
Initialize
(
void
);
123
protected
:
124
int
adapter
,
frontend
;
125
private
:
126
dvb_frontend_info
frontendInfo
;
127
int
deliverySystems
[
MAXDELIVERYSYSTEMS
];
128
int
numDeliverySystems
;
129
int
numModulations
;
130
int
fd_dvr
,
fd_ca
;
131
static
cMutex
bondMutex
;
132
cDvbDevice
*
bondedDevice
;
133
mutable
bool
needsDetachBondedReceivers
;
134
bool
QueryDeliverySystems
(
int
fd_frontend);
135
public
:
136
cDvbDevice
(
int
Adapter,
int
Frontend);
137
virtual
~cDvbDevice
();
138
int
Adapter
(
void
)
const
{
return
adapter
; }
139
int
Frontend
(
void
)
const
{
return
frontend
; }
140
virtual
bool
Ready
(
void
);
141
virtual
cString
DeviceType
(
void
)
const
;
142
virtual
cString
DeviceName
(
void
)
const
;
143
static
bool
BondDevices
(
const
char
*Bondings);
149
static
void
UnBondDevices
(
void
);
151
bool
Bond
(
cDvbDevice
*Device);
159
void
UnBond
(
void
);
163
bool
BondingOk
(
const
cChannel
*Channel,
bool
ConsiderOccupied =
false
)
const
;
170
171
// Common Interface facilities:
172
173
private
:
174
cCiAdapter
*
ciAdapter
;
175
176
// Channel facilities
177
178
private
:
179
cDvbTuner
*
dvbTuner
;
180
public
:
181
virtual
bool
ProvidesDeliverySystem
(
int
DeliverySystem)
const
;
182
virtual
bool
ProvidesSource
(
int
Source)
const
;
183
virtual
bool
ProvidesTransponder
(
const
cChannel
*Channel)
const
;
184
virtual
bool
ProvidesChannel
(
const
cChannel
*Channel,
int
Priority
=
IDLEPRIORITY
,
bool
*NeedsDetachReceivers = NULL)
const
;
185
virtual
bool
ProvidesEIT
(
void
)
const
;
186
virtual
int
NumProvidedSystems
(
void
)
const
;
187
virtual
int
SignalStrength
(
void
)
const
;
188
virtual
int
SignalQuality
(
void
)
const
;
189
virtual
const
cChannel
*
GetCurrentlyTunedTransponder
(
void
)
const
;
190
virtual
bool
IsTunedToTransponder
(
const
cChannel
*Channel)
const
;
191
virtual
bool
MaySwitchTransponder
(
const
cChannel
*Channel)
const
;
192
protected
:
193
virtual
bool
SetChannelDevice
(
const
cChannel
*Channel,
bool
LiveView);
194
public
:
195
virtual
bool
HasLock
(
int
TimeoutMs = 0);
196
197
// PID handle facilities
198
199
protected
:
200
virtual
bool
SetPid
(
cPidHandle
*Handle,
int
Type,
bool
On);
201
202
// Section filter facilities
203
204
protected
:
205
virtual
int
OpenFilter
(u_short Pid,
u_char
Tid,
u_char
Mask);
206
virtual
void
CloseFilter
(
int
Handle);
207
208
// Common Interface facilities:
209
210
public
:
211
virtual
bool
HasCi
(
void
);
212
213
// Audio facilities
214
215
protected
:
216
static
int
setTransferModeForDolbyDigital
;
217
public
:
218
static
void
SetTransferModeForDolbyDigital
(
int
Mode);
// needs to be here for backwards compatibility
224
225
// Receiver facilities
226
227
private
:
228
cTSBuffer
*
tsBuffer
;
229
protected
:
230
virtual
bool
OpenDvr
(
void
);
231
virtual
void
CloseDvr
(
void
);
232
virtual
bool
GetTSPacket
(
uchar
*&Data);
233
virtual
void
DetachAllReceivers
(
void
);
234
};
235
236
// A plugin that implements a DVB device derived from cDvbDevice needs to create
237
// a cDvbDeviceProbe derived object on the heap in order to have its Probe()
238
// function called, where it can actually create the appropriate device.
239
// The cDvbDeviceProbe object must be created in the plugin's constructor,
240
// and deleted in its destructor.
241
242
class
cDvbDeviceProbe
:
public
cListObject
{
243
public
:
244
cDvbDeviceProbe
(
void
);
245
virtual
~cDvbDeviceProbe
();
246
static
uint32_t
GetSubsystemId
(
int
Adapter,
int
Frontend);
247
virtual
bool
Probe
(
int
Adapter,
int
Frontend) = 0;
251
};
252
253
extern
cList<cDvbDeviceProbe>
DvbDeviceProbes
;
254
255
#endif //__DVBDEVICE_H
Generated by
1.8.1.2