summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorOliver Freyermuth <o.freyermuth@googlemail.com>2016-01-20 20:46:15 +0100
committerwm4 <wm4@nowhere>2016-01-21 00:34:02 +0100
commitb2a5c16a9d8a2b2103d60f0ac1c512800161ac74 (patch)
tree28e58b22474b4557d71bc5bb10ff8f9d06778dd3 /stream
parent346cf7abf0a6c2ca4404440e24dd79f27fb39a23 (diff)
downloadmpv-b2a5c16a9d8a2b2103d60f0ac1c512800161ac74.tar.bz2
mpv-b2a5c16a9d8a2b2103d60f0ac1c512800161ac74.tar.xz
stream_dvb: use DVBv5 API also for DVB-C tuning.
Using the new API is a necessity for multiple-delivery-system devices, since the old API does not offer a way to switch the delivery system of the card. This should in principle also be done for DVB-T / ATSC, especially since most DVB-T devices also support DVB-C, but I can not test such an implementation due to lack of hardware (currently) so it seems better to leave the existing, tested code-path in place for now.
Diffstat (limited to 'stream')
-rw-r--r--stream/dvb_tune.c47
1 files changed, 39 insertions, 8 deletions
diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c
index 80a240e71b..de43907217 100644
--- a/stream/dvb_tune.c
+++ b/stream/dvb_tune.c
@@ -470,7 +470,7 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend,
}
switch (state->tuner_type) {
- case TUNER_TER:
+ case TUNER_TER: {
if (freq < 1000000)
freq *= 1000UL;
feparams.frequency = freq;
@@ -488,8 +488,9 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend,
MP_ERR(priv, "ERROR tuning channel\n");
return -1;
}
- break;
- case TUNER_SAT:
+ }
+ break;
+ case TUNER_SAT: {
// DVB-S
if (freq > 2200000) {
// this must be an absolute frequency
@@ -566,8 +567,35 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend,
return -1;
}
#endif
- break;
- case TUNER_CBL:
+ }
+ break;
+ case TUNER_CBL: {
+#ifdef DVB_USE_S2API
+ /* S2API is the DVB API new since 2.6.28.
+ * It is also needed for devices supporting multiple delivery systems,
+ * commonly DVB-C + DVB-T are supported here.
+ */
+ fe_delivery_system_t delsys = SYS_DVBC_ANNEX_AC;
+ struct dtv_property p[] = {
+ { .cmd = DTV_DELIVERY_SYSTEM, .u.data = delsys },
+ { .cmd = DTV_FREQUENCY, .u.data = freq },
+ { .cmd = DTV_INVERSION, .u.data = specInv },
+ { .cmd = DTV_MODULATION, .u.data = modulation },
+ { .cmd = DTV_SYMBOL_RATE, .u.data = srate },
+ { .cmd = DTV_INNER_FEC, .u.data = HP_CodeRate },
+ { .cmd = DTV_TUNE },
+ };
+ struct dtv_properties cmdseq = {
+ .num = sizeof(p) / sizeof(p[0]),
+ .props = p
+ };
+ MP_VERBOSE(priv, "tuning DVB-C to %d, srate=%d using DVBv5 API...\n",
+ freq, srate);
+ if ((ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq)) == -1) {
+ MP_ERR(priv, "ERROR tuning channel\n");
+ return -1;
+ }
+#else
feparams.frequency = freq;
feparams.inversion = specInv;
feparams.u.qam.symbol_rate = srate;
@@ -578,9 +606,11 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend,
MP_ERR(priv, "ERROR tuning channel\n");
return -1;
}
- break;
+#endif
+ }
+ break;
#ifdef DVB_ATSC
- case TUNER_ATSC:
+ case TUNER_ATSC: {
feparams.frequency = freq;
feparams.u.vsb.modulation = modulation;
MP_VERBOSE(priv, "tuning ATSC to %d, modulation=%d\n", freq, modulation);
@@ -588,7 +618,8 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend,
MP_ERR(priv, "ERROR tuning channel\n");
return -1;
}
- break;
+ }
+ break;
#endif
default:
MP_VERBOSE(priv, "Unknown FE type. Aborting\n");