40 #include <sys/select.h>
42 #include <sys/types.h>
49 #include "libmythbase/mythconfig.h"
65 DTVTunerType tuner_type,
const dvb_frontend_parameters& params);
68 uint intermediate_freq,
bool can_fec_auto,
bool do_tune =
true);
73 #define LOC QString("DVBChan[%1](%2): ").arg(m_inputId).arg(DVBChannel::GetDevice())
76 #define DTV_STAT_FULL_DEBUG 0 // All DTV_STAT_xxx values
84 :
DTVChannel(parent), m_device(std::move(aDevice))
89 m_key += QString(
":%1")
99 else if (master !=
nullptr)
123 QMutexLocker master_locker(&(master->m_hwLock));
124 QMutexLocker new_master_locker(&(new_master->
m_hwLock));
125 new_master->
m_isOpen = master->m_isOpen;
149 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Closing DVB channel");
153 IsOpenMap::iterator it =
m_isOpen.find(who);
160 if (master !=
nullptr && master !=
this)
194 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Opening DVB channel");
199 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Use legacy DVBv3 API");
213 if (!master->
Open(who))
251 QByteArray devn = dvbdev.toLatin1();
253 for (
int tries = 1; ; ++tries)
260 LOG(VB_GENERAL, LOG_WARNING,
LOC +
261 "Opening DVB frontend device failed." +
ENO);
263 if (tries >= 5 || (errno != EBUSY && errno != EAGAIN))
265 LOG(VB_GENERAL, LOG_ERR,
LOC +
266 QString(
"Failed to open DVB frontend device due to "
267 "fatal error or too many attempts."));
270 std::this_thread::sleep_for(50ms);
275 dvb_frontend_info
info {};
278 LOG(VB_GENERAL, LOG_ERR,
LOC +
279 "Failed to get frontend information." +
ENO);
293 LOG(VB_CHANNEL, LOG_INFO,
LOC +
297 LOG(VB_CHANNEL, LOG_INFO, QString(
" %1").arg(capstr));
302 std::array<struct dtv_property,2> prop = {};
303 struct dtv_properties cmd = {};
305 prop[0].cmd = DTV_API_VERSION;
306 prop[1].cmd = DTV_DELIVERY_SYSTEM;
309 cmd.props = prop.data();
313 prop[0].u.data = 0x300;
314 prop[1].u.data = SYS_UNDEFINED;
340 if (
info.caps & FE_CAN_2G_MODULATION)
345 if (
info.caps & FE_CAN_TURBO_FEC)
360 if (
info.caps & FE_CAN_2G_MODULATION)
367 if (
info.caps & (FE_CAN_8VSB | FE_CAN_16VSB))
372 if (
info.caps & (FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_QAM_AUTO))
374 delsys = SYS_DVBC_ANNEX_B;
382 LOG(VB_GENERAL, LOG_ERR,
LOC +
383 QString(
"Frontend '%1' delivery system not detected.").arg(
m_frontendName));
392 std::array<struct dtv_property,1> prop = {};
393 struct dtv_properties cmd = {};
395 prop[0].cmd = DTV_ENUM_DELSYS;
398 cmd.props = prop.data();
402 LOG(VB_GENERAL, LOG_ERR,
LOC +
403 QString(
"Frontend '%1' FE_GET_PROPERTY failed.").arg(
m_frontendName));
408 int p_num_systems = prop[0].u.buffer.len;
409 for (
int i = 0; i < p_num_systems; i++)
415 if (p_num_systems == 0) {
416 LOG(VB_GENERAL, LOG_ERR,
LOC +
417 QString(
"Frontend '%1' returned 0 supported delivery systems!").arg(
m_frontendName));
427 LOG(VB_CHANNEL, LOG_INFO,
LOC +
429 LOG(VB_CHANNEL, LOG_INFO,
LOC +
430 QString(
"DVB version:0x%1 ").arg(
m_version,3,16,QChar(
'0')) +
435 LOG(VB_CHANNEL, LOG_INFO,
"Supported delivery systems: ");
440 LOG(VB_CHANNEL, LOG_INFO, QString(
" [%1]")
441 .arg(delsys.toString()));
445 LOG(VB_CHANNEL, LOG_INFO, QString(
" %1")
446 .arg(delsys.toString()));
450 uint32_t frq_min =
info.frequency_min;
451 uint32_t frq_max =
info.frequency_max;
452 uint32_t frq_stp =
info.frequency_stepsize;
454 if (
info.type == FE_QPSK)
462 LOG(VB_CHANNEL, LOG_INFO, QString(
"Frequency range for the current standard:"));
463 LOG(VB_CHANNEL, LOG_INFO, QString(
" From: %1 Hz").arg(frq_min,11));
464 LOG(VB_CHANNEL, LOG_INFO, QString(
" To: %1 Hz").arg(frq_max,11));
465 LOG(VB_CHANNEL, LOG_INFO, QString(
" Step: %1 Hz").arg(frq_stp,11));
467 if (
info.type == FE_QPSK ||
info.type == FE_QAM)
469 LOG(VB_CHANNEL, LOG_INFO, QString(
"Symbol rate ranges for the current standard:"));
470 LOG(VB_CHANNEL, LOG_INFO, QString(
" From: %1 Baud").arg(
info.symbol_rate_min,11));
471 LOG(VB_CHANNEL, LOG_INFO, QString(
" To: %1 Baud").arg(
info.symbol_rate_max,11));
484 LOG(VB_CHANNEL, LOG_INFO,
LOC +
485 QString(
"Change delivery system from %1 to %2.")
494 LOG(VB_CHANNEL, LOG_INFO,
LOC +
495 QString(
"Delivery system in database and in card equal, leave at %1.")
501 LOG(VB_CHANNEL, LOG_INFO,
LOC +
519 LOG(VB_CHANNEL, LOG_INFO,
LOC +
520 QString(
"Requested %1 channel is on SCR system")
525 LOG(VB_CHANNEL, LOG_INFO,
LOC +
526 QString(
"Requested %1 channel is on non-SCR system")
551 IsOpenMap::const_iterator it =
m_isOpen.find(
this);
572 LOG(VB_GENERAL, LOG_WARNING,
LOC +
573 QString(
"Frequency setting (%1) is out of range (min/max:%2/%3)")
583 LOG(VB_GENERAL, LOG_WARNING,
LOC +
584 "'Auto' inversion parameter unsupported by this driver, "
585 "falling back to 'off'.");
604 LOG(VB_GENERAL, LOG_WARNING,
LOC +
605 QString(
"Symbol Rate setting (%1) is out of range (min/max:%2/%3)")
612 LOG(VB_GENERAL, LOG_WARNING,
LOC +
613 "Selected fec_inner parameter unsupported by this driver.");
618 LOG(VB_GENERAL, LOG_WARNING,
LOC +
619 "Selected modulation parameter unsupported by this driver.");
635 LOG(VB_GENERAL, LOG_WARNING,
LOC +
636 "Selected code_rate_hp parameter unsupported by this driver.");
641 LOG(VB_GENERAL, LOG_WARNING,
LOC +
642 "Selected code_rate_lp parameter unsupported by this driver.");
648 LOG(VB_GENERAL, LOG_WARNING,
LOC +
649 "'Auto' bandwidth parameter unsupported by this driver.");
655 LOG(VB_GENERAL, LOG_WARNING,
LOC +
656 "'Auto' transmission_mode parameter unsupported by this driver.");
662 LOG(VB_GENERAL, LOG_WARNING,
LOC +
663 "'Auto' guard_interval parameter unsupported by this driver.");
669 LOG(VB_GENERAL, LOG_WARNING,
LOC +
670 "'Auto' hierarchy parameter unsupported by this driver. ");
675 LOG(VB_GENERAL, LOG_WARNING,
LOC +
676 "Selected modulation parameter unsupported by this driver.");
711 #if HAVE_FE_CAN_2G_MODULATION
715 #endif //HAVE_FE_CAN_2G_MODULATION
751 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Tune(): Invalid input."));
754 return Tune(tuning,
false,
false);
783 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Tuning on slave channel");
785 bool ok = master->
Tune(tuning, force_reset,
false);
792 uint intermediate_freq = 0;
793 bool can_fec_auto =
false;
798 LOG(VB_GENERAL, LOG_ERR,
LOC +
799 "DVB-S/S2 needs device tree for LNB handling");
807 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Tune(): Card not open!");
815 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Tuning parameters:");
817 LOG(VB_CHANNEL, LOG_INFO,
" New: " + tuning.
toString());
822 int freq_mult = (is_dvbs) ? 1 : 1000;
823 QString suffix = (is_dvbs) ?
"kHz" :
"Hz";
827 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"Tune(): Tuning to %1%2")
828 .arg(intermediate_freq ? intermediate_freq : tuning.
m_frequency)
835 if (tuning_delay > 0ms)
837 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Next tuning after less than %1ms, delaying by %2ms")
839 std::this_thread::sleep_for(tuning_delay);
855 LOG(VB_GENERAL, LOG_ERR,
LOC +
856 "Tune(): Failed to setup DiSEqC devices");
864 LOG(VB_GENERAL, LOG_ERR,
LOC +
865 "Tune(): No LNB for this configuration");
899 struct dtv_property p_clear = {};
900 struct dtv_properties cmdseq_clear = {};
902 p_clear.cmd = DTV_CLEAR;
903 cmdseq_clear.num = 1;
904 cmdseq_clear.props = &p_clear;
906 if ((ioctl(
m_fdFrontend, FE_SET_PROPERTY, &cmdseq_clear)) < 0)
908 LOG(VB_GENERAL, LOG_ERR,
LOC +
909 "Tune(): Clearing DTV properties cache failed." +
ENO);
917 LOG(VB_GENERAL, LOG_ERR,
LOC +
918 "Failed to convert DTVMultiplex to DTV_PROPERTY sequence");
924 for (
uint i = 0; i < cmds->num; i++)
926 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
927 QString(
"prop %1: cmd = %2, data %3")
928 .arg(i).arg(cmds->props[i].cmd)
929 .arg(cmds->props[i].u.data));
940 LOG(VB_GENERAL, LOG_ERR,
LOC +
941 "Tune(): Setting Frontend tuning parameters failed." +
ENO);
949 m_tunerType, tuning, intermediate_freq, can_fec_auto);
953 LOG(VB_GENERAL, LOG_ERR,
LOC +
954 "Tune(): Setting Frontend tuning parameters failed." +
ENO);
970 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"Tune(): Tuning to %1%2 skipped, already tuned")
971 .arg(intermediate_freq ? intermediate_freq : tuning.
m_frequency)
978 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Tune(): Frequency tuning successful");
997 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Card not open!");
1019 dvb_frontend_parameters params {};
1021 int res = ioctl(
m_fdFrontend, FE_GET_FRONTEND, ¶ms);
1024 LOG(VB_CHANNEL, LOG_ERR,
LOC +
"FE_GET_FRONTEND failed." +
ENO);
1043 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Card not open!");
1073 dvb_frontend_parameters params {};
1076 LOG(VB_GENERAL, LOG_ERR,
LOC +
1077 "Getting Frontend tuning parameters failed." +
ENO);
1104 query.
prepare(
"SELECT chanid, visible "
1105 "FROM channel, capturecard "
1106 "WHERE channel.deleted IS NULL AND "
1107 " capturecard.sourceid = channel.sourceid AND "
1108 " channel.channum = :CHANNUM AND "
1109 " capturecard.cardid = :INPUTID");
1120 while (query.
next())
1122 bool visible = query.
value(1).toInt() > 0;
1125 int chanid = query.
value(0).toInt();
1126 idlist.append(chanid);
1130 if (idlist.isEmpty())
1132 LOG(VB_GENERAL, LOG_WARNING,
LOC +
1133 QString(
"No visible channel ID for %1")
1138 id = idlist.value(0);
1139 if (idlist.count() > 1)
1142 for (
auto chanid : idlist)
1144 sl.append(QString::number(chanid));
1146 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
1147 QString(
"Found for '%1' multiple visible channel IDs: %2")
1152 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
1153 QString(
"Found visible channel ID %1 for '%2'")
1174 bool haslock = master->
HasLock(ok);
1180 #if ((DVB_API_VERSION > 5) || ((DVB_API_VERSION == 5) && (DVB_API_VERSION_MINOR > 10)))
1181 fe_status_t status = FE_NONE;
1182 #else // debian9, centos7
1183 fe_status_t status = (fe_status_t)0;
1186 int ret = ioctl(
m_fdFrontend, FE_READ_STATUS, &status);
1189 LOG(VB_GENERAL, LOG_ERR,
LOC +
"FE_READ_STATUS failed" +
ENO);
1193 LOG(VB_CHANNEL, LOG_DEBUG,
LOC + QString(
"%1 status: 0x%2 %3")
1194 .arg(__func__).arg(status,2,16,QChar(
'0')).arg(
toString(status)));
1200 return (status & FE_HAS_LOCK) != 0;
1205 struct dtv_property prop = {};
1206 struct dtv_properties cmd = {};
1208 prop.cmd = DTV_STAT_SIGNAL_STRENGTH;
1214 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
"FE_GET_PROPERTY DTV_STAT_SIGNAL_STRENGTH failed" +
ENO);
1218 #if DTV_STAT_FULL_DEBUG
1219 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
"DTV_STAT_SIGNAL_STRENGTH " +
1220 QString(
"res=%1 len=%2 scale=%3 val=%4")
1221 .arg(cmd.props->result)
1222 .arg(cmd.props->u.st.len)
1223 .arg(cmd.props->u.st.stat[0].scale)
1224 .arg(cmd.props->u.st.stat[0].svalue));
1228 bool tmpOk = (ret == 0) && (cmd.props->u.st.len > 0);
1235 if (cmd.props->u.st.stat[0].scale == FE_SCALE_DECIBEL)
1241 int64_t svalue = cmd.props->u.st.stat[0].svalue;
1242 if (svalue >= -100000 && svalue <= 0)
1245 value = svalue + 100000;
1246 value = value / 100000.0;
1247 value = std::min(value, 1.0);
1250 else if (cmd.props->u.st.stat[0].scale == FE_SCALE_RELATIVE)
1253 value = cmd.props->u.st.stat[0].uvalue / 65535.0;
1285 int ret = ioctl(
m_fdFrontend, FE_READ_SIGNAL_STRENGTH, &sig);
1289 return sig * (1.0 / 65535.0);
1294 struct dtv_property prop = {};
1295 struct dtv_properties cmd = {};
1297 prop.cmd = DTV_STAT_CNR;
1303 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
"FE_GET_PROPERTY DTV_STAT_CNR failed" +
ENO);
1307 #if DTV_STAT_FULL_DEBUG
1308 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
"DTV_STAT_CNR " +
1309 QString(
"res=%1 len=%2 scale=%3 val=%4")
1310 .arg(cmd.props->result)
1311 .arg(cmd.props->u.st.len)
1312 .arg(cmd.props->u.st.stat[0].scale)
1313 .arg(cmd.props->u.st.stat[0].svalue));
1317 bool tmpOk = (ret == 0) && (cmd.props->u.st.len > 0);
1323 if (cmd.props->u.st.stat[0].scale == FE_SCALE_DECIBEL)
1328 value = cmd.props->u.st.stat[0].svalue;
1329 value = value / 50000.0;
1335 else if (cmd.props->u.st.stat[0].scale == FE_SCALE_RELATIVE)
1338 value = cmd.props->u.st.stat[0].uvalue / 65535.0;
1349 double val = master->
GetSNR(ok);
1374 return snr * (1.0 / 65535.0);
1379 std::array<struct dtv_property,2> prop {};
1380 struct dtv_properties cmd = {};
1382 prop[0].cmd = DTV_STAT_POST_ERROR_BIT_COUNT;
1383 prop[1].cmd = DTV_STAT_POST_TOTAL_BIT_COUNT;
1384 cmd.num = prop.size();
1385 cmd.props = prop.data();
1389 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
"FE_GET_PROPERTY DTV_STAT_POST_ERROR_BIT_COUNT failed" +
ENO);
1393 #if DTV_STAT_FULL_DEBUG
1394 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
"DTV_STAT_POST_ERROR_BIT_COUNT " +
1395 QString(
"res=%1 len=%2 scale=%3 val=%4 res=%5 len=%6 scale=%7 val=%8")
1396 .arg(cmd.props[0].result)
1397 .arg(cmd.props[0].u.st.len)
1398 .arg(cmd.props[0].u.st.stat[0].scale)
1399 .arg(cmd.props[0].u.st.stat[0].uvalue)
1400 .arg(cmd.props[1].result)
1401 .arg(cmd.props[1].u.st.len)
1402 .arg(cmd.props[1].u.st.stat[0].scale)
1403 .arg(cmd.props[1].u.st.stat[0].uvalue));
1407 bool tmpOk = (ret == 0) &&
1408 (cmd.props[0].u.st.len > 0) &&
1409 (cmd.props[1].u.st.len > 0);
1415 if ((cmd.props[0].u.st.stat[0].scale == FE_SCALE_COUNTER) &&
1416 (cmd.props[1].u.st.stat[0].scale == FE_SCALE_COUNTER) &&
1417 (cmd.props[1].u.st.stat[0].uvalue != 0))
1419 value =
static_cast<double>(
1420 static_cast<long double>(cmd.props[0].u.st.stat[0].uvalue) /
1421 cmd.props[1].u.st.stat[0].uvalue);
1455 return (
double) ber;
1460 struct dtv_property prop = {};
1461 struct dtv_properties cmd = {};
1463 prop.cmd = DTV_STAT_ERROR_BLOCK_COUNT;
1469 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
"FE_GET_PROPERTY DTV_STAT_ERROR_BLOCK_COUNT failed" +
ENO);
1473 #if DTV_STAT_FULL_DEBUG
1474 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
"DTV_STAT_ERROR_BLOCK_COUNT " +
1475 QString(
"res=%1 len=%2 scale=%3 val=%4")
1476 .arg(cmd.props[0].result)
1477 .arg(cmd.props[0].u.st.len)
1478 .arg(cmd.props[0].u.st.stat[0].scale)
1479 .arg(cmd.props[0].u.st.stat[0].svalue));
1483 bool tmpOk = (ret == 0) && (cmd.props->u.st.len > 0);
1489 if (cmd.props->u.st.stat[0].scale == FE_SCALE_COUNTER)
1490 value = cmd.props->u.st.stat[0].uvalue;
1518 uint32_t ublocks = 0;
1519 int ret = ioctl(
m_fdFrontend, FE_READ_UNCORRECTED_BLOCKS, &ublocks);
1523 return static_cast<double>(ublocks);
1536 auto *dvbm =
dynamic_cast<DVBChannel*
>(master);
1537 if (master && !dvbm)
1545 bool is_master = (master ==
this);
1557 struct dvb_frontend_event event {};
1559 while ((ret = ioctl(fd, FE_GET_EVENT, &event)) == 0);
1560 if ((ret < 0) && (EAGAIN != errno) && (EWOULDBLOCK != errno) && (EOVERFLOW != errno))
1562 LOG(VB_CHANNEL, LOG_ERR,
LOC +
1563 QString(
"%1 FE_GET_EVENT failed: ").arg(__func__) +
logStrerror(errno));
1592 auto seconds = duration_cast<std::chrono::seconds>(timeout_ms);
1593 auto usecs = duration_cast<std::chrono::microseconds>(timeout_ms) - seconds;
1594 struct timeval select_timeout = {
1595 static_cast<typeof(select_timeout.tv_sec)
>(seconds.count()),
1596 static_cast<typeof(select_timeout.tv_usec)
>(usecs.count())};
1597 fd_set fd_select_set;
1598 FD_ZERO( &fd_select_set);
1599 FD_SET (fd, &fd_select_set);
1604 do ret = select(fd+1, &fd_select_set,
nullptr,
nullptr, &select_timeout);
1605 while ((-1 == ret) && (EINTR == errno));
1609 LOG(VB_GENERAL, LOG_ERR,
LOC +
1610 QString(
"%1: Failed to wait on output.").arg(__func__) +
ENO);
1616 #if ((DVB_API_VERSION > 5) || ((DVB_API_VERSION == 5) && (DVB_API_VERSION_MINOR > 10)))
1617 fe_status_t status = FE_NONE;
1618 #else // debian9, centos7
1619 fe_status_t status = (fe_status_t)0;
1622 if (ioctl(fd, FE_READ_STATUS, &status) < 0)
1624 LOG(VB_GENERAL, LOG_ERR,
LOC +
1625 QString(
"%1: FE_READ_STATUS failed.").arg(__func__) +
ENO);
1630 LOG(VB_CHANNEL, LOG_DEBUG,
LOC +
1631 QString(
"%1: status: 0x%2 %3") .arg(__func__)
1632 .arg(status,2,16,QChar(
'0')).arg(
toString(status)));
1641 uint intermediate_freq,
bool can_fec_auto)
1643 dvb_frontend_parameters params {};
1645 params.frequency = tuning.m_frequency;
1646 params.inversion = (fe_spectral_inversion_t) (
int) tuning.m_inversion;
1652 LOG(VB_GENERAL, LOG_ERR,
1653 "DVBChan: Cannot tune to DVB-S2 transport with DVB-S card.");
1656 params.frequency = intermediate_freq;
1657 params.u.qpsk.symbol_rate = tuning.m_symbolRate;
1658 params.u.qpsk.fec_inner = can_fec_auto ? FEC_AUTO
1659 : (fe_code_rate_t) (
int) tuning.m_fec;
1664 LOG(VB_GENERAL, LOG_ERR,
1665 "DVBChan: Cannot tune DVB-S2 card with DVBv3 API.");
1670 params.u.qam.symbol_rate = tuning.m_symbolRate;
1671 params.u.qam.fec_inner = (fe_code_rate_t) (
int) tuning.m_fec;
1672 params.u.qam.modulation = (fe_modulation_t) (
int) tuning.m_modulation;
1678 params.u.ofdm.bandwidth = (fe_bandwidth_t) (
int) tuning.m_bandwidth;
1679 params.u.ofdm.code_rate_HP = (fe_code_rate_t) (
int) tuning.m_hpCodeRate;
1680 params.u.ofdm.code_rate_LP = (fe_code_rate_t) (
int) tuning.m_lpCodeRate;
1681 params.u.ofdm.constellation = (fe_modulation_t) (
int) tuning.m_modulation;
1682 params.u.ofdm.transmission_mode = (fe_transmit_mode_t) (
int) tuning.m_transMode;
1683 params.u.ofdm.guard_interval = (fe_guard_interval_t) (
int) tuning.m_guardInterval;
1684 params.u.ofdm.hierarchy_information = (fe_hierarchy_t) (
int) tuning.m_hierarchy;
1689 params.u.vsb.modulation = (fe_modulation_t) (
int) tuning.m_modulation;
1698 DTVTunerType tuner_type,
const dvb_frontend_parameters ¶ms)
1709 tuning.
m_fec = params.u.qpsk.fec_inner;
1715 tuning.
m_fec = params.u.qam.fec_inner;
1726 tuning.
m_transMode = params.u.ofdm.transmission_mode;
1728 tuning.
m_hierarchy = params.u.ofdm.hierarchy_information;
1743 uint intermediate_freq,
bool can_fec_auto,
bool do_tune)
1748 LOG(VB_CHANNEL, LOG_DEBUG, QString(
"DVBChan[%1]: m_modsys:%2 current_sys:%3")
1749 .arg(QString::number(inputId),
1753 auto *cmdseq = (
struct dtv_properties*) calloc(1,
sizeof(
struct dtv_properties));
1757 cmdseq->props = (
struct dtv_property*) calloc(20,
sizeof(*(cmdseq->props)));
1758 if (!(cmdseq->props))
1769 can_fec_auto =
false;
1779 LOG(VB_CHANNEL, LOG_DEBUG, QString(
"DVBChan[%1]:%2 set delivery_system to %3")
1780 .arg(inputId).arg(__LINE__).arg(delivery_system.
toString()));
1784 delivery_system = current_sys;
1785 LOG(VB_CHANNEL, LOG_DEBUG, QString(
"DVBChan[%1]:%2 set delivery_system to %3")
1786 .arg(inputId).arg(__LINE__).arg(delivery_system.
toString()));
1791 LOG(VB_CHANNEL, LOG_DEBUG, QString(
"DVBChan[%1]:%2 set delivery_system to %3")
1792 .arg(inputId).arg(__LINE__).arg(delivery_system.
toString()));
1797 LOG(VB_CHANNEL, LOG_DEBUG, QString(
"DVBChan[%1]:%2 set delivery_system to %3")
1798 .arg(inputId).arg(__LINE__).arg(delivery_system.
toString()));
1803 LOG(VB_CHANNEL, LOG_DEBUG, QString(
"DVBChan[%1]:%2 set delivery_system to %3")
1804 .arg(inputId).arg(__LINE__).arg(delivery_system.
toString()));
1809 LOG(VB_CHANNEL, LOG_DEBUG, QString(
"DVBChan[%1]:%2 set delivery_system to %3")
1810 .arg(inputId).arg(__LINE__).arg(delivery_system.
toString()));
1815 LOG(VB_CHANNEL, LOG_DEBUG, QString(
"DVBChan[%1]:%2 set delivery_system to %3")
1816 .arg(inputId).arg(__LINE__).arg(delivery_system.
toString()));
1821 LOG(VB_CHANNEL, LOG_DEBUG, QString(
"DVBChan[%1]:%2 set delivery_system to %3")
1822 .arg(inputId).arg(__LINE__).arg(delivery_system.
toString()));
1825 LOG(VB_CHANNEL, LOG_INFO, QString(
"DVBChan[%1]: Delivery system: %2")
1826 .arg(inputId).arg(delivery_system.
toString()));
1830 cmdseq->props[c].cmd = DTV_DELIVERY_SYSTEM;
1831 cmdseq->props[c++].u.data = delivery_system;
1835 LOG(VB_GENERAL, LOG_ERR, QString(
"DVBChan[%1]: Delivery system: %2")
1836 .arg(inputId).arg(delivery_system.
toString()));
1840 cmdseq->props[c].cmd = DTV_FREQUENCY;
1841 cmdseq->props[c++].u.data = intermediate_freq ? intermediate_freq : tuning.
m_frequency;
1842 cmdseq->props[c].cmd = DTV_MODULATION;
1844 cmdseq->props[c].cmd = DTV_INVERSION;
1852 cmdseq->props[c].cmd = DTV_SYMBOL_RATE;
1859 cmdseq->props[c].cmd = DTV_INNER_FEC;
1860 cmdseq->props[c++].u.data = can_fec_auto ? FEC_AUTO
1861 : (fe_code_rate_t) (
int) tuning.
m_fec;
1868 cmdseq->props[c].cmd = DTV_BANDWIDTH_HZ;
1869 cmdseq->props[c++].u.data = (8-tuning.
m_bandwidth) * 1000000;
1870 cmdseq->props[c].cmd = DTV_CODE_RATE_HP;
1872 cmdseq->props[c].cmd = DTV_CODE_RATE_LP;
1874 cmdseq->props[c].cmd = DTV_TRANSMISSION_MODE;
1876 cmdseq->props[c].cmd = DTV_GUARD_INTERVAL;
1878 cmdseq->props[c].cmd = DTV_HIERARCHY;
1885 cmdseq->props[c].cmd = DTV_ROLLOFF;
1892 cmdseq->props[c].cmd = DTV_PILOT;
1893 cmdseq->props[c++].u.data = PILOT_AUTO;
1894 cmdseq->props[c].cmd = DTV_ROLLOFF;
1895 cmdseq->props[c++].u.data = tuning.
m_rolloff;
1899 cmdseq->props[c++].cmd = DTV_TUNE;