From 81b381e1f5dd38ad1b80a3b3d96060b89a5fab6c Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Fri, 18 Nov 2005 02:52:38 +0000 Subject: [PATCH] pts: as the decoding demux isn't stored in the dvbchannel (it could be shared, and a decoding demux can't be shared), it has to be given to the pts relevant functions. --- lib/dvb/dvb.cpp | 20 ++++++++++---------- lib/dvb/dvb.h | 6 +++--- lib/dvb/idvb.h | 11 ++++++++--- lib/dvb/pmt.cpp | 2 ++ lib/service/servicedvb.cpp | 14 ++++++++++++-- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 5ede1e38..04c2b40e 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -583,7 +583,7 @@ RESULT eDVBChannel::playFile(const char *file) m_pvr_fd_dst = open("/dev/misc/pvr", O_WRONLY); if (m_pvr_fd_dst < 0) { - eDebug("can't open /dev/misc/pvr - you need to buy the new(!) $$$ box! (%m)"); + 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; } @@ -609,9 +609,9 @@ RESULT eDVBChannel::getLength(pts_t &len) return m_tstools.calcLen(len); } -RESULT eDVBChannel::getCurrentPosition(pts_t &pos) +RESULT eDVBChannel::getCurrentPosition(iDVBDemux *decoding_demux, pts_t &pos) { - if (!m_decoder_demux) + if (!decoding_demux) return -1; off_t begin = 0; @@ -625,7 +625,7 @@ RESULT eDVBChannel::getCurrentPosition(pts_t &pos) pts_t now; - r = m_decoder_demux->get().getSTC(now); + r = decoding_demux->getSTC(now); if (r) { @@ -650,7 +650,7 @@ RESULT eDVBChannel::getCurrentPosition(pts_t &pos) return 0; } -RESULT eDVBChannel::seekTo(int relative, pts_t &pts) +RESULT eDVBChannel::seekTo(iDVBDemux *decoding_demux, int relative, pts_t &pts) { int bitrate = m_tstools.calcBitrate(); /* in bits/s */ @@ -660,7 +660,7 @@ RESULT eDVBChannel::seekTo(int relative, pts_t &pts) if (relative) { pts_t now; - if (getCurrentPosition(now)) + if (getCurrentPosition(decoding_demux, now)) { eDebug("seekTo: getCurrentPosition failed!"); return -1; @@ -673,11 +673,11 @@ RESULT eDVBChannel::seekTo(int relative, pts_t &pts) off_t offset = (pts * (pts_t)bitrate) / 8ULL / 90000ULL; - seekToPosition(offset); + seekToPosition(decoding_demux, offset); return 0; } -RESULT eDVBChannel::seekToPosition(const off_t &r) +RESULT eDVBChannel::seekToPosition(iDVBDemux *decoding_demux, const off_t &r) { /* when seeking, we have to ensure that all buffers are flushed. there are basically 3 buffers: @@ -699,8 +699,8 @@ RESULT eDVBChannel::seekToPosition(const off_t &r) ::ioctl(m_pvr_fd_dst, 0); /* flush ratebuffers (video, audio) */ - if (m_decoder_demux) - m_decoder_demux->get().flush(); + if (decoding_demux) + decoding_demux->flush(); /* demux will also flush all decoder.. */ m_pvr_thread->seek(SEEK_SET, r); diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index 03702db2..924d4e6e 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -191,11 +191,11 @@ public: /* iDVBPVRChannel */ RESULT playFile(const char *file); RESULT getLength(pts_t &len); - RESULT getCurrentPosition(pts_t &pos); - RESULT seekTo(int relative, pts_t &pts); + RESULT getCurrentPosition(iDVBDemux *decoding_demux, pts_t &pos); + RESULT seekTo(iDVBDemux *decoding_demux, int relative, pts_t &pts); /* seeking to relative positions won't work - there is an unknown amount of buffers in between */ - RESULT seekToPosition(const off_t &off); + RESULT seekToPosition(iDVBDemux *decoding_demux, const off_t &off); private: ePtr m_frontend; diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 483c395b..699474d3 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -410,9 +410,14 @@ public: virtual RESULT playFile(const char *file) = 0; virtual RESULT getLength(pts_t &pts) = 0; - virtual RESULT getCurrentPosition(pts_t &pos) = 0; - virtual RESULT seekTo(int relative, pts_t &pts) = 0; - virtual RESULT seekToPosition(const off_t &pts) = 0; + + /* we explicitely ask for the decoding demux here because a channel + can be shared between multiple decoders. + Of couse skipping doesn't make much sense + then, but getCurrentPosition does. */ + virtual RESULT getCurrentPosition(iDVBDemux *decoding_demux, pts_t &pos) = 0; + virtual RESULT seekTo(iDVBDemux *decoding_demux, int relative, pts_t &pts) = 0; + virtual RESULT seekToPosition(iDVBDemux *decoding_demux, const off_t &pts) = 0; }; class iDVBSectionReader; diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index e743d266..6fb2d1cc 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -12,10 +12,12 @@ eDVBServicePMTHandler::eDVBServicePMTHandler(int record) eDVBResourceManager::getInstance(m_resourceManager); CONNECT(m_PMT.tableReady, eDVBServicePMTHandler::PMTready); CONNECT(m_PAT.tableReady, eDVBServicePMTHandler::PATready); + eDebug("new PMT handler record: %d", m_record); } eDVBServicePMTHandler::~eDVBServicePMTHandler() { + eDebug("delete PMT handler record: %d", m_record); delete m_ca_servicePtr; } diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index f805ee70..d8206b9a 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -654,7 +654,12 @@ RESULT eDVBServicePlay::seekRelative(int direction, pts_t to) to *= direction; - return pvr_channel->seekTo(1, to); + ePtr demux; + m_service_handler.getDemux(demux); + if (!demux) + return -1; + + return pvr_channel->seekTo(demux, 1, to); } RESULT eDVBServicePlay::getPlayPosition(pts_t &pos) @@ -664,7 +669,12 @@ RESULT eDVBServicePlay::getPlayPosition(pts_t &pos) if (m_service_handler.getPVRChannel(pvr_channel)) return -1; - return pvr_channel->getCurrentPosition(pos); + ePtr demux; + m_service_handler.getDemux(demux); + if (!demux) + return -1; + + return pvr_channel->getCurrentPosition(demux, pos); } RESULT eDVBServicePlay::info(ePtr &ptr) -- 2.30.2