capmt: remember source demux for updates; use record demux from channel

Origin commit data
------------------
Branch: ni/coolstream
Commit: 109d74c24b
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-01-13 (Fri, 13 Jan 2012)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2012-01-13 15:59:49 +04:00
parent 678f4e9ed8
commit 98aac75ff9
2 changed files with 11 additions and 5 deletions

View File

@@ -46,6 +46,7 @@ class CCam : public CBasicClient
virtual unsigned char getVersion(void) const;
virtual const char *getSocketName(void) const;
int camask, demuxes[3];
int source_demux;
public:
CCam();
@@ -53,6 +54,7 @@ class CCam : public CBasicClient
bool setCaPmt(CCaPmt * const caPmt, int _demux = 0, int _camask = 1, bool update = false);
int getCaMask(void) { return camask; };
int makeMask(int demux, bool add);
int getSource() { return source_demux; };
};
typedef std::map<t_channel_id, CCam*> cammap_t;

View File

@@ -33,6 +33,7 @@ CCam::CCam()
{
camask = 0;
demuxes[0] = demuxes[1] = demuxes[2] = 0;
source_demux = -1;
}
unsigned char CCam::getVersion(void) const
@@ -72,6 +73,7 @@ bool CCam::sendMessage(const char * const data, const size_t length, bool update
bool CCam::setCaPmt(CCaPmt * const caPmt, int _demux, int _camask, bool update)
{
camask = _camask;
source_demux = _demux;
printf("CCam::setCaPmt cam %x source %d camask %d update %s\n", (int) this, _demux, camask, update ? "yes" : "no" );
if(camask == 0) {
@@ -140,7 +142,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
printf("CCamManager: channel %llx not found\n", channel_id);
return false;
}
printf("CCam::SetMode: channel %llx [%s] mode %d %s update %d\n", channel_id, channel->getName().c_str(), mode, start ? "START" : "STOP", force_update);
mutex.lock();
if(channel->getCaPmt() == NULL) {
printf("CCamManager: channel %llx dont have caPmt\n", channel_id);
@@ -148,8 +150,6 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
return false;
}
sat_iterator_t sit = satellitePositions.find(channel->getSatellitePosition());
cammap_iterator_t it = channel_map.find(channel_id);
if(it != channel_map.end()) {
cam = it->second;
@@ -167,8 +167,8 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
demux = LIVE_DEMUX;
break;
case RECORD:
source = DEMUX_SOURCE_0;
demux = RECORD_DEMUX;//FIXME
source = channel->getRecordDemux(); //DEMUX_SOURCE_0;//FIXME
demux = channel->getRecordDemux(); //RECORD_DEMUX;//FIXME
break;
case STREAM:
source = DEMUX_SOURCE_0;
@@ -182,6 +182,10 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
else
newmask = cam->makeMask(demux, start);
if(cam->getSource() > 0)
source = cam->getSource();
printf("CCam::SetMode: source %d old mask %d new mask %d force update %s\n", source, oldmask, newmask, force_update ? "yes" : "no");
if((oldmask != newmask) || force_update)
cam->setCaPmt(channel->getCaPmt(), source, newmask, true);