diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-08-17 02:16:32 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-08-17 02:16:32 +0000 |
| commit | 0af11516cabc973907890f548925a66313c8d18c (patch) | |
| tree | c31b0f76274fbc23d24f0b0188c54282b96442bc /lib/dvb | |
| parent | 17647e30993cc20d8f94f2de4a0bc78ce6b593cb (diff) | |
| download | enigma2-0af11516cabc973907890f548925a66313c8d18c.tar.gz enigma2-0af11516cabc973907890f548925a66313c8d18c.zip | |
- add iSeekableService, implement it for serviceDvb
Diffstat (limited to 'lib/dvb')
| -rw-r--r-- | lib/dvb/demux.cpp | 32 | ||||
| -rw-r--r-- | lib/dvb/demux.h | 1 | ||||
| -rw-r--r-- | lib/dvb/dvb.cpp | 31 | ||||
| -rw-r--r-- | lib/dvb/idvb.h | 3 | ||||
| -rw-r--r-- | lib/dvb/pmt.cpp | 9 | ||||
| -rw-r--r-- | lib/dvb/pmt.h | 1 | ||||
| -rw-r--r-- | lib/dvb/tstools.h | 1 |
7 files changed, 74 insertions, 4 deletions
diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp index bdd8e67d..3e05065b 100644 --- a/lib/dvb/demux.cpp +++ b/lib/dvb/demux.cpp @@ -59,6 +59,38 @@ RESULT eDVBDemux::getMPEGDecoder(ePtr<iTSMPEGDecoder> &decoder) return 0; } +RESULT eDVBDemux::getSTC(pts_t &pts) +{ + char filename[128]; +#if HAVE_DVB_API_VERSION < 3 + sprintf(filename, "/dev/dvb/card%d/demux%d", adapter, demux); +#else + sprintf(filename, "/dev/dvb/adapter%d/demux%d", adapter, demux); +#endif + int fd = ::open(filename, O_RDWR); + + if (fd < 0) + return -ENODEV; + + struct dmx_stc stc; + stc.num = 0; + stc.base = 1; + + if (ioctl(fd, DMX_GET_STC, &stc) < 0) + { + ::close(fd); + return -1; + } + + pts = stc.stc; + eDebug("got demux stc: %08llx", pts); + + ::close(fd); + + return 0; +} + + void eDVBSectionReader::data(int) { __u8 data[4096]; // max. section size diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h index fdec4177..23aef0f3 100644 --- a/lib/dvb/demux.h +++ b/lib/dvb/demux.h @@ -21,6 +21,7 @@ public: RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader); RESULT createTSRecorder(ePtr<iDVBTSRecorder> &recorder); RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader); + RESULT getSTC(pts_t &pts); }; class eDVBSectionReader: public iDVBSectionReader, public Object diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index cfb32d09..3e4c7bdc 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -552,14 +552,39 @@ RESULT eDVBChannel::getLength(pts_t &len) RESULT eDVBChannel::getCurrentPosition(pts_t &pos) { -#if 0 off_t begin = 0; /* getPTS for offset 0 is cached, so it doesn't harm. */ int r = m_tstools.getPTS(begin, pos); if (r) + { + eDebug("tstools getpts(0) failed!"); return r; + } + + pts_t now; + + r = m_demux->get().getSTC(now); + + if (r) + { + eDebug("demux getSTC failed"); + return -1; + } + + eDebug("STC: %08llx PTS: %08llx, diff %lld", now, pos, now - pos); + + /* when we are less than 10 seconds before the start, return 0. */ + /* (we're just waiting for the timespam to start) */ + if ((now < pos) && ((pos - now) < 90000 * 10)) + { + pos = 0; + return 0; + } + + if (now < pos) /* wrap around */ + pos = now + ((pts_t)1)<<33 - pos; + else + pos = now - pos; - // DMX_GET_STC -#endif return 0; } diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 518525f9..683a7b71 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -459,7 +459,7 @@ public: /* so this is VERY UGLY. */ virtual RESULT playFile(const char *file) = 0; - virtual RESULT getLength(pts_t &len) = 0; + virtual RESULT getLength(pts_t &pts) = 0; virtual RESULT getCurrentPosition(pts_t &pos) = 0; // seekTo ... @@ -475,6 +475,7 @@ public: virtual RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader)=0; virtual RESULT createTSRecorder(ePtr<iDVBTSRecorder> &recorder)=0; virtual RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader)=0; + virtual RESULT getSTC(pts_t &pts)=0; }; class iTSMPEGDecoder: public iObject diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 541a248c..e62de9b8 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -168,6 +168,15 @@ int eDVBServicePMTHandler::getDemux(ePtr<iDVBDemux> &demux) return -1; } +int eDVBServicePMTHandler::getPVRChannel(ePtr<iDVBPVRChannel> &pvr_channel) +{ + pvr_channel = m_pvr_channel; + if (pvr_channel) + return 0; + else + return -1; +} + int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref) { RESULT res; diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index 9d35aa4c..efe54ee7 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -66,6 +66,7 @@ public: int getProgramInfo(struct program &program); int getDemux(ePtr<iDVBDemux> &demux); + int getPVRChannel(ePtr<iDVBPVRChannel> &pvr_channel); int tune(eServiceReferenceDVB &ref); }; diff --git a/lib/dvb/tstools.h b/lib/dvb/tstools.h index a50ab441..4ec4b66a 100644 --- a/lib/dvb/tstools.h +++ b/lib/dvb/tstools.h @@ -1,6 +1,7 @@ #ifndef __lib_dvb_tstools_h #define __lib_dvb_tstools_h +#include <config.h> #include <sys/types.h> /* |
