always return currently active apid
[enigma2.git] / lib / service / servicedvb.cpp
index 977399697396d438a699ff60c21dadd8b8070142..99474a86e88c99d83bba5aea266e735efa132902 100644 (file)
@@ -312,6 +312,9 @@ eServiceFactoryDVB::eServiceFactoryDVB()
        eServiceCenter::getPrivInstance(sc);
        if (sc)
                sc->addServiceFactory(eServiceFactoryDVB::id, this);
+
+       m_StaticServiceDVBInfo = new eStaticServiceDVBInformation;
+       m_StaticServiceDVBBouquetInfo = new eStaticServiceDVBBouquetInformation;
 }
 
 eServiceFactoryDVB::~eServiceFactoryDVB()
@@ -584,9 +587,9 @@ RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServic
        if ((ref.flags & eServiceReference::flagDirectory) == eServiceReference::flagDirectory) // bouquet
        {
                if ( !ref.name.empty() )  // satellites or providers list
-                       ptr = new eStaticServiceDVBInformation;
+                       ptr = m_StaticServiceDVBInfo;
                else // a dvb bouquet
-                       ptr = new eStaticServiceDVBBouquetInformation;
+                       ptr = m_StaticServiceDVBBouquetInfo;
        }
        else if (!ref.path.empty()) /* do we have a PVR service? */
                ptr = new eStaticServiceDVBPVRInformation(ref);
@@ -594,7 +597,7 @@ RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServic
        {
                ePtr<eDVBService> service;
                if (lookupService(service, ref)) // no eDVBService avail for this reference ( Linkage Services... )
-                       ptr = new eStaticServiceDVBInformation;
+                       ptr = m_StaticServiceDVBInfo;
                else
                        /* eDVBService has the iStaticServiceInformation interface, so we pass it here. */
                        ptr = service;
@@ -1191,7 +1194,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;
@@ -1319,8 +1322,6 @@ int eDVBServicePlay::selectAudioStream(int i)
                }
        }
 
-       m_current_audio_stream = i;
-
        return 0;
 }
 
@@ -1740,16 +1741,6 @@ void eDVBServicePlay::updateDecoder()
                m_teletext_parser = new eDVBTeletextParser(m_decode_demux);
                m_teletext_parser->connectNewPage(slot(*this, &eDVBServicePlay::newSubtitlePage), m_new_subtitle_page_connection);
 #endif
-               if (apid != 1)
-               {
-                       ePtr<iDVBDemux> data_demux;
-                       if ( (m_timeshift_active && !m_service_handler_timeshift.getDataDemux(data_demux))
-                               || (!m_timeshift_active && !m_service_handler.getDataDemux(data_demux)))
-                       {
-                               m_radiotext_parser = new eDVBRadioTextParser(data_demux);
-                               m_radiotext_parser->connectUpdatedRadiotext(slot(*this, &eDVBServicePlay::radioTextUpdated), m_radiotext_updated_connection);
-                       }
-               }
        }
 
        if (m_decoder)
@@ -1789,10 +1780,21 @@ 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))
+               {
                        m_decoder->setSyncPCR(pcrpid);
+                       if (apid != -1)
+                       {
+                               ePtr<iDVBDemux> data_demux;
+                               if (!h.getDataDemux(data_demux))
+                               {
+                                       m_radiotext_parser = new eDVBRadioTextParser(data_demux);
+                                       m_radiotext_parser->connectUpdatedRadiotext(slot(*this, &eDVBServicePlay::radioTextUpdated), m_radiotext_updated_connection);
+                                       m_radiotext_parser->start(apid);
+                               }
+                       }
+               }
                else
                        m_decoder->setSyncPCR(-1);
 
@@ -1801,9 +1803,6 @@ void eDVBServicePlay::updateDecoder()
                if (m_teletext_parser)
                        m_teletext_parser->start(tpid);
 
-               if (m_radiotext_parser)
-                       m_radiotext_parser->start(apid);
-
                if (!m_is_primary)
                        m_decoder->setTrickmode(1);