X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb%2Fdvb.cpp;h=b7b831bfb0a98c8e2727256822a961214bbeb588;hp=756c6854c3a34f271920a5cdc9b64d2783253b10;hb=eb510064c67c19fec47fd04ea03017c17569e3c5;hpb=4911a0121954f6b6657ba28fab8d9dd9031d9a59 diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 756c685..b7b831b 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -15,6 +15,7 @@ #include #include #include +#include DEFINE_REF(eDVBRegisteredFrontend); DEFINE_REF(eDVBRegisteredDemux); @@ -93,6 +94,8 @@ eDVBResourceManager::eDVBResourceManager() num_adapter++; } + setUsbTuner(); + int fd = open("/proc/stb/info/model", O_RDONLY); char tmp[255]; int rd = fd >= 0 ? read(fd, tmp, 255) : 0; @@ -325,6 +328,59 @@ void eDVBResourceManager::addAdapter(iDVBAdapter *adapter) } +void eDVBResourceManager::setUsbTuner() +{ + std::ifstream in("/proc/bus/nim_sockets"); + std::string line; + + int res = -1; + int fe_idx = -1; + int usbtuner_idx[8] = {0}; + int usbtuner_count = 0; + + if (in.is_open()) + { + while(!in.eof()) + { + getline(in, line); + if ((res = sscanf(line.c_str(), "NIM Socket %d:", &fe_idx)) == 1) + continue; + + if ((fe_idx != -1) && (line.find("\tName: ") == 0) && (line.find("VTUNER") != -1)) + usbtuner_idx[usbtuner_count++] = fe_idx; + } + in.close(); + } + + if (usbtuner_count) + { + for (eSmartPtrList::iterator it(m_frontend.begin()); it != m_frontend.end(); ++it) + { + int slotid = it->m_frontend->getSlotID(); + for (int i=0; i < usbtuner_count ; i++) + { + if (slotid == usbtuner_idx[i]) + { + it->m_frontend->setUSBTuner(true); + break; + } + } + } + for (eSmartPtrList::iterator it(m_simulate_frontend.begin()); it != m_simulate_frontend.end(); ++it) + { + int slotid = it->m_frontend->getSlotID(); + for (int i=0; i < usbtuner_count ; i++) + { + if (slotid == usbtuner_idx[i]) + { + it->m_frontend->setUSBTuner(true); + break; + } + } + } + } +} + PyObject *eDVBResourceManager::setFrontendSlotInformations(ePyObject list) { if (!PyList_Check(list)) @@ -2035,7 +2091,8 @@ RESULT eDVBChannel::playSource(ePtr &source, const char *streaminfo_f return -ENOENT; } - m_tstools.setSource(source, streaminfo_file); + m_source = source; + m_tstools.setSource(m_source, streaminfo_file); /* DON'T EVEN THINK ABOUT FIXING THIS. FIX THE ATI SOURCES FIRST, THEN DO A REAL FIX HERE! */ @@ -2072,12 +2129,12 @@ RESULT eDVBChannel::playSource(ePtr &source, const char *streaminfo_f m_pvr_thread = new eDVBChannelFilePush(); m_pvr_thread->enablePVRCommit(1); /* If the source specifies a length, it's a file. If not, it's a stream */ - m_pvr_thread->setStreamMode(source->isStream()); + m_pvr_thread->setStreamMode(m_source->isStream()); m_pvr_thread->setScatterGather(this); m_event(this, evtPreStart); - m_pvr_thread->start(source, m_pvr_fd_dst); + m_pvr_thread->start(m_source, m_pvr_fd_dst); CONNECT(m_pvr_thread->m_event, eDVBChannel::pvrEvent); m_state = state_ok; @@ -2099,8 +2156,9 @@ void eDVBChannel::stopSource() ::close(m_pvr_fd_dst); m_pvr_fd_dst = -1; } - ePtr d; - m_tstools.setSource(d); + + m_source = NULL; + m_tstools.setSource(m_source); } void eDVBChannel::stopFile() @@ -2141,8 +2199,7 @@ RESULT eDVBChannel::getCurrentPosition(iDVBDemux *decoding_demux, pts_t &pos, in } else now = pos; /* fixup supplied */ - off_t off = 0; /* TODO: fixme */ - r = m_tstools.fixupPTS(off, now); + r = m_tstools.fixupPTS(m_source ? m_source->offset() : 0, now); if (r) { eDebug("fixup PTS failed");