Switched to the new S2API driver API; cDvbTuner::IsTunedTo()now also checks the symbol rate in case of DVB-S and DVB-C

This commit is contained in:
Klaus Schmidinger 2008-12-13 12:22:36 +01:00
parent 3abe4f2b91
commit 3c7d1a16ac
10 changed files with 227 additions and 218 deletions

View File

@ -2375,3 +2375,12 @@ Michael Nork <mnork0@gmx.net>
Winfried Köhler <w_koehl@gmx.de>
for fixing wrong value for TableIdBAT in libsi/si.h
Igor M. Liplianin <liplianin@tut.by>
for a patch that was used to convert VDR to the S2API driver API
Niels Wagenaar <n.wagenaar@xs4all.nl>
for a patch that was used to convert VDR to the S2API driver API
Edgar Hucek <gimli@dark-green.com>
for a patch that was used to convert VDR to the S2API driver API

View File

@ -5832,6 +5832,11 @@ Video Disk Recorder Revision History
- Removed unneeded include files <linux/dvb/dmx.h> und <time.h> from remux.h
(reported by Tobias Grimm).
2008-09-14: Version 1.7.2
2008-12-13: Version 1.7.2
- Added a note about 'Id' being obsolete to the description of cDevice::PlayAudio().
- Switched to the new S2API driver API, which was decided to become the official
DVB API in the kernel (based on patches from Igor M. Liplianin, Niels Wagenaar
and Edgar Hucek).
- The cDvbTuner::IsTunedTo() function now also checks the symbol rate in case of
DVB-S and DVB-C.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.c 2.3 2008/07/06 12:59:41 kls Exp $
* $Id: channels.c 2.4 2008/12/13 11:42:15 kls Exp $
*/
#include "channels.h"
@ -21,114 +21,86 @@
// --- Channel Parameter Maps ------------------------------------------------
const tChannelParameterMap InversionValues[] = {
{ 0, DVBFE_INVERSION_OFF, trNOOP("off") },
{ 1, DVBFE_INVERSION_ON, trNOOP("on") },
{ 999, DVBFE_INVERSION_AUTO },
{ 0, INVERSION_OFF, trNOOP("off") },
{ 1, INVERSION_ON, trNOOP("on") },
{ 999, INVERSION_AUTO, trNOOP("auto") },
{ -1 }
};
const tChannelParameterMap BandwidthValues[] = {
{ 5, DVBFE_BANDWIDTH_5_MHZ, "5 MHz" },
{ 6, DVBFE_BANDWIDTH_6_MHZ, "6 MHz" },
{ 7, DVBFE_BANDWIDTH_7_MHZ, "7 MHz" },
{ 8, DVBFE_BANDWIDTH_8_MHZ, "8 MHz" },
{ 999, DVBFE_BANDWIDTH_AUTO },
{ 6, 6000000, "6 MHz" },
{ 7, 7000000, "7 MHz" },
{ 8, 8000000, "8 MHz" },
{ -1 }
};
const tChannelParameterMap CoderateValues[] = {
{ 0, DVBFE_FEC_NONE, trNOOP("none") },
{ 12, DVBFE_FEC_1_2, "1/2" },
{ 13, DVBFE_FEC_1_3, "1/3" },
{ 14, DVBFE_FEC_1_4, "1/4" },
{ 23, DVBFE_FEC_2_3, "2/3" },
{ 25, DVBFE_FEC_2_5, "2/5" },
{ 34, DVBFE_FEC_3_4, "3/4" },
{ 35, DVBFE_FEC_3_5, "3/5" },
{ 45, DVBFE_FEC_4_5, "4/5" },
{ 56, DVBFE_FEC_5_6, "5/6" },
{ 67, DVBFE_FEC_6_7, "6/7" },
{ 78, DVBFE_FEC_7_8, "7/8" },
{ 89, DVBFE_FEC_8_9, "8/9" },
{ 910, DVBFE_FEC_9_10, "9/10" },
{ 999, DVBFE_FEC_AUTO },
{ 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 }
};
const tChannelParameterMap ModulationValues[] = {
{ 0, DVBFE_MOD_NONE, trNOOP("none") },
{ 4, DVBFE_MOD_QAM4, "QAM4" },
{ 16, DVBFE_MOD_QAM16, "QAM16" },
{ 32, DVBFE_MOD_QAM32, "QAM32" },
{ 64, DVBFE_MOD_QAM64, "QAM64" },
{ 128, DVBFE_MOD_QAM128, "QAM128" },
{ 256, DVBFE_MOD_QAM256, "QAM256" },
{ 512, DVBFE_MOD_QAM512, "QAM512" },
{1024, DVBFE_MOD_QAM1024, "QAM1024" },
{ 1, DVBFE_MOD_BPSK, "BPSK" },
{ 2, DVBFE_MOD_QPSK, "QPSK" },
{ 3, DVBFE_MOD_OQPSK, "OQPSK" },
{ 5, DVBFE_MOD_8PSK, "8PSK" },
{ 6, DVBFE_MOD_16APSK, "16APSK" },
{ 7, DVBFE_MOD_32APSK, "32APSK" },
{ 8, DVBFE_MOD_OFDM, "OFDM" },
{ 9, DVBFE_MOD_COFDM, "COFDM" },
{ 10, DVBFE_MOD_VSB8, "VSB8" },
{ 11, DVBFE_MOD_VSB16, "VSB16" },
{ 998, DVBFE_MOD_QAMAUTO, "QAMAUTO" },
{ 999, DVBFE_MOD_AUTO },
{ 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" },
{ 10, VSB_8, "VSB8" },
{ 11, VSB_16, "VSB16" },
{ 998, QAM_AUTO, "QAMAUTO" },
{ -1 }
};
const tChannelParameterMap SystemValues[] = {
{ 0, DVBFE_DELSYS_DVBS, "DVB-S" },
{ 1, DVBFE_DELSYS_DVBS2, "DVB-S2" },
{ 0, SYS_DVBS, "DVB-S" },
{ 1, SYS_DVBS2, "DVB-S2" },
{ -1 }
};
const tChannelParameterMap TransmissionValues[] = {
{ 2, DVBFE_TRANSMISSION_MODE_2K, "2K" },
{ 4, DVBFE_TRANSMISSION_MODE_4K, "4K" },
{ 8, DVBFE_TRANSMISSION_MODE_8K, "8K" },
{ 999, DVBFE_TRANSMISSION_MODE_AUTO },
{ 2, TRANSMISSION_MODE_2K, "2K" },
{ 8, TRANSMISSION_MODE_8K, "8K" },
{ 999, TRANSMISSION_MODE_AUTO, trNOOP("auto") },
{ -1 }
};
const tChannelParameterMap GuardValues[] = {
{ 4, DVBFE_GUARD_INTERVAL_1_4, "1/4" },
{ 8, DVBFE_GUARD_INTERVAL_1_8, "1/8" },
{ 16, DVBFE_GUARD_INTERVAL_1_16, "1/16" },
{ 32, DVBFE_GUARD_INTERVAL_1_32, "1/32" },
{ 999, DVBFE_GUARD_INTERVAL_AUTO },
{ 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" },
{ 999, GUARD_INTERVAL_AUTO, trNOOP("auto") },
{ -1 }
};
const tChannelParameterMap HierarchyValues[] = {
{ 0, DVBFE_HIERARCHY_OFF, trNOOP("off") },
{ 1, DVBFE_HIERARCHY_ON, trNOOP("on") },
{ 999, DVBFE_HIERARCHY_AUTO },
{ -1 }
};
const tChannelParameterMap AlphaValues[] = {
{ 0, 0 },
{ 1, DVBFE_ALPHA_1 },
{ 2, DVBFE_ALPHA_2 },
{ 4, DVBFE_ALPHA_4 },
{ -1 }
};
const tChannelParameterMap PriorityValues[] = {
{ 0, DVBFE_STREAM_PRIORITY_HP, trNOOP("high") },
{ 1, DVBFE_STREAM_PRIORITY_LP, trNOOP("low") },
{ 0, HIERARCHY_NONE, trNOOP("none") },
{ 1, HIERARCHY_1, "1" },
{ 2, HIERARCHY_2, "2" },
{ 4, HIERARCHY_4, "4" },
{ 999, HIERARCHY_AUTO, trNOOP("auto") },
{ -1 }
};
const tChannelParameterMap RollOffValues[] = {
{ 0, DVBFE_ROLLOFF_UNKNOWN },
{ 20, DVBFE_ROLLOFF_20, "0.20" },
{ 25, DVBFE_ROLLOFF_25, "0.25" },
{ 35, DVBFE_ROLLOFF_35, "0.35" },
{ 0, ROLLOFF_AUTO, trNOOP("auto") },
{ 20, ROLLOFF_20, "0.20" },
{ 25, ROLLOFF_25, "0.25" },
{ 35, ROLLOFF_35, "0.35" },
{ -1 }
};
@ -217,18 +189,16 @@ cChannel::cChannel(void)
provider = strdup("");
portalName = strdup("");
memset(&__BeginData__, 0, (char *)&__EndData__ - (char *)&__BeginData__);
inversion = DVBFE_INVERSION_AUTO;
bandwidth = DVBFE_BANDWIDTH_AUTO;
coderateH = DVBFE_FEC_AUTO;
coderateL = DVBFE_FEC_AUTO;
modulation = DVBFE_MOD_AUTO;
system = DVBFE_DELSYS_DVBS;
transmission = DVBFE_TRANSMISSION_MODE_AUTO;
guard = DVBFE_GUARD_INTERVAL_AUTO;
hierarchy = DVBFE_HIERARCHY_AUTO;
alpha = 0;
priority = DVBFE_STREAM_PRIORITY_HP;
rollOff = DVBFE_ROLLOFF_UNKNOWN;
inversion = INVERSION_AUTO;
bandwidth = 8000000;
coderateH = FEC_AUTO;
coderateL = FEC_AUTO;
modulation = QPSK;
system = SYS_DVBS;
transmission = TRANSMISSION_MODE_AUTO;
guard = GUARD_INTERVAL_AUTO;
hierarchy = HIERARCHY_AUTO;
rollOff = ROLLOFF_AUTO;
modification = CHANNELMOD_NONE;
schedule = NULL;
linkChannels = NULL;
@ -335,8 +305,6 @@ void cChannel::CopyTransponderData(const cChannel *Channel)
transmission = Channel->transmission;
guard = Channel->guard;
hierarchy = Channel->hierarchy;
alpha = Channel->alpha;
priority = Channel->priority;
rollOff = Channel->rollOff;
}
}
@ -394,9 +362,9 @@ bool cChannel::SetCableTransponderData(int Source, int Frequency, int Modulation
return true;
}
bool cChannel::SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CoderateH, int CoderateL, int Guard, int Transmission, int Alpha, int Priority)
bool cChannel::SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CoderateH, int CoderateL, int Guard, int Transmission)
{
if (source != Source || frequency != Frequency || bandwidth != Bandwidth || modulation != Modulation || hierarchy != Hierarchy || coderateH != CoderateH || coderateL != CoderateL || guard != Guard || transmission != Transmission || alpha != Alpha || priority != Priority) {
if (source != Source || frequency != Frequency || bandwidth != Bandwidth || modulation != Modulation || hierarchy != Hierarchy || coderateH != CoderateH || coderateL != CoderateL || guard != Guard || transmission != Transmission) {
cString OldTransponderData = TransponderDataToString();
source = Source;
frequency = Frequency;
@ -407,8 +375,6 @@ bool cChannel::SetTerrTransponderData(int Source, int Frequency, int Bandwidth,
coderateL = CoderateL;
guard = Guard;
transmission = Transmission;
alpha = Alpha;
priority = Priority;
schedule = NULL;
if (Number()) {
dsyslog("changing transponder data of channel %d from %s to %s", Number(), *OldTransponderData, *TransponderDataToString());
@ -670,7 +636,6 @@ cString cChannel::ParametersToString(void) const
char *q = buffer;
*q = 0;
ST(" S ") q += sprintf(q, "%c", polarization);
ST(" T") q += PrintParameter(q, 'A', MapToUser(alpha, AlphaValues));
ST(" T") q += PrintParameter(q, 'B', MapToUser(bandwidth, BandwidthValues));
ST("CST") q += PrintParameter(q, 'C', MapToUser(coderateH, CoderateValues));
ST(" T") q += PrintParameter(q, 'D', MapToUser(coderateL, CoderateValues));
@ -678,7 +643,6 @@ cString cChannel::ParametersToString(void) const
ST("CST") q += PrintParameter(q, 'I', MapToUser(inversion, InversionValues));
ST("CST") q += PrintParameter(q, 'M', MapToUser(modulation, ModulationValues));
ST(" S ") q += PrintParameter(q, 'O', MapToUser(rollOff, RollOffValues));
ST(" T") q += PrintParameter(q, 'P', MapToUser(priority, PriorityValues));
ST(" S ") q += PrintParameter(q, 'S', MapToUser(system, SystemValues));
ST(" T") q += PrintParameter(q, 'T', MapToUser(transmission, TransmissionValues));
ST(" T") q += PrintParameter(q, 'Y', MapToUser(hierarchy, HierarchyValues));
@ -701,11 +665,18 @@ static const char *ParseParameter(const char *s, int &Value, const tChannelParam
return NULL;
}
static const char *SkipDigits(const char *s)
{
while (*++s && isdigit(*s))
;
return s;
}
bool cChannel::StringToParameters(const char *s)
{
while (s && *s) {
switch (toupper(*s)) {
case 'A': s = ParseParameter(s, alpha, AlphaValues); break;
case 'A': s = SkipDigits(s); break; // for compatibility with the "multiproto" approach - may be removed in future versions
case 'B': s = ParseParameter(s, bandwidth, BandwidthValues); break;
case 'C': s = ParseParameter(s, coderateH, CoderateValues); break;
case 'D': s = ParseParameter(s, coderateL, CoderateValues); break;
@ -714,14 +685,14 @@ bool cChannel::StringToParameters(const char *s)
case 'I': s = ParseParameter(s, inversion, InversionValues); break;
case 'L': polarization = *s++; break;
case 'M': s = ParseParameter(s, modulation, ModulationValues); break;
case 'Z':// for compatibility with the original DVB-S2 patch - may be removed in future versions
case 'O': s = ParseParameter(s, rollOff, RollOffValues); break;
case 'P': s = ParseParameter(s, priority, PriorityValues); break;
case 'P': s = SkipDigits(s); break; // for compatibility with the "multiproto" approach - may be removed in future versions
case 'R': polarization = *s++; break;
case 'S': s = ParseParameter(s, system, SystemValues); break;
case 'T': s = ParseParameter(s, transmission, TransmissionValues); break;
case 'V': polarization = *s++; break;
case 'Y': s = ParseParameter(s, hierarchy, HierarchyValues); break;
case 'Z': s = SkipDigits(s); break; // for compatibility with the original DVB-S2 patch - may be removed in future versions
default: esyslog("ERROR: unknown parameter key '%c'", *s);
return false;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.h 2.3 2008/07/06 11:49:37 kls Exp $
* $Id: channels.h 2.4 2008/11/22 13:35:52 kls Exp $
*/
#ifndef __CHANNELS_H
@ -66,8 +66,6 @@ extern const tChannelParameterMap SystemValues[];
extern const tChannelParameterMap TransmissionValues[];
extern const tChannelParameterMap GuardValues[];
extern const tChannelParameterMap HierarchyValues[];
extern const tChannelParameterMap AlphaValues[];
extern const tChannelParameterMap PriorityValues[];
extern const tChannelParameterMap RollOffValues[];
struct tChannelID {
@ -149,8 +147,6 @@ private:
int transmission;
int guard;
int hierarchy;
int alpha;
int priority;
int rollOff;
int __EndData__;
int modification;
@ -209,8 +205,6 @@ public:
int Transmission(void) const { return transmission; }
int Guard(void) const { return guard; }
int Hierarchy(void) const { return hierarchy; }
int Alpha(void) const { return alpha; }
int Priority(void) const { return priority; }
int RollOff(void) const { return rollOff; }
const cLinkChannels* LinkChannels(void) const { return linkChannels; }
const cChannel *RefChannel(void) const { return refChannel; }
@ -223,7 +217,7 @@ public:
void CopyTransponderData(const cChannel *Channel);
bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation, int System, int RollOff);
bool SetCableTransponderData(int Source, int Frequency, int Modulation, int Srate, int CoderateH);
bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission, int Alpha, int Priority);
bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission);
void SetId(int Nid, int Tid, int Sid, int Rid = 0);
void SetName(const char *Name, const char *ShortName, const char *Provider);
void SetPortalName(const char *PortalName);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.c 2.4 2008/07/06 13:58:56 kls Exp $
* $Id: dvbdevice.c 2.5 2008/12/13 12:22:36 kls Exp $
*/
#include "dvbdevice.h"
@ -27,6 +27,13 @@
#include "status.h"
#include "transfer.h"
// FIXME: temporary workaround until the S2API driver supports detecting
// S2 capability in a clean way. This macro allows compiling VDR with an
// unpatched driver. However, with an unpatched driver it will not support
// DVB-S2 hardware. If you have DVB-S2 hardware you need to either patch
// the driver or modify the line that uses this macro in cDvbDevice::cDvbDevice().
#define FE_CAN_2ND_GEN_MODULATION 0x10000000
#define DO_REC_AND_PLAY_ON_PRIMARY_DEVICE 1
#define DO_MULTIPLE_RECORDINGS 1
@ -76,7 +83,7 @@ private:
int tuneTimeout;
int lockTimeout;
time_t lastTimeoutReport;
dvbfe_delsys frontendType;
fe_delivery_system frontendType;
cChannel channel;
const char *diseqcCommands;
eTunerStatus tunerStatus;
@ -87,14 +94,14 @@ private:
bool SetFrontend(void);
virtual void Action(void);
public:
cDvbTuner(int Fd_Frontend, int CardIndex, dvbfe_delsys FrontendType);
cDvbTuner(int Fd_Frontend, int CardIndex, fe_delivery_system FrontendType);
virtual ~cDvbTuner();
bool IsTunedTo(const cChannel *Channel) const;
void Set(const cChannel *Channel, bool Tune);
bool Locked(int TimeoutMs = 0);
};
cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, dvbfe_delsys FrontendType)
cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, fe_delivery_system FrontendType)
{
fd_frontend = Fd_Frontend;
cardIndex = CardIndex;
@ -104,7 +111,7 @@ cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, dvbfe_delsys FrontendType)
lastTimeoutReport = 0;
diseqcCommands = NULL;
tunerStatus = tsIdle;
if (frontendType & (DVBFE_DELSYS_DVBS | DVBFE_DELSYS_DVBS2))
if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2)
CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); // must explicitly turn on LNB power
SetDescription("tuner on device %d", cardIndex + 1);
Start();
@ -127,7 +134,6 @@ bool cDvbTuner::IsTunedTo(const cChannel *Channel) const
char Type = **cSource::ToString(Channel->Source());
#define ST(s, p) if (strchr(s, Type)) if (channel.p() != Channel->p()) return false;
// Polarization is already checked as part of the Transponder.
ST(" T", Alpha);
ST(" T", Bandwidth);
ST("CST", CoderateH);
ST(" T", CoderateL);
@ -135,8 +141,8 @@ bool cDvbTuner::IsTunedTo(const cChannel *Channel) const
ST("CST", Inversion);
ST("CST", Modulation);
ST(" S ", RollOff);
ST(" T", Priority);
ST(" S ", System);
ST("CS ", Srate);
ST(" T", Transmission);
ST(" T", Hierarchy);
return true;
@ -192,10 +198,27 @@ static unsigned int FrequencyToHz(unsigned int f)
bool cDvbTuner::SetFrontend(void)
{
dvbfe_params Frontend;
#define MAXFRONTENDCMDS 16
#define SETCMD(c, d) { Frontend[CmdSeq.num].cmd = (c);\
Frontend[CmdSeq.num].u.data = (d);\
if (CmdSeq.num++ > MAXFRONTENDCMDS) {\
esyslog("ERROR: too many tuning commands on frontend %d", cardIndex);\
return false;\
}\
}
dtv_property Frontend[MAXFRONTENDCMDS];
memset(&Frontend, 0, sizeof(Frontend));
dtv_properties CmdSeq;
memset(&CmdSeq, 0, sizeof(CmdSeq));
CmdSeq.props = Frontend;
SETCMD(DTV_CLEAR, 0);
if (ioctl(fd_frontend, FE_SET_PROPERTY, &CmdSeq) < 0) {
esyslog("ERROR: frontend %d: %m", cardIndex);
return false;
}
CmdSeq.num = 0;
if (frontendType & (DVBFE_DELSYS_DVBS | DVBFE_DELSYS_DVBS2)) {
if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) {
unsigned int frequency = channel.Frequency();
if (Setup.DiSEqC) {
cDiseqc *diseqc = Diseqcs.Get(channel.Source(), channel.Frequency(), channel.Polarization());
@ -249,48 +272,56 @@ bool cDvbTuner::SetFrontend(void)
}
frequency = abs(frequency); // Allow for C-band, where the frequency is less than the LOF
Frontend.delivery = dvbfe_delsys(channel.System());
Frontend.frequency = frequency * 1000UL;
Frontend.inversion = fe_spectral_inversion_t(channel.Inversion());
if (Frontend.delivery == DVBFE_DELSYS_DVBS) {
Frontend.delsys.dvbs.modulation = dvbfe_modulation(channel.Modulation());
Frontend.delsys.dvbs.symbol_rate = channel.Srate() * 1000UL;
Frontend.delsys.dvbs.fec = dvbfe_fec(channel.CoderateH());
// DVB-S/DVB-S2 (common parts)
SETCMD(DTV_DELIVERY_SYSTEM, channel.System());
SETCMD(DTV_FREQUENCY, frequency * 1000UL);
SETCMD(DTV_MODULATION, channel.Modulation());
SETCMD(DTV_SYMBOL_RATE, channel.Srate() * 1000UL);
SETCMD(DTV_INNER_FEC, channel.CoderateH());
SETCMD(DTV_INVERSION, channel.Inversion());
if (channel.System() == SYS_DVBS2) {
if (frontendType == SYS_DVBS2) {
// DVB-S2
SETCMD(DTV_PILOT, PILOT_AUTO);
SETCMD(DTV_ROLLOFF, channel.RollOff());
}
else {
esyslog("ERROR: frontend %d doesn't provide DVB-S2", cardIndex);
return false;
}
}
else {
Frontend.delsys.dvbs2.modulation = dvbfe_modulation(channel.Modulation());
Frontend.delsys.dvbs2.symbol_rate = channel.Srate() * 1000UL;
Frontend.delsys.dvbs2.fec = dvbfe_fec(channel.CoderateH());
Frontend.delsys.dvbs2.rolloff = dvbfe_rolloff(channel.RollOff());
// DVB-S
SETCMD(DTV_ROLLOFF, ROLLOFF_35); // DVB-S always has a ROLLOFF of 0.35
}
tuneTimeout = DVBS_TUNE_TIMEOUT;
lockTimeout = DVBS_LOCK_TIMEOUT;
}
else if (frontendType & DVBFE_DELSYS_DVBC) {
Frontend.delivery = DVBFE_DELSYS_DVBC;
Frontend.frequency = FrequencyToHz(channel.Frequency());
Frontend.inversion = fe_spectral_inversion_t(channel.Inversion());
Frontend.delsys.dvbc.symbol_rate = channel.Srate() * 1000UL;
Frontend.delsys.dvbc.fec = dvbfe_fec(channel.CoderateH());
Frontend.delsys.dvbc.modulation = dvbfe_modulation(channel.Modulation());
else if (frontendType == SYS_DVBC_ANNEX_AC || frontendType == SYS_DVBC_ANNEX_B) {
// DVB-C
SETCMD(DTV_DELIVERY_SYSTEM, frontendType);
SETCMD(DTV_FREQUENCY, FrequencyToHz(channel.Frequency()));
SETCMD(DTV_INVERSION, channel.Inversion());
SETCMD(DTV_SYMBOL_RATE, channel.Srate() * 1000UL);
SETCMD(DTV_INNER_FEC, channel.CoderateH());
SETCMD(DTV_MODULATION, channel.Modulation());
tuneTimeout = DVBC_TUNE_TIMEOUT;
lockTimeout = DVBC_LOCK_TIMEOUT;
}
else if (frontendType & DVBFE_DELSYS_DVBT) {
Frontend.delivery = DVBFE_DELSYS_DVBT;
Frontend.frequency = FrequencyToHz(channel.Frequency());
Frontend.inversion = fe_spectral_inversion_t(channel.Inversion());
Frontend.delsys.dvbt.bandwidth = dvbfe_bandwidth(channel.Bandwidth());
Frontend.delsys.dvbt.code_rate_HP = dvbfe_fec(channel.CoderateH());
Frontend.delsys.dvbt.code_rate_LP = dvbfe_fec(channel.CoderateL());
Frontend.delsys.dvbt.constellation = dvbfe_modulation(channel.Modulation());
Frontend.delsys.dvbt.transmission_mode = dvbfe_transmission_mode(channel.Transmission());
Frontend.delsys.dvbt.guard_interval = dvbfe_guard_interval(channel.Guard());
Frontend.delsys.dvbt.hierarchy = dvbfe_hierarchy(channel.Hierarchy());
Frontend.delsys.dvbt.alpha = dvbfe_alpha(channel.Alpha());
Frontend.delsys.dvbt.priority = dvbfe_stream_priority(channel.Priority());
else if (frontendType == SYS_DVBT) {
// DVB-T
SETCMD(DTV_DELIVERY_SYSTEM, frontendType);
SETCMD(DTV_FREQUENCY, FrequencyToHz(channel.Frequency()));
SETCMD(DTV_INVERSION, channel.Inversion());
SETCMD(DTV_BANDWIDTH_HZ, channel.Bandwidth());
SETCMD(DTV_CODE_RATE_HP, channel.CoderateH());
SETCMD(DTV_CODE_RATE_LP, channel.CoderateL());
SETCMD(DTV_MODULATION, channel.Modulation());
SETCMD(DTV_TRANSMISSION_MODE, channel.Transmission());
SETCMD(DTV_GUARD_INTERVAL, channel.Guard());
SETCMD(DTV_HIERARCHY, channel.Hierarchy());
tuneTimeout = DVBT_TUNE_TIMEOUT;
lockTimeout = DVBT_LOCK_TIMEOUT;
@ -299,8 +330,8 @@ bool cDvbTuner::SetFrontend(void)
esyslog("ERROR: attempt to set channel with unknown DVB frontend type");
return false;
}
CHECK(ioctl(fd_frontend, DVBFE_SET_DELSYS, &Frontend.delivery));
if (ioctl(fd_frontend, DVBFE_SET_PARAMS, &Frontend) < 0) {
SETCMD(DTV_TUNE, 0);
if (ioctl(fd_frontend, FE_SET_PROPERTY, &CmdSeq) < 0) {
esyslog("ERROR: frontend %d: %m", cardIndex);
return false;
}
@ -372,13 +403,22 @@ int cDvbDevice::devVideoOffset = -1;
int cDvbDevice::setTransferModeForDolbyDigital = 1;
const char *DeliverySystems[] = {
"DVBS",
"UNDEFINED",
"DVB-C",
"DVB-C",
"DVB-T",
"DSS",
"DVBS2",
"DVBC",
"DVBT",
"DVBH",
"DVB-S",
"DVB-S2",
"DVB-H",
"ISDBT",
"ISDBS",
"ISDBC",
"ATSC",
"ATSCMH",
"DMBTH",
"CMMB",
"DAB",
NULL
};
@ -386,7 +426,7 @@ cDvbDevice::cDvbDevice(int n)
{
ciAdapter = NULL;
dvbTuner = NULL;
frontendType = DVBFE_DELSYS_DUMMY;
frontendType = SYS_UNDEFINED;
numProvidedSystems = 0;
spuDecoder = NULL;
digitalAudio = false;
@ -449,26 +489,24 @@ cDvbDevice::cDvbDevice(int n)
// We only check the devices that must be present - the others will be checked before accessing them://XXX
if (fd_frontend >= 0) {
if (ioctl(fd_frontend, DVBFE_GET_DELSYS, &frontendType) >= 0) {
const char **DeliverySystem = DeliverySystems;
cString ds;
for (int i = 0; i < 32; i++) {
if (frontendType & (1u << i)) {
numProvidedSystems++;
if (*DeliverySystem)
ds = cString::sprintf("%s %s", *ds ? *ds : "", *DeliverySystem);
else
esyslog("ERROR: unknown delivery system %d", i);
}
if (*DeliverySystem)
DeliverySystem++;
}
if (*ds)
isyslog("device %d provides:%s", CardIndex() + 1, *ds);
dvbTuner = new cDvbTuner(fd_frontend, CardIndex(), frontendType);
if (ioctl(fd_frontend, FE_GET_INFO, &frontendInfo) >= 0) {
switch (frontendInfo.type) {
case FE_QPSK: frontendType = (frontendInfo.caps & FE_CAN_2ND_GEN_MODULATION) ? SYS_DVBS2 : SYS_DVBS; break;
case FE_OFDM: frontendType = SYS_DVBT; break;
case FE_QAM: frontendType = SYS_DVBC_ANNEX_AC; break;
case FE_ATSC: frontendType = SYS_ATSC; break;
default: esyslog("ERROR: unknown frontend type %d on device %d", frontendInfo.type, CardIndex() + 1);
}
}
else
LOG_ERROR;
if (frontendType != SYS_UNDEFINED) {
numProvidedSystems++;
if (frontendType == SYS_DVBS2)
numProvidedSystems++;
isyslog("device %d provides %s (\"%s\")", CardIndex() + 1, DeliverySystems[frontendType], frontendInfo.name);
dvbTuner = new cDvbTuner(fd_frontend, CardIndex(), frontendType);
}
}
else
esyslog("ERROR: can't open DVB device %d", n);
@ -789,9 +827,9 @@ bool cDvbDevice::ProvidesSource(int Source) const
{
int type = Source & cSource::st_Mask;
return type == cSource::stNone
|| type == cSource::stCable && (frontendType & DVBFE_DELSYS_DVBC)
|| type == cSource::stSat && (frontendType & (DVBFE_DELSYS_DVBS | DVBFE_DELSYS_DVBS2))
|| type == cSource::stTerr && (frontendType & DVBFE_DELSYS_DVBT);
|| type == cSource::stCable && (frontendType == SYS_DVBC_ANNEX_AC || frontendType == SYS_DVBC_ANNEX_B)
|| type == cSource::stSat && (frontendType == SYS_DVBS || frontendType == SYS_DVBS2)
|| type == cSource::stTerr && (frontendType == SYS_DVBT);
}
bool cDvbDevice::ProvidesTransponder(const cChannel *Channel) const
@ -800,7 +838,7 @@ bool cDvbDevice::ProvidesTransponder(const cChannel *Channel) const
return false; // doesn't provide source
if (!cSource::IsSat(Channel->Source()))
return true; // source is sufficient for non sat
if (!(frontendType & Channel->System()))
if (frontendType == SYS_DVBS && Channel->System() == SYS_DVBS2)
return false; // requires modulation system which frontend doesn't provide
return !Setup.DiSEqC || Diseqcs.Get(Channel->Source(), Channel->Frequency(), Channel->Polarization());
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.h 2.2 2008/06/01 09:48:04 kls Exp $
* $Id: dvbdevice.h 2.3 2008/12/06 13:31:12 kls Exp $
*/
#ifndef __DVBDEVICE_H
@ -15,8 +15,8 @@
#include "device.h"
#include "dvbspu.h"
#if DVB_API_VERSION != 3 || DVB_API_VERSION_MINOR != 3
#error VDR requires Linux DVB driver API version 3.3!
#if DVB_API_VERSION != 5 || DVB_API_VERSION_MINOR != 0
#error VDR requires Linux DVB driver API version 5.0!
#endif
#define MAXDVBDEVICES 8
@ -35,8 +35,9 @@ public:
///< Must be called before accessing any DVB functions.
///< \return True if any devices are available.
private:
dvbfe_delsys frontendType;
dvb_frontend_info frontendInfo;
int numProvidedSystems;
fe_delivery_system frontendType;
int fd_osd, fd_audio, fd_video, fd_dvr, fd_stc, fd_ca;
protected:
virtual void MakePrimaryDevice(bool On);

4
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 2.2 2008/05/01 14:37:24 kls Exp $
* $Id: menu.c 2.3 2008/11/22 15:18:00 kls Exp $
*/
#include "menu.h"
@ -252,8 +252,6 @@ void cMenuEditChannel::Setup(void)
ST(" T") Add(new cMenuEditMapItem( tr("Transmission"), &data.transmission, TransmissionValues));
ST(" T") Add(new cMenuEditMapItem( tr("Guard"), &data.guard, GuardValues));
ST(" T") Add(new cMenuEditMapItem( tr("Hierarchy"), &data.hierarchy, HierarchyValues));
ST(" T") Add(new cMenuEditMapItem( tr("Alpha"), &data.alpha, AlphaValues));
ST(" T") Add(new cMenuEditMapItem( tr("Priority"), &data.priority, PriorityValues));
ST(" S ") Add(new cMenuEditMapItem( tr("Rolloff"), &data.rollOff, RollOffValues));
SetCurrent(Get(current));

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menuitems.c 2.1 2008/04/12 12:05:25 kls Exp $
* $Id: menuitems.c 2.2 2008/12/13 11:35:31 kls Exp $
*/
#include "menuitems.h"
@ -951,9 +951,7 @@ void cMenuEditMapItem::Set(void)
{
const char *s = NULL;
int n = MapToUser(*value, map, &s);
if (n == 999)
SetValue(tr("auto"));
else if (n == 0 && zeroString)
if (n == 0 && zeroString)
SetValue(zeroString);
else if (n >= 0) {
if (s)

37
nit.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: nit.c 2.1 2008/04/12 12:06:40 kls Exp $
* $Id: nit.c 2.2 2008/12/06 15:46:50 kls Exp $
*/
#include "nit.h"
@ -127,13 +127,13 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
int Frequency = Frequencies[0] = BCD2INT(sd->getFrequency()) / 100;
static char Polarizations[] = { 'h', 'v', 'l', 'r' };
char Polarization = Polarizations[sd->getPolarization()];
static int CodeRates[] = { DVBFE_FEC_NONE, DVBFE_FEC_1_2, DVBFE_FEC_2_3, DVBFE_FEC_3_4, DVBFE_FEC_5_6, DVBFE_FEC_7_8, DVBFE_FEC_8_9, DVBFE_FEC_3_5, DVBFE_FEC_4_5, DVBFE_FEC_9_10, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_NONE };
static int CodeRates[] = { FEC_NONE, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_8_9, FEC_3_5, FEC_4_5, FEC_9_10, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_NONE };
int CodeRate = CodeRates[sd->getFecInner()];
static int Modulations[] = { DVBFE_MOD_AUTO, DVBFE_MOD_QPSK, DVBFE_MOD_8PSK, DVBFE_MOD_QAM16 };
static int Modulations[] = { QPSK, PSK_8, QAM_16 };
int Modulation = Modulations[sd->getModulationType()];
int System = sd->getModulationSystem() ? DVBFE_DELSYS_DVBS2 : DVBFE_DELSYS_DVBS;
static int RollOffs[] = { DVBFE_ROLLOFF_35, DVBFE_ROLLOFF_25, DVBFE_ROLLOFF_20, DVBFE_ROLLOFF_UNKNOWN };
int RollOff = sd->getModulationSystem() ? RollOffs[sd->getRollOff()] : DVBFE_ROLLOFF_UNKNOWN;
int System = sd->getModulationSystem() ? SYS_DVBS2 : SYS_DVBS;
static int RollOffs[] = { ROLLOFF_35, ROLLOFF_25, ROLLOFF_20, ROLLOFF_AUTO };
int RollOff = sd->getModulationSystem() ? RollOffs[sd->getRollOff()] : ROLLOFF_AUTO;
int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10;
if (ThisNIT >= 0) {
for (int n = 0; n < NumFrequencies; n++) {
@ -181,9 +181,9 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
int Source = cSource::FromData(cSource::stCable);
int Frequency = Frequencies[0] = BCD2INT(sd->getFrequency()) / 10;
//XXX FEC_outer???
static int CodeRates[] = { DVBFE_FEC_NONE, DVBFE_FEC_1_2, DVBFE_FEC_2_3, DVBFE_FEC_3_4, DVBFE_FEC_5_6, DVBFE_FEC_7_8, DVBFE_FEC_8_9, DVBFE_FEC_3_5, DVBFE_FEC_4_5, DVBFE_FEC_9_10, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_NONE };
static int CodeRates[] = { FEC_NONE, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_8_9, FEC_3_5, FEC_4_5, FEC_9_10, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_AUTO, FEC_NONE };
int CodeRate = CodeRates[sd->getFecInner()];
static int Modulations[] = { DVBFE_MOD_NONE, DVBFE_MOD_QAM16, DVBFE_MOD_QAM32, DVBFE_MOD_QAM64, DVBFE_MOD_QAM128, DVBFE_MOD_QAM256, QAM_AUTO };
static int Modulations[] = { QPSK, QAM_16, QAM_32, QAM_64, QAM_128, QAM_256, QAM_AUTO };
int Modulation = Modulations[min(sd->getModulation(), 6)];
int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10;
if (ThisNIT >= 0) {
@ -231,22 +231,19 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
SI::TerrestrialDeliverySystemDescriptor *sd = (SI::TerrestrialDeliverySystemDescriptor *)d;
int Source = cSource::FromData(cSource::stTerr);
int Frequency = Frequencies[0] = sd->getFrequency() * 10;
static int Bandwidths[] = { DVBFE_BANDWIDTH_8_MHZ, DVBFE_BANDWIDTH_7_MHZ, DVBFE_BANDWIDTH_6_MHZ, DVBFE_BANDWIDTH_5_MHZ, DVBFE_BANDWIDTH_AUTO, DVBFE_BANDWIDTH_AUTO, DVBFE_BANDWIDTH_AUTO, DVBFE_BANDWIDTH_AUTO };
static int Bandwidths[] = { 8000000, 7000000, 6000000, 0, 0, 0, 0, 0 };
int Bandwidth = Bandwidths[sd->getBandwidth()];
static int Constellations[] = { DVBFE_MOD_QPSK, DVBFE_MOD_QAM16, DVBFE_MOD_QAM64, DVBFE_MOD_AUTO };
static int Constellations[] = { QPSK, QAM_16, QAM_64, QAM_AUTO };
int Constellation = Constellations[sd->getConstellation()];
static int CodeRates[] = { DVBFE_FEC_1_2, DVBFE_FEC_2_3, DVBFE_FEC_3_4, DVBFE_FEC_5_6, DVBFE_FEC_7_8, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO, DVBFE_FEC_AUTO };
static int Hierarchies[] = { HIERARCHY_NONE, HIERARCHY_1, HIERARCHY_2, HIERARCHY_4, HIERARCHY_AUTO, HIERARCHY_AUTO, HIERARCHY_AUTO, HIERARCHY_AUTO };
int Hierarchy = Hierarchies[sd->getHierarchy()];
static int CodeRates[] = { FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8, FEC_AUTO, FEC_AUTO, FEC_AUTO };
int CodeRateHP = CodeRates[sd->getCodeRateHP()];
int CodeRateLP = CodeRates[sd->getCodeRateLP()];
static int GuardIntervals[] = { DVBFE_GUARD_INTERVAL_1_32, DVBFE_GUARD_INTERVAL_1_16, DVBFE_GUARD_INTERVAL_1_8, DVBFE_GUARD_INTERVAL_1_4 };
static int GuardIntervals[] = { GUARD_INTERVAL_1_32, GUARD_INTERVAL_1_16, GUARD_INTERVAL_1_8, GUARD_INTERVAL_1_4 };
int GuardInterval = GuardIntervals[sd->getGuardInterval()];
static int TransmissionModes[] = { DVBFE_TRANSMISSION_MODE_2K, DVBFE_TRANSMISSION_MODE_8K, DVBFE_TRANSMISSION_MODE_4K, DVBFE_TRANSMISSION_MODE_AUTO };
static int TransmissionModes[] = { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_AUTO, TRANSMISSION_MODE_AUTO };
int TransmissionMode = TransmissionModes[sd->getTransmissionMode()];
static int Priorities[] = { DVBFE_STREAM_PRIORITY_LP, DVBFE_STREAM_PRIORITY_HP };
int Priority = Priorities[sd->getPriority()];
static int Alphas[] = { 0, DVBFE_ALPHA_1, DVBFE_ALPHA_2, DVBFE_ALPHA_4 };
int Alpha = Alphas[sd->getHierarchy() & 3];
int Hierarchy = Alpha ? DVBFE_HIERARCHY_ON : DVBFE_HIERARCHY_OFF;
if (ThisNIT >= 0) {
for (int n = 0; n < NumFrequencies; n++) {
if (ISTRANSPONDER(Frequencies[n] / 1000000, Transponder())) {
@ -272,14 +269,14 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
}
}
if (ISTRANSPONDER(Frequency / 1000000, Transponder())) // only modify channels if we're actually receiving this transponder
Channel->SetTerrTransponderData(Source, Frequency, Bandwidth, Constellation, Hierarchy, CodeRateHP, CodeRateLP, GuardInterval, TransmissionMode, Alpha, Priority);
Channel->SetTerrTransponderData(Source, Frequency, Bandwidth, Constellation, Hierarchy, CodeRateHP, CodeRateLP, GuardInterval, TransmissionMode);
}
}
if (!found) {
for (int n = 0; n < NumFrequencies; n++) {
cChannel *Channel = new cChannel;
Channel->SetId(ts.getOriginalNetworkId(), ts.getTransportStreamId(), 0, 0);
if (Channel->SetTerrTransponderData(Source, Frequencies[n], Bandwidth, Constellation, Hierarchy, CodeRateHP, CodeRateLP, GuardInterval, TransmissionMode, Alpha, Priority))
if (Channel->SetTerrTransponderData(Source, Frequencies[n], Bandwidth, Constellation, Hierarchy, CodeRateHP, CodeRateLP, GuardInterval, TransmissionMode))
EITScanner.AddTransponder(Channel);
else
delete Channel;

16
vdr.5
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
.\" $Id: vdr.5 2.4 2008/07/06 13:00:19 kls Exp $
.\" $Id: vdr.5 2.5 2008/11/22 15:23:10 kls Exp $
.\"
.TH vdr 5 "10 Feb 2008" "1.6" "Video Disk Recorder Files"
.SH NAME
@ -83,22 +83,20 @@ meaning (and allowed values) are
.TS
tab (@);
l l.
\fBA\fR@Alpha (0, 1, 2, 4)
\fBB\fR@Bandwidth (5, 6, 7, 8)
\fBC\fR@Code rate high priority (0, 12, 13, 14, 23, 25, 34, 35, 45, 56, 67, 78, 89, 910)
\fBD\fR@coDe rate low priority (0, 12, 13, 14, 23, 25, 34, 35, 45, 56, 67, 78, 89, 910)
\fBB\fR@Bandwidth (6, 7, 8)
\fBC\fR@Code rate high priority (0, 12, 23, 34, 35, 45, 56, 67, 78, 89, 910)
\fBD\fR@coDe rate low priority (0, 12, 23, 34, 35, 45, 56, 67, 78, 89, 910)
\fBG\fR@Guard interval (4, 8, 16, 32)
\fBH\fR@Horizontal polarization
\fBI\fR@Inversion (0, 1)
\fBL\fR@Left circular polarization
\fBM\fR@Modulation (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 32, 64, 128, 256, 512, 998, 1024)
\fBM\fR@Modulation (2, 5, 6, 10, 11, 16, 32, 64, 128, 256, 998)
\fBO\fR@rollOff (0, 20, 25, 35)
\fBP\fR@Priority (0, 1)
\fBR\fR@Right circular polarization
\fBS\fR@delivery System (0, 1)
\fBT\fR@Transmission mode (2, 4, 8)
\fBT\fR@Transmission mode (2, 8)
\fBV\fR@Vertical polarization
\fBY\fR@hierarchY (0, 1)
\fBY\fR@hierarchY (0, 1, 2, 4)
.TE
The polarization parameters have no integer numbers following them. This is for