X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fservice%2Fservicemp3.h;h=01f7cf7f2efd6fa63aa15da1383089ad51f24b97;hp=ae12c33a66aa400ecd0b23cf89c01cdd03691466;hb=675f9d0eeb82577252a68ee263049acc1ff80bcc;hpb=77923ed4e1caecf4cef7d46bd6979ef700fed7e2 diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index ae12c33..01f7cf7 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -8,6 +8,8 @@ #include #include #include +/* for subtitles */ +#include class eStaticServiceMP3Info; @@ -39,6 +41,7 @@ class eStaticServiceMP3Info: public iStaticServiceInformation public: RESULT getName(const eServiceReference &ref, std::string &name); int getLength(const eServiceReference &ref); + int getInfo(const eServiceReference &ref, int w); }; typedef struct _GstElement GstElement; @@ -47,8 +50,9 @@ typedef enum { atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFL typedef enum { stPlainText, stSSA, stSRT } subtype_t; typedef enum { ctNone, ctMPEGTS, ctMPEGPS, ctMKV, ctAVI, ctMP4, ctVCD, ctCDA } containertype_t; -class eServiceMP3: public iPlayableService, public iPauseableService, - public iServiceInformation, public iSeekableService, public iAudioTrackSelection, public iAudioChannelSelection, public iSubtitleOutput, public Object +class eServiceMP3: public iPlayableService, public iPauseableService, + public iServiceInformation, public iSeekableService, public iAudioTrackSelection, public iAudioChannelSelection, + public iSubtitleOutput, public iStreamedService, public iAudioDelay, public Object { DECLARE_REF(eServiceMP3); public: @@ -68,16 +72,17 @@ public: RESULT audioTracks(ePtr &ptr); RESULT audioChannel(ePtr &ptr); RESULT subtitle(ePtr &ptr); + RESULT audioDelay(ePtr &ptr); // not implemented (yet) RESULT frontendInfo(ePtr &ptr) { ptr = 0; return -1; } RESULT subServices(ePtr &ptr) { ptr = 0; return -1; } RESULT timeshift(ePtr &ptr) { ptr = 0; return -1; } RESULT cueSheet(ePtr &ptr) { ptr = 0; return -1; } - RESULT audioDelay(ePtr &ptr) { ptr = 0; return -1; } + RESULT rdsDecoder(ePtr &ptr) { ptr = 0; return -1; } - RESULT stream(ePtr &ptr) { ptr = 0; return -1; } RESULT keys(ePtr &ptr) { ptr = 0; return -1; } + RESULT stream(ePtr &ptr) { ptr = 0; return -1; } // iPausableService RESULT pause(); @@ -97,6 +102,7 @@ public: RESULT getName(std::string &name); int getInfo(int w); std::string getInfoString(int w); + PyObject *getInfoObject(int w); // iAudioTrackSelection int getNumberOfTracks(); @@ -114,11 +120,23 @@ public: PyObject *getSubtitleList(); PyObject *getCachedSubtitle(); + // iStreamedService + RESULT streamed(ePtr &ptr); + PyObject *getBufferCharge(); + int setBufferSize(int size); + + // iAudioDelay + int getAC3Delay(); + int getPCMDelay(); + void setAC3Delay(int); + void setPCMDelay(int); + struct audioStream { GstPad* pad; audiotype_t type; std::string language_code; /* iso-639, if available. */ + std::string codec; /* clear text codec description */ audioStream() :pad(0), type(atUnknown) { @@ -145,7 +163,20 @@ public: { } }; + struct bufferInfo + { + int bufferPercent; + int avgInRate; + int avgOutRate; + long long bufferingLeft; + bufferInfo() + :bufferPercent(0), avgInRate(0), avgOutRate(0), bufferingLeft(-1) + { + } + }; private: + static int pcm_delay; + static int ac3_delay; int m_currentAudioStream; int m_currentSubtitleStream; int selectAudioStream(int i); @@ -153,18 +184,20 @@ private: std::vector m_subtitleStreams; eSubtitleWidget *m_subtitle_widget; int m_currentTrickRatio; - eTimer m_seekTimeout; + ePtr m_seekTimeout; void seekTimeoutCB(); friend class eServiceFactoryMP3; - std::string m_filename; - eServiceMP3(const char *filename); + eServiceReference m_ref; + int m_buffer_size; + bufferInfo m_bufferInfo; + eServiceMP3(eServiceReference ref); Signal2 m_event; enum { stIdle, stRunning, stStopped, }; int m_state; - GstElement *m_gst_pipeline; + GstElement *m_gst_playbin; GstTagList *m_stream_tags; eFixedMessagePump m_pump; std::string m_error_message; @@ -172,14 +205,28 @@ private: audiotype_t gstCheckAudioPad(GstStructure* structure); void gstBusCall(GstBus *bus, GstMessage *msg); static GstBusSyncReply gstBusSyncHandler(GstBus *bus, GstMessage *message, gpointer user_data); - static void gstCBpadAdded(GstElement *decodebin, GstPad *pad, gpointer data); /* for mpegdemux */ - static void gstCBfilterPadAdded(GstElement *filter, GstPad *pad, gpointer user_data); /* for id3demux */ - static void gstCBnewPad(GstElement *decodebin, GstPad *pad, gboolean last, gpointer data); /* for decodebin */ - static void gstCBunknownType(GstElement *decodebin, GstPad *pad, GstCaps *l, gpointer data); - static void gstCBsubtitleAvail(GstElement *element, GstBuffer *buffer, GstPad *pad, gpointer user_data); - static void gstCBsubtitlePadEvent(GstPad *pad, GstEvent *event, gpointer user_data); + static void gstCBsubtitleAvail(GstElement *element, gpointer user_data); GstPad* gstCreateSubtitleSink(eServiceMP3* _this, subtype_t type); void gstPoll(const int&); + static void gstHTTPSourceSetAgent(GObject *source, GParamSpec *unused, gpointer user_data); + + std::list m_subtitle_pages; + ePtr m_subtitle_sync_timer; + + ePtr m_streamingsrc_timeout; + void pushSubtitles(); + void pullSubtitle(); + void sourceTimeout(); + int m_subs_to_pull; + sourceStream m_sourceinfo; + eSingleLock m_subs_to_pull_lock; + gulong m_subs_to_pull_handler_id; + + RESULT seekToImpl(pts_t to); + + gint m_aspect, m_width, m_height, m_framerate, m_progressive; + std::string m_useragent; + RESULT trickSeek(gdouble ratio); }; #endif