add channel events, like EOF
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 17 Jan 2006 00:21:37 +0000 (00:21 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 17 Jan 2006 00:21:37 +0000 (00:21 +0000)
lib/dvb/dvb.cpp
lib/dvb/dvb.h
lib/dvb/idvb.h

index f20ce8a..6a0211e 100644 (file)
@@ -607,6 +607,17 @@ void eDVBChannel::frontendStateChanged(iDVBFrontend*fe)
        }
 }
 
+void eDVBChannel::pvrEvent(int event)
+{
+       switch (event)
+       {
+       case eFilePushThread::evtEOF:
+               eDebug("eDVBChannel: End of file!");
+               m_event(this, evtEOF);
+               break;
+       }
+}
+
 void eDVBChannel::AddUse()
 {
        ++m_use_count;
@@ -658,6 +669,12 @@ RESULT eDVBChannel::connectStateChange(const Slot1<void,iDVBChannel*> &stateChan
        return 0;
 }
 
+RESULT eDVBChannel::connectEvent(const Slot2<void,iDVBChannel*,int> &event, ePtr<eConnection> &connection)
+{
+       connection = new eConnection((iDVBChannel*)this, m_event.connect(event));
+       return 0;
+}
+
 RESULT eDVBChannel::getState(int &state)
 {
        state = m_state;
@@ -733,6 +750,7 @@ RESULT eDVBChannel::playFile(const char *file)
        
        m_pvr_thread = new eFilePushThread();
        m_pvr_thread->start(m_pvr_fd_src, m_pvr_fd_dst);
+       CONNECT(m_pvr_thread->m_event, eDVBChannel::pvrEvent);
 
        return 0;
 }
index 23dd777..511ef9a 100644 (file)
@@ -206,6 +206,8 @@ public:
        eDVBChannelID getChannelID() { return m_channel_id; }
 
        RESULT connectStateChange(const Slot1<void,iDVBChannel*> &stateChange, ePtr<eConnection> &connection);
+       RESULT connectEvent(const Slot2<void,iDVBChannel*,int> &eventChange, ePtr<eConnection> &connection);
+       
        RESULT getState(int &state);
 
        RESULT setCIRouting(const eDVBCIRouting &routing);
@@ -229,6 +231,7 @@ private:
        ePtr<iDVBFrontendParameters> m_current_frontend_parameters;
        eDVBChannelID m_channel_id;
        Signal1<void,iDVBChannel*> m_stateChanged;
+       Signal2<void,iDVBChannel*,int> m_event;
        int m_state;
 
                        /* for channel list */
@@ -239,6 +242,8 @@ private:
        
                /* for PVR playback */
        eFilePushThread *m_pvr_thread;
+       void pvrEvent(int event);
+       
        int m_pvr_fd_src, m_pvr_fd_dst;
        eDVBTSTools m_tstools;
 
index 399abaa..8aa3391 100644 (file)
@@ -388,7 +388,13 @@ public:
                state_ok,          /* ok */
                state_release      /* channel is being shut down. */
        };
+       
+       enum 
+       {
+               evtEOF, evtFailed
+       };
        virtual RESULT connectStateChange(const Slot1<void,iDVBChannel*> &stateChange, ePtr<eConnection> &connection)=0;
+       virtual RESULT connectEvent(const Slot2<void,iDVBChannel*,int> &eventChange, ePtr<eConnection> &connection)=0;
        virtual RESULT getState(int &state)=0;
        
                /* demux capabilities */