Hi list,
Based on the original DVB API patch of last week, I've done a cleaner
rewrite of the patch. This time, the changes to the VDR sources are
limited to a few #includes and replacements of ioctl calls by the new
DVBFE_ioctl wrapper call. All the magic goes into this API wrapper, that
translates multiproto calls into DVB 3.0 API calls.
There's also more control on the behavior. Adding DEFINES +=
-DDVB_MULTIPROTO_WRAPPER=1 to Make.config will enforce the API
translation even if the multiproto API is present, setting it =0 will
disable API translation, requiring the multiproto API to be present. By
default, the present API is automatically detected, and the wrapper is
enabled accordingly.
The patch currently doesn't translate the whole API, just the parts that
are used by VDR. But if required, the missing parts can surely be
integrated.
Cheers,
Udo
diff -Nu vdr-1.5.14/channels.c vdr-1.5.14-wrapper/channels.c
--- vdr-1.5.14/channels.c 2008-01-27 14:59:53.0 +0100
+++ vdr-1.5.14-wrapper/channels.c 2008-02-02 23:37:38.0 +0100
@@ -11,6 +11,7 @@
#include linux/dvb/frontend.h
#include ctype.h
#include device.h
+#include dvb_api_wrapper.h
#include epg.h
#include timers.h
diff -Nu vdr-1.5.14/dvb_api_wrapper.c vdr-1.5.14-wrapper/dvb_api_wrapper.c
--- vdr-1.5.14/dvb_api_wrapper.c1970-01-01 01:00:00.0 +0100
+++ vdr-1.5.14-wrapper/dvb_api_wrapper.c2008-02-02 23:57:09.0
+0100
@@ -0,0 +1,203 @@
+/*
+ * dvb_api_wrapper.c:
+ * Wrapper to translate Multiproto DVB API to DVB 3.0 API calls
+ *
+ * See the main source file 'vdr.c' for copyright information and
+ * how to reach the author.
+ *
+ * $Id: $
+ */
+
+#include dvb_api_wrapper.h
+#include string.h
+#include errno.h
+#include sys/ioctl.h
+
+#ifdef DVB_MULTIPROTO_WRAPPER
+
+static bool TranslateCodeRate(fe_code_rate oldfec, dvbfe_fec fec) {
+ switch (fec) {
+case DVBFE_FEC_NONE: oldfec = FEC_NONE; return true;
+case DVBFE_FEC_1_2: oldfec = FEC_1_2; return true;
+case DVBFE_FEC_2_3: oldfec = FEC_2_3; return true;
+case DVBFE_FEC_3_4: oldfec = FEC_3_4; return true;
+case DVBFE_FEC_4_5: oldfec = FEC_4_5; return true;
+case DVBFE_FEC_5_6: oldfec = FEC_5_6; return true;
+case DVBFE_FEC_6_7: oldfec = FEC_6_7; return true;
+case DVBFE_FEC_7_8: oldfec = FEC_7_8; return true;
+case DVBFE_FEC_8_9: oldfec = FEC_8_9; return true;
+case DVBFE_FEC_AUTO: oldfec = FEC_AUTO; return true;
+default: return false;
+}
+}
+
+static bool TranslateModulation(fe_modulation oldmod, dvbfe_modulation mod) {
+ switch (mod) {
+case DVBFE_MOD_QPSK:oldmod = QPSK; return true;
+case DVBFE_MOD_QAM16: oldmod = QAM_16; return true;
+case DVBFE_MOD_QAM32: oldmod = QAM_32; return true;
+case DVBFE_MOD_QAM64: oldmod = QAM_64; return true;
+case DVBFE_MOD_QAM128: oldmod = QAM_128; return true;
+case DVBFE_MOD_QAM256: oldmod = QAM_256; return true;
+case DVBFE_MOD_QAMAUTO: oldmod = QAM_AUTO; return true;
+default: return false;
+ }
+}
+
+static bool TranslateBandwidth(fe_bandwidth_t oldbw, dvbfe_bandwidth
bandwidth) {
+ switch (bandwidth) {
+case DVBFE_BANDWIDTH_8_MHZ: oldbw = BANDWIDTH_8_MHZ; return true;
+case DVBFE_BANDWIDTH_7_MHZ: oldbw = BANDWIDTH_7_MHZ; return true;
+case DVBFE_BANDWIDTH_6_MHZ: oldbw = BANDWIDTH_6_MHZ; return true;
+case DVBFE_BANDWIDTH_AUTO: oldbw = BANDWIDTH_AUTO; return true;
+default: return false;
+ }
+}
+
+static bool TranslateTransmission(fe_transmit_mode_t oldtrans,
dvbfe_transmission_mode trans) {
+ switch (trans) {
+case DVBFE_TRANSMISSION_MODE_2K: oldtrans = TRANSMISSION_MODE_2K;
return true;
+case DVBFE_TRANSMISSION_MODE_8K: oldtrans = TRANSMISSION_MODE_8K;
return true;
+case DVBFE_TRANSMISSION_MODE_AUTO: oldtrans = TRANSMISSION_MODE_AUTO;
return true;
+default: return false;
+ }
+}
+
+static bool TranslateGuard(fe_guard_interval_t oldguard, dvbfe_guard_interval
guard) {
+ switch (guard) {
+case DVBFE_GUARD_INTERVAL_1_32: oldguard = GUARD_INTERVAL_1_32; return
true;
+case DVBFE_GUARD_INTERVAL_1_16: oldguard = GUARD_INTERVAL_1_16; return
true;
+case DVBFE_GUARD_INTERVAL_1_8: oldguard = GUARD_INTERVAL_1_8; return
true;
+case DVBFE_GUARD_INTERVAL_1_4: oldguard = GUARD_INTERVAL_1_4; return
true;
+case DVBFE_GUARD_INTERVAL_AUTO: oldguard = GUARD_INTERVAL_AUTO; return
true;
+default: return false;
+ }
+}
+
+static bool TranslateHierarchy(fe_hierarchy_t oldhier, dvbfe_hierarchy
hierarchy, dvbfe_alpha alpha) {
+ switch (hierarchy) {
+case DVBFE_HIERARCHY_OFF: oldhier = HIERARCHY_NONE; return true;
+case DVBFE_HIERARCHY_AUTO: oldhier = HIERARCHY_AUTO; return true;
+case DVBFE_HIERARCHY_ON:
+ switch (alpha) {
+ case DVBFE_ALPHA_1: oldhier = HIERARCHY_1; return true;
+ case DVBFE_ALPHA_2: oldhier = HIERARCHY_2; return true;
+ case