initialize self.list
[enigma2.git] / lib / service / servicexine.h
1 #ifndef __servicemp3_h
2 #define __servicemp3_h
3
4 #define HAVE_XINE
5 #ifdef HAVE_XINE
6 #include <lib/base/message.h>
7 #include <lib/service/iservice.h>
8
9 #include <xine.h>
10 #include <xine/xineutils.h>
11
12 class eStaticServiceXineInfo;
13
14 class eServiceFactoryXine: public iServiceHandler
15 {
16 DECLARE_REF(eServiceFactoryXine);
17 public:
18         eServiceFactoryXine();
19         virtual ~eServiceFactoryXine();
20         enum { id = 0x1010 };
21
22                 // iServiceHandler
23         RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
24         RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
25         RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
26         RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
27         RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
28 private:
29         ePtr<eStaticServiceXineInfo> m_service_info;
30 };
31
32 class eStaticServiceXineInfo: public iStaticServiceInformation
33 {
34         DECLARE_REF(eStaticServiceXineInfo);
35         friend class eServiceFactoryXine;
36         eStaticServiceXineInfo();
37 public:
38         RESULT getName(const eServiceReference &ref, std::string &name);
39         int getLength(const eServiceReference &ref);
40 };
41
42 typedef struct _GstElement GstElement;
43
44 class eServiceXine: public iPlayableService, public iPauseableService, 
45         public iServiceInformation, public iSeekableService, public Object
46 {
47 DECLARE_REF(eServiceXine);
48 public:
49         virtual ~eServiceXine();
50
51                 // iPlayableService
52         RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
53         RESULT start();
54         RESULT stop();
55         RESULT setTarget(int target);
56         
57         RESULT pause(ePtr<iPauseableService> &ptr);
58         RESULT setSlowMotion(int ratio);
59         RESULT setFastForward(int ratio);
60
61         RESULT seek(ePtr<iSeekableService> &ptr);
62
63                 // not implemented (yet)
64         RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr) { ptr = 0; return -1; }
65         RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr) { ptr = 0; return -1; }
66         RESULT frontendInfo(ePtr<iFrontendInformation> &ptr) { ptr = 0; return -1; }
67         RESULT subServices(ePtr<iSubserviceList> &ptr) { ptr = 0; return -1; }
68         RESULT timeshift(ePtr<iTimeshiftService> &ptr) { ptr = 0; return -1; }
69         RESULT cueSheet(ePtr<iCueSheet> &ptr) { ptr = 0; return -1; }
70         RESULT subtitle(ePtr<iSubtitleOutput> &ptr) { ptr = 0; return -1; }
71         RESULT audioDelay(ePtr<iAudioDelay> &ptr) { ptr = 0; return -1; }
72         RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr) { ptr = 0; return -1; }
73
74                 // iPausableService
75         RESULT pause();
76         RESULT unpause();
77         
78         RESULT info(ePtr<iServiceInformation>&);
79         
80                 // iSeekableService
81         RESULT getLength(pts_t &SWIG_OUTPUT);
82         RESULT seekTo(pts_t to);
83         RESULT seekRelative(int direction, pts_t to);
84         RESULT getPlayPosition(pts_t &SWIG_OUTPUT);
85         RESULT setTrickmode(int trick);
86         RESULT isCurrentlySeekable();
87         
88                 // iServiceInformation
89         RESULT getName(std::string &name);
90         int getInfo(int w);
91         std::string getInfoString(int w);
92 private:
93         friend class eServiceFactoryXine;
94         std::string m_filename;
95         eServiceXine(const char *filename);     
96         Signal2<void,iPlayableService*,int> m_event;
97
98         xine_stream_t *stream;
99         xine_video_port_t *vo_port;
100         xine_audio_port_t *ao_port;
101         xine_event_queue_t *event_queue;
102
103         enum
104         {
105                 stError, stIdle, stRunning, stStopped,
106         };
107         int m_state;
108         
109         static void eventListenerWrap(void *user_data, const xine_event_t *event);
110         void eventListener(const xine_event_t *event);
111         
112
113         eFixedMessagePump<int> m_pump;
114 };
115 #endif
116
117 #endif