5 #include <lib/base/message.h>
6 #include <lib/service/iservice.h>
7 #include <lib/dvb/pmt.h>
10 class eStaticServiceMP3Info;
12 class eServiceFactoryMP3: public iServiceHandler
14 DECLARE_REF(eServiceFactoryMP3);
17 virtual ~eServiceFactoryMP3();
21 RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
22 RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
23 RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
24 RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
25 RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
27 ePtr<eStaticServiceMP3Info> m_service_info;
30 class eStaticServiceMP3Info: public iStaticServiceInformation
32 DECLARE_REF(eStaticServiceMP3Info);
33 friend class eServiceFactoryMP3;
34 eStaticServiceMP3Info();
36 RESULT getName(const eServiceReference &ref, std::string &name);
37 int getLength(const eServiceReference &ref);
40 typedef struct _GstElement GstElement;
42 class eServiceMP3: public iPlayableService, public iPauseableService,
43 public iServiceInformation, public iSeekableService, public iAudioTrackSelection, public iAudioChannelSelection, public Object
45 DECLARE_REF(eServiceMP3);
47 virtual ~eServiceMP3();
50 RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
53 RESULT setTarget(int target);
55 RESULT pause(ePtr<iPauseableService> &ptr);
56 RESULT setSlowMotion(int ratio);
57 RESULT setFastForward(int ratio);
59 RESULT seek(ePtr<iSeekableService> &ptr);
60 RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
61 RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr);
63 // not implemented (yet)
64 RESULT frontendInfo(ePtr<iFrontendInformation> &ptr) { ptr = 0; return -1; }
65 RESULT subServices(ePtr<iSubserviceList> &ptr) { ptr = 0; return -1; }
66 RESULT timeshift(ePtr<iTimeshiftService> &ptr) { ptr = 0; return -1; }
67 RESULT cueSheet(ePtr<iCueSheet> &ptr) { ptr = 0; return -1; }
68 RESULT subtitle(ePtr<iSubtitleOutput> &ptr) { ptr = 0; return -1; }
69 RESULT audioDelay(ePtr<iAudioDelay> &ptr) { ptr = 0; return -1; }
70 RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr) { ptr = 0; return -1; }
71 RESULT stream(ePtr<iStreamableService> &ptr) { ptr = 0; return -1; }
72 RESULT keys(ePtr<iServiceKeys> &ptr) { ptr = 0; return -1; }
78 RESULT info(ePtr<iServiceInformation>&);
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();
88 // iServiceInformation
89 RESULT getName(std::string &name);
91 std::string getInfoString(int w);
93 // iAudioTrackSelection
94 int getNumberOfTracks();
95 RESULT selectTrack(unsigned int i);
96 RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
97 int getCurrentTrack();
99 // iAudioChannelSelection
100 int getCurrentChannel();
101 RESULT selectChannel(int i);
106 enum { atMP2, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG };
107 int type; // mpeg2, ac3, dts, ...
108 std::string language_code; /* iso-639, if available. */
111 int m_currentAudioStream;
112 int m_currentTrickRate;
113 std::vector<audioStream> m_audioStreams;
114 friend class eServiceFactoryMP3;
115 std::string m_filename;
116 eServiceMP3(const char *filename);
117 Signal2<void,iPlayableService*,int> m_event;
120 stIdle, stRunning, stStopped,
123 GstElement *m_gst_pipeline;
124 GstTagList *m_stream_tags;
125 eFixedMessagePump<int> m_pump;
127 void gstBusCall(GstBus *bus, GstMessage *msg);
128 static GstBusSyncReply gstBusSyncHandler(GstBus *bus, GstMessage *message, gpointer user_data);
129 static void gstCBpadAdded(GstElement *decodebin, GstPad *pad, gpointer data); /* for mpegdemux */
130 static void gstCBfilterPadAdded(GstElement *filter, GstPad *pad, gpointer user_data); /* for id3demux */
131 static void gstCBnewPad(GstElement *decodebin, GstPad *pad, gboolean last, gpointer data); /* for decodebin */
132 static void gstCBunknownType(GstElement *decodebin, GstPad *pad, GstCaps *l, gpointer data);
133 void gstPoll(const int&);