fix srt subtitles
[enigma2.git] / lib / service / servicemp3.cpp
index 3e6de28223bf7a4065f373a3fdccb0296870758e..7d5901e234148cf50e26020480fe5c087ef5b27e 100644 (file)
@@ -101,6 +101,7 @@ public:
        
        RESULT deleteFromDisk(int simulate);
        RESULT getListOfFilenames(std::list<std::string> &);
+       RESULT reindex();
 };
 
 DEFINE_REF(eMP3ServiceOfflineOperations);
@@ -143,6 +144,11 @@ RESULT eMP3ServiceOfflineOperations::getListOfFilenames(std::list<std::string> &
        return 0;
 }
 
+RESULT eMP3ServiceOfflineOperations::reindex()
+{
+       return -1;
+}
+
 
 RESULT eServiceFactoryMP3::offlineOperations(const eServiceReference &ref, ePtr<iServiceOfflineOperations> &ptr)
 {
@@ -491,6 +497,8 @@ RESULT eServiceMP3::seekTo(pts_t to)
        if (!m_gst_playbin)
                return -1;
 
+       eSingleLocker l(m_subs_to_pull_lock); // this is needed to dont handle incomming subtitles during seek!
+
                /* convert pts to nanoseconds */
        gint64 time_nanoseconds = to * 11111LL;
        if (!gst_element_seek (m_gst_playbin, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
@@ -502,7 +510,6 @@ RESULT eServiceMP3::seekTo(pts_t to)
        }
 
        m_subtitle_pages.clear();
-       eSingleLocker l(m_subs_to_pull_lock);
        m_subs_to_pull = 0;
 
        return 0;
@@ -1089,7 +1096,6 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
                        eWarning("Gstreamer error: %s (%i) from %s", err->message, err->code, sourceName );
                        if ( err->domain == GST_STREAM_ERROR )
                        {
-                               eDebug("err->code %d", err->code);
                                if ( err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND )
                                {
                                        if ( g_strrstr(sourceName, "videosink") )
@@ -1158,6 +1164,9 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
 
                        eDebug("eServiceMP3::async-done - %d video, %d audio, %d subtitle", n_video, n_audio, n_text);
 
+                       if ( n_video + n_audio <= 0 )
+                               stop();
+
                        active_idx = 0;
 
                        m_audioStreams.clear();