Exemple #1
0
void eDVBScan::stateChange(iDVBChannel *ch)
{
	int state;
	if (ch->getState(state))
		return;
	if (m_channel_state == state)
		return;

	if (state == iDVBChannel::state_ok)
	{
		startFilter();
		m_channel_state = state;
	} else if (state == iDVBChannel::state_failed)
	{
		if (m_ch_current && m_channel)
		{
			int type;
			m_ch_current->getSystem(type);
			m_ch_unavailable.push_back(m_ch_current);
			if (type == iDVBFrontend::feTerrestrial)
			{
				eDVBFrontendParametersTerrestrial parm;
				m_ch_current->getDVBT(parm);
				if (parm.system == eDVBFrontendParametersTerrestrial::System_DVB_T_T2)
				{
					/* we have to scan T2 as well as T */
					ePtr<iDVBFrontend> fe;
					eDVBFrontendParameters eparm;
					parm.system = eDVBFrontendParametersTerrestrial::System_DVB_T2;
					eparm.setDVBT(parm);
					m_channel->getFrontend(fe);
					if (fe)
					{
						ePtr<iDVBFrontendParameters> feparm = new eDVBFrontendParameters(eparm);
						/* but only if the frontend supports T2 */
						if (fe->isCompatibleWith(feparm))
						{
							addChannelToScan(feparm);
						}
					}
				}
			}
		}
		nextChannel();
	}
			/* unavailable will timeout, anyway. */
}
Exemple #2
0
void eDVBScan::stateChange(iDVBChannel *ch)
{
	int state;
	if (ch->getState(state))
		return;
	if (m_channel_state == state)
		return;

	if (state == iDVBChannel::state_ok)
	{
		if (m_ch_current && m_channel)
		{
			int type;
			m_ch_current->getSystem(type);
			if (type == iDVBFrontend::feTerrestrial)
			{
				eDVBFrontendParametersTerrestrial parm;
				m_ch_current->getDVBT(parm);
				if (parm.system == eDVBFrontendParametersTerrestrial::System_DVB_T_T2)
				{
					/* we have a lock, this is a valid DVB-T transponder, set our system parameter */
					parm.system = eDVBFrontendParametersTerrestrial::System_DVB_T;
					m_ch_current->setDVBT(parm);
				}
			}
		}
		if (!m_ch_blindscan.empty())
		{
			/* update current blindscan iteration channel with scanned parameters */
			if (m_ch_current && m_channel)
			{
				ePtr<iDVBFrontend> fe;
				m_channel->getFrontend(fe);
				if (fe)
				{
					ePtr<iDVBTransponderData> tp;
					fe->getTransponderData(tp, false);
					if (tp)
					{
						ePtr<eDVBFrontendParameters> feparm = new eDVBFrontendParameters;
						int type;
						m_ch_current->getSystem(type);
						switch (type)
						{
						case iDVBFrontend::feSatellite:
						{
							eDVBFrontendParametersSatellite parm;
							m_ch_current->getDVBS(parm);
							parm.system = tp->getSystem();
							parm.frequency = tp->getFrequency();
							parm.symbol_rate = tp->getSymbolRate();
							parm.modulation = tp->getModulation();
							feparm->setDVBS(parm);
							break;
						}
						case iDVBFrontend::feCable:
						{
							eDVBFrontendParametersCable parm;
							m_ch_current->getDVBC(parm);
							parm.system = tp->getSystem();
							parm.frequency = tp->getFrequency();
							parm.symbol_rate = tp->getSymbolRate();
							parm.modulation = tp->getModulation();
							feparm->setDVBC(parm);
							break;
						}
						case iDVBFrontend::feTerrestrial:
						{
							eDVBFrontendParametersTerrestrial parm;
							m_ch_current->getDVBT(parm);
							parm.system = tp->getSystem();
							parm.frequency = tp->getFrequency();
							parm.bandwidth = tp->getBandwidth();
							parm.modulation = tp->getConstellation();
							feparm->setDVBT(parm);
							break;
						}
						case iDVBFrontend::feATSC:
						{
							eDVBFrontendParametersATSC parm;
							m_ch_current->getATSC(parm);
							parm.system = tp->getSystem();
							parm.frequency = tp->getFrequency();
							feparm->setATSC(parm);
							break;
						}
						}
						m_ch_current = m_ch_blindscan_result = feparm;
					}
				}
			}
		}
		startFilter();
		m_channel_state = state;
	} else if (state == iDVBChannel::state_failed)
	{
		if (m_ch_current && m_channel)
		{
			int type;
			m_ch_current->getSystem(type);
			m_ch_unavailable.push_back(m_ch_current);
			if (type == iDVBFrontend::feTerrestrial)
			{
				eDVBFrontendParametersTerrestrial parm;
				m_ch_current->getDVBT(parm);
				if (parm.system == eDVBFrontendParametersTerrestrial::System_DVB_T_T2)
				{
					/* we have to scan T2 as well as T */
					ePtr<iDVBFrontend> fe;
					eDVBFrontendParameters eparm;
					parm.system = eDVBFrontendParametersTerrestrial::System_DVB_T2;
					eparm.setDVBT(parm);
					m_channel->getFrontend(fe);
					if (fe)
					{
						ePtr<iDVBFrontendParameters> feparm = new eDVBFrontendParameters(eparm);
						/* but only if the frontend supports T2 */
						if (fe->isCompatibleWith(feparm))
						{
							addChannelToScan(feparm);
						}
					}
				}
			}
		}
		if (!m_ch_blindscan.empty())
		{
			/* tune failure, this means the blindscan channel iteration run has completed */
			SCAN_eDebug("[eDVBScan] blindscan channel completed");
			m_ch_blindscan.pop_front();
		}
		nextChannel();
	}
			/* unavailable will timeout, anyway. */
}