diff options
-rw-r--r-- | lib/dvb/decoder.cpp | 5 | ||||
-rw-r--r-- | lib/dvb/demux.cpp | 7 | ||||
-rw-r--r-- | lib/dvb/demux.h | 3 | ||||
-rw-r--r-- | lib/dvb/dvb.cpp | 26 | ||||
-rw-r--r-- | lib/dvb/idvb.h | 1 | ||||
-rw-r--r-- | lib/dvb/pmt.cpp | 14 | ||||
-rw-r--r-- | lib/dvb/pmt.h | 4 |
7 files changed, 47 insertions, 13 deletions
diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp index 8ed9f43..df45063 100644 --- a/lib/dvb/decoder.cpp +++ b/lib/dvb/decoder.cpp @@ -1302,10 +1302,11 @@ RESULT eTSMPEGDecoder::showSinglePic(const char *filename) if (f >= 0) { struct stat s; + size_t written=0; fstat(f, &s); if (m_video_clip_fd == -1) - m_video_clip_fd = open("/dev/dvb/adapter0/video0", O_WRONLY|O_NONBLOCK); - if (m_video_clip_fd >= 0) + m_video_clip_fd = open("/dev/dvb/adapter0/video0", O_WRONLY); + while (m_video_clip_fd >= 0) { bool seq_end_avail = false; size_t pos=0; diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp index 0c736c5..f4d8618 100644 --- a/lib/dvb/demux.cpp +++ b/lib/dvb/demux.cpp @@ -85,6 +85,13 @@ int eDVBDemux::openDemux(void) return ::open(filename, O_RDWR); } +int eDVBDemux::openDVR(int flags) +{ + char filename[128]; + snprintf(filename, 128, "/dev/dvb/adapter%d/dvr%d", adapter, demux); + return ::open(filename, flags); +} + DEFINE_REF(eDVBDemux) RESULT eDVBDemux::setSourceFrontend(int fenum) diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h index d43c41b..e73982e 100644 --- a/lib/dvb/demux.h +++ b/lib/dvb/demux.h @@ -26,7 +26,8 @@ public: RESULT getCADemuxID(uint8_t &id) { id = demux; return 0; } RESULT flush(); RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn); - + int openDVR(int flags); + int getRefCount() { return ref; } private: int adapter, demux, source; diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index c2ddb40..6f9a67f 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -466,7 +466,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBA ePtr<eDVBRegisteredDemux> unused; - if (m_boxtype == DM800 || m_boxtype == DM500HD || m_boxtype == DM800SE) // dm800 / 500hd + if (m_boxtype == DM800) // dm800 { cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux for (; i != m_demux.end(); ++i, ++n) @@ -522,7 +522,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBA } } } - else if (m_boxtype == DM8000 || m_boxtype == DM7020HD) + else if (m_boxtype == DM8000 || m_boxtype == DM500HD || m_boxtype == DM800SE || m_boxtype == DM7020HD) { cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux for (; i != m_demux.end(); ++i, ++n) @@ -1792,14 +1792,28 @@ RESULT eDVBChannel::playSource(ePtr<iTsSource> &source, const char *streaminfo_f /* (this codepath needs to be improved anyway.) */ #if HAVE_DVB_API_VERSION < 3 m_pvr_fd_dst = open("/dev/pvr", O_WRONLY); -#else - 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. + eDebug("can't open /dev/pvr - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved. + return -ENODEV; + } +#else + ePtr<eDVBAllocatedDemux> &demux = m_demux ? m_demux : m_decoder_demux; + if (demux) + { + m_pvr_fd_dst = demux->get().openDVR(O_WRONLY); + if (m_pvr_fd_dst < 0) + { + eDebug("can't open /dev/dvb/adapterX/dvrX - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved. + return -ENODEV; + } + } + else + { + eDebug("no demux allocated yet.. so its not possible to open the dvr device!!"); return -ENODEV; } +#endif } m_pvr_thread = new eDVBChannelFilePush(); diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index e56a2c7..bd3eb9a 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -636,6 +636,7 @@ public: virtual RESULT getSTC(pts_t &pts, int num=0)=0; virtual RESULT getCADemuxID(uint8_t &id)=0; virtual RESULT flush()=0; + int openDVR(int flags)=0; }; #if HAVE_DVB_API_VERSION < 3 && !defined(VIDEO_EVENT_SIZE_CHANGED) diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 4ad4e76..e5e6331 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -44,8 +44,15 @@ void eDVBServicePMTHandler::channelStateChanged(iDVBChannel *channel) && (state == iDVBChannel::state_ok) && (!m_demux)) { if (m_channel) - if (m_channel->getDemux(m_demux, (!m_use_decode_demux) ? 0 : iDVBChannel::capDecode)) + { + if (m_pvr_demux_tmp) + { + m_demux = m_pvr_demux_tmp; + m_pvr_demux_tmp = NULL; + } + else if (m_channel->getDemux(m_demux, (!m_use_decode_demux) ? 0 : iDVBChannel::capDecode)) eDebug("Allocating %s-decoding a demux for now tuned-in channel failed.", m_use_decode_demux ? "" : "non-"); + } serviceEvent(eventTuned); @@ -842,7 +849,10 @@ int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_dem if (m_pvr_channel) { m_pvr_channel->setCueSheet(cue); - if (source) + + if (m_pvr_channel->getDemux(m_pvr_demux_tmp, (!m_use_decode_demux) ? 0 : iDVBChannel::capDecode)) + eDebug("Allocating %s-decoding a demux for PVR channel failed.", m_use_decode_demux ? "" : "non-"); + else if (source) m_pvr_channel->playSource(source, streaminfo_file); else m_pvr_channel->playFile(ref.path.c_str()); diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index 1888e05..0c44f35 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -86,8 +86,8 @@ class eDVBServicePMTHandler: public Object eUsePtr<iDVBChannel> m_channel; eUsePtr<iDVBPVRChannel> m_pvr_channel; ePtr<eDVBResourceManager> m_resourceManager; - ePtr<iDVBDemux> m_demux; - + ePtr<iDVBDemux> m_demux, m_pvr_demux_tmp; + void channelStateChanged(iDVBChannel *); ePtr<eConnection> m_channelStateChanged_connection; void channelEvent(iDVBChannel *, int event); |