Merge pull request #112 from mx3L/topic_servicemp3_user_agent
[openblackhole/openblackhole-enigma2.git] / lib / service / servicemp3.cpp
index ff19cf1..5000224 100644 (file)
@@ -416,6 +416,7 @@ eServiceMP3::eServiceMP3(eServiceReference ref):
        m_paused = false;
        m_seek_paused = false;
        m_cuesheet_loaded = false; /* cuesheet CVR */
+       m_user_paused = false;
 #if GST_VERSION_MAJOR >= 1
        m_use_chapter_entries = false; /* TOC chapter support CVR */
        m_last_seek_pos = 0; /* CVR last seek position */
@@ -755,7 +756,7 @@ RESULT eServiceMP3::start()
        {
                eDebug("[eServiceMP3] starting pipeline");
                GstStateChangeReturn ret;
-               ret = gst_element_set_state (m_gst_playbin, GST_STATE_PLAYING);
+               ret = gst_element_set_state (m_gst_playbin, GST_STATE_PAUSED);
 
                switch(ret)
                {
@@ -1752,6 +1753,7 @@ void eServiceMP3::gstBusCall(GstMessage *msg)
                                {
                                        if ( m_sourceinfo.is_streaming && m_streamingsrc_timeout )
                                                m_streamingsrc_timeout->stop();
+                                       m_user_paused = false;
                                        m_paused = false;
                                        if (m_seek_paused)
                                        {
@@ -1763,6 +1765,7 @@ void eServiceMP3::gstBusCall(GstMessage *msg)
                                }       break;
                                case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
                                {
+                                       m_user_paused = true;
                                        m_paused = true;
                                }       break;
                                case GST_STATE_CHANGE_PAUSED_TO_READY:
@@ -2035,6 +2038,8 @@ void eServiceMP3::gstBusCall(GstMessage *msg)
                                if (m_errorInfo.missing_codec.find("video/") == 0 || (m_errorInfo.missing_codec.find("audio/") == 0 && m_audioStreams.empty()))
                                        m_event((iPlayableService*)this, evUser+12);
                        }
+                       if(!m_user_paused)
+                               gst_element_set_state (m_gst_playbin, GST_STATE_PLAYING);
                        break;
                }
                case GST_MESSAGE_ELEMENT: