compile fixes for gcc-4.3, allow compilation with old gst
[enigma2.git] / lib / service / servicemp3.cpp
index 2fe9d9976e0f6e8d2ee89c975a5c6befbd46752e..5866d0698729c649a0dfe30d142d2373eef86ce4 100644 (file)
 /* for subtitles */
 #include <lib/gui/esubtitle.h>
 
+#ifndef GST_SEEK_FLAG_SKIP
+#warning Compiling for legacy gstreamer, things will break
+#define GST_SEEK_FLAG_SKIP 0
+#define GST_TAG_HOMEPAGE ""
+#endif
+
 // eServiceFactoryMP3
 
 eServiceFactoryMP3::eServiceFactoryMP3()
@@ -477,6 +483,8 @@ RESULT eServiceMP3::getLength(pts_t &pts)
 
 RESULT eServiceMP3::seekTo(pts_t to)
 {
+       m_subtitle_pages.clear();
+
        if (!m_gst_playbin)
                return -1;
 
@@ -601,7 +609,7 @@ RESULT eServiceMP3::getName(std::string &name)
 
 int eServiceMP3::getInfo(int w)
 {
-       gchar *tag = 0;
+       const gchar *tag = 0;
 
        switch (w)
        {
@@ -702,7 +710,7 @@ std::string eServiceMP3::getInfoString(int w)
 {
        if ( !m_stream_tags )
                return "";
-       gchar *tag = 0;
+       const gchar *tag = 0;
        switch (w)
        {
        case sTagTitle:
@@ -818,7 +826,7 @@ std::string eServiceMP3::getInfoString(int w)
 
 PyObject *eServiceMP3::getInfoObject(int w)
 {
-       gchar *tag = 0;
+       const gchar *tag = 0;
        bool isBuffer = false;
        switch (w)
        {
@@ -1278,7 +1286,7 @@ void eServiceMP3::pushSubtitles()
        GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin),"subtitle_sink");
        GstClock *clock;
        clock = gst_element_get_clock (appsink);
-       do
+       while ( !m_subtitle_pages.empty() )
        {
                page = m_subtitle_pages.front();
 
@@ -1297,7 +1305,7 @@ void eServiceMP3::pushSubtitles()
                        m_subtitle_widget->setPage(page);
                        m_subtitle_pages.pop_front();
                }
-       } while ( !m_subtitle_pages.empty() );
+       } ;
 
        gst_object_unref (clock);
 }
@@ -1331,6 +1339,7 @@ RESULT eServiceMP3::enableSubtitles(eWidget *parent, ePyObject tuple)
        g_object_get (G_OBJECT (m_gst_playbin), "current-text", &text_pid, NULL);
 
        eDebug ("eServiceMP3::switched to subtitle stream %i", text_pid);
+       m_subtitle_pages.clear();
 
        return 0;
 
@@ -1343,6 +1352,7 @@ error_out:
 RESULT eServiceMP3::disableSubtitles(eWidget *parent)
 {
        eDebug("eServiceMP3::disableSubtitles");
+       m_subtitle_pages.clear();
        delete m_subtitle_widget;
        m_subtitle_widget = 0;
        return 0;