zapit/src/channel.cpp: add bLocked flag to lock single channel

This commit is contained in:
[CST] Focus
2014-10-13 16:36:46 +04:00
parent 27cd2846f2
commit ab2be9aeb0
4 changed files with 15 additions and 9 deletions

View File

@@ -151,7 +151,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
is_video_started = true; is_video_started = true;
if (channel) { if (channel) {
current_channel_name = channel->getName(); current_channel_name = channel->getName();
if (!!channel->bLockCount != g_settings.parentallock_defaultlocked) if (channel->Locked() != g_settings.parentallock_defaultlocked)
stopvideo(); stopvideo();
} }
CVFD::getInstance()->showServicename(current_channel_name); // UTF-8 CVFD::getInstance()->showServicename(current_channel_name); // UTF-8

View File

@@ -184,6 +184,7 @@ class CZapitChannel
casys_map_t camap; casys_map_t camap;
unsigned int bLockCount; unsigned int bLockCount;
bool bLocked;
int number; int number;
CChannelEvent currentEvent,nextEvent; CChannelEvent currentEvent,nextEvent;
@@ -275,6 +276,7 @@ class CZapitChannel
{ {
return (((uint64_t)(sat+freq*4) << 48) | ((uint64_t) tsid << 32) | ((uint64_t)onid << 16) | (uint64_t)sid); return (((uint64_t)(sat+freq*4) << 48) | ((uint64_t) tsid << 32) | ((uint64_t)onid << 16) | (uint64_t)sid);
}; };
bool Locked() { return (bLocked || !!bLockCount); }
}; };
struct CmpChannelBySat: public std::binary_function <const CZapitChannel * const, const CZapitChannel * const, bool> struct CmpChannelBySat: public std::binary_function <const CZapitChannel * const, const CZapitChannel * const, bool>

View File

@@ -412,6 +412,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
GET_ATTR(channel_node, "s", SCANF_SATELLITE_POSITION_TYPE, satellitePosition); GET_ATTR(channel_node, "s", SCANF_SATELLITE_POSITION_TYPE, satellitePosition);
GET_ATTR(channel_node, "t", SCANF_TRANSPORT_STREAM_ID_TYPE, transport_stream_id); GET_ATTR(channel_node, "t", SCANF_TRANSPORT_STREAM_ID_TYPE, transport_stream_id);
GET_ATTR(channel_node, "frq", SCANF_SATELLITE_POSITION_TYPE, freq); GET_ATTR(channel_node, "frq", SCANF_SATELLITE_POSITION_TYPE, freq);
bool clock = xmlGetNumericAttribute(channel_node, "l", 10);
if(freq > 20000) if(freq > 20000)
freq = freq/1000; freq = freq/1000;
@@ -431,6 +432,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
#endif #endif
if(!bUser) if(!bUser)
chan->pname = (char *) newBouquet->Name.c_str(); chan->pname = (char *) newBouquet->Name.c_str();
chan->bLocked = clock;
newBouquet->addService(chan); newBouquet->addService(chan);
} else if (bUser) { } else if (bUser) {
@@ -438,6 +440,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser)
satellitePosition, freq); satellitePosition, freq);
CServiceManager::getInstance()->AddChannel(chan); CServiceManager::getInstance()->AddChannel(chan);
chan->flags = CZapitChannel::NOT_FOUND; chan->flags = CZapitChannel::NOT_FOUND;
chan->bLocked = clock;
newBouquet->addService(chan); newBouquet->addService(chan);
CServiceManager::getInstance()->SetServicesChanged(false); CServiceManager::getInstance()->SetServicesChanged(false);
} }

View File

@@ -90,6 +90,7 @@ void CZapitChannel::Init()
flags = 0; flags = 0;
delsys = DVB_S; delsys = DVB_S;
bLockCount = 0; bLockCount = 0;
bLocked = 0;
} }
CZapitChannel::~CZapitChannel(void) CZapitChannel::~CZapitChannel(void)
@@ -350,27 +351,27 @@ void CZapitChannel::dumpBouquetXml(FILE * fd)
if(write_names) { if(write_names) {
if (url.empty()) if (url.empty())
fprintf(fd, "\t\t<S i=\"%x\" n=\"%s\" t=\"%x\" on=\"%x\" s=\"%hd\" frq=\"%hd\"/>\n", fprintf(fd, "\t\t<S i=\"%x\" n=\"%s\" t=\"%x\" on=\"%x\" s=\"%hd\" frq=\"%hd\" l=\"%d\"/>\n",
getServiceId(), getServiceId(),
convert_UTF8_To_UTF8_XML(getName().c_str()).c_str(), convert_UTF8_To_UTF8_XML(getName().c_str()).c_str(),
getTransportStreamId(), getTransportStreamId(),
getOriginalNetworkId(), getOriginalNetworkId(),
getSatellitePosition(), getSatellitePosition(),
getFreqId()); getFreqId(), bLocked ? 1 : 0);
else else
fprintf(fd, "\t\t<S n=\"%s\" u=\"%s\"/>\n", fprintf(fd, "\t\t<S n=\"%s\" u=\"%s\" l=\"%d\"/>\n",
convert_UTF8_To_UTF8_XML(getName().c_str()).c_str(), convert_UTF8_To_UTF8_XML(getName().c_str()).c_str(),
convert_UTF8_To_UTF8_XML(url.c_str()).c_str()); convert_UTF8_To_UTF8_XML(url.c_str()).c_str(), bLocked ? 1 : 0);
} else { } else {
if (url.empty()) if (url.empty())
fprintf(fd, "\t\t<S i=\"%x\" t=\"%x\" on=\"%x\" s=\"%hd\" frq=\"%hd\"/>\n", fprintf(fd, "\t\t<S i=\"%x\" t=\"%x\" on=\"%x\" s=\"%hd\" frq=\"%hd\" l=\"%d\"/>\n",
getServiceId(), getServiceId(),
getTransportStreamId(), getTransportStreamId(),
getOriginalNetworkId(), getOriginalNetworkId(),
getSatellitePosition(), getSatellitePosition(),
getFreqId()); getFreqId(), bLocked ? 1 : 0);
else else
fprintf(fd, "\t\t<S u=\"%s\"/>\n", fprintf(fd, "\t\t<S u=\"%s\" l=\"%d\"/>\n",
convert_UTF8_To_UTF8_XML(url.c_str()).c_str()); convert_UTF8_To_UTF8_XML(url.c_str()).c_str(), bLocked ? 1 : 0);
} }
} }