zapit/src/femanager.cpp: change free demux for PiP detection

This commit is contained in:
[CST] Focus
2014-03-28 14:48:02 +04:00
parent c4dc143934
commit 87e0691ca2

View File

@@ -393,6 +393,10 @@ void CFEManager::linkFrontends(bool init)
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex);
enabled_count = 0;
unused_demux = 0;
int demuxes[MAX_DMX_UNITS];
for(int i = 0; i < MAX_DMX_UNITS; i++)
demuxes[i] = 0;
demuxes[0] = 1;
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second;
int femode = fe->getMode();
@@ -442,8 +446,15 @@ void CFEManager::linkFrontends(bool init)
fe->Init();
if (femode != CFrontend::FE_MODE_UNUSED) {
enabled_count++;
} else if (!unused_demux) {
unused_demux = fe->fenumber + 1;
if ((fe->fenumber + 1) < MAX_DMX_UNITS)
demuxes[fe->fenumber + 1] = 1;
}
}
for(int i = 0; i < MAX_DMX_UNITS; i++) {
if (demuxes[i] == 0) {
unused_demux = i;
INFO("pip demux: %d\n", unused_demux);
break;
}
}
}
@@ -643,10 +654,8 @@ CFrontend * CFEManager::allocateFE(CZapitChannel * channel, bool forrecord)
cDemux::SetSource(frontend->fenumber+1, frontend->fenumber);
#ifdef ENABLE_PIP
/* FIXME until proper demux management */
if (enabled_count < 4) {
channel->setPipDemux(unused_demux ? unused_demux : PIP_DEMUX);
//cDemux::SetSource(PIP_DEMUX, frontend->fenumber);
}
if (unused_demux)
channel->setPipDemux(unused_demux);
INFO("pip demux: %d", channel->getPipDemux());
#endif
#endif