trunk 20080912
[gitenigma.git] / include / lib / dvb / serviceexternal.h
blob2cc7027bf19b70269ba5410a0a63ee30dbe6437d
1 #ifndef DISABLE_FILE
3 #ifndef __lib_dvb_serviceexternal_h
4 #define __lib_dvb_serviceexternal_h
6 #include <lib/dvb/service.h>
7 #include <lib/base/thread.h>
8 #include <lib/base/message.h>
10 class eServiceHandlerExternal: public eServiceHandler
12 static eServiceHandlerExternal *instance;
14 struct FileExtensionScriptInfo
16 int needfb;
17 int needrc;
18 int needlcd;
19 eString pattern;
20 eString command;
23 std::vector<FileExtensionScriptInfo> extensionFileList, extensionDirectoryList;
25 void addFile(void *node, const eString &filename);
26 void addDirectory(void *node, const eString &filename);
28 public:
29 eServiceHandlerExternal();
30 ~eServiceHandlerExternal();
32 int play(const eServiceReference &service, int workaround = 0);
33 int stop(int workaround = 0);
35 eService *addRef(const eServiceReference &service);
36 void removeRef(const eServiceReference &service);
38 void addFileHandler(const eString &pattern, const eString &command, int needfb, int needrc, int needlcd);
39 void addDirectoryHandler(const eString &pattern, const eString &command, int needfb, int needrc, int needlcd);
41 static eServiceHandlerExternal *getInstance() { return instance; }
44 class ePlayerThread: public eThread, public Object
46 eFixedMessagePump<int> message;
47 bool needfb, needrc, needlcd;
48 eString command;
49 void thread();
50 void thread_finished();
51 void finalize_player();
52 void recv_msg(const int &);
53 public:
54 ePlayerThread(eString command, int needfb, int needrc, int needlcd)
55 :message(eApp, 1), command(command), needfb(needfb), needrc(needrc), needlcd(needlcd)
57 CONNECT(message.recv_msg, ePlayerThread::recv_msg);
59 ~ePlayerThread()
62 void start();
65 #endif
67 #endif //DISABLE_FILE