~eMain() { m_dvbdb->saveServicelist(); m_mgr->releaseCachedChannel(); done_servicepeer(); e2avahi_close(); }
void frontendDataToDict(ePyObject &dest, ePtr<iDVBFrontendData> data) { if (dest && PyDict_Check(dest)) { PutToDict(dest, "tuner_number", data->getNumber()); PutToDict(dest, "tuner_type", data->getTypeDescription().c_str()); } }
void eSubtitleWidget::setPixmap(ePtr<gPixmap> &pixmap, gRegion changed, eRect pixmap_dest) { m_pixmap = pixmap; m_pixmap_dest = pixmap_dest; /* this is in a virtual 720x576 cage */ /* incoming "changed" regions are relative to the physical pixmap area, so they have to be scaled to the virtual pixmap area, then to the screen */ changed.scale(m_pixmap_dest.width(), 720, m_pixmap_dest.height(), 576); changed.moveBy(ePoint(m_pixmap_dest.x(), m_pixmap_dest.y())); if (pixmap->size().width() && pixmap->size().height()) changed.scale(size().width(), pixmap->size().width(), size().height(), pixmap->size().height()); invalidate(changed); }
int tuner_type_channel_default(ePtr<iDVBChannelList> &channellist, const eDVBChannelID &chid) { if (channellist) { ePtr<iDVBFrontendParameters> feparm; if (!channellist->getChannelFrontendData(chid, feparm)) { int system; if (!feparm->getSystem(system)) { switch(system) { case iDVBFrontend::feSatellite: return 50000; case iDVBFrontend::feCable: return 40000; case iDVBFrontend::feTerrestrial: return 30000; default: break; } } } } return 0; }
RESULT eNavigation::recordService(const eServiceReference &ref, ePtr<iRecordableService> &service, bool simulate, pNavigation::RecordType type) { ASSERT(m_servicehandler); RESULT res = m_servicehandler->record(ref, service); if (res) { eDebug("record: %d", res); service = 0; } else { if (simulate) m_simulate_recordings.insert(service); else { ePtr<eConnection> conn; service->connectEvent(slot(*this, &eNavigation::recordEvent), conn); m_recordings[service]=conn; m_recordings_services[service]=ref; m_recordings_types[service]=type; //for (std::map<ePtr<iRecordableService>, eServiceReference >::iterator it2(m_recordings_services.begin()); it2 != m_recordings_services.end(); ++it2) // eDebug("[core.cpp] recordService: ref %s", (it2->second).toString().c_str()); //for (std::map<ePtr<iRecordableService>, pNavigation::RecordType >::iterator it3(m_recordings_types.begin()); it3 != m_recordings_types.end(); ++it3) // eDebug("[core.cpp] recordService: type %d", it3->second); } } return res; }
eMain() { m_dvbdb = new eDVBDB(); m_mgr = new eDVBResourceManager(); eDVBFrontendParametersSatellite fesat; fesat.frequency = 11817000; // 12070000; fesat.symbol_rate = 27500000; fesat.polarisation = eDVBFrontendParametersSatellite::Polarisation_Vertical; fesat.fec = eDVBFrontendParametersSatellite::FEC_3_4; fesat.inversion = eDVBFrontendParametersSatellite::Inversion_Off; fesat.orbital_position = 192; eDVBFrontendParameters *fe = new eDVBFrontendParameters(); fe->setDVBS(fesat); if (m_mgr->allocateRawChannel(m_channel)) eDebug("shit it failed!"); // init.setRunlevel(eAutoInitNumbers::main); eDebug("starting scan..."); std::list<ePtr<iDVBFrontendParameters> > list; list.push_back(fe); m_scan = new eDVBScan(m_channel); m_scan->start(list); m_scan->connectEvent(slot(*this, &eMain::scanEvent), m_scan_event_connection); }
void eServiceMP3::gstPoll(ePtr<GstMessageContainer> const &msg) { switch (msg->getType()) { case 1: { GstMessage *gstmessage = *((GstMessageContainer*)msg); if (gstmessage) { gstBusCall(gstmessage); } break; } case 2: { GstBuffer *buffer = *((GstMessageContainer*)msg); if (buffer) { pullSubtitle(buffer); } break; } case 3: { GstPad *pad = *((GstMessageContainer*)msg); gstTextpadHasCAPS_synced(pad); break; } } }
RESULT eNavigation::stopRecordService(ePtr<iRecordableService> &service) { service->stop(); std::set<ePtr<iRecordableService> >::iterator it = m_simulate_recordings.find(service); if (it != m_simulate_recordings.end()) { m_simulate_recordings.erase(it); return 0; } else { std::map<ePtr<iRecordableService>, ePtr<eConnection> >::iterator it = m_recordings.find(service); if (it != m_recordings.end()) { m_recordings.erase(it); /* send stop event */ m_record_event(service, iRecordableService::evEnd); return 0; } } eDebug("try to stop non running recording!!"); // this should not happen return -1; }
void eVideoWidget::updatePosition(int disable) { if (!disable) m_state |= 4; if (disable && !(m_state & 4)) { // eDebug("was not visible!"); return; } if ((m_state & 2) != 2) { // eDebug("no size!"); return; } // eDebug("position %d %d -> %d %d", position().x(), position().y(), size().width(), size().height()); eRect pos(0,0,0,0); if (!disable) pos = eRect(getAbsolutePosition(), size()); else m_state &= ~4; // eDebug("abs position %d %d -> %d %d", pos.left(), pos.top(), pos.width(), pos.height()); if (!disable && m_state & 8 && pos == m_user_rect) { // eDebug("matched"); return; } if (!(m_state & 1)) { m_user_rect = pos; m_state |= 1; // eDebug("set user rect pos!"); } // eDebug("m_user_rect %d %d -> %d %d", m_user_rect.left(), m_user_rect.top(), m_user_rect.width(), m_user_rect.height()); if (!disable) { cXineLib* xineLib = cXineLib::getInstance(); xineLib->setVideoWindow(pos.left(), pos.top(), pos.width(), pos.height()); pendingFullsize &= ~(1 << m_decoder); m_state |= 8; } else { m_state &= ~8; pendingFullsize |= (1 << m_decoder); fullsizeTimer->start(100, true); } }
eMain() { init.setRunlevel(eAutoInitNumbers::main); /* TODO: put into init */ m_dvbdb = new eDVBDB(); m_mgr = new eDVBResourceManager(); m_locale_time_handler = new eDVBLocalTimeHandler(); m_epgcache = new eEPGCache(); m_mgr->setChannelList(m_dvbdb); }
void streamingDataToDict(ePyObject &dest, ePtr<iStreamData> data) { if (dest && PyDict_Check(dest)) { int pmt, pcr, txt, adapter, demux, default_audio_pid; std::vector<int> video, audio, subtitle; unsigned int i; ePyObject l = PyList_New(0); PyList_AppendSteal(l, createTuple(0, "pat")); data->getPmtPid(pmt); if (pmt != -1) PyList_AppendSteal(l, createTuple(pmt, "pmt")); data->getVideoPids(video); for (i = 0; i < video.size(); i++) { PyList_AppendSteal(l, createTuple(video[i], "video")); } data->getAudioPids(audio); for (i = 0; i < audio.size(); i++) { PyList_AppendSteal(l, createTuple(audio[i], "audio")); } data->getSubtitlePids(subtitle); for (i = 0; i < subtitle.size(); i++) { PyList_AppendSteal(l, createTuple(subtitle[i], "subtitle")); } data->getPcrPid(pcr); PyList_AppendSteal(l, createTuple(pcr, "pcr")); data->getTxtPid(txt); if (txt != -1) PyList_AppendSteal(l, createTuple(txt, "text")); PutToDict(dest, "pids", l); data->getAdapterId(adapter); PutToDict(dest, "adapter", adapter); data->getDemuxId(demux); PutToDict(dest, "demux", demux); data->getDefaultAudioPid(default_audio_pid); PutToDict(dest, "default_audio_pid", default_audio_pid); } }
int eRTSPStreamClient::addCachedPids(ePtr<eDVBService> service, eServiceReferenceDVB s) { int found = 0; for (int x = 0; x < 5; ++x) { int entry = service->getCacheEntry((eDVBService::cacheID)x); if (entry != -1) { eDebug("Found cached pid %d [%x]", entry, entry); pid_sr[entry] = s; found = 1; } } return !found; }
void frontendStatusToDict(ePyObject &dest, ePtr<iDVBFrontendStatus> status) { if (dest && PyDict_Check(dest)) { PutToDict(dest, "tuner_state", status->getStateDescription().c_str()); PutToDict(dest, "tuner_locked", status->getLocked()); PutToDict(dest, "tuner_synced", status->getSynced()); PutToDict(dest, "tuner_bit_error_rate", status->getBER()); PutToDict(dest, "tuner_signal_quality", status->getSNR()); int snrdb = status->getSNRdB(); if (snrdb >= 0) PutToDict(dest, "tuner_signal_quality_db", snrdb); PutToDict(dest, "tuner_signal_power", status->getSignalPower()); } }
void eServiceMP3Record::gstPoll(ePtr<GstMessageContainer> const &msg) { switch (msg->getType()) { case 1: { GstMessage *gstmessage = *((GstMessageContainer*)msg); if (gstmessage) { gstBusCall(gstmessage); } break; } default: eDebug("[eMP3ServiceRecord] gstPoll error unknown message type"); } }
int eDVBServicePMTHandler::getDecodeDemux(ePtr<iDVBDemux> &demux) { int ret=0; /* if we're using the decoding demux as data source (for example in pvr playbacks), return that one. */ if (m_use_decode_demux) { demux = m_demux; return ret; } ASSERT(m_channel); /* calling without a previous ::tune is certainly bad. */ ret = m_channel->getDemux(demux, iDVBChannel::capDecode); if (!ret) demux->getCADemuxID(m_decode_demux_num); return ret; }
RESULT eNavigation::stopRecordService(ePtr<iRecordableService> &service) { service->stop(); std::set<ePtr<iRecordableService> >::iterator it = m_simulate_recordings.find(service); if (it != m_simulate_recordings.end()) { m_simulate_recordings.erase(it); return 0; } else { std::map<ePtr<iRecordableService>, ePtr<eConnection> >::iterator it = m_recordings.find(service); if (it != m_recordings.end()) { m_recordings.erase(it); /* send stop event */ m_record_event(service, iRecordableService::evEnd); std::map<ePtr<iRecordableService>, eServiceReference >::iterator it_services = m_recordings_services.find(service); if (it_services != m_recordings_services.end()) { m_recordings_services.erase(it_services); } std::map<ePtr<iRecordableService>, pNavigation::RecordType >::iterator it_types = m_recordings_types.find(service); if (it_types != m_recordings_types.end()) { m_recordings_types.erase(it_types); } //for (std::map<ePtr<iRecordableService>, eServiceReference >::iterator it2(m_recordings_services.begin()); it2 != m_recordings_services.end(); ++it2) // eDebug("[core.cpp] after stopRecordService: ref %s", (it2->second).toString().c_str()); //for (std::map<ePtr<iRecordableService>, pNavigation::RecordType >::iterator it3(m_recordings_types.begin()); it3 != m_recordings_types.end(); ++it3) // eDebug("[core.cpp] after stopRecordService: type %d", it3->second); return 0; } } eDebug("try to stop non running recording!!"); // this should not happen return -1; }
RESULT eNavigation::recordService(const eServiceReference &ref, ePtr<iRecordableService> &service, bool simulate) { ASSERT(m_servicehandler); RESULT res = m_servicehandler->record(ref, service); if (res) { eDebug("record: %d", res); service = 0; } else { if (simulate) m_simulate_recordings.insert(service); else { ePtr<eConnection> conn; service->connectEvent(slot(*this, &eNavigation::recordEvent), conn); m_recordings[service]=conn; } } return res; }
~eMain() { m_dvbdb->saveServicelist(); m_mgr->releaseCachedChannel(); }
int main(int argc, char **argv) { #ifdef MEMLEAK_CHECK atexit(DumpUnfreed); #endif #ifdef OBJECT_DEBUG atexit(object_dump); #endif gst_init(&argc, &argv); for (int i = 0; i < argc; i++) { if (!(strcmp(argv[i], "--debug-no-color")) or !(strcmp(argv[i], "--nc"))) { logOutputColors = 0; } } m_erroroutput = new eErrorOutput(); m_erroroutput->run(); // set pythonpath if unset setenv("PYTHONPATH", eEnv::resolve("${libdir}/enigma2/python").c_str(), 0); printf("PYTHONPATH: %s\n", getenv("PYTHONPATH")); printf("DVB_API_VERSION %d DVB_API_VERSION_MINOR %d\n", DVB_API_VERSION, DVB_API_VERSION_MINOR); bsodLogInit(); ePython python; eMain main; #if 1 ePtr<gMainDC> my_dc; gMainDC::getInstance(my_dc); //int double_buffer = my_dc->haveDoubleBuffering(); ePtr<gLCDDC> my_lcd_dc; gLCDDC::getInstance(my_lcd_dc); /* ok, this is currently hardcoded for arabic. */ /* some characters are wrong in the regular font, force them to use the replacement font */ for (int i = 0x60c; i <= 0x66d; ++i) eTextPara::forceReplacementGlyph(i); eTextPara::forceReplacementGlyph(0xfdf2); for (int i = 0xfe80; i < 0xff00; ++i) eTextPara::forceReplacementGlyph(i); eWidgetDesktop dsk(my_dc->size()); eWidgetDesktop dsk_lcd(my_lcd_dc->size()); dsk.setStyleID(0); dsk_lcd.setStyleID(my_lcd_dc->size().width() == 96 ? 2 : 1); /* if (double_buffer) { eDebug(" - double buffering found, enable buffered graphics mode."); dsk.setCompositionMode(eWidgetDesktop::cmBuffered); } */ wdsk = &dsk; lcddsk = &dsk_lcd; dsk.setDC(my_dc); dsk_lcd.setDC(my_lcd_dc); dsk.setBackgroundColor(gRGB(0,0,0,0xFF)); #endif /* redrawing is done in an idle-timer, so we have to set the context */ dsk.setRedrawTask(main); dsk_lcd.setRedrawTask(main); eDebug("Checking box..."); FILE *infile; char line[100]; char command[64]; if((infile = fopen("/proc/stb/info/boxtype", "r")) != NULL) { fgets(line, sizeof(line), infile); if(strcmp(line, "ini-5000sv\n") == 0) { eDebug("Miraclebox Premium Twin detected"); } else if(strcmp(line, "ini-1000sv\n") == 0) { eDebug("Miraclebox Premium Mini detected"); } else if(strcmp(line, "ini-2000sv\n") == 0) { eDebug("Miraclebox Premium Mini+ detected"); } else if(strcmp(line, "ini-8000sv\n") == 0) { eDebug("Miraclebox Premium Ultra detected"); } else if(strcmp(line, "7000S\n") == 0) { eDebug("Miraclebox Premium Micro detected"); } else if(strcmp(line, "7005S\n") == 0) { eDebug("Miraclebox Premium Micro v2 detected"); } else if(strcmp(line, "g300\n") == 0) { eDebug("Miraclebox Premium Twin+ detected"); } else { eDebug("Wrong HW, this image can be only run on Miraclbox Premium Series"); sprintf(command, "showiframe /usr/share/enigma2/box.mvi > /dev/null"); system(command); //sprintf(command, "flash_erase /dev/mtd/2 0 0"); //system(command); //sprintf(command, "flash_erase /dev/mtd/4 0 0"); //system(command); sprintf(command, "sleep 5;reboot -f"); } fclose(infile); } std::string active_skin = getConfigCurrentSpinner("config.skin.primary_skin"); eDebug("Loading spinners..."); { int i; #define MAX_SPINNER 64 ePtr<gPixmap> wait[MAX_SPINNER]; for (i=0; i<MAX_SPINNER; ++i) { char filename[64]; std::string rfilename; snprintf(filename, sizeof(filename), "${datadir}/enigma2/%s/wait%d.png", active_skin.c_str(), i + 1); rfilename = eEnv::resolve(filename); loadPNG(wait[i], rfilename.c_str()); if (!wait[i]) { if (!i) eDebug("failed to load %s! (%m)", rfilename.c_str()); else eDebug("found %d spinner!", i); break; } } if (i) my_dc->setSpinner(eRect(ePoint(100, 100), wait[0]->size()), wait, i); else my_dc->setSpinner(eRect(100, 100, 0, 0), wait, 1); } gRC::getInstance()->setSpinnerDC(my_dc); eRCInput::getInstance()->keyEvent.connect(slot(keyEvent)); printf("executing main\n"); bsodCatchSignals(); catchTermSignal(); setIoPrio(IOPRIO_CLASS_BE, 3); /* start at full size */ eVideoWidget::setFullsize(true); // python.execute("mytest", "__main__"); python.execFile(eEnv::resolve("${libdir}/enigma2/python/mytest.py").c_str()); /* restore both decoders to full size */ eVideoWidget::setFullsize(true); if (exit_code == 5) /* python crash */ { eDebug("(exit code 5)"); bsodFatal(0); } dsk.paint(); dsk_lcd.paint(); { gPainter p(my_lcd_dc); p.resetClip(eRect(ePoint(0, 0), my_lcd_dc->size())); p.clear(); p.flush(); } m_erroroutput = NULL; return exit_code; }
void eVideoWidget::updatePosition(int disable) { if (!disable) m_state |= 4; if (disable && !(m_state & 4)) { // eDebug("was not visible!"); return; } if ((m_state & 2) != 2) { // eDebug("no size!"); return; } // eDebug("position %d %d -> %d %d", position().x(), position().y(), size().width(), size().height()); eRect pos(0,0,0,0); if (!disable) pos = eRect(getAbsolutePosition(), size()); else m_state &= ~4; // eDebug("abs position %d %d -> %d %d", pos.left(), pos.top(), pos.width(), pos.height()); if (!disable && m_state & 8 && pos == m_user_rect) { // eDebug("matched"); return; } if (!(m_state & 1)) { m_user_rect = pos; m_state |= 1; // eDebug("set user rect pos!"); } // eDebug("m_user_rect %d %d -> %d %d", m_user_rect.left(), m_user_rect.top(), m_user_rect.width(), m_user_rect.height()); int left = pos.left() * 720 / m_fb_size.width(); int top = pos.top() * 576 / m_fb_size.height(); int width = pos.width() * 720 / m_fb_size.width(); int height = pos.height() * 576 / m_fb_size.height(); int tmp = left - (width * 4) / 100; left = tmp < 0 ? 0 : tmp; tmp = top - (height * 4) / 100; top = tmp < 0 ? 0 : tmp; tmp = (width * 108) / 100; width = left + tmp > 720 ? 720 - left : tmp; tmp = (height * 108) / 100; height = top + tmp > 576 ? 576 - top : tmp; // eDebug("picture recalced %d %d -> %d %d", left, top, width, height); if (!disable) { for (int i=0; i<4; ++i) { #ifndef __sh__ const char *targets[]={"left", "top", "width", "height"}; #else const char *targets[]={"width", "height", "left", "top"}; #endif char filename[128]; snprintf(filename, 128, "/proc/stb/vmpeg/%d/dst_%s", m_decoder, targets[i]); FILE *f = fopen(filename, "w"); if (!f) { eDebug("failed to open %s - %m", filename); break; } int val = 0; { switch (i) { #ifndef __sh__ case 0: val = left; break; case 1: val = top; break; case 2: val = width; break; case 3: val = height; break; #else case 0: val = width; break; case 1: val = height; break; case 2: val = left; break; case 3: val = top; break; #endif } fprintf(f, "%08x\n", val); fclose(f); // eDebug("%s %08x", filename, val); } } pendingFullsize &= ~(1 << m_decoder); m_state |= 8; } else { m_state &= ~8; pendingFullsize |= (1 << m_decoder); fullsizeTimer->start(100, true); } }
void activated(int event) { eDebug("[Avahi] watch activated: %#x", event); lastEvent = event; callback(this, sn->getFD(), (AvahiWatchEvent)event, userdata); }
void transponderDataToDict(ePyObject &dest, ePtr<iDVBTransponderData> data) { if (dest && PyDict_Check(dest)) { int value; PutToDict(dest, "tuner_type", data->getTunerType().c_str()); PutToDict(dest, "frequency", data->getFrequency()); value = data->getSymbolRate(); if (value > 0) PutToDict(dest, "symbol_rate", value); value = data->getOrbitalPosition(); if (value >= 0) PutToDict(dest, "orbital_position", value); value = data->getInversion(); if (value >= 0) PutToDict(dest, "inversion", value); value = data->getFecInner(); if (value >= 0) PutToDict(dest, "fec_inner", value); value = data->getModulation(); if (value >= 0) PutToDict(dest, "modulation", value); value = data->getPolarization(); if (value >= 0) PutToDict(dest, "polarization", value); value = data->getRolloff(); if (value >= 0) PutToDict(dest, "rolloff", value); value = data->getPilot(); if (value >= 0) PutToDict(dest, "pilot", value); value = data->getSystem(); if (value >= 0) PutToDict(dest, "system", value); value = data->getIsId(); if (value >= -1) PutToDict(dest, "is_id", value); value = data->getPLSMode(); if (value >= 0) PutToDict(dest, "pls_mode", value); value = data->getPLSCode(); if (value >= 0) PutToDict(dest, "pls_code", value); /* additional terrestrial fields */ value = data->getBandwidth(); if (value >= 0) PutToDict(dest, "bandwidth", value); value = data->getCodeRateLp(); if (value >= 0) PutToDict(dest, "code_rate_lp", value); value = data->getCodeRateHp(); if (value >= 0) PutToDict(dest, "code_rate_hp", value); value = data->getConstellation(); if (value >= 0) PutToDict(dest, "constellation", value); value = data->getTransmissionMode(); if (value >= 0) PutToDict(dest, "transmission_mode", value); value = data->getGuardInterval(); if (value >= 0) PutToDict(dest, "guard_interval", value); value = data->getHierarchyInformation(); if (value >= 0) PutToDict(dest, "hierarchy_information", value); value = data->getPlpId(); if (value >= 0) PutToDict(dest, "plp_id", value); } }
RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBAllocatedDemux> &demux, int &cap) { /* find first unused demux which is on same adapter as frontend (or any, if PVR) never use the first one unless we need a decoding demux. */ eDebug("allocate demux"); eSmartPtrList<eDVBRegisteredDemux>::iterator i(m_demux.begin()); if (i == m_demux.end()) return -1; ePtr<eDVBRegisteredDemux> unused; if (m_boxtype == DM7025) // ATI { /* FIXME: hardware demux policy */ int n=0; if (!(cap & iDVBChannel::capDecode)) { if (m_demux.size() > 2) /* assumed to be true, otherwise we have lost anyway */ { ++i, ++n; ++i, ++n; } } for (; i != m_demux.end(); ++i, ++n) { int is_decode = n < 2; int in_use = is_decode ? (i->m_demux->getRefCount() != 2) : i->m_inuse; if ((!in_use) && ((!fe) || (i->m_adapter == fe->m_adapter))) { if ((cap & iDVBChannel::capDecode) && !is_decode) continue; unused = i; break; } } } else { iDVBAdapter *adapter = fe ? fe->m_adapter : m_adapter.begin(); /* look for a demux on the same adapter as the frontend, or the first adapter for dvr playback */ int source = fe ? fe->m_frontend->getDVBID() : -1; cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux if (!fe) { /* * For pvr playback, start with the last demux. * On some hardware, we have less ca devices than demuxes, * so we should try to leave the first demuxes for live tv, * and start with the last for pvr playback */ i = m_demux.end(); --i; } while (i != m_demux.end()) { if (i->m_adapter == adapter) { if (!i->m_inuse) { /* mark the first unused demux, we'll use that when we do not find a better match */ if (!unused) unused = i; } else { /* demux is in use, see if we can share it */ if (i->m_demux->getSource() == source) { /* * TODO: when allocating a dvr demux, we cannot share a used demux. * We should probably always pick a free demux, to start a new pvr playback. * Each demux is fed by its own dvr device, so each has a different memory source */ demux = new eDVBAllocatedDemux(i); return 0; } } } if (fe) { ++i; } else { --i; } } } if (unused) { demux = new eDVBAllocatedDemux(unused); if (fe) demux->get().setSourceFrontend(fe->m_frontend->getDVBID()); else demux->get().setSourcePVR(0); return 0; } eDebug("demux not found"); return -1; }