1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added definitions for older DVB API versions, back until 5.0

This commit is contained in:
Klaus Schmidinger 2013-04-09 13:44:50 +02:00
parent ae208771e8
commit e5971d2684
3 changed files with 99 additions and 30 deletions

View File

@ -7783,8 +7783,10 @@ Video Disk Recorder Revision History
- Bumped all version numbers to 2.0.0. - Bumped all version numbers to 2.0.0.
- Official release. - Official release.
2013-04-07: Version 2.0.1 2013-04-09: Version 2.0.1
- Fixed initializing cDevice::keepTracks. - Fixed initializing cDevice::keepTracks.
- Fixed an endless loop in cTextWrapper::Set() in case the given Width is smaller than - Fixed an endless loop in cTextWrapper::Set() in case the given Width is smaller than
one character (reported by Stefan Braun). one character (reported by Stefan Braun).
- Added definitions for older DVB API versions, back until 5.0 (based on a patch from
Udo Richter).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: dvbdevice.c 2.88 2013/03/16 15:23:35 kls Exp $ * $Id: dvbdevice.c 2.88.1.1 2013/04/09 13:42:26 kls Exp $
*/ */
#include "dvbdevice.h" #include "dvbdevice.h"
@ -21,10 +21,7 @@
#include "menuitems.h" #include "menuitems.h"
#include "sourceparams.h" #include "sourceparams.h"
#if (DVB_API_VERSION << 8 | DVB_API_VERSION_MINOR) < 0x0508 static int DvbApiVersion = 0x0000; // the version of the DVB driver actually in use (will be determined by the first device created)
#define DTV_STREAM_ID DTV_DVBT2_PLP_ID
#define FE_CAN_MULTISTREAM 0x4000000
#endif
#define DVBS_TUNE_TIMEOUT 9000 //ms #define DVBS_TUNE_TIMEOUT 9000 //ms
#define DVBS_LOCK_TIMEOUT 2000 //ms #define DVBS_LOCK_TIMEOUT 2000 //ms
@ -801,7 +798,8 @@ bool cDvbTuner::SetFrontend(void)
// DVB-S2 // DVB-S2
SETCMD(DTV_PILOT, PILOT_AUTO); SETCMD(DTV_PILOT, PILOT_AUTO);
SETCMD(DTV_ROLLOFF, dtp.RollOff()); SETCMD(DTV_ROLLOFF, dtp.RollOff());
SETCMD(DTV_STREAM_ID, dtp.StreamId()); if (DvbApiVersion >= 0x0508)
SETCMD(DTV_STREAM_ID, dtp.StreamId());
} }
else { else {
// DVB-S // DVB-S
@ -835,7 +833,11 @@ bool cDvbTuner::SetFrontend(void)
SETCMD(DTV_HIERARCHY, dtp.Hierarchy()); SETCMD(DTV_HIERARCHY, dtp.Hierarchy());
if (frontendType == SYS_DVBT2) { if (frontendType == SYS_DVBT2) {
// DVB-T2 // DVB-T2
SETCMD(DTV_STREAM_ID, dtp.StreamId()); if (DvbApiVersion >= 0x0508) {
SETCMD(DTV_STREAM_ID, dtp.StreamId());
}
else if (DvbApiVersion >= 0x0503)
SETCMD(DTV_DVBT2_PLP_ID_LEGACY, dtp.StreamId());
} }
tuneTimeout = DVBT_TUNE_TIMEOUT; tuneTimeout = DVBT_TUNE_TIMEOUT;
@ -1178,28 +1180,44 @@ bool cDvbDevice::QueryDeliverySystems(int fd_frontend)
LOG_ERROR; LOG_ERROR;
return false; return false;
} }
#if (DVB_API_VERSION << 8 | DVB_API_VERSION_MINOR) >= 0x0505
dtv_property Frontend[1]; dtv_property Frontend[1];
memset(&Frontend, 0, sizeof(Frontend));
dtv_properties CmdSeq; dtv_properties CmdSeq;
memset(&CmdSeq, 0, sizeof(CmdSeq)); // Determine the version of the running DVB API:
CmdSeq.props = Frontend; if (!DvbApiVersion) {
SETCMD(DTV_ENUM_DELSYS, 0); memset(&Frontend, 0, sizeof(Frontend));
int Result = ioctl(fd_frontend, FE_GET_PROPERTY, &CmdSeq); memset(&CmdSeq, 0, sizeof(CmdSeq));
if (Result == 0) { CmdSeq.props = Frontend;
for (uint i = 0; i < Frontend[0].u.buffer.len; i++) { SETCMD(DTV_API_VERSION, 0);
if (numDeliverySystems >= MAXDELIVERYSYSTEMS) { if (ioctl(fd_frontend, FE_GET_PROPERTY, &CmdSeq) != 0) {
esyslog("ERROR: too many delivery systems on frontend %d/%d", adapter, frontend); LOG_ERROR;
break; return false;
} }
deliverySystems[numDeliverySystems++] = Frontend[0].u.buffer.data[i]; DvbApiVersion = Frontend[0].u.data;
} isyslog("DVB API version is 0x%04X (VDR was built with 0x%04X)", DvbApiVersion, DVBAPIVERSION);
} }
else { // Determine the types of delivery systems this device provides:
esyslog("ERROR: can't query delivery systems on frontend %d/%d - falling back to legacy mode", adapter, frontend); bool LegacyMode = true;
#else if (DvbApiVersion >= 0x0505) {
{ memset(&Frontend, 0, sizeof(Frontend));
#endif memset(&CmdSeq, 0, sizeof(CmdSeq));
CmdSeq.props = Frontend;
SETCMD(DTV_ENUM_DELSYS, 0);
int Result = ioctl(fd_frontend, FE_GET_PROPERTY, &CmdSeq);
if (Result == 0) {
for (uint i = 0; i < Frontend[0].u.buffer.len; i++) {
if (numDeliverySystems >= MAXDELIVERYSYSTEMS) {
esyslog("ERROR: too many delivery systems on frontend %d/%d", adapter, frontend);
break;
}
deliverySystems[numDeliverySystems++] = Frontend[0].u.buffer.data[i];
}
LegacyMode = false;
}
else {
esyslog("ERROR: can't query delivery systems on frontend %d/%d - falling back to legacy mode", adapter, frontend);
}
}
if (LegacyMode) {
// Legacy mode (DVB-API < 5.5): // Legacy mode (DVB-API < 5.5):
switch (frontendInfo.type) { switch (frontendInfo.type) {
case FE_QPSK: deliverySystems[numDeliverySystems++] = SYS_DVBS; case FE_QPSK: deliverySystems[numDeliverySystems++] = SYS_DVBS;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: dvbdevice.h 2.29 2013/03/07 09:42:29 kls Exp $ * $Id: dvbdevice.h 2.29.1.1 2013/04/09 13:43:33 kls Exp $
*/ */
#ifndef __DVBDEVICE_H #ifndef __DVBDEVICE_H
@ -14,10 +14,59 @@
#include <linux/dvb/version.h> #include <linux/dvb/version.h>
#include "device.h" #include "device.h"
#if (DVB_API_VERSION << 8 | DVB_API_VERSION_MINOR) < 0x0503 #define DVBAPIVERSION (DVB_API_VERSION << 8 | DVB_API_VERSION_MINOR)
#error VDR requires Linux DVB driver API version 5.3 or higher!
#if DVBAPIVERSION < 0x0500
#error VDR requires Linux DVB driver API version 5.0 or higher!
#endif #endif
// --- Definitions for older DVB API versions --------------------------------
#if DVBAPIVERSION < 0x0501
enum {
FE_CAN_2G_MODULATION = 0x10000000,
};
enum {
TRANSMISSION_MODE_4K = TRANSMISSION_MODE_AUTO + 1,
};
#endif
#if DVBAPIVERSION < 0x0502
enum {
FE_CAN_TURBO_FEC = 0x8000000,
};
#endif
#if DVBAPIVERSION < 0x0503
enum {
TRANSMISSION_MODE_1K = TRANSMISSION_MODE_4K + 1,
TRANSMISSION_MODE_16K,
TRANSMISSION_MODE_32K,
};
enum {
GUARD_INTERVAL_1_128 = GUARD_INTERVAL_AUTO + 1,
GUARD_INTERVAL_19_128,
GUARD_INTERVAL_19_256,
};
enum {
SYS_DVBT2 = SYS_DAB + 1,
};
#endif
#if DVBAPIVERSION < 0x0505
#define DTV_ENUM_DELSYS 44
#endif
#if DVBAPIVERSION < 0x0508
enum {
FE_CAN_MULTISTREAM = 0x4000000,
};
#define DTV_STREAM_ID 42
#define DTV_DVBT2_PLP_ID_LEGACY 43
#endif
// --- End of definitions for older DVB API versions -------------------------
#define MAXDVBDEVICES 8 #define MAXDVBDEVICES 8
#define MAXDELIVERYSYSTEMS 8 #define MAXDELIVERYSYSTEMS 8