vdr 2.6.7
Classes | Macros | Functions | Variables
dvbdevice.c File Reference
#include "dvbdevice.h"
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/frontend.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include "channels.h"
#include "diseqc.h"
#include "dvbci.h"
#include "menuitems.h"
#include "sourceparams.h"

Go to the source code of this file.

Classes

class  cDvbFrontend
 
class  cDvbTuner
 
class  cDvbSourceParam
 

Macros

#define BANDWIDTH_HZ_AUTO   0
 
#define DVBS_TUNE_TIMEOUT   9000
 
#define DVBS_LOCK_TIMEOUT   2000
 
#define DVBC_TUNE_TIMEOUT   9000
 
#define DVBC_LOCK_TIMEOUT   2000
 
#define DVBT_TUNE_TIMEOUT   9000
 
#define DVBT_LOCK_TIMEOUT   2000
 
#define ATSC_TUNE_TIMEOUT   9000
 
#define ATSC_LOCK_TIMEOUT   2000
 
#define SCR_RANDOM_TIMEOUT   500
 
#define TSBUFFERSIZE   MEGABYTE(16)
 
#define DVB_SYSTEM_1   0
 
#define DVB_SYSTEM_2   1
 
#define ST(s)   if (strchr(s, Type) && (strchr(s, '0' + system + 1) || strchr(s, '*')))
 
#define MAXFRONTENDCMDS   16
 
#define SETCMD(c, d)
 
#define TUNER_POLL_TIMEOUT   10
 
#define REF_S1(q1)   (mod == QPSK) ? q1 : 0
 
#define REF_S2(q1, q2, q3, q4)   (mod == QPSK) ? q1 : (mod == PSK_8) ? q2 : (mod == APSK_16) ? q3 : (mod == APSK_32) ? q4 : 0
 
#define REF_T1(q1, q2, q3)   (mod == QPSK) ? q1 : (mod == QAM_16) ? q2 : (mod == QAM_64) ? q3 : 0
 
#define REF_T2(q1, q2, q3, q4)   (mod == QPSK) ? q1 : (mod == QAM_16) ? q2 : (mod == QAM_64) ? q3 : (mod == QAM_256) ? q4 : 0
 
#define REF_C1(q1, q2, q3, q4, q5)   (mod == QAM_16) ? q1 : (mod == QAM_32) ? q2 : (mod == QAM_64) ? q3 : (mod == QAM_128) ? q4 : (mod == QAM_256) ? q5: 0
 
#define IGNORE_BER   1
 
#define BER_ERROR_FREE   (1000*1000*1000)
 
#define LOCK_THRESHOLD   5
 
#define ST(s)   if (strchr(s, type))
 
#define RB_NUM_SECTIONS   8
 

Functions

int UserIndex (int Value, const tDvbParameterMap *Map)
 
int DriverIndex (int Value, const tDvbParameterMap *Map)
 
int MapToUser (int Value, const tDvbParameterMap *Map, const char **String)
 
const char * MapToUserString (int Value, const tDvbParameterMap *Map)
 
int MapToDriver (int Value, const tDvbParameterMap *Map)
 
static const char * GetDeliverySystemName (int Index)
 
static int GetRequiredDeliverySystem (const cChannel *Channel, const cDvbTransponderParameters *Dtp)
 
int dB1000toPercent (int dB1000, int Low, int High)
 
int StrengthToSSI (const cChannel *Channel, int Strength, int FeModulation, int FeCoderateH, int FeFec)
 
int SignalToSQI (const cChannel *Channel, int Signal, int Ber, int FeModulation, int FeCoderateH, int FeFec)
 
static unsigned int FrequencyToHz (unsigned int f)
 
cString DvbName (const char *Name, int Adapter, int Frontend)
 
int DvbOpen (const char *Name, int Adapter, int Frontend, int Mode, bool ReportError)
 

Variables

static int DvbApiVersion = 0x0000
 
const tDvbParameterMap PilotValues []
 
const tDvbParameterMap InversionValues []
 
const tDvbParameterMap BandwidthValues []
 
const tDvbParameterMap CoderateValues []
 
const tDvbParameterMap ModulationValues []
 
const tDvbParameterMap SystemValuesSat []
 
const tDvbParameterMap SystemValuesTerr []
 
const tDvbParameterMap TransmissionValues []
 
const tDvbParameterMap GuardValues []
 
const tDvbParameterMap HierarchyValues []
 
const tDvbParameterMap RollOffValues []
 
const char * DeliverySystemNames []
 
static const int DeliverySystemNamesMax = sizeof(DeliverySystemNames) / sizeof(DeliverySystemNames[0]) - 2
 
cList< cDvbDeviceProbeDvbDeviceProbes
 

Macro Definition Documentation

◆ ATSC_LOCK_TIMEOUT

#define ATSC_LOCK_TIMEOUT   2000

Definition at line 35 of file dvbdevice.c.

Referenced by cDvbTuner::SetFrontend().

◆ ATSC_TUNE_TIMEOUT

#define ATSC_TUNE_TIMEOUT   9000

Definition at line 34 of file dvbdevice.c.

Referenced by cDvbTuner::SetFrontend().

◆ BANDWIDTH_HZ_AUTO

#define BANDWIDTH_HZ_AUTO   0

Definition at line 26 of file dvbdevice.c.

Referenced by cDvbTransponderParameters::Parse().

◆ BER_ERROR_FREE

#define BER_ERROR_FREE   (1000*1000*1000)

Definition at line 1083 of file dvbdevice.c.

Referenced by cDvbTuner::GetSignalQuality(), and SignalToSQI().

◆ DVB_SYSTEM_1

#define DVB_SYSTEM_1   0

◆ DVB_SYSTEM_2

#define DVB_SYSTEM_2   1

Definition at line 102 of file dvbdevice.c.

Referenced by cNitFilter::Process().

◆ DVBC_LOCK_TIMEOUT

#define DVBC_LOCK_TIMEOUT   2000

Definition at line 31 of file dvbdevice.c.

Referenced by cDvbTuner::SetFrontend().

◆ DVBC_TUNE_TIMEOUT

#define DVBC_TUNE_TIMEOUT   9000

Definition at line 30 of file dvbdevice.c.

Referenced by cDvbTuner::SetFrontend().

◆ DVBS_LOCK_TIMEOUT

#define DVBS_LOCK_TIMEOUT   2000

Definition at line 29 of file dvbdevice.c.

Referenced by cDvbTuner::SetFrontend().

◆ DVBS_TUNE_TIMEOUT

#define DVBS_TUNE_TIMEOUT   9000

Definition at line 28 of file dvbdevice.c.

Referenced by cDvbTuner::SetFrontend().

◆ DVBT_LOCK_TIMEOUT

#define DVBT_LOCK_TIMEOUT   2000

Definition at line 33 of file dvbdevice.c.

Referenced by cDvbTuner::SetFrontend().

◆ DVBT_TUNE_TIMEOUT

#define DVBT_TUNE_TIMEOUT   9000

Definition at line 32 of file dvbdevice.c.

Referenced by cDvbTuner::SetFrontend().

◆ IGNORE_BER

#define IGNORE_BER   1

Definition at line 1082 of file dvbdevice.c.

◆ LOCK_THRESHOLD

#define LOCK_THRESHOLD   5

Definition at line 1290 of file dvbdevice.c.

Referenced by cDvbTuner::GetSignalQuality().

◆ MAXFRONTENDCMDS

#define MAXFRONTENDCMDS   16

◆ RB_NUM_SECTIONS

#define RB_NUM_SECTIONS   8

Definition at line 2145 of file dvbdevice.c.

Referenced by cDvbDevice::OpenFilter().

◆ REF_C1

#define REF_C1 ( q1,
q2,
q3,
q4,
q5 )   (mod == QAM_16) ? q1 : (mod == QAM_32) ? q2 : (mod == QAM_64) ? q3 : (mod == QAM_128) ? q4 : (mod == QAM_256) ? q5: 0

Definition at line 1006 of file dvbdevice.c.

Referenced by SignalToSQI(), and StrengthToSSI().

◆ REF_S1

#define REF_S1 ( q1)    (mod == QPSK) ? q1 : 0

Definition at line 1002 of file dvbdevice.c.

Referenced by SignalToSQI().

◆ REF_S2

#define REF_S2 ( q1,
q2,
q3,
q4 )   (mod == QPSK) ? q1 : (mod == PSK_8) ? q2 : (mod == APSK_16) ? q3 : (mod == APSK_32) ? q4 : 0

Definition at line 1003 of file dvbdevice.c.

Referenced by SignalToSQI().

◆ REF_T1

#define REF_T1 ( q1,
q2,
q3 )   (mod == QPSK) ? q1 : (mod == QAM_16) ? q2 : (mod == QAM_64) ? q3 : 0

Definition at line 1004 of file dvbdevice.c.

Referenced by SignalToSQI(), and StrengthToSSI().

◆ REF_T2

#define REF_T2 ( q1,
q2,
q3,
q4 )   (mod == QPSK) ? q1 : (mod == QAM_16) ? q2 : (mod == QAM_64) ? q3 : (mod == QAM_256) ? q4 : 0

Definition at line 1005 of file dvbdevice.c.

Referenced by SignalToSQI(), and StrengthToSSI().

◆ SCR_RANDOM_TIMEOUT

#define SCR_RANDOM_TIMEOUT   500

Definition at line 37 of file dvbdevice.c.

Referenced by cDvbTuner::Action().

◆ SETCMD

#define SETCMD ( c,
d )
Value:
{ Props[CmdSeq.num].cmd = (c);\
Props[CmdSeq.num].u.data = (d);\
if (CmdSeq.num++ > MAXFRONTENDCMDS) {\
esyslog("ERROR: too many tuning commands on frontend %d/%d", adapter, frontend);\
return false;\
}\
}
#define MAXFRONTENDCMDS
Definition dvbdevice.c:336

Definition at line 337 of file dvbdevice.c.

Referenced by cDvbTuner::GetSignalQuality(), cDvbTuner::GetSignalStats(), cDvbTuner::GetSignalStrength(), cDvbFrontend::QueryDeliverySystems(), and cDvbTuner::SetFrontend().

◆ ST [1/2]

#define ST ( s)    if (strchr(s, Type) && (strchr(s, '0' + system + 1) || strchr(s, '*')))

◆ ST [2/2]

#define ST ( s)    if (strchr(s, type))

◆ TSBUFFERSIZE

#define TSBUFFERSIZE   MEGABYTE(16)

Definition at line 39 of file dvbdevice.c.

Referenced by cDvbDevice::OpenDvr().

◆ TUNER_POLL_TIMEOUT

#define TUNER_POLL_TIMEOUT   10

Definition at line 514 of file dvbdevice.c.

Referenced by cDvbTuner::ClearEventQueue().

Function Documentation

◆ dB1000toPercent()

int dB1000toPercent ( int dB1000,
int Low,
int High )

Definition at line 987 of file dvbdevice.c.

Referenced by SignalToSQI(), and StrengthToSSI().

◆ DriverIndex()

int DriverIndex ( int Value,
const tDvbParameterMap * Map )

◆ DvbName()

cString DvbName ( const char * Name,
int Adapter,
int Frontend )

◆ DvbOpen()

int DvbOpen ( const char * Name,
int Adapter,
int Frontend,
int Mode,
bool ReportError )

◆ FrequencyToHz()

static unsigned int FrequencyToHz ( unsigned int f)
static

Definition at line 1464 of file dvbdevice.c.

Referenced by cDvbTuner::SetFrontend().

◆ GetDeliverySystemName()

static const char * GetDeliverySystemName ( int Index)
static

◆ GetRequiredDeliverySystem()

static int GetRequiredDeliverySystem ( const cChannel * Channel,
const cDvbTransponderParameters * Dtp )
static

◆ MapToDriver()

int MapToDriver ( int Value,
const tDvbParameterMap * Map )

Definition at line 197 of file dvbdevice.c.

References tDvbParameterMap::driverValue, and UserIndex().

Referenced by cDvbTransponderParameters::ParseParameter().

◆ MapToUser()

int MapToUser ( int Value,
const tDvbParameterMap * Map,
const char ** String )

◆ MapToUserString()

const char * MapToUserString ( int Value,
const tDvbParameterMap * Map )

Definition at line 189 of file dvbdevice.c.

References DriverIndex(), and tDvbParameterMap::userString.

Referenced by cDvbFrontend::QueryDeliverySystems().

◆ SignalToSQI()

int SignalToSQI ( const cChannel * Channel,
int Signal,
int Ber,
int FeModulation,
int FeCoderateH,
int FeFec )

◆ StrengthToSSI()

int StrengthToSSI ( const cChannel * Channel,
int Strength,
int FeModulation,
int FeCoderateH,
int FeFec )

◆ UserIndex()

int UserIndex ( int Value,
const tDvbParameterMap * Map )

Definition at line 156 of file dvbdevice.c.

References tDvbParameterMap::userValue.

Referenced by MapToDriver().

Variable Documentation

◆ BandwidthValues

const tDvbParameterMap BandwidthValues[]
Initial value:
= {
{ 5, 5000000, "5 MHz" },
{ 6, 6000000, "6 MHz" },
{ 7, 7000000, "7 MHz" },
{ 8, 8000000, "8 MHz" },
{ 10, 10000000, "10 MHz" },
{ 1712, 1712000, "1.712 MHz" },
{ 999, BANDWIDTH_HZ_AUTO, trNOOP("auto") },
{ -1, 0, NULL }
}
#define BANDWIDTH_HZ_AUTO
Definition dvbdevice.c:26
#define trNOOP(s)
Definition i18n.h:88

Definition at line 57 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), and cDvbTransponderParameters::ToString().

◆ CoderateValues

const tDvbParameterMap CoderateValues[]
Initial value:
= {
{ 0, FEC_NONE, trNOOP("none") },
{ 12, FEC_1_2, "1/2" },
{ 23, FEC_2_3, "2/3" },
{ 34, FEC_3_4, "3/4" },
{ 35, FEC_3_5, "3/5" },
{ 45, FEC_4_5, "4/5" },
{ 56, FEC_5_6, "5/6" },
{ 67, FEC_6_7, "6/7" },
{ 78, FEC_7_8, "7/8" },
{ 89, FEC_8_9, "8/9" },
{ 910, FEC_9_10, "9/10" },
{ 999, FEC_AUTO, trNOOP("auto") },
{ -1, 0, NULL }
}

Definition at line 68 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), and cDvbTransponderParameters::ToString().

◆ DeliverySystemNames

const char* DeliverySystemNames[]
Initial value:
= {
"???",
"DVB-C",
"DVB-C",
"DVB-T",
"DSS",
"DVB-S",
"DVB-S2",
"DVB-H",
"ISDBT",
"ISDBS",
"ISDBC",
"ATSC",
"ATSCMH",
"DTMB",
"CMMB",
"DAB",
"DVB-T2",
"TURBO",
"DVB-C",
"DVB-C2",
NULL
}

Definition at line 303 of file dvbdevice.c.

Referenced by GetDeliverySystemName().

◆ DeliverySystemNamesMax

const int DeliverySystemNamesMax = sizeof(DeliverySystemNames) / sizeof(DeliverySystemNames[0]) - 2
static

Definition at line 327 of file dvbdevice.c.

Referenced by GetDeliverySystemName().

◆ DvbApiVersion

int DvbApiVersion = 0x0000
static

Definition at line 24 of file dvbdevice.c.

Referenced by cDvbFrontend::QueryDeliverySystems(), and cDvbTuner::SetFrontend().

◆ DvbDeviceProbes

cList<cDvbDeviceProbe> DvbDeviceProbes

◆ GuardValues

const tDvbParameterMap GuardValues[]
Initial value:
= {
{ 4, GUARD_INTERVAL_1_4, "1/4" },
{ 8, GUARD_INTERVAL_1_8, "1/8" },
{ 16, GUARD_INTERVAL_1_16, "1/16" },
{ 32, GUARD_INTERVAL_1_32, "1/32" },
{ 128, GUARD_INTERVAL_1_128, "1/128" },
{ 19128, GUARD_INTERVAL_19_128, "19/128" },
{ 19256, GUARD_INTERVAL_19_256, "19/256" },
{ 999, GUARD_INTERVAL_AUTO, trNOOP("auto") },
{ -1, 0, NULL }
}
@ GUARD_INTERVAL_19_128
Definition dvbdevice.h:48
@ GUARD_INTERVAL_19_256
Definition dvbdevice.h:49
@ GUARD_INTERVAL_1_128
Definition dvbdevice.h:47

Definition at line 127 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), and cDvbTransponderParameters::ToString().

◆ HierarchyValues

const tDvbParameterMap HierarchyValues[]
Initial value:
= {
{ 0, HIERARCHY_NONE, trNOOP("none") },
{ 1, HIERARCHY_1, "1" },
{ 2, HIERARCHY_2, "2" },
{ 4, HIERARCHY_4, "4" },
{ 999, HIERARCHY_AUTO, trNOOP("auto") },
{ -1, 0, NULL }
}

Definition at line 139 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), and cDvbTransponderParameters::ToString().

◆ InversionValues

const tDvbParameterMap InversionValues[]
Initial value:
= {
{ 0, INVERSION_OFF, trNOOP("off") },
{ 1, INVERSION_ON, trNOOP("on") },
{ 999, INVERSION_AUTO, trNOOP("auto") },
{ -1, 0, NULL }
}

Definition at line 50 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), and cDvbTransponderParameters::ToString().

◆ ModulationValues

const tDvbParameterMap ModulationValues[]
Initial value:
= {
{ 16, QAM_16, "QAM16" },
{ 32, QAM_32, "QAM32" },
{ 64, QAM_64, "QAM64" },
{ 128, QAM_128, "QAM128" },
{ 256, QAM_256, "QAM256" },
{ 2, QPSK, "QPSK" },
{ 5, PSK_8, "8PSK" },
{ 6, APSK_16, "16APSK" },
{ 7, APSK_32, "32APSK" },
{ 10, VSB_8, "VSB8" },
{ 11, VSB_16, "VSB16" },
{ 12, DQPSK, "DQPSK" },
{ 999, QAM_AUTO, trNOOP("auto") },
{ -1, 0, NULL }
}

Definition at line 84 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), cDvbFrontend::QueryDeliverySystems(), and cDvbTransponderParameters::ToString().

◆ PilotValues

const tDvbParameterMap PilotValues[]
Initial value:
= {
{ 0, PILOT_OFF, trNOOP("off") },
{ 1, PILOT_ON, trNOOP("on") },
{ 999, PILOT_AUTO, trNOOP("auto") },
{ -1, 0, NULL }
}

Definition at line 43 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), and cDvbTransponderParameters::ToString().

◆ RollOffValues

const tDvbParameterMap RollOffValues[]
Initial value:
= {
{ 0, ROLLOFF_AUTO, trNOOP("auto") },
{ 20, ROLLOFF_20, "0.20" },
{ 25, ROLLOFF_25, "0.25" },
{ 35, ROLLOFF_35, "0.35" },
{ -1, 0, NULL }
}

Definition at line 148 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), and cDvbTransponderParameters::ToString().

◆ SystemValuesSat

const tDvbParameterMap SystemValuesSat[]
Initial value:
= {
{ 0, DVB_SYSTEM_1, "DVB-S" },
{ 1, DVB_SYSTEM_2, "DVB-S2" },
{ -1, 0, NULL }
}
#define DVB_SYSTEM_1
Definition dvbdevice.c:101
#define DVB_SYSTEM_2
Definition dvbdevice.c:102

Definition at line 104 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), and cDvbTransponderParameters::ToString().

◆ SystemValuesTerr

const tDvbParameterMap SystemValuesTerr[]
Initial value:
= {
{ 0, DVB_SYSTEM_1, "DVB-T" },
{ 1, DVB_SYSTEM_2, "DVB-T2" },
{ -1, 0, NULL }
}

Definition at line 110 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem().

◆ TransmissionValues

const tDvbParameterMap TransmissionValues[]
Initial value:
= {
{ 1, TRANSMISSION_MODE_1K, "1K" },
{ 2, TRANSMISSION_MODE_2K, "2K" },
{ 4, TRANSMISSION_MODE_4K, "4K" },
{ 8, TRANSMISSION_MODE_8K, "8K" },
{ 16, TRANSMISSION_MODE_16K, "16K" },
{ 32, TRANSMISSION_MODE_32K, "32K" },
{ 999, TRANSMISSION_MODE_AUTO, trNOOP("auto") },
{ -1, 0, NULL }
}
@ TRANSMISSION_MODE_16K
Definition dvbdevice.h:43
@ TRANSMISSION_MODE_1K
Definition dvbdevice.h:42
@ TRANSMISSION_MODE_32K
Definition dvbdevice.h:44
@ TRANSMISSION_MODE_4K
Definition dvbdevice.h:30

Definition at line 116 of file dvbdevice.c.

Referenced by cDvbSourceParam::GetOsdItem(), cDvbTransponderParameters::Parse(), and cDvbTransponderParameters::ToString().