Beispiel #1
0
void ParseTransponders(xmlNodePtr node, t_satellite_position satellitePosition, uint8_t Source )
{
	t_transport_stream_id transport_stream_id;
	t_original_network_id original_network_id;
	FrontendParameters feparams;
	uint8_t polarization = 0;
	freq_id_t freq;
	tcnt = 0;

	memset(&feparams, 0, sizeof(FrontendParameters));

	// read all transponders
	while ((node = xmlGetNextOccurence(node, "TS")) != NULL) 
	{
		// common
		transport_stream_id = xmlGetNumericAttribute(node, "id", 16);
		original_network_id = xmlGetNumericAttribute(node, "on", 16);
		feparams.frequency = xmlGetNumericAttribute(node, "frq", 0);
		feparams.inversion = (fe_spectral_inversion) xmlGetNumericAttribute(node, "inv", 0);

		// DVB-C
		if(Source == DVB_C)
		{
			feparams.u.qam.symbol_rate = xmlGetNumericAttribute(node, "sr", 0);
			feparams.u.qam.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0);
			feparams.u.qam.modulation = (fe_modulation_t) xmlGetNumericAttribute(node, "mod", 0);
		}
		// DVB-T
		else if(Source == DVB_T)
		{
			feparams.u.ofdm.bandwidth = (fe_bandwidth_t) xmlGetNumericAttribute(node, "band", 0);
			feparams.u.ofdm.code_rate_HP = (fe_code_rate_t) xmlGetNumericAttribute(node, "HP", 0);
			feparams.u.ofdm.code_rate_LP = (fe_code_rate_t) xmlGetNumericAttribute(node, "LP", 0);
			feparams.u.ofdm.constellation = (fe_modulation_t) xmlGetNumericAttribute(node, "const", 0);
			feparams.u.ofdm.transmission_mode = (fe_transmit_mode_t) xmlGetNumericAttribute(node, "trans", 0);
			feparams.u.ofdm.guard_interval = (fe_guard_interval_t) xmlGetNumericAttribute(node, "guard", 0);
			feparams.u.ofdm.hierarchy_information = (fe_hierarchy_t) xmlGetNumericAttribute(node, "hierarchy", 0);
		}
		// DVB-S
		else if(Source == DVB_S)
		{
			feparams.u.qpsk.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0);
			feparams.u.qpsk.symbol_rate = xmlGetNumericAttribute(node, "sr", 0);
			polarization = xmlGetNumericAttribute(node, "pol", 0);

			if(feparams.u.qpsk.symbol_rate < 50000) 
				feparams.u.qpsk.symbol_rate = feparams.u.qpsk.symbol_rate * 1000;
			
			// ???
			if(feparams.frequency < 20000) 
				feparams.frequency = feparams.frequency*1000;
		}

		if(Source == DVB_C)
			freq = feparams.frequency/100;
		else if(Source == DVB_S)
			freq = feparams.frequency/1000;
		else if(Source == DVB_T)
			freq = feparams.frequency/1000000;

		// add current transponder to list
		transponder_id_t tid = CREATE_TRANSPONDER_ID_FROM_SATELLITEPOSITION_ORIGINALNETWORK_TRANSPORTSTREAM_ID(freq, satellitePosition, original_network_id, transport_stream_id);

		pair<map<transponder_id_t, transponder>::iterator, bool> ret;

		ret = transponders.insert (std::pair <transponder_id_t, transponder> ( tid, transponder(transport_stream_id, feparams, polarization, original_network_id)));
		
		if (ret.second == false)
			printf("[zapit] duplicate transponder id %llx freq %d\n", tid, feparams.frequency);

		// read channels that belong to the current transponder
		ParseChannels(node->xmlChildrenNode, transport_stream_id, original_network_id, satellitePosition, freq, polarization);

		// hop to next transponder
		node = node->xmlNextNode;
	}

	return;
}
void CServiceManager::ParseTransponders(xmlNodePtr node, t_satellite_position satellitePosition, bool cable)
{
	t_transport_stream_id transport_stream_id;
	t_original_network_id original_network_id;
	FrontendParameters feparams;
	uint8_t polarization = 0;
	uint16_t freq;
	tp_count = 0;

	memset(&feparams, 0, sizeof(FrontendParameters));

	/* read all transponders */
	while ((node = xmlGetNextOccurence(node, "TS")) != NULL) {
		transport_stream_id = xmlGetNumericAttribute(node, "id", 16);
		original_network_id = xmlGetNumericAttribute(node, "on", 16);
		feparams.frequency = xmlGetNumericAttribute(node, "frq", 0);
		feparams.inversion = (fe_spectral_inversion) xmlGetNumericAttribute(node, "inv", 0);

		if(cable) {
			feparams.u.qam.symbol_rate = xmlGetNumericAttribute(node, "sr", 0);
			feparams.u.qam.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0);
			feparams.u.qam.modulation = (fe_modulation_t) xmlGetNumericAttribute(node, "mod", 0);

			if (feparams.frequency > 1000*1000)
				feparams.frequency = feparams.frequency/1000; //transponderlist was read from tuxbox

			//feparams.frequency = (int) 1000 * (int) round ((double) feparams.frequency / (double) 1000);
		} else {
			feparams.u.qpsk.fec_inner = (fe_code_rate_t) xmlGetNumericAttribute(node, "fec", 0);
			feparams.u.qpsk.symbol_rate = xmlGetNumericAttribute(node, "sr", 0);

			polarization = xmlGetNumericAttribute(node, "pol", 0);

			if(feparams.u.qpsk.symbol_rate < 50000) feparams.u.qpsk.symbol_rate = feparams.u.qpsk.symbol_rate * 1000;

			if(feparams.frequency < 20000) 
				feparams.frequency = feparams.frequency*1000;
			else
				feparams.frequency = (int) 1000 * (int) round ((double) feparams.frequency / (double) 1000);
		}
		if(cable)
			freq = feparams.frequency/100;
		else
			freq = feparams.frequency/1000;

		transponder_id_t tid = CREATE_TRANSPONDER_ID_FROM_SATELLITEPOSITION_ORIGINALNETWORK_TRANSPORTSTREAM_ID(freq, satellitePosition,original_network_id,transport_stream_id);
		pair<map<transponder_id_t, transponder>::iterator,bool> ret;

		ret = transponders.insert (
				std::pair <transponder_id_t, transponder> ( tid,
					transponder (transport_stream_id, feparams,
						polarization, original_network_id)
					)
				);
		if (ret.second == false)
			printf("[zapit] duplicate transponder id %llx freq %d\n", tid, feparams.frequency);

		/* read channels that belong to the current transponder */
		ParseChannels(node->xmlChildrenNode, transport_stream_id, original_network_id, satellitePosition, freq);

		/* hop to next transponder */
		node = node->xmlNextNode;
	}
	return;
}