X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb%2Fdvb.cpp;h=a8dfb193e9f30a9a2a989e62f0efe5ab274a3cad;hp=e6d9a25de6a0fe5841494a34196db8ba1dcf8104;hb=0cf3bc28d59e7bfb8519839a8e9c36a87ea382c8;hpb=b7f07b6052ac2ca6b5e2a2c9e322b26e2c506109 diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index e6d9a25..a8dfb19 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -438,7 +438,9 @@ alloc_fe_by_id_not_possible: return err; } -RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr &demux, int cap) +#define capHoldDecodeReference 64 + +RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr &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. */ @@ -455,6 +457,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtrm_inuse) @@ -510,6 +513,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr &demux, int cap) if (m_mgr->allocateDemux(m_frontend ? (eDVBRegisteredFrontend*)*m_frontend : (eDVBRegisteredFrontend*)0, our_demux, cap)) return -1; - } - demux = *our_demux; + demux = *our_demux; + /* don't hold a reference to the decoding demux, we don't need it. */ /* FIXME: by dropping the 'allocated demux' in favour of the 'iDVBDemux', the refcount is lost. thus, decoding demuxes are never allocated. this poses a big problem for PiP. */ - if (cap & capDecode) - our_demux = 0; + + if (cap & capHoldDecodeReference) // this is set in eDVBResourceManager::allocateDemux for Dm500HD/DM800 and DM8000 + ; + else if (cap & capDecode) + our_demux = 0; + } + else + demux = *our_demux; + return 0; } @@ -1739,16 +1746,19 @@ RESULT eDVBChannel::playFile(const char *file) /* DON'T EVEN THINK ABOUT FIXING THIS. FIX THE ATI SOURCES FIRST, THEN DO A REAL FIX HERE! */ + if (m_pvr_fd_dst < 0) + { /* (this codepath needs to be improved anyway.) */ #if HAVE_DVB_API_VERSION < 3 - m_pvr_fd_dst = open("/dev/pvr", O_WRONLY); + m_pvr_fd_dst = open("/dev/pvr", O_WRONLY); #else - m_pvr_fd_dst = open("/dev/misc/pvr", O_WRONLY); + m_pvr_fd_dst = open("/dev/misc/pvr", O_WRONLY); #endif - if (m_pvr_fd_dst < 0) - { - eDebug("can't open /dev/misc/pvr - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved. - return -ENODEV; + if (m_pvr_fd_dst < 0) + { + eDebug("can't open /dev/misc/pvr - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved. + return -ENODEV; + } } m_pvr_thread = new eDVBChannelFilePush(); @@ -1760,6 +1770,8 @@ RESULT eDVBChannel::playFile(const char *file) { delete m_pvr_thread; m_pvr_thread = 0; + ::close(m_pvr_fd_dst); + m_pvr_fd_dst = -1; eDebug("can't open PVR file %s (%m)", file); return -ENOENT; } @@ -1776,10 +1788,11 @@ void eDVBChannel::stopFile() if (m_pvr_thread) { m_pvr_thread->stop(); - ::close(m_pvr_fd_dst); delete m_pvr_thread; m_pvr_thread = 0; } + if (m_pvr_fd_dst >= 0) + ::close(m_pvr_fd_dst); } void eDVBChannel::setCueSheet(eCueSheet *cuesheet)