diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dvb/decoder.cpp | 34 | ||||
| -rw-r--r-- | lib/dvb/decoder.h | 8 | ||||
| -rw-r--r-- | lib/dvb/demux.cpp | 13 | ||||
| -rw-r--r-- | lib/dvb/demux.h | 6 |
4 files changed, 60 insertions, 1 deletions
diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp index 28d877df..b7118558 100644 --- a/lib/dvb/decoder.cpp +++ b/lib/dvb/decoder.cpp @@ -92,6 +92,12 @@ void eDVBAudio::stopPid() eWarning("audio: DMX_STOP: %m"); } #endif + +void eDVBAudio::flush() +{ + if (::ioctl(m_fd, AUDIO_CLEAR_BUFFER) < 0) + eDebug("audio: AUDIO_CLEAR_BUFFER: %m"); +} eDVBAudio::~eDVBAudio() { @@ -171,6 +177,12 @@ void eDVBVideo::stopPid() } #endif +void eDVBVideo::flush() +{ + if (::ioctl(m_fd, VIDEO_CLEAR_BUFFER) < 0) + eDebug("video: VIDEO_CLEAR_BUFFER: %m"); +} + eDVBVideo::~eDVBVideo() { if (m_fd >= 0) @@ -342,6 +354,7 @@ int eTSMPEGDecoder::setState() eTSMPEGDecoder::eTSMPEGDecoder(eDVBDemux *demux, int decoder): m_demux(demux), m_changed(0) { + demux->connectEvent(slot(*this, &eTSMPEGDecoder::demux_event), m_demux_event); } eTSMPEGDecoder::~eTSMPEGDecoder() @@ -421,3 +434,24 @@ RESULT eTSMPEGDecoder::setZoom(int what) { return -1; } + +RESULT eTSMPEGDecoder::flush() +{ + if (m_audio) + m_audio->flush(); + if (m_video) + m_video->flush(); + return 0; +} + +void eTSMPEGDecoder::demux_event(int event) +{ + switch (event) + { + case eDVBDemux::evtFlush: + flush(); + break; + default: + break; + } +} diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h index df639551..a26d6cf5 100644 --- a/lib/dvb/decoder.h +++ b/lib/dvb/decoder.h @@ -18,6 +18,7 @@ public: void start(); void stopPid(); #endif + void flush(); virtual ~eDVBAudio(); }; @@ -35,6 +36,7 @@ public: void start(); void stopPid(); #endif + void flush(); virtual ~eDVBVideo(); }; @@ -51,7 +53,7 @@ public: virtual ~eDVBPCR(); }; -class eTSMPEGDecoder: public iTSMPEGDecoder +class eTSMPEGDecoder: public Object, public iTSMPEGDecoder { DECLARE_REF(eTSMPEGDecoder); private: @@ -68,6 +70,9 @@ private: }; int m_changed; int setState(); + ePtr<eConnection> m_demux_event; + + void demux_event(int event); public: enum { pidNone = -1 }; eTSMPEGDecoder(eDVBDemux *demux, int decoder); @@ -83,5 +88,6 @@ public: RESULT setPictureSkipMode(int what); RESULT setSlowMotion(int repeat); RESULT setZoom(int what); + RESULT flush(); }; #endif diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp index d5c7cf73..329eafda 100644 --- a/lib/dvb/demux.cpp +++ b/lib/dvb/demux.cpp @@ -88,6 +88,19 @@ RESULT eDVBDemux::getSTC(pts_t &pts) return 0; } +RESULT eDVBDemux::flush() +{ + // FIXME: implement flushing the PVR queue here. + + m_event(evtFlush); + return 0; +} + +RESULT eDVBDemux::connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn) +{ + conn = new eConnection(this, m_event.connect(event)); + return 0; +} void eDVBSectionReader::data(int) { diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h index a01cf60b..08d9f43d 100644 --- a/lib/dvb/demux.h +++ b/lib/dvb/demux.h @@ -15,7 +15,11 @@ class eDVBDemux: public iDVBDemux friend class eDVBPCR; friend class eDVBTSRecorder; friend class eDVBCAService; + Signal1<void, int> m_event; public: + enum { + evtFlush + }; DECLARE_REF(eDVBDemux); eDVBDemux(int adapter, int demux); virtual ~eDVBDemux(); @@ -24,6 +28,8 @@ public: RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader); RESULT getSTC(pts_t &pts); RESULT getCADemuxID(uint8_t &id) { id = demux; return 0; } + RESULT flush(); + RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn); }; class eDVBSectionReader: public iDVBSectionReader, public Object |
