本文整理汇总了C++中DVBChannel::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ DVBChannel::Open方法的具体用法?C++ DVBChannel::Open怎么用?C++ DVBChannel::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DVBChannel
的用法示例。
在下文中一共展示了DVBChannel::Open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
bool DVBChannel::Open(DVBChannel *who)
{
LOG(VB_CHANNEL, LOG_INFO, LOC + "Opening DVB channel");
QMutexLocker locker(&hw_lock);
if (fd_frontend >= 0)
{
is_open[who] = true;
return true;
}
DVBChannel *master = GetMasterLock();
if (master != this)
{
if (!master->Open(who))
{
ReturnMasterLock(master);
return false;
}
fd_frontend = master->fd_frontend;
frontend_name = master->frontend_name;
tunerType = master->tunerType;
capabilities = master->capabilities;
ext_modulations = master->ext_modulations;
frequency_minimum = master->frequency_minimum;
frequency_maximum = master->frequency_maximum;
symbol_rate_minimum = master->symbol_rate_minimum;
symbol_rate_maximum = master->symbol_rate_maximum;
is_open[who] = true;
if (!InitializeInputs())
{
Close();
ReturnMasterLock(master);
return false;
}
ReturnMasterLock(master);
return true;
}
ReturnMasterLock(master); // if we're the master we don't need this lock..
QString devname = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, device);
QByteArray devn = devname.toAscii();
for (int tries = 1; ; ++tries)
{
fd_frontend = open(devn.constData(), O_RDWR | O_NONBLOCK);
if (fd_frontend >= 0)
break;
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Opening DVB frontend device failed." + ENO);
if (tries >= 20 || (errno != EBUSY && errno != EAGAIN))
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Failed to open DVB frontend device due to "
"fatal error or too many attempts."));
return false;
}
usleep(50000);
}
dvb_frontend_info info;
memset(&info, 0, sizeof(info));
if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
"Failed to get frontend information." + ENO);
close(fd_frontend);
fd_frontend = -1;
return false;
}
frontend_name = info.name;
tunerType = info.type;
#if HAVE_FE_CAN_2G_MODULATION
if (tunerType == DTVTunerType::kTunerTypeDVBS1 &&
(info.caps & FE_CAN_2G_MODULATION))
tunerType = DTVTunerType::kTunerTypeDVBS2;
#endif // HAVE_FE_CAN_2G_MODULATION
capabilities = info.caps;
frequency_minimum = info.frequency_min;
frequency_maximum = info.frequency_max;
symbol_rate_minimum = info.symbol_rate_min;
symbol_rate_maximum = info.symbol_rate_max;
LOG(VB_RECORD, LOG_INFO, LOC +
QString("Using DVB card %1, with frontend '%2'.")
.arg(device).arg(frontend_name));
// Turn on the power to the LNB
if (tunerType.IsDiSEqCSupported())
{
diseqc_tree = diseqc_dev.FindTree(GetCardID());
if (diseqc_tree)
diseqc_tree->Open(fd_frontend);
//.........这里部分代码省略.........
示例2: Open
bool DVBChannel::Open(DVBChannel *who)
{
LOG(VB_CHANNEL, LOG_INFO, LOC + "Opening DVB channel");
if (!m_inputid)
{
if (!InitializeInput())
return false;
}
QMutexLocker locker(&m_hw_lock);
if (m_fd_frontend >= 0)
{
m_is_open[who] = true;
return true;
}
DVBChannel *master = GetMasterLock();
if (master != this)
{
if (!master->Open(who))
{
ReturnMasterLock(master);
return false;
}
m_fd_frontend = master->m_fd_frontend;
m_frontend_name = master->m_frontend_name;
m_tunerType = master->m_tunerType;
m_capabilities = master->m_capabilities;
m_ext_modulations = master->m_ext_modulations;
m_frequency_minimum = master->m_frequency_minimum;
m_frequency_maximum = master->m_frequency_maximum;
m_symbol_rate_minimum = master->m_symbol_rate_minimum;
m_symbol_rate_maximum = master->m_symbol_rate_maximum;
m_is_open[who] = true;
if (!InitializeInput())
{
Close();
ReturnMasterLock(master);
return false;
}
ReturnMasterLock(master);
return true;
}
ReturnMasterLock(master); // if we're the master we don't need this lock..
QString devname = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, m_device);
QByteArray devn = devname.toLatin1();
for (int tries = 1; ; ++tries)
{
m_fd_frontend = open(devn.constData(), O_RDWR | O_NONBLOCK);
if (m_fd_frontend >= 0)
break;
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Opening DVB frontend device failed." + ENO);
if (tries >= 20 || (errno != EBUSY && errno != EAGAIN))
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Failed to open DVB frontend device due to "
"fatal error or too many attempts."));
return false;
}
usleep(50000);
}
dvb_frontend_info info;
memset(&info, 0, sizeof(info));
if (ioctl(m_fd_frontend, FE_GET_INFO, &info) < 0)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
"Failed to get frontend information." + ENO);
close(m_fd_frontend);
m_fd_frontend = -1;
return false;
}
m_frontend_name = info.name;
m_tunerType = info.type;
#if HAVE_FE_CAN_2G_MODULATION
if (info.caps & FE_CAN_2G_MODULATION)
{
if (m_tunerType == DTVTunerType::kTunerTypeDVBS1)
m_tunerType = DTVTunerType::kTunerTypeDVBS2;
else if (m_tunerType == DTVTunerType::kTunerTypeDVBT)
m_tunerType = DTVTunerType::kTunerTypeDVBT2;
}
#endif // HAVE_FE_CAN_2G_MODULATION
m_capabilities = info.caps;
m_frequency_minimum = info.frequency_min;
m_frequency_maximum = info.frequency_max;
m_symbol_rate_minimum = info.symbol_rate_min;
m_symbol_rate_maximum = info.symbol_rate_max;
//.........这里部分代码省略.........