4.3.1r21
[enigma2.git] / usr / include / enigma2 / lib / hbbtv / hbbtv.h
1 #ifndef __lib_hbbtv_hbbtv_h_
2 #define __lib_hbbtv_hbbtv_h_
3
4 #include "oipfapplication.h"
5
6 #include <lib/base/esignal.h>
7 #include <lib/service/iservice.h>
8 #include <lib/service/event.h>
9
10 #define HBBTV_USER_AGENT "Mozilla/5.0 (Linux mips; U;HbbTV/1.2.1 (+RTSP;Dream Property GmbH;Dreambox;1.5;1.0;) CE-HTML/1.0; en) WebKit QtWebkit OIPF/1.1 "
11
12 extern std::string hbbtvUserAgent;
13
14 class eDVBServiceAITHandler;
15
16 class eHbbtv : public sigc::trackable
17 {
18         E_DECLARE_PRIVATE(eHbbtv)
19         static eHbbtv *instance;
20
21         void aitChanged(int pid);
22         std::vector<std::string> split(const std::string &s, char delim, int limit = 0);
23         void checkApp(const eOipfApplication *app);
24         bool addApplication(const eOipfApplication &app, std::map<std::string, eOipfApplication> *currentServiceApps);
25         bool isStreaming();
26
27 #ifdef SWIG
28         eHbbtv();
29         ~eHbbtv();
30 #endif
31 public:
32 #ifndef SWIG
33         eHbbtv();
34         ~eHbbtv();
35 #endif
36
37         static const int VERSION_MAJOR = 1;
38         static const int VERSION_MINOR = 1;
39         static const int VERSION_MICRO = 1;
40
41         enum EventTypes{
42                 EVENT_NOW = 0,
43                 EVENT_NEXT = 1,
44         };
45
46         enum PlayStates {
47                 BROADCAST_STATE_UNREALIZED = 0,
48                 BROADCAST_STATE_CONNECTING,
49                 BROADCAST_STATE_PRESENTING,
50         };
51
52         enum ChannelErrors{
53                 CHANNEL_ERROR_NOT_SUPPORTED = 0,
54                 CHANNEL_ERROR_TUNE_FAILED,
55                 CHANNEL_ERROR_TUNER_FOREIGN_LOCK,
56                 CHANNEL_ERROR_PARENTAL_LOCK,
57                 CHANNEL_ERROR_CANNOT_DECRYPT,
58                 CHANNEL_ERROR_UNKNOWN,
59                 CHANNEL_ERROR_SWITCH_INTERRUPTED,
60                 CHANNEL_ERROR_LOCKED_BY_RECORD,
61                 CHANNEL_ERROR_RESOLVE_FAILED,
62                 CHANNEL_ERROR_BANDWITH_INSUFFICIENT,
63                 CHANNEL_ERROR_CANNOT_ZAP,
64         };
65
66         enum StreamPlayStates {
67                 STREAM_STATE_STOPPED = 0,
68                 STREAM_STATE_PLAYING,
69                 STREAM_STATE_PAUSED,
70                 STREAM_STATE_CONNECTING,
71                 STREAM_STATE_BUFFERING,
72                 STREAM_STATE_FINISHED,
73                 STREAM_STATE_ERROR,
74         };
75
76         enum StreamErrors {
77                 STREAM_ERROR_NONE = -1,
78                 STREAM_ERROR_UNSUPPORTED = 0,
79                 STREAM_ERROR_CONNECTING,
80                 STREAM_ERROR_UNKNOWN,
81                 STREAM_ERROR_NO_RESOURCES,
82                 STREAM_ERROR_CORRUPT,
83                 STREAM_ERROR_UNAVAILABLE,
84                 STREAM_ERROR_UNAVAILABLE_POS,
85         };
86
87         //python accessible
88         static eHbbtv *getInstance();
89         void setAitSignalsEnabled(bool enabled);
90         void setServiceList(std::string sref);
91         void setStreamState(int state, int error=STREAM_ERROR_UNKNOWN);
92         const eOipfApplication getApplication(const std::string &id);
93         const std::string resolveApplicationLocator(const std::string &dvbUrl);
94         std::list<std::pair<std::string, std::string> > getApplicationIdsAndName();
95         void pageLoadFinished();
96
97 #ifndef SWIG
98         //C++ only
99         const std::string getCurrentServiceTriplet();
100         const eServiceReference &getCurrentService();
101         void setCurrentService(eServiceReference service, ePtr<iPlayableService> &playableService);
102         void playService(const std::string &sref);
103         void playStream(const std::string &uri);
104         void pauseStream();
105         bool seekStream(pts_t to);
106         void stopStream();
107         void nextService();
108         void prevService();
109         void onCurrentServiceStop();
110         void onCurrentServiceEvent(iPlayableService *playableService, int what);
111         ePtr<iPlayableService> getPlayableService();
112         long getPlayTime();
113         long getPlayPosition();
114         void setVolume(int volume);
115         const std::list<eServiceReference> getServiceList();
116         ePtr<eServiceEvent> getEvent(int nownext);
117         void setVideoWindow(unsigned int x, unsigned int y, unsigned int w, unsigned int h);
118         void unsetVideoWindow();
119         void showCurrent();
120         void hideCurrent();
121         void createApplication(const std::string &uri);
122
123         Signal0<void> currentServiceChanged;
124         Signal1<void, int> serviceChangeError;
125         Signal2<void, int, int> streamPlayStateChanged;
126         Signal0<void> serviceListChanged;
127         Signal0<void> loadFinished;
128 #endif
129
130         /* void playServiceRequest(std::string); */
131         eSignal1<void, const char *> playServiceRequest;
132         /* void playStreamRequest(std::string); */
133         eSignal1<void, const char *> playStreamRequest;
134         /* void pauseStreamRequest(); */
135         eSignal0<void> pauseStreamRequest;
136         /* void stopStreamRequest(); */
137         eSignal0<void> stopStreamRequest;
138         /* void nextServiceRequest(); */
139         eSignal0<void> nextServiceRequest;
140         /* void prevServiceRequest(); */
141         eSignal0<void> prevServiceRequest;
142         /* void setVolumeRequest(int); */
143         eSignal1<void, int> setVolumeRequest;
144         /* void setVideoWindowRequest(unsigned int, unsigned int, unsigned int, unsigned int); */
145         eSignal4<void, unsigned int, unsigned int, unsigned int, unsigned int> setVideoWindowRequest;
146         /* void unsetVideoWindowRequest(); */
147         eSignal0<void> unsetVideoWindowRequest;
148         /* void aitInvalidated() */
149         eSignal0<void> aitInvalidated;
150         /* void redButtonAppplicationReady(std::string); */
151         eSignal1<void, const char*> redButtonAppplicationReady;
152         /* void textApplicationReady(std::string); */
153         eSignal1<void, const char*> textApplicationReady;
154         /* void createApplicationRequest(std::string); */
155         eSignal1<void, const char*> createApplicationRequest
156         /* void show() */;
157         eSignal0<void> show;
158         /* void hide() */;
159         eSignal0<void> hide;
160 };
161
162 #endif /* __lib_hbbtv_hbbtv_h_ */