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 f20ce8a286d9a64d3d88d7622837717e69ffdf9f..6a0211ec54f3701e38d56b85f2e42a7ac6d123e2 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 23dd777843b45c3369cd1cc39c70d94e1e8c3fe6..511ef9aa26d94294ae7221dd81c7121b612cbf1c 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 399abaa57404d7e7ecc155f4683e0976ac5d0c57..8aa3391dfeda6e9351ee2807cc7709e4756e1327 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 */