void AM1DDerivativeAB::setAnalyzedName(const QString &name) { analyzedName_ = name; setModified(true); canAnalyze_ = canAnalyze(name); setInputSource(); }
eDVBCIInterfaces::eDVBCIInterfaces() { int num_ci = 0; instance = this; eDebug("scanning for common interfaces.."); while (1) { char filename[128]; #ifdef __sh__ sprintf(filename, "/dev/dvb/adapter0/ci%d", num_ci); #else sprintf(filename, "/dev/ci%d", num_ci); #endif if (::access(filename, R_OK) < 0) break; ePtr<eDVBCISlot> cislot; cislot = new eDVBCISlot(eApp, num_ci); m_slots.push_back(cislot); ++num_ci; } for (eSmartPtrList<eDVBCISlot>::iterator it(m_slots.begin()); it != m_slots.end(); ++it) it->setSource(TUNER_A); if (num_ci > 1) // // FIXME .. we force DM8000 when more than one CI Slot is avail { setInputSource(0, TUNER_A); setInputSource(1, TUNER_B); setInputSource(2, TUNER_C); setInputSource(3, TUNER_D); setInputSource(4, TUNER_E); setInputSource(5, TUNER_F); } else { setInputSource(0, TUNER_A); setInputSource(1, TUNER_B); } eDebug("done, found %d common interface slots", num_ci); }
eDVBCIInterfaces::eDVBCIInterfaces() : eServerSocket(CIPLUS_SERVER_SOCKET, eApp) { int num_ci = 0; std::stringstream path; instance = this; client = NULL; eDebug("[CI] scanning for common interfaces.."); for (;;) { path.str(""); path.clear(); path << "/dev/ci" << num_ci; if(::access(path.str().c_str(), R_OK) < 0) break; ePtr<eDVBCISlot> cislot; cislot = new eDVBCISlot(eApp, num_ci); m_slots.push_back(cislot); ++num_ci; } for (eSmartPtrList<eDVBCISlot>::iterator it(m_slots.begin()); it != m_slots.end(); ++it) it->setSource("A"); for (int tuner_no = 0; tuner_no < 26; ++tuner_no) // NOTE: this assumes tuners are A .. Z max. { path.str(""); path.clear(); path << "/proc/stb/tsmux/input" << tuner_no << "_choices"; if(::access(path.str().c_str(), R_OK) < 0) break; setInputSource(tuner_no, eDVBCISlot::getTunerLetter(tuner_no)); } eDebug("[CI] done, found %d common interface slots", num_ci); }
void eDVBCIInterfaces::ciRemoved(eDVBCISlot *slot) { if (slot->use_count) { eDebug("[CI] Slot %d: removed... usecount %d", slot->getSlotID(), slot->use_count); for (PMTHandlerList::iterator it(m_pmt_handlers.begin()); it != m_pmt_handlers.end(); ++it) { if (it->cislot == slot) // remove the base slot it->cislot = slot->linked_next; else if (it->cislot) { eDVBCISlot *prevSlot = it->cislot, *hSlot = it->cislot->linked_next; while (hSlot) { if (hSlot == slot) { prevSlot->linked_next = slot->linked_next; break; } prevSlot = hSlot; hSlot = hSlot->linked_next; } } } if (slot->linked_next) slot->linked_next->setSource(slot->current_source); else // last CI in chain setInputSource(slot->current_tuner, eDVBCISlot::getTunerLetter(slot->current_tuner)); slot->linked_next = 0; slot->use_count=0; slot->plugged=true; slot->user_mapped=false; slot->removeService(0xFFFF); recheckPMTHandlers(); } }
OutputWindow::OutputWindow() : QGraphicsView(new QGraphicsScene()) , m_url("") , m_pollDviz(false) , m_updateTime(1000) , m_isDataPoll(false) , m_slideId(-1) , m_slideName("") //, m_startStopButton(0) , m_countValue(0) , m_drw(0) , m_blinkCount(0) { // Setup graphics view setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform ); setCacheMode(QGraphicsView::CacheBackground); setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); setOptimizationFlags(QGraphicsView::DontSavePainterState); setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); setTransformationAnchor(AnchorUnderMouse); setResizeAnchor(AnchorViewCenter); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Add pixmap item for background QPixmap bluePixmap(32,23); bluePixmap.fill(Qt::blue); m_pixmap = scene()->addPixmap(bluePixmap); // Background behind text m_counterBgRect = scene()->addRect(0,0,100,60,QPen(), Qt::black); m_counterBgRect->setZValue(99); // Add text (for use with clock) QFont font("Monospace", 50, 600); m_counterText = new QGraphicsSimpleTextItem("0"); m_counterText->setFont(font); m_counterText->setPen(QPen(Qt::black)); m_counterText->setBrush(Qt::white); m_counterText->setPos(0, -13); m_counterText->setZValue(100); scene()->addItem(m_counterText); // Background behind text m_overlayBgRect = scene()->addRect(0,300,100,60,QPen(), Qt::black); m_overlayBgRect->setZValue(99); // Add text (for use with clock) //QFont font("Monospace", 50, 600); m_overlayText = new QGraphicsSimpleTextItem("Hello, World!"); m_overlayText->setFont(font); m_overlayText->setPen(QPen(Qt::black)); m_overlayText->setBrush(Qt::white); m_overlayText->setPos(0, 300-13); m_overlayText->setZValue(100); scene()->addItem(m_overlayText); m_blinkOverlay = false; connect(&m_blinkOverlayTimer, SIGNAL(timeout()), this, SLOT(blinkOverlaySlot())); GET_CONFIG(); QPoint windowPos(1024,0); QPoint windowSize(1024,768); //QPoint windowPos(10,10); //QPoint windowSize = QPoint(640,480); QString windowGeomString = config.value("geom","1024,0,1024,768").toString(); if(!windowGeomString.isEmpty()) { QStringList list = windowGeomString.split(","); windowPos = QPoint(list[0].toInt(), list[1].toInt()); windowSize = QPoint(list[2].toInt(), list[3].toInt()); } setWindowGeom(QRect(windowPos.x(),windowPos.y(),windowSize.x(),windowSize.y())); bool frameless = config.value("frameless","true").toString() == "true"; if(frameless) setWindowFlags(Qt::FramelessWindowHint);// | Qt::ToolTip); connect(&m_pollDvizTimer, SIGNAL(timeout()), this, SLOT(initDvizPoll())); //connect(&m_pollImageTimer, SIGNAL(timeout()), this, SLOT(initImagePoll())); setUpdateTime(m_updateTime); //setUrl("http://10.10.9.90:8081/image"); //setUrl(""); //setPollDviz(true); setInputSource(config.value("source","dviz://192.168.0.10:8081/image").toString()); // m_startStopButton = new QPushButton("Start Counter"); // connect(m_startStopButton, SIGNAL(clicked()), this, SLOT(toggleCounter())); connect(&m_counterTimer, SIGNAL(timeout()), this, SLOT(counterTick())); m_counterTimer.setInterval(1000); // // m_startStopButton->show(); //toggleCounter(); setCounterActive(false); setBlinkOverlay(config.value("blink-overlay","false").toString() == "true", config.value("blink-speed", 333).toInt()); //setOverlayVisible(config.value("overlay-visible", "true").toString() == "true"); setCounterVisible(config.value("counter-visible", "true").toString() == "true"); setCounterAlignment((Qt::Alignment)config.value("counter-alignment", (int)(Qt::AlignLeft | Qt::AlignTop)).toInt()); setOverlayAlignment((Qt::Alignment)config.value("overlay-alignment", (int)(Qt::AlignCenter | Qt::AlignBottom)).toInt()); setOverlayText(config.value("overlay-text").toString()); }
void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler) { PMTHandlerList::iterator it=std::find(m_pmt_handlers.begin(),m_pmt_handlers.end(),pmthandler); if (it != m_pmt_handlers.end()) { eDVBCISlot *slot = it->cislot; eDVBCISlot *base_slot = slot; eDVBServicePMTHandler *pmthandler = it->pmthandler; m_pmt_handlers.erase(it); eServiceReferenceDVB service_to_remove; pmthandler->getServiceReference(service_to_remove); bool sameServiceExist=false; for (PMTHandlerList::iterator i=m_pmt_handlers.begin(); i != m_pmt_handlers.end(); ++i) { if (i->cislot) { eServiceReferenceDVB ref; i->pmthandler->getServiceReference(ref); if ( ref == service_to_remove ) { sameServiceExist=true; break; } } } while(slot) { eDVBCISlot *next = slot->linked_next; if (!sameServiceExist) { eDebug("[eDVBCIInterfaces] remove last pmt handler for service %s send empty capmt", service_to_remove.toString().c_str()); std::vector<uint16_t> caids; caids.push_back(0xFFFF); slot->sendCAPMT(pmthandler, caids); // send a capmt without caids to remove a running service slot->removeService(service_to_remove.getServiceID().get()); if (slot->current_tuner == -1) { // no previous tuner to go back to, signal to CI interface CI action is finished std::string finish_source; switch (m_stream_finish_mode) { case finish_use_tuner_a: { finish_source = "A"; break; } case finish_use_pvr_none: { finish_source = "PVR_NONE"; break; } case finish_use_none: { finish_source = "NONE"; break; } default: (void)0; } if(finish_source == "") { eDebug("[CI] warning: CI streaming finish mode not set, assuming \"tuner A\""); finish_source = "A"; } slot->setSource(finish_source); } } if (!--slot->use_count) { if (slot->linked_next) slot->linked_next->setSource(slot->current_source); else setInputSource(slot->current_tuner, eDVBCISlot::getTunerLetter(slot->current_tuner)); if (base_slot != slot) { eDVBCISlot *tmp = it->cislot; while(tmp->linked_next != slot) tmp = tmp->linked_next; ASSERT(tmp); if (slot->linked_next) tmp->linked_next = slot->linked_next; else tmp->linked_next = 0; } else // removed old base slot.. update ptr base_slot = slot->linked_next; slot->linked_next = 0; slot->user_mapped = false; } eDebug("[CI] (3) slot %d usecount is now %d", slot->getSlotID(), slot->use_count); slot = next; } // check if another service is waiting for the CI recheckPMTHandlers(); } }
void eDVBCIInterfaces::recheckPMTHandlers() { eDebugCI("[CI] recheckPMTHAndlers()"); for (PMTHandlerList::iterator it(m_pmt_handlers.begin()); it != m_pmt_handlers.end(); ++it) { CAID_LIST caids; ePtr<eDVBService> service; eServiceReferenceDVB ref; eDVBCISlot *tmp = it->cislot; eDVBServicePMTHandler *pmthandler = it->pmthandler; eDVBServicePMTHandler::program p; bool plugged_cis_exist = false; pmthandler->getServiceReference(ref); pmthandler->getService(service); eDebugCI("[CI] recheck %p %s", pmthandler, ref.toString().c_str()); for (eSmartPtrList<eDVBCISlot>::iterator ci_it(m_slots.begin()); ci_it != m_slots.end(); ++ci_it) if (ci_it->plugged && ci_it->getCAManager()) { eDebug("[CI] Slot %d plugged", ci_it->getSlotID()); ci_it->plugged = false; plugged_cis_exist = true; } // check if this pmt handler has already assigned CI(s) .. and this CI(s) are already running if (!plugged_cis_exist) { while(tmp) { if (!tmp->running_services.empty()) break; tmp=tmp->linked_next; } if (tmp) // we dont like to change tsmux for running services { eDebugCI("[CI] already assigned and running CI!\n"); continue; } } if (!pmthandler->getProgramInfo(p)) { int cnt=0; std::set<eDVBServicePMTHandler::program::capid_pair> set(p.caids.begin(), p.caids.end()); for (std::set<eDVBServicePMTHandler::program::capid_pair>::reverse_iterator x(set.rbegin()); x != set.rend(); ++x, ++cnt) caids.push_front(x->caid); if (service && cnt) service->m_ca = caids; } if (service) caids = service->m_ca; if (caids.empty()) continue; // unscrambled service for (eSmartPtrList<eDVBCISlot>::iterator ci_it(m_slots.begin()); ci_it != m_slots.end(); ++ci_it) { eDebugCI("[CI] check Slot %d", ci_it->getSlotID()); bool useThis=false; bool user_mapped=true; eDVBCICAManagerSession *ca_manager = ci_it->getCAManager(); if (ca_manager) { int mask=0; if (!ci_it->possible_services.empty()) { mask |= 1; serviceSet::iterator it = ci_it->possible_services.find(ref); if (it != ci_it->possible_services.end()) { eDebug("[CI] '%s' is in service list of slot %d... so use it", ref.toString().c_str(), ci_it->getSlotID()); useThis = true; } else // check parent { eServiceReferenceDVB parent_ref = ref.getParentServiceReference(); if (parent_ref) { it = ci_it->possible_services.find(ref); if (it != ci_it->possible_services.end()) { eDebug("[CI] parent '%s' of '%s' is in service list of slot %d... so use it", parent_ref.toString().c_str(), ref.toString().c_str(), ci_it->getSlotID()); useThis = true; } } } } if (!useThis && !ci_it->possible_providers.empty()) { eDVBNamespace ns = ref.getDVBNamespace(); mask |= 2; if (!service) // subservice? { eServiceReferenceDVB parent_ref = ref.getParentServiceReference(); eDVBDB::getInstance()->getService(parent_ref, service); } if (service) { providerSet::iterator it = ci_it->possible_providers.find(providerPair(service->m_provider_name, ns.get())); if (it != ci_it->possible_providers.end()) { eDebug("[CI] '%s/%08x' is in provider list of slot %d... so use it", service->m_provider_name.c_str(), ns.get(), ci_it->getSlotID()); useThis = true; } } } if (!useThis && !ci_it->possible_caids.empty()) { mask |= 4; for (CAID_LIST::iterator ca(caids.begin()); ca != caids.end(); ++ca) { caidSet::iterator it = ci_it->possible_caids.find(*ca); if (it != ci_it->possible_caids.end()) { eDebug("[CI] caid '%04x' is in caid list of slot %d... so use it", *ca, ci_it->getSlotID()); useThis = true; break; } } } if (!useThis && !mask) { const std::vector<uint16_t> &ci_caids = ca_manager->getCAIDs(); for (CAID_LIST::iterator ca(caids.begin()); ca != caids.end(); ++ca) { std::vector<uint16_t>::const_iterator z = std::lower_bound(ci_caids.begin(), ci_caids.end(), *ca); if ( z != ci_caids.end() && *z == *ca ) { eDebug("[CI] The CI in Slot %d has said it can handle caid %04x... so use it", ci_it->getSlotID(), *z); useThis = true; user_mapped = false; break; } } } } if (useThis) { // check if this CI is already assigned to this pmthandler eDVBCISlot *tmp = it->cislot; while(tmp) { if (tmp == ci_it) break; tmp=tmp->linked_next; } if (tmp) // ignore already assigned cislots... { eDebugCI("[CI] already assigned!"); continue; } eDebugCI("[CI] current slot %d usecount %d", ci_it->getSlotID(), ci_it->use_count); if (ci_it->use_count) // check if this CI can descramble more than one service { bool found = false; useThis = false; PMTHandlerList::iterator tmp = m_pmt_handlers.begin(); while (!found && tmp != m_pmt_handlers.end()) { eDebugCI("[CI] ."); eDVBCISlot *tmp_cislot = tmp->cislot; while (!found && tmp_cislot) { eDebugCI("[CI] .."); eServiceReferenceDVB ref2; tmp->pmthandler->getServiceReference(ref2); if ( tmp_cislot == ci_it && it->pmthandler != tmp->pmthandler ) { eDebugCI("[CI] check pmthandler %s for same service/tp", ref2.toString().c_str()); eDVBChannelID s1, s2; if (ref != ref2) { eDebugCI("[CI] different services!"); ref.getChannelID(s1); ref2.getChannelID(s2); } if (ref == ref2 || (s1 == s2 && canDescrambleMultipleServices(tmp_cislot->getSlotID()))) { found = true; eDebugCI("[CI] found!"); eDVBCISlot *tmpci = it->cislot = tmp->cislot; while(tmpci) { ++tmpci->use_count; eDebug("[CI] (2)CISlot %d, usecount now %d", tmpci->getSlotID(), tmpci->use_count); tmpci=tmpci->linked_next; } } } tmp_cislot=tmp_cislot->linked_next; } eDebugCI("[CI] ..."); ++tmp; } } if (useThis) { if (ci_it->user_mapped) // we dont like to link user mapped CIs { eDebugCI("[CI] user mapped CI already in use... dont link!"); continue; } ++ci_it->use_count; eDebug("[CI] (1)Slot %d, usecount now %d", ci_it->getSlotID(), ci_it->use_count); std::stringstream ci_source; ci_source << "CI" << ci_it->getSlotID(); if (!it->cislot) { int tunernum = -1; eUsePtr<iDVBChannel> channel; if (!pmthandler->getChannel(channel)) { ePtr<iDVBFrontend> frontend; if (!channel->getFrontend(frontend)) { eDVBFrontend *fe = (eDVBFrontend*) &(*frontend); tunernum = fe->getSlotID(); } if (tunernum != -1) { setInputSource(tunernum, ci_source.str()); ci_it->setSource(eDVBCISlot::getTunerLetter(tunernum)); } else { /* * No associated frontend, this must be a DVR source * * No need to set tuner input (setInputSource), because we have no tuner. */ switch(m_stream_interface) { case interface_use_dvr: { std::stringstream source; source << "DVR" << channel->getDvrId(); ci_it->setSource(source.str()); break; } case interface_use_pvr: { ci_it->setSource("PVR"); break; } default: { eDebug("[CI] warning: no valid CI streaming interface"); break; } } } } ci_it->current_tuner = tunernum; } else { ci_it->current_tuner = it->cislot->current_tuner; ci_it->linked_next = it->cislot; ci_it->setSource(ci_it->linked_next->current_source); ci_it->linked_next->setSource(ci_source.str()); } it->cislot = ci_it; eDebugCI("[CI] assigned!"); gotPMT(pmthandler); } if (it->cislot && user_mapped) // CI assigned to this pmthandler in this run.. and user mapped? then we break here.. we dont like to link other CIs to user mapped CIs { eDebugCI("[CI] user mapped CI assigned... dont link CIs!"); break; } } } } }
eDVBCIInterfaces::eDVBCIInterfaces() : eServerSocket(CIPLUS_SERVER_SOCKET, eApp) { int num_ci = 0; std::stringstream path; instance = this; client = NULL; m_stream_interface = interface_none; m_stream_finish_mode = finish_none; eDebug("[CI] scanning for common interfaces.."); for (;;) { path.str(""); path.clear(); #ifdef __sh__ path << "/dev/dvb/adapter0/ci" << num_ci; #else path << "/dev/ci" << num_ci; #endif if(::access(path.str().c_str(), R_OK) < 0) break; ePtr<eDVBCISlot> cislot; cislot = new eDVBCISlot(eApp, num_ci); m_slots.push_back(cislot); ++num_ci; } for (eSmartPtrList<eDVBCISlot>::iterator it(m_slots.begin()); it != m_slots.end(); ++it) it->setSource("A"); for (int tuner_no = 0; tuner_no < 26; ++tuner_no) // NOTE: this assumes tuners are A .. Z max. { path.str(""); path.clear(); path << "/proc/stb/tsmux/input" << tuner_no << "_choices"; if(::access(path.str().c_str(), R_OK) < 0) break; setInputSource(tuner_no, eDVBCISlot::getTunerLetter(tuner_no)); } eDebug("[CI] done, found %d common interface slots", num_ci); if (num_ci) { static const char *proc_ci_choices = "/proc/stb/tsmux/ci0_input_choices"; if (CFile::contains_word(proc_ci_choices, "PVR")) // lowest prio = PVR m_stream_interface = interface_use_pvr; if (CFile::contains_word(proc_ci_choices, "DVR")) // low prio = DVR m_stream_interface = interface_use_dvr; if (CFile::contains_word(proc_ci_choices, "DVR0")) // high prio = DVR0 m_stream_interface = interface_use_dvr; if (m_stream_interface == interface_none) // fallback = DVR { m_stream_interface = interface_use_dvr; eDebug("[CI] Streaming CI routing interface not advertised, assuming DVR method"); } if (CFile::contains_word(proc_ci_choices, "PVR_NONE")) // low prio = PVR_NONE m_stream_finish_mode = finish_use_pvr_none; if (CFile::contains_word(proc_ci_choices, "NONE")) // high prio = NONE m_stream_finish_mode = finish_use_none; if (m_stream_finish_mode == finish_none) // fallback = "tuner" { m_stream_finish_mode = finish_use_tuner_a; eDebug("[CI] Streaming CI finish interface not advertised, assuming \"tuner\" method"); } } }
void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler) { PMTHandlerList::iterator it=std::find(m_pmt_handlers.begin(),m_pmt_handlers.end(),pmthandler); if (it != m_pmt_handlers.end()) { eDVBCISlot *slot = it->cislot; eDVBCISlot *base_slot = slot; eDVBServicePMTHandler *pmthandler = it->pmthandler; m_pmt_handlers.erase(it); eServiceReferenceDVB service_to_remove; pmthandler->getServiceReference(service_to_remove); bool sameServiceExist=false; for (PMTHandlerList::iterator i=m_pmt_handlers.begin(); i != m_pmt_handlers.end(); ++i) { if (i->cislot) { eServiceReferenceDVB ref; i->pmthandler->getServiceReference(ref); if ( ref == service_to_remove ) { sameServiceExist=true; break; } } } while(slot) { eDVBCISlot *next = slot->linked_next; if (!sameServiceExist) { eDebug("[eDVBCIInterfaces] remove last pmt handler for service %s send empty capmt", service_to_remove.toString().c_str()); std::vector<uint16_t> caids; caids.push_back(0xFFFF); slot->sendCAPMT(pmthandler, caids); // send a capmt without caids to remove a running service slot->removeService(service_to_remove.getServiceID().get()); } if (!--slot->use_count) { if (slot->linked_next) slot->linked_next->setSource(slot->current_source); else setInputSource(slot->current_tuner, slot->current_source); if (base_slot != slot) { eDVBCISlot *tmp = it->cislot; while(tmp->linked_next != slot) tmp = tmp->linked_next; ASSERT(tmp); if (slot->linked_next) tmp->linked_next = slot->linked_next; else tmp->linked_next = 0; } else // removed old base slot.. update ptr base_slot = slot->linked_next; slot->linked_next = 0; slot->user_mapped = false; } eDebug("(3) slot %d usecount is now %d", slot->getSlotID(), slot->use_count); slot = next; } // check if another service is waiting for the CI recheckPMTHandlers(); } }
foreach(VCMatrixControl* control, m_controls) { if (control->m_inputSource != NULL) setInputSource(NULL, control->m_id); delete control; }