- sdl is now default output
[enigma2.git] / lib / dvb / dvb.h
1 #ifndef __dvb_dvb_h
2 #define __dvb_dvb_h
3
4 #include <lib/dvb/idvb.h>
5 #include <lib/dvb/demux.h>
6 #include <lib/dvb/frontend.h>
7 #include <connection.h>
8
9 class eDVBChannel;
10
11 class eDVBResourceManager: public iDVBResourceManager
12 {
13         DECLARE_REF(eDVBResourceManager);
14         int avail, busy;
15         struct adapter
16         {
17                 eSmartPtrList<eDVBFrontend> fe;
18                 eSmartPtrList<eDVBDemux> demux;
19         };
20         std::multimap<eDVBChannelID,eDVBChannel*> m_active_channels;
21         ePtr<iDVBChannelList> m_list;
22         ePtr<iDVBSatelliteEquipmentControl> m_sec;
23         static eDVBResourceManager *instance;
24 public:
25         eDVBResourceManager();
26         virtual ~eDVBResourceManager();
27         
28         static RESULT getInstance(ePtr<eDVBResourceManager> &ptr) { if (instance) { ptr = instance; return 0; } return -1; }
29         
30         RESULT setChannelList(iDVBChannelList *list);
31         RESULT getChannelList(ePtr<iDVBChannelList> &list);
32         
33         RESULT allocateChannel(const eDVBChannelID &channelid, ePtr<iDVBChannel> &channel);
34         RESULT allocateRawChannel(ePtr<iDVBChannel> &channel);
35         RESULT allocatePVRChannel(int caps);
36         
37         RESULT addChannel(const eDVBChannelID &chid, eDVBChannel *ch);
38         RESULT removeChannel(const eDVBChannelID &chid, eDVBChannel *ch);
39 };
40
41 class eDVBChannel: public iDVBChannel, public eDVBDemux, public Object
42 {
43         DECLARE_REF(eDVBChannel);
44 private:
45         ePtr<eDVBFrontend> m_frontend;
46         ePtr<iDVBFrontendParameters> m_current_frontend_parameters;
47         eDVBChannelID m_channel_id;
48         Signal1<void,iDVBChannel*> m_stateChanged;
49         int m_state;
50         ePtr<eDVBResourceManager> m_mgr;
51         
52         void frontendStateChanged(iDVBFrontend*fe);
53         ePtr<eConnection> m_conn_frontendStateChanged;
54 public:
55         eDVBChannel(eDVBResourceManager *mgr, int adapter, int frontend, int demux);
56         virtual ~eDVBChannel();
57
58                 /* only for managed channels */
59         RESULT setChannel(const eDVBChannelID &id);
60         
61         RESULT connectStateChange(const Slot1<void,iDVBChannel*> &stateChange, ePtr<eConnection> &connection);
62         RESULT getState(int &state);
63
64         RESULT setCIRouting(const eDVBCIRouting &routing);
65         RESULT getDemux(ePtr<iDVBDemux> &demux);
66         RESULT getFrontend(ePtr<iDVBFrontend> &frontend);
67 };
68
69 #endif