mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 17:31:11 +02:00
zapit/src/capmt.cpp: stop cam if channel not found
Origin commit data
------------------
Commit: b2dc082707
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2014-03-13 (Thu, 13 Mar 2014)
This commit is contained in:
@@ -94,6 +94,7 @@ class CCamManager
|
|||||||
OpenThreads::Mutex mutex;
|
OpenThreads::Mutex mutex;
|
||||||
static CCamManager * manager;
|
static CCamManager * manager;
|
||||||
bool SetMode(t_channel_id id, enum runmode mode, bool enable, bool force_update = false);
|
bool SetMode(t_channel_id id, enum runmode mode, bool enable, bool force_update = false);
|
||||||
|
void StopCam(t_channel_id id, CCam *cam);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCamManager();
|
CCamManager();
|
||||||
|
@@ -181,6 +181,14 @@ CCamManager * CCamManager::getInstance(void)
|
|||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCamManager::StopCam(t_channel_id channel_id, CCam *cam)
|
||||||
|
{
|
||||||
|
cam->sendMessage(NULL, 0, false);
|
||||||
|
cam->sendCaPmt(channel_id, NULL, 0);
|
||||||
|
channel_map.erase(channel_id);
|
||||||
|
delete cam;
|
||||||
|
}
|
||||||
|
|
||||||
bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start, bool force_update)
|
bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start, bool force_update)
|
||||||
{
|
{
|
||||||
CCam * cam;
|
CCam * cam;
|
||||||
@@ -190,12 +198,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
|
|||||||
|
|
||||||
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id);
|
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id);
|
||||||
|
|
||||||
if(channel == NULL) {
|
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex);
|
||||||
printf("CCamManager: channel %" PRIx64 " not found\n", channel_id);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//INFO("channel %llx [%s] mode %d %s update %d", channel_id, channel->getName().c_str(), mode, start ? "START" : "STOP", force_update);
|
|
||||||
mutex.lock();
|
|
||||||
|
|
||||||
cammap_iterator_t it = channel_map.find(channel_id);
|
cammap_iterator_t it = channel_map.find(channel_id);
|
||||||
if(it != channel_map.end()) {
|
if(it != channel_map.end()) {
|
||||||
@@ -204,9 +207,14 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
|
|||||||
cam = new CCam();
|
cam = new CCam();
|
||||||
channel_map.insert(std::pair<t_channel_id, CCam*>(channel_id, cam));
|
channel_map.insert(std::pair<t_channel_id, CCam*>(channel_id, cam));
|
||||||
} else {
|
} else {
|
||||||
mutex.unlock();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(channel == NULL) {
|
||||||
|
printf("CCamManager: channel %" PRIx64 " not found\n", channel_id);
|
||||||
|
StopCam(channel_id, cam);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//INFO("channel %llx [%s] mode %d %s update %d", channel_id, channel->getName().c_str(), mode, start ? "START" : "STOP", force_update);
|
||||||
|
|
||||||
/* FIXME until proper demux management */
|
/* FIXME until proper demux management */
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
@@ -246,10 +254,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
|
|||||||
if((oldmask != newmask) || force_update) {
|
if((oldmask != newmask) || force_update) {
|
||||||
cam->setCaMask(newmask);
|
cam->setCaMask(newmask);
|
||||||
cam->setSource(source);
|
cam->setSource(source);
|
||||||
if(newmask == 0) {
|
if(newmask != 0) {
|
||||||
cam->sendMessage(NULL, 0, false);
|
|
||||||
cam->sendCaPmt(channel->getChannelID(), NULL, 0);
|
|
||||||
} else {
|
|
||||||
cam->makeCaPmt(channel, true);
|
cam->makeCaPmt(channel, true);
|
||||||
cam->setCaPmt(true);
|
cam->setCaPmt(true);
|
||||||
}
|
}
|
||||||
@@ -259,9 +264,9 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
|
|||||||
/* FIXME: back to live channel from playback dont parse pmt and call setCaPmt
|
/* FIXME: back to live channel from playback dont parse pmt and call setCaPmt
|
||||||
* (see CMD_SB_LOCK / UNLOCK PLAYBACK */
|
* (see CMD_SB_LOCK / UNLOCK PLAYBACK */
|
||||||
//channel->setRawPmt(NULL);//FIXME
|
//channel->setRawPmt(NULL);//FIXME
|
||||||
channel_map.erase(channel_id);
|
StopCam(channel_id, cam);
|
||||||
delete cam;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CaIdVector caids;
|
CaIdVector caids;
|
||||||
cCA::GetInstance()->GetCAIDS(caids);
|
cCA::GetInstance()->GetCAIDS(caids);
|
||||||
//uint8_t list = CCam::CAPMT_FIRST;
|
//uint8_t list = CCam::CAPMT_FIRST;
|
||||||
@@ -287,7 +292,6 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
|
|||||||
cam->sendCaPmt(channel->getChannelID(), buffer, len);
|
cam->sendCaPmt(channel->getChannelID(), buffer, len);
|
||||||
//list = CCam::CAPMT_MORE;
|
//list = CCam::CAPMT_MORE;
|
||||||
}
|
}
|
||||||
mutex.unlock();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user