Merge branch 'bug_461_play_another_timeshift_file_after_eof' into experimental
[enigma2.git] / lib / dvb / demux.h
index b2d571ac71f02fe5dcd3051fa4cb3d6ce2a2ae78..7a697d49db27b5473db29b4d07b77bf800a5202f 100644 (file)
@@ -6,33 +6,55 @@
 
 class eDVBDemux: public iDVBDemux
 {
-       int adapter, demux;
+       DECLARE_REF(eDVBDemux);
+public:
+       enum {
+               evtFlush
+       };
+       eDVBDemux(int adapter, int demux);
+       virtual ~eDVBDemux();
+       
+       RESULT setSourceFrontend(int fenum);
+       int getSource() { return source; }
+       RESULT setSourcePVR(int pvrnum);
+       
+       RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader);
+       RESULT createPESReader(eMainloop *context, ePtr<iDVBPESReader> &reader);
+       RESULT createTSRecorder(ePtr<iDVBTSRecorder> &recorder);
+       RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader, int primary);
+       RESULT getSTC(pts_t &pts, int num);
+       RESULT getCADemuxID(uint8_t &id) { id = demux; return 0; }
+       RESULT flush();
+       RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
+       
+       int getRefCount() { return ref; }
+private:
+       int adapter, demux, source;
        
        int m_dvr_busy;
        friend class eDVBSectionReader;
+       friend class eDVBPESReader;
        friend class eDVBAudio;
        friend class eDVBVideo;
+       friend class eDVBPCR;
+       friend class eDVBTText;
        friend class eDVBTSRecorder;
-public:
-       DECLARE_REF(eDVBDemux);
-       eDVBDemux(int adapter, int demux);
-       virtual ~eDVBDemux();
-       RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader);
-       RESULT createTSRecorder(ePtr<iDVBTSRecorder> &recorder);
-       RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader);
+       friend class eDVBCAService;
+       Signal1<void, int> m_event;
+       
+       int openDemux(void);
 };
 
 class eDVBSectionReader: public iDVBSectionReader, public Object
 {
        DECLARE_REF(eDVBSectionReader);
-private:
        int fd;
        Signal1<void, const __u8*> read;
        ePtr<eDVBDemux> demux;
        int active;
        int checkcrc;
        void data(int);
-       eSocketNotifier *notifier;
+       ePtr<eSocketNotifier> notifier;
 public:
        
        eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
@@ -42,7 +64,24 @@ public:
        RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn);
 };
 
-class eDVBTSRecorderThread;
+class eDVBPESReader: public iDVBPESReader, public Object
+{
+       DECLARE_REF(eDVBPESReader);
+       int m_fd;
+       Signal2<void, const __u8*, int> m_read;
+       ePtr<eDVBDemux> m_demux;
+       int m_active;
+       void data(int);
+       ePtr<eSocketNotifier> m_notifier;
+public:
+       eDVBPESReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
+       virtual ~eDVBPESReader();
+       RESULT start(int pid);
+       RESULT stop();
+       RESULT connectRead(const Slot2<void,const __u8*, int> &read, ePtr<eConnection> &conn);
+};
+
+class eDVBRecordFileThread;
 
 class eDVBTSRecorder: public iDVBTSRecorder, public Object
 {
@@ -55,26 +94,31 @@ public:
        RESULT addPID(int pid);
        RESULT removePID(int pid);
        
-       RESULT setFormat(int pid);
+       RESULT setTimingPID(int pid, int type);
        
        RESULT setTargetFD(int fd);
+       RESULT setTargetFilename(const char *filename);
        RESULT setBoundary(off_t max);
        
        RESULT stop();
-       
+
+       RESULT getCurrentPCR(pts_t &pcr);
+
        RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
 private:
        RESULT startPID(int pid);
        void stopPID(int pid);
        
-       eDVBTSRecorderThread *m_thread;
+       eDVBRecordFileThread *m_thread;
+       void filepushEvent(int event);
        
        std::map<int,int> m_pids;
        Signal1<void,int> m_event;
        
        ePtr<eDVBDemux> m_demux;
        
-       int m_running, m_format, m_target_fd, m_source_fd;
+       int m_running, m_target_fd, m_source_fd;
+       std::string m_target_filename;
 };
 
 #endif