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;
}
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;
pts_t now;
- r = m_decoder_demux->get().getSTC(now);
+ r = decoding_demux->getSTC(now);
if (r)
{
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 */
if (relative)
{
pts_t now;
- if (getCurrentPosition(now))
+ if (getCurrentPosition(decoding_demux, now))
{
eDebug("seekTo: getCurrentPosition failed!");
return -1;
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:
::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);
/* 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<eDVBAllocatedFrontend> m_frontend;
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;
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;
}
to *= direction;
- return pvr_channel->seekTo(1, to);
+ ePtr<iDVBDemux> demux;
+ m_service_handler.getDemux(demux);
+ if (!demux)
+ return -1;
+
+ return pvr_channel->seekTo(demux, 1, to);
}
RESULT eDVBServicePlay::getPlayPosition(pts_t &pos)
if (m_service_handler.getPVRChannel(pvr_channel))
return -1;
- return pvr_channel->getCurrentPosition(pos);
+ ePtr<iDVBDemux> demux;
+ m_service_handler.getDemux(demux);
+ if (!demux)
+ return -1;
+
+ return pvr_channel->getCurrentPosition(demux, pos);
}
RESULT eDVBServicePlay::info(ePtr<iServiceInformation> &ptr)