2014-03-08 12:07:47 +01:00
|
|
|
/*
|
|
|
|
* device.h: SAT>IP plugin for the Video Disk Recorder
|
|
|
|
*
|
|
|
|
* See the README file for copyright information and how to reach the author.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SATIP_DEVICE_H
|
|
|
|
#define __SATIP_DEVICE_H
|
|
|
|
|
|
|
|
#include <vdr/device.h>
|
|
|
|
#include "common.h"
|
|
|
|
#include "deviceif.h"
|
|
|
|
#include "tuner.h"
|
|
|
|
#include "sectionfilter.h"
|
|
|
|
#include "statistics.h"
|
|
|
|
|
|
|
|
class cSatipDevice : public cDevice, public cSatipPidStatistics, public cSatipBufferStatistics, public cSatipDeviceIf {
|
|
|
|
// static ones
|
|
|
|
public:
|
2017-11-13 21:12:10 +01:00
|
|
|
static cMutex mutexS;
|
2014-03-08 12:07:47 +01:00
|
|
|
static bool Initialize(unsigned int DeviceCount);
|
|
|
|
static void Shutdown(void);
|
|
|
|
static unsigned int Count(void);
|
|
|
|
static cSatipDevice *GetSatipDevice(int CardIndex);
|
2014-11-10 22:46:45 +01:00
|
|
|
static cString GetSatipStatus(void);
|
2014-03-08 12:07:47 +01:00
|
|
|
|
|
|
|
// private parts
|
|
|
|
private:
|
2014-03-28 18:53:22 +01:00
|
|
|
enum {
|
2017-11-13 21:12:10 +01:00
|
|
|
eReadyTimeoutMs = 2000, // in milliseconds
|
|
|
|
eTuningTimeoutMs = 1000 // in milliseconds
|
2014-03-28 18:53:22 +01:00
|
|
|
};
|
2014-03-08 12:07:47 +01:00
|
|
|
unsigned int deviceIndexM;
|
2017-04-17 21:10:29 +02:00
|
|
|
int bytesDeliveredM;
|
2014-03-08 12:07:47 +01:00
|
|
|
bool isOpenDvrM;
|
2017-04-17 21:10:29 +02:00
|
|
|
bool checkTsBufferM;
|
2014-03-08 12:07:47 +01:00
|
|
|
cString deviceNameM;
|
|
|
|
cChannel channelM;
|
|
|
|
cRingBufferLinear *tsBufferM;
|
|
|
|
cSatipTuner *pTunerM;
|
|
|
|
cSatipSectionFilterHandler *pSectionFilterHandlerM;
|
2014-03-28 18:53:22 +01:00
|
|
|
cTimeMs createdM;
|
2017-11-13 21:12:10 +01:00
|
|
|
cCondVar tunedM;
|
2014-03-08 12:07:47 +01:00
|
|
|
|
|
|
|
// constructor & destructor
|
|
|
|
public:
|
2015-08-16 00:38:03 +02:00
|
|
|
explicit cSatipDevice(unsigned int deviceIndexP);
|
2014-03-08 12:07:47 +01:00
|
|
|
virtual ~cSatipDevice();
|
|
|
|
cString GetInformation(unsigned int pageP = SATIP_DEVICE_INFO_ALL);
|
|
|
|
|
|
|
|
// copy and assignment constructors
|
|
|
|
private:
|
|
|
|
cSatipDevice(const cSatipDevice&);
|
|
|
|
cSatipDevice& operator=(const cSatipDevice&);
|
|
|
|
|
|
|
|
// for statistics and general information
|
|
|
|
cString GetGeneralInformation(void);
|
|
|
|
cString GetPidsInformation(void);
|
|
|
|
cString GetFiltersInformation(void);
|
|
|
|
|
|
|
|
// for channel info
|
|
|
|
public:
|
2014-03-23 16:59:08 +01:00
|
|
|
virtual bool Ready(void);
|
2014-03-08 12:07:47 +01:00
|
|
|
virtual cString DeviceType(void) const;
|
|
|
|
virtual cString DeviceName(void) const;
|
2014-03-10 20:21:08 +01:00
|
|
|
virtual bool AvoidRecording(void) const;
|
2017-05-24 22:13:21 +02:00
|
|
|
virtual bool SignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL, int *Status = NULL) const;
|
2014-03-08 12:07:47 +01:00
|
|
|
virtual int SignalStrength(void) const;
|
|
|
|
virtual int SignalQuality(void) const;
|
|
|
|
|
|
|
|
// for channel selection
|
|
|
|
public:
|
|
|
|
virtual bool ProvidesSource(int sourceP) const;
|
|
|
|
virtual bool ProvidesTransponder(const cChannel *channelP) const;
|
|
|
|
virtual bool ProvidesChannel(const cChannel *channelP, int priorityP = -1, bool *needsDetachReceiversP = NULL) const;
|
|
|
|
virtual bool ProvidesEIT(void) const;
|
|
|
|
virtual int NumProvidedSystems(void) const;
|
|
|
|
virtual const cChannel *GetCurrentlyTunedTransponder(void) const;
|
|
|
|
virtual bool IsTunedToTransponder(const cChannel *channelP) const;
|
|
|
|
virtual bool MaySwitchTransponder(const cChannel *channelP) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool SetChannelDevice(const cChannel *channelP, bool liveViewP);
|
|
|
|
|
|
|
|
// for recording
|
|
|
|
private:
|
2017-04-17 21:10:29 +02:00
|
|
|
uchar *GetData(int *availableP = NULL, bool checkTsBuffer = false);
|
2014-03-08 12:07:47 +01:00
|
|
|
void SkipData(int countP);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool SetPid(cPidHandle *handleP, int typeP, bool onP);
|
|
|
|
virtual bool OpenDvr(void);
|
|
|
|
virtual void CloseDvr(void);
|
|
|
|
virtual bool GetTSPacket(uchar *&dataP);
|
|
|
|
|
|
|
|
// for section filtering
|
|
|
|
public:
|
|
|
|
virtual int OpenFilter(u_short pidP, u_char tidP, u_char maskP);
|
|
|
|
virtual void CloseFilter(int handleP);
|
|
|
|
|
|
|
|
// for transponder lock
|
|
|
|
public:
|
2017-05-24 22:13:21 +02:00
|
|
|
virtual bool HasLock(int timeoutMsP = 0) const;
|
2014-03-08 12:07:47 +01:00
|
|
|
|
|
|
|
// for common interface
|
|
|
|
public:
|
|
|
|
virtual bool HasInternalCam(void);
|
|
|
|
|
|
|
|
// for internal device interface
|
|
|
|
public:
|
|
|
|
virtual void WriteData(u_char *bufferP, int lengthP);
|
2017-11-13 21:12:10 +01:00
|
|
|
virtual void SetChannelTuned(void);
|
2014-04-06 12:37:45 +02:00
|
|
|
virtual int GetId(void);
|
2015-01-05 23:58:35 +01:00
|
|
|
virtual int GetPmtPid(void);
|
2015-01-09 14:42:03 +01:00
|
|
|
virtual int GetCISlot(void);
|
2016-08-27 17:54:03 +02:00
|
|
|
virtual cString GetTnrParameterString(void);
|
2015-05-22 21:42:11 +02:00
|
|
|
virtual bool IsIdle(void);
|
2014-03-08 12:07:47 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __SATIP_DEVICE_H
|