From ab2be9aeb0e825ed471268afa5672c001ca9b9ec Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 13 Oct 2014 16:36:46 +0400 Subject: [PATCH] zapit/src/channel.cpp: add bLocked flag to lock single channel --- src/daemonc/remotecontrol.cpp | 2 +- src/zapit/include/zapit/channel.h | 2 ++ src/zapit/src/bouquets.cpp | 3 +++ src/zapit/src/channel.cpp | 17 +++++++++-------- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index 33931a3fe..c637e9fcb 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -151,7 +151,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data is_video_started = true; if (channel) { current_channel_name = channel->getName(); - if (!!channel->bLockCount != g_settings.parentallock_defaultlocked) + if (channel->Locked() != g_settings.parentallock_defaultlocked) stopvideo(); } CVFD::getInstance()->showServicename(current_channel_name); // UTF-8 diff --git a/src/zapit/include/zapit/channel.h b/src/zapit/include/zapit/channel.h index 85a487a55..f60a57098 100644 --- a/src/zapit/include/zapit/channel.h +++ b/src/zapit/include/zapit/channel.h @@ -184,6 +184,7 @@ class CZapitChannel casys_map_t camap; unsigned int bLockCount; + bool bLocked; int number; 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); }; + bool Locked() { return (bLocked || !!bLockCount); } }; struct CmpChannelBySat: public std::binary_function diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 18e6514fe..62245d394 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -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, "t", SCANF_TRANSPORT_STREAM_ID_TYPE, transport_stream_id); GET_ATTR(channel_node, "frq", SCANF_SATELLITE_POSITION_TYPE, freq); + bool clock = xmlGetNumericAttribute(channel_node, "l", 10); if(freq > 20000) freq = freq/1000; @@ -431,6 +432,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser) #endif if(!bUser) chan->pname = (char *) newBouquet->Name.c_str(); + chan->bLocked = clock; newBouquet->addService(chan); } else if (bUser) { @@ -438,6 +440,7 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser) satellitePosition, freq); CServiceManager::getInstance()->AddChannel(chan); chan->flags = CZapitChannel::NOT_FOUND; + chan->bLocked = clock; newBouquet->addService(chan); CServiceManager::getInstance()->SetServicesChanged(false); } diff --git a/src/zapit/src/channel.cpp b/src/zapit/src/channel.cpp index 1740c847c..f041d1fd1 100644 --- a/src/zapit/src/channel.cpp +++ b/src/zapit/src/channel.cpp @@ -90,6 +90,7 @@ void CZapitChannel::Init() flags = 0; delsys = DVB_S; bLockCount = 0; + bLocked = 0; } CZapitChannel::~CZapitChannel(void) @@ -350,27 +351,27 @@ void CZapitChannel::dumpBouquetXml(FILE * fd) if(write_names) { if (url.empty()) - fprintf(fd, "\t\t\n", + fprintf(fd, "\t\t\n", getServiceId(), convert_UTF8_To_UTF8_XML(getName().c_str()).c_str(), getTransportStreamId(), getOriginalNetworkId(), getSatellitePosition(), - getFreqId()); + getFreqId(), bLocked ? 1 : 0); else - fprintf(fd, "\t\t\n", + fprintf(fd, "\t\t\n", 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 { if (url.empty()) - fprintf(fd, "\t\t\n", + fprintf(fd, "\t\t\n", getServiceId(), getTransportStreamId(), getOriginalNetworkId(), getSatellitePosition(), - getFreqId()); + getFreqId(), bLocked ? 1 : 0); else - fprintf(fd, "\t\t\n", - convert_UTF8_To_UTF8_XML(url.c_str()).c_str()); + fprintf(fd, "\t\t\n", + convert_UTF8_To_UTF8_XML(url.c_str()).c_str(), bLocked ? 1 : 0); } }