make capacity fault-proof
[enigma2.git] / lib / service / servicemp3.h
1 #ifndef __servicemp3_h
2 #define __servicemp3_h
3
4 #include <lib/service/iservice.h>
5
6 class eStaticServiceMP3Info;
7
8 class eServiceFactoryMP3: public iServiceHandler
9 {
10 DECLARE_REF(eServiceFactoryMP3);
11 public:
12         eServiceFactoryMP3();
13         virtual ~eServiceFactoryMP3();
14         enum { id = 0x1001 };
15
16                 // iServiceHandler
17         RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
18         RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
19         RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
20         RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
21 private:
22         ePtr<eStaticServiceMP3Info> m_service_info;
23 };
24
25 class eStaticServiceMP3Info: public iStaticServiceInformation
26 {
27         DECLARE_REF(eStaticServiceMP3Info);
28         friend class eServiceFactoryMP3;
29         eStaticServiceMP3Info();
30 public:
31         RESULT getName(const eServiceReference &ref, std::string &name);
32         int getLength(const eServiceReference &ref);
33 };
34
35 class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object
36 {
37 DECLARE_REF(eServiceMP3);
38 private:
39         friend class eServiceFactoryMP3;
40         std::string filename;
41         eServiceMP3(const char *filename);      
42         eTimer test;
43         void test_end();
44         Signal2<void,iPlayableService*,int> m_event;
45         enum
46         {
47                 stIdle, stRunning, stStopped,
48         };
49         int m_state;
50 public:
51         virtual ~eServiceMP3();
52
53                 // iPlayableService
54         RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
55         RESULT start();
56         RESULT stop();
57         RESULT pause(ePtr<iPauseableService> &ptr);
58         RESULT seek(ePtr<iSeekableService> &ptr);
59
60                 // iPausableService
61         RESULT pause();
62         RESULT unpause();
63         
64         RESULT info(ePtr<iServiceInformation>&);
65         
66                 // iServiceInformation
67         RESULT getName(std::string &name);
68 };
69
70 #endif