aacd9d81605ffe3f38e0bfe8ccfd83f3906ce080
[vuplus_dvbapp] / lib / dvb / fcc.h
1 #ifndef __dvb_fcc_h
2 #define __dvb_fcc_h
3
4 #include <lib/dvb/idvb.h>
5 #include <lib/base/object.h>
6 #include <lib/service/iservice.h>
7 #include <connection.h>
8
9 class eNavigation;
10
11 class FCCServiceChannels
12 {
13 private:
14         std::map<eDVBChannelID, int> m_fcc_chids;
15
16 public:
17         void addFCCService(const eServiceReference &service);
18         void removeFCCService(const eServiceReference &service);
19         int getFCCChannelID(std::map<eDVBChannelID, int> &fcc_chids);
20 };
21
22 typedef struct _tagFccElem
23 {
24         eServiceReference m_service_reference;
25         ePtr<eConnection> m_service_event_conn;
26         int m_state;
27 }FCCServiceElem;
28
29 class eFCCServiceManager: public iObject, public Object
30 {
31         DECLARE_REF(eFCCServiceManager);
32 private:
33         eNavigation *m_core;
34         static eFCCServiceManager* m_instance;
35         std::map<ePtr<iPlayableService>, FCCServiceElem, std::less<iPlayableService*> > m_FCCServices;
36         FCCServiceChannels m_fccServiceChannels;
37
38         bool m_fcc_enable;
39
40         void FCCEvent(iPlayableService* service, int event);
41 public:
42         PSignal1<void, int> m_fcc_event;
43         static eFCCServiceManager* getInstance();
44         eFCCServiceManager(eNavigation *navptr);
45         ~eFCCServiceManager();
46
47         enum
48         {
49                 fcc_state_preparing,
50                 fcc_state_decoding,
51                 fcc_state_failed
52         };
53         SWIG_VOID(RESULT)  playFCCService(const eServiceReference &ref, ePtr<iPlayableService> &SWIG_OUTPUT);
54         RESULT stopFCCService(const eServiceReference &sref);
55         RESULT stopFCCService();
56         RESULT cleanupFCCService();
57         RESULT tryFCCService(const eServiceReference &service, ePtr<iPlayableService> &ptr);
58         int isLocked(ePtr<iPlayableService> service);
59         PyObject *getFCCServiceList();
60         void printFCCServices();
61         static int getFCCChannelID(std::map<eDVBChannelID, int> &fcc_chids);
62         static bool checkAvailable(const eServiceReference &ref);
63         void setFCCEnable(int enable) { m_fcc_enable = (enable != 0); }
64         bool isEnable() { return m_fcc_enable; }
65 };
66
67 #endif /* __dvb_fcc_h */