fix for canAllocateChannel
[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         RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
22 private:
23         ePtr<eStaticServiceMP3Info> m_service_info;
24 };
25
26 class eStaticServiceMP3Info: public iStaticServiceInformation
27 {
28         DECLARE_REF(eStaticServiceMP3Info);
29         friend class eServiceFactoryMP3;
30         eStaticServiceMP3Info();
31 public:
32         RESULT getName(const eServiceReference &ref, std::string &name);
33         int getLength(const eServiceReference &ref);
34 };
35
36 class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object
37 {
38 DECLARE_REF(eServiceMP3);
39 private:
40         friend class eServiceFactoryMP3;
41         std::string filename;
42         eServiceMP3(const char *filename);      
43         eTimer test;
44         void test_end();
45         Signal2<void,iPlayableService*,int> m_event;
46         enum
47         {
48                 stIdle, stRunning, stStopped,
49         };
50         int m_state;
51 public:
52         virtual ~eServiceMP3();
53
54                 // iPlayableService
55         RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
56         RESULT start();
57         RESULT stop();
58         RESULT pause(ePtr<iPauseableService> &ptr);
59         RESULT setSlowMotion(int ratio);
60         RESULT setFastForward(int ratio);
61
62                 // not implemented (yet)
63         RESULT seek(ePtr<iSeekableService> &ptr) { ptr = 0; return -1; }
64         RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr) { ptr = 0; return -1; }
65         RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr) { ptr = 0; return -1; }
66         RESULT subServices(ePtr<iSubserviceList> &ptr) { ptr = 0; return -1; }
67         RESULT timeshift(ePtr<iTimeshiftService> &ptr) { ptr = 0; return -1; }
68         
69                 // iPausableService
70         RESULT pause();
71         RESULT unpause();
72         
73         RESULT info(ePtr<iServiceInformation>&);
74         
75                 // iServiceInformation
76         RESULT getName(std::string &name);
77 };
78
79 #endif