7ef84025d9ac028d081f33a17f5a6178fcc0dbf1
[enigma2.git] / lib / service / servicemp3.h
1 #ifndef __servicemp3_h
2 #define __servicemp3_h
3
4 #include <lib/service/iservice.h>
5
6 class eServiceMP3Info ;
7
8 class eServiceFactoryMP3: public iServiceHandler
9 {
10 DECLARE_REF;
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<iServiceInformation> &ptr);
21 private:
22         ePtr<eServiceMP3Info> m_service_info;
23 };
24
25 class eServiceMP3Info: public iServiceInformation
26 {
27         DECLARE_REF;
28         friend class eServiceFactoryMP3;
29         eServiceMP3Info();
30 public:
31         RESULT getName(const eServiceReference &ref, std::string &name);
32 };
33
34 class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object
35 {
36 DECLARE_REF;
37 private:
38         friend class eServiceFactoryMP3;
39         std::string filename;
40         eServiceMP3(const char *filename);      
41         eTimer test;
42         void test_end();
43         Signal2<void,iPlayableService*,int> m_event;
44         enum
45         {
46                 stIdle, stRunning, stStopped,
47         };
48         int m_state;
49 public:
50         virtual ~eServiceMP3();
51
52                 // iPlayableService
53         RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
54         RESULT start();
55         RESULT stop();
56         RESULT getIPausableService(ePtr<iPauseableService> &ptr);
57
58                 // iPausableService
59         RESULT pause();
60         RESULT unpause();
61         
62         RESULT getIServiceInformation(ePtr<iServiceInformation>&);
63         
64                 // iServiceInformation
65         RESULT getName(const eServiceReference &ref, std::string &name);
66 };
67
68 #endif