add ability to select default encoding for dvb texts in many ways.. ( take a look...
[enigma2.git] / lib / dvb / demux.h
1 #ifndef __dvb_demux_h
2 #define __dvb_demux_h
3
4 #include <lib/dvb/idvb.h>
5 #include <lib/dvb/idemux.h>
6
7 class eDVBDemux: public iDVBDemux
8 {
9         DECLARE_REF(eDVBDemux);
10 public:
11         enum {
12                 evtFlush
13         };
14         eDVBDemux(int adapter, int demux);
15         virtual ~eDVBDemux();
16         
17         RESULT setSourceFrontend(int fenum);
18         RESULT setSourcePVR(int pvrnum);
19         
20         RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader);
21         RESULT createTSRecorder(ePtr<iDVBTSRecorder> &recorder);
22         RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader);
23         RESULT getSTC(pts_t &pts);
24         RESULT getCADemuxID(uint8_t &id) { id = demux; return 0; }
25         RESULT flush();
26         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
27 private:
28         int adapter, demux;
29         
30         int m_dvr_busy;
31         friend class eDVBSectionReader;
32         friend class eDVBAudio;
33         friend class eDVBVideo;
34         friend class eDVBPCR;
35         friend class eDVBTSRecorder;
36         friend class eDVBCAService;
37         Signal1<void, int> m_event;
38         
39         int openDemux(void);
40 };
41
42 class eDVBSectionReader: public iDVBSectionReader, public Object
43 {
44         DECLARE_REF(eDVBSectionReader);
45 private:
46         int fd;
47         Signal1<void, const __u8*> read;
48         ePtr<eDVBDemux> demux;
49         int active;
50         int checkcrc;
51         void data(int);
52         eSocketNotifier *notifier;
53 public:
54         
55         eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
56         virtual ~eDVBSectionReader();
57         RESULT start(const eDVBSectionFilterMask &mask);
58         RESULT stop();
59         RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn);
60 };
61
62 class eFilePushThread;
63
64 class eDVBTSRecorder: public iDVBTSRecorder, public Object
65 {
66         DECLARE_REF(eDVBTSRecorder);
67 public:
68         eDVBTSRecorder(eDVBDemux *demux);
69         ~eDVBTSRecorder();
70
71         RESULT start();
72         RESULT addPID(int pid);
73         RESULT removePID(int pid);
74         
75         RESULT setFormat(int pid);
76         
77         RESULT setTargetFD(int fd);
78         RESULT setBoundary(off_t max);
79         
80         RESULT stop();
81         
82         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
83 private:
84         RESULT startPID(int pid);
85         void stopPID(int pid);
86         
87         eFilePushThread *m_thread;
88         
89         std::map<int,int> m_pids;
90         Signal1<void,int> m_event;
91         
92         ePtr<eDVBDemux> m_demux;
93         
94         int m_running, m_format, m_target_fd, m_source_fd;
95 };
96
97 #endif