-
Notifications
You must be signed in to change notification settings - Fork 1
/
device.h
178 lines (164 loc) · 4.37 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ifndef _PVRINPUT_DEVICE_H_
#define _PVRINPUT_DEVICE_H_
typedef enum { /* enumeration with encoder states */
eStop,
eStart,
} eEncState;
typedef enum {
eTelevision,
eRadio,
eSVideo0,
eSVideo1,
eSVideo2,
eSVideo3,
eComposite0,
eComposite1,
eComposite2,
eComposite3,
eComposite4,
eComponent,
eExternalInput
} eInputType;
typedef enum {
undef,
ivtv,
cx18,
pvrusb2,
cx88_blackbird,
hdpvr,
} eV4l2Driver;
typedef enum {
UNDEF,
PVR150,
PVR250,
PVR350,
PVR500_1,
PVR500_2,
HVR1300,
HVR1600,
HVR1900,
HVR1950,
PVRUSB2,
HDPVR,
} eV4l2CardName;
class cPvrReadThread;
class cPvrDevice : public cDevice {
friend class cPvrReadThread;
#ifdef __DYNAMIC_DEVICE_PROBE
friend class cPvrDeviceProbe;
#endif
private:
static bool Probe(int DeviceNumber);
static cString externChannelSwitchScript;
static int VBIDeviceCount;
public:
static bool Initialize(void);
static void StopAll(void);
static void ReInitAll(void);
static int Count();
static cPvrDevice * Get(int index);
private:
int index;
int number;
int v4l2_fd;
int mpeg_fd;
int radio_fd;
int v4l2_dev;
int mpeg_dev;
cString radio_devname;
int inputs[12];
int numInputs;
int vpid;
int apid;
int tpid;
cChannel CurrentChannel;
uint64_t CurrentNorm;
int CurrentLinesPerFrame;
int CurrentFrequency;
int CurrentInput;
eInputType CurrentInputType; // can only be eTelevision, eRadio or eExternalInput
uint64_t newNorm;
int newLinesPerFrame;
int newFrequency;
int newInput;
eInputType newInputType;
cString BusID;
eEncState EncoderState;
int driver_apiversion;
bool SupportsSlicedVBI;
cString vbi_devname;
bool hasDecoder;
bool hasTuner;
int streamType;
bool dvrOpen;
bool delivered;
bool isClosing;
bool readThreadRunning;
bool ChannelSettingsDone;
bool pvrusb2_ready;
eV4l2Driver driver;
eV4l2CardName cardname;
cRingBufferLinear *tsBuffer;
int tsBufferPrefill;
cPvrReadThread *readThread;
cPvrSectionHandler sectionHandler;
protected:
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
#if VDRVERSNUM >= 10600
virtual void CloseFilter(int Handle);
#endif
virtual bool OpenDvr(void);
virtual void CloseDvr(void);
void ResetBuffering();
bool IsBuffering();
virtual bool GetTSPacket(uchar *&Data);
public:
cPvrDevice(int DeviceNumber, cDevice *ParentDevice = NULL);
virtual ~cPvrDevice(void);
virtual bool ProvidesSource(int Source) const;
virtual bool ProvidesTransponder(const cChannel *Channel) const;
virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL) const;
virtual int NumProvidedSystems(void) const;
virtual int SignalStrength(void) const;
virtual int SignalQuality(void) const;
virtual const cChannel *GetCurrentlyTunedTransponder(void) const;
virtual bool IsTunedToTransponder(const cChannel *Channel) const;
virtual bool MaySwitchTransponder(const cChannel *Channel) const;
bool ParseChannel(const cChannel *Channel, int *input, uint64_t *norm, int *LinesPerFrame, int *card,
eInputType *inputType, int *apid, int *vpid, int *tpid) const;
int ReOpen(void);
void ReInit(void);
void Stop(void);
void StopReadThread(void);
void GetStandard(void);
void TurnOffSlicedVBI(void);
bool Tune(int frequency);
bool SetInput(int input);
bool SetAudioInput(int input);
bool SetVideoNorm(uint64_t norm);
bool SetVideoSize(int width, int height);
void SetTunerAudioMode(int tuneraudiomode);
void SetAudioVolumeTV(void);
void SetEncoderState(eEncState state);
bool SetVBImode(int vbiLinesPerFrame, int vbistatus);
bool ControlIdIsValid(__u32 ctrlid);
// overloaded function SetControlValue
int SetControlValue(__u32 control, __s32 Val);
int SetControlValue(struct valSet *vs, __s32 Val);
int SetControlValue(__u32 control_class, __u32 control, __s32 Val, struct v4l2_queryctrl queryctrl);
int QueryControl(struct valSet *vs);
bool QueryAllControls(void);
};
#ifdef __DYNAMIC_DEVICE_PROBE
class cPvrDeviceProbe : public cDynamicDeviceProbe {
private:
static cPvrDeviceProbe *probe;
public:
static void Init(void);
static void Shutdown(void);
virtual cDevice *Attach(cDevice *ParentDevice, const char *DevPath);
};
#endif
#endif