mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 01:11:06 +02:00
zapit/include/zapit/getservices.h:
extend transponder struct;
add map to store satellite transponders per satellite;
add GetSatelliteTransponders(), remove global select_transponders
Origin commit data
------------------
Branch: ni/coolstream
Commit: 778733fc75
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-04-13 (Fri, 13 Apr 2012)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -35,7 +35,6 @@
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#define zapped_chan_is_nvod 0x80
|
||||
|
||||
struct transponder
|
||||
{
|
||||
@@ -47,16 +46,8 @@ struct transponder
|
||||
struct dvb_frontend_parameters feparams;
|
||||
unsigned char polarization;
|
||||
bool updated;
|
||||
#if 0
|
||||
transponder(const t_transport_stream_id p_transport_stream_id, const t_original_network_id p_original_network_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization = 0)
|
||||
{
|
||||
transport_stream_id = p_transport_stream_id;
|
||||
original_network_id = p_original_network_id;
|
||||
feparams = p_feparams;
|
||||
polarization = p_polarization;
|
||||
updated = 0;
|
||||
}
|
||||
#endif
|
||||
bool failed;
|
||||
|
||||
transponder(const transponder_id_t t_id, const struct dvb_frontend_parameters p_feparams, const uint8_t p_polarization = 0)
|
||||
{
|
||||
transponder_id = t_id;
|
||||
@@ -65,19 +56,43 @@ struct transponder
|
||||
feparams = p_feparams;
|
||||
polarization = p_polarization;
|
||||
updated = 0;
|
||||
failed = 0;
|
||||
satellitePosition = GET_SATELLITEPOSITION_FROM_TRANSPONDER_ID(transponder_id);
|
||||
if(satellitePosition & 0xF000)
|
||||
satellitePosition = -(satellitePosition & 0xFFF);
|
||||
else
|
||||
satellitePosition = satellitePosition & 0xFFF;
|
||||
|
||||
}
|
||||
bool operator==(const transponder& t) const {
|
||||
return (
|
||||
(satellitePosition == t.satellitePosition) &&
|
||||
//(transport_stream_id == t.transport_stream_id) &&
|
||||
//(original_network_id == t.original_network_id) &&
|
||||
((polarization & 1) == (t.polarization & 1)) &&
|
||||
(abs((int) feparams.frequency - (int)t.feparams.frequency) <= 3000)
|
||||
);
|
||||
}
|
||||
void dump(std::string label = "tp", bool cable = 0) {
|
||||
if(cable)
|
||||
printf("%s: tp-id %016llx freq %d rate %d fec %d mod %d\n", label.c_str(),
|
||||
transponder_id, feparams.frequency, feparams.u.qam.symbol_rate,
|
||||
feparams.u.qam.fec_inner, feparams.u.qam.modulation);
|
||||
else
|
||||
printf("%s: tp-id %016llx freq %d rate %d fec %d pol %d\n", label.c_str(),
|
||||
transponder_id, feparams.frequency, feparams.u.qpsk.symbol_rate,
|
||||
feparams.u.qpsk.fec_inner, polarization);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map <transponder_id_t, transponder> transponder_list_t;
|
||||
typedef std::map <transponder_id_t, transponder>::iterator stiterator;
|
||||
extern transponder_list_t scantransponders;
|
||||
typedef std::pair<transponder_id_t, transponder> transponder_pair_t;
|
||||
|
||||
extern transponder_list_t transponders;
|
||||
|
||||
typedef std::map <t_satellite_position, transponder_list_t> sat_transponder_map_t;
|
||||
|
||||
typedef map<t_channel_id, CZapitChannel> channel_map_t;
|
||||
typedef channel_map_t::iterator channel_map_iterator_t;
|
||||
typedef std::pair<t_channel_id, CZapitChannel> channel_pair_t;
|
||||
@@ -122,6 +137,7 @@ class CServiceManager
|
||||
|
||||
fe_type_t frontendType;
|
||||
satellite_map_t satellitePositions;
|
||||
sat_transponder_map_t satelliteTransponders;
|
||||
|
||||
bool ParseScanXml();
|
||||
void ParseTransponders(xmlNodePtr node, t_satellite_position satellitePosition, bool cable);
|
||||
@@ -169,8 +185,8 @@ class CServiceManager
|
||||
std::string GetServiceName(t_channel_id channel_id);
|
||||
|
||||
tallchans* GetAllChannels(){ return &allchans; };
|
||||
bool GetAllRadioChannels(ZapitChannelList &list);
|
||||
bool GetAllTvChannels(ZapitChannelList &list);
|
||||
bool GetAllRadioChannels(ZapitChannelList &list, int flags = 0);
|
||||
bool GetAllTvChannels(ZapitChannelList &list, int flags = 0);
|
||||
bool GetAllHDChannels(ZapitChannelList &list);
|
||||
bool GetAllSatelliteChannels(ZapitChannelList &list, t_satellite_position position);
|
||||
bool GetAllTransponderChannels(ZapitChannelList &list, transponder_id_t tpid);
|
||||
@@ -201,5 +217,8 @@ class CServiceManager
|
||||
void FreeNumber(int number, bool radio);
|
||||
void UseNumber(int number, bool radio);
|
||||
void SetServicesChanged(bool changed) { services_changed = changed; }
|
||||
|
||||
bool GetTransponder(struct transponder &t);
|
||||
transponder_list_t & GetSatelliteTransponders(t_satellite_position position) { return satelliteTransponders[position]; }
|
||||
};
|
||||
#endif /* __getservices_h__ */
|
||||
|
@@ -32,7 +32,6 @@
|
||||
//#define SAVE_DEBUG
|
||||
|
||||
extern transponder_list_t transponders;
|
||||
std::map<transponder_id_t, transponder> select_transponders;
|
||||
|
||||
CServiceManager * CServiceManager::manager = NULL;
|
||||
|
||||
@@ -113,6 +112,7 @@ bool CServiceManager::AddNVODChannel(CZapitChannel * &channel)
|
||||
t_transport_stream_id transport_stream_id = channel->getTransportStreamId();
|
||||
|
||||
t_satellite_position satellitePosition = channel->getSatellitePosition();
|
||||
//FIXME define CREATE_NVOD_CHANNEL_ID
|
||||
t_channel_id sub_channel_id =
|
||||
((uint64_t) ( satellitePosition >= 0 ? satellitePosition : (uint64_t)(0xF000+ abs(satellitePosition))) << 48) |
|
||||
(uint64_t) CREATE_CHANNEL_ID(service_id, original_network_id, transport_stream_id);
|
||||
@@ -458,6 +458,7 @@ void CServiceManager::ParseSatTransponders(fe_type_t fType, xmlNodePtr search, t
|
||||
FrontendParameters feparams;
|
||||
|
||||
fake_tid = fake_nid = 0;
|
||||
satelliteTransponders[satellitePosition].clear();
|
||||
|
||||
xmlNodePtr tps = search->xmlChildrenNode;
|
||||
|
||||
@@ -465,9 +466,6 @@ void CServiceManager::ParseSatTransponders(fe_type_t fType, xmlNodePtr search, t
|
||||
memset(&feparams, 0x00, sizeof(FrontendParameters));
|
||||
|
||||
feparams.frequency = xmlGetNumericAttribute(tps, "frequency", 0);
|
||||
|
||||
freq_id_t freq = 0;
|
||||
|
||||
feparams.inversion = INVERSION_AUTO;
|
||||
|
||||
if (fType == FE_QAM) {
|
||||
@@ -476,8 +474,6 @@ void CServiceManager::ParseSatTransponders(fe_type_t fType, xmlNodePtr search, t
|
||||
feparams.u.qam.modulation = (fe_modulation_t) xmlGetNumericAttribute(tps, "modulation", 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);
|
||||
freq = feparams.frequency/100;
|
||||
}
|
||||
else if (fType == FE_QPSK) {
|
||||
feparams.u.qpsk.symbol_rate = xmlGetNumericAttribute(tps, "symbol_rate", 0);
|
||||
@@ -490,18 +486,14 @@ void CServiceManager::ParseSatTransponders(fe_type_t fType, xmlNodePtr search, t
|
||||
xml_fec += 9;
|
||||
feparams.u.qpsk.fec_inner = (fe_code_rate_t) xml_fec;
|
||||
feparams.frequency = (int) 1000 * (int) round ((double) feparams.frequency / (double) 1000);
|
||||
freq = feparams.frequency/1000;
|
||||
}
|
||||
|
||||
transponder_id_t tid =
|
||||
CREATE_TRANSPONDER_ID64(
|
||||
freq /*feparams.frequency/1000*/, satellitePosition, fake_nid, fake_tid);
|
||||
|
||||
freq_id_t freq = CREATE_FREQ_ID(feparams.frequency, fType == FE_QAM);
|
||||
polarization &= 1;
|
||||
select_transponders.insert (
|
||||
std::pair <transponder_id_t, transponder> (tid,
|
||||
transponder (tid, feparams, polarization))
|
||||
);
|
||||
|
||||
transponder_id_t tid = CREATE_TRANSPONDER_ID64(freq, satellitePosition, fake_nid, fake_tid);
|
||||
transponder t(tid, feparams, polarization);
|
||||
satelliteTransponders[satellitePosition].insert(transponder_pair_t(tid, t));
|
||||
|
||||
fake_nid ++; fake_tid ++;
|
||||
|
||||
tps = tps->xmlNextNode;
|
||||
@@ -606,7 +598,6 @@ bool CServiceManager::LoadServices(bool only_current)
|
||||
TIMER_START();
|
||||
allchans.clear();
|
||||
transponders.clear();
|
||||
select_transponders.clear();
|
||||
tv_numbers.clear();
|
||||
radio_numbers.clear();
|
||||
have_numbers = false;
|
||||
@@ -1091,3 +1082,14 @@ void CServiceManager::UseNumber(int number, bool radio)
|
||||
service_number_map_t * channel_numbers = radio ? &radio_numbers : &tv_numbers;
|
||||
channel_numbers->insert(number);
|
||||
}
|
||||
|
||||
bool CServiceManager::GetTransponder(struct transponder &t)
|
||||
{
|
||||
for (transponder_list_t::iterator tI = transponders.begin(); tI != transponders.end(); tI++) {
|
||||
if (t == tI->second) {
|
||||
t = tI->second;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user