From e46338c66a6ded23c364d79d5beb2432980cba19 Mon Sep 17 00:00:00 2001 From: Oliver Freyermuth Date: Sun, 8 Oct 2017 05:01:55 +0200 Subject: dvb: Fixes for ATSC tuning. ATSC is a mix of terrestrial and cable, and depending on modulation is actually using DVBC_ANNEX_B. Thus, we need to override the delivery system depending on the modulation, channel by channel. Signed-off-by: Oliver Freyermuth --- stream/dvb_tune.c | 5 +++-- stream/stream_dvb.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'stream') diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c index bc7b099c89..7c24af104e 100644 --- a/stream/dvb_tune.c +++ b/stream/dvb_tune.c @@ -152,11 +152,9 @@ old_api: if ((FE_CAN_8VSB | FE_CAN_16VSB) & fe_info.caps) { DELSYS_SET(ret_mask, SYS_ATSC); } -#if 0 /* Not used now. */ if ((FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_QAM_AUTO) & fe_info.caps) { DELSYS_SET(ret_mask, SYS_DVBC_ANNEX_B); } -#endif break; #endif default: @@ -598,6 +596,7 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, break; #ifdef DVB_ATSC case SYS_ATSC: + case SYS_DVBC_ANNEX_B: MP_VERBOSE(priv, "tuning %s to %d, modulation=%d\n", get_dvb_delsys(delsys), freq, modulation); break; @@ -700,6 +699,7 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys, break; #ifdef DVB_ATSC case SYS_ATSC: + case SYS_DVBC_ANNEX_B: { struct dtv_property p[] = { { .cmd = DTV_DELIVERY_SYSTEM, .u.data = delsys }, @@ -768,6 +768,7 @@ old_api: break; #ifdef DVB_ATSC case SYS_ATSC: + case SYS_DVBC_ANNEX_B: feparams.u.vsb.modulation = modulation; break; #endif diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 1572f2687b..856c9a7ffd 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -319,6 +319,7 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, case SYS_DVBC_ANNEX_A: case SYS_DVBC_ANNEX_C: case SYS_ATSC: + case SYS_DVBC_ANNEX_B: mp_verbose(log, "VDR, %s, NUM: %d, NUM_FIELDS: %d, NAME: %s, " "FREQ: %d, SRATE: %d", get_dvb_delsys(delsys), @@ -390,6 +391,7 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, break; #ifdef DVB_ATSC case SYS_ATSC: + case SYS_DVBC_ANNEX_B: fields = sscanf(&line[k], atsc_conf, &ptr->freq, mod, vpid_str, apid_str); mp_verbose(log, "%s, NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d\n", @@ -523,6 +525,7 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, case SYS_DVBC_ANNEX_A: case SYS_DVBC_ANNEX_C: case SYS_ATSC: + case SYS_DVBC_ANNEX_B: if (!strcmp(mod, "QAM_128")) { ptr->mod = QAM_128; } else if (!strcmp(mod, "QAM_256")) { @@ -541,6 +544,19 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, #endif } } +#ifdef DVB_ATSC + /* Modulation defines real delsys for ATSC: + Terrestrial (VSB) is SYS_ATSC, Cable (QAM) is SYS_DVBC_ANNEX_B. */ + if (delsys == SYS_ATSC || delsys == SYS_DVBC_ANNEX_B) { + if (ptr->mod == VSB_8 || ptr->mod == VSB_16) { + delsys = SYS_ATSC; + } else { + delsys = SYS_DVBC_ANNEX_B; + } + mp_verbose(log, "Defined delivery system for ATSC as %s from modulation.\n", + get_dvb_delsys(delsys)); + } +#endif switch (delsys) { case SYS_DVBT: -- cgit v1.2.3