only write .cuts file when .ts file is still accessible
[enigma2.git] / lib / service / servicedvb.cpp
index f175b07e8cc34051a8e76d66787b5c3dd563acf1..75b55215b9158099309f3785d8ce55c5ae2fa873 100644 (file)
@@ -21,6 +21,7 @@
 #include <lib/gui/esubtitle.h>
 
 #include <sys/vfs.h>
+#include <sys/stat.h>
 
 #include <byteswap.h>
 #include <netinet/in.h>
@@ -826,7 +827,12 @@ RESULT eDVBServicePlay::stop()
        m_service_handler.free();
        
        if (m_is_pvr && m_cuesheet_changed)
-               saveCuesheet();
+       {
+               struct stat s;
+                               /* save cuesheet only when main file is accessible. */
+               if (!::stat(m_reference.path.c_str(), &s))
+                       saveCuesheet();
+       }
        
        return 0;
 }
@@ -1194,7 +1200,7 @@ int eDVBServicePlay::getInfo(int w)
        case sIsCrypted: return program.isCrypted();
        case sVideoPID: if (program.videoStreams.empty()) return -1; return program.videoStreams[0].pid;
        case sVideoType: if (program.videoStreams.empty()) return -1; return program.videoStreams[0].type;
-       case sAudioPID: if (program.audioStreams.empty()) return -1; return program.audioStreams[m_current_audio_stream].pid;
+       case sAudioPID: if (program.audioStreams.empty()) return -1; return program.audioStreams[0].pid;
        case sPCRPID: return program.pcrPid;
        case sPMTPID: return program.pmtPid;
        case sTXTPID: return program.textPid;
@@ -1322,8 +1328,6 @@ int eDVBServicePlay::selectAudioStream(int i)
                }
        }
 
-       m_current_audio_stream = i;
-
        return 0;
 }
 
@@ -1782,7 +1786,6 @@ void eDVBServicePlay::updateDecoder()
                m_decoder->setPCMDelay(pcm_delay == -1 ? 0 : pcm_delay);
 
                m_decoder->setVideoPID(vpid, vpidtype);
-               m_current_audio_stream = 0;
                m_decoder->setAudioPID(apid, apidtype);
                if (!(m_is_pvr || m_timeshift_active || !m_is_primary))
                {