Merge branch 'bug_293_indicate_unhandled_key' into experimental
[enigma2.git] / lib / dvb / pmt.cpp
index fb81fa4c3f45559892bb1b68d750a10b62d564f9..ee89a3a43a93a55133f838c2d1aa34e27fdc2798 100644 (file)
@@ -75,6 +75,9 @@ void eDVBServicePMTHandler::channelEvent(iDVBChannel *channel, int event)
 {
        switch (event)
        {
+       case iDVBChannel::evtPreStart:
+               serviceEvent(eventPreStart);
+               break;
        case iDVBChannel::evtEOF:
                serviceEvent(eventEOF);
                break;
@@ -184,6 +187,7 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
 
        int first_ac3 = -1;
        program.defaultAudioStream = 0;
+       audioStream *prev_audio = 0;
 
        if ( m_service && !m_service->cacheEmpty() )
        {
@@ -215,13 +219,15 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
                                for (es = pmt.getEsInfo()->begin(); es != pmt.getEsInfo()->end(); ++es)
                                {
                                        int isaudio = 0, isvideo = 0, issubtitle = 0, forced_video = 0, forced_audio = 0, isteletext = 0;
+                                       int streamtype = (*es)->getType();
                                        videoStream video;
                                        audioStream audio;
                                        audio.component_tag=video.component_tag=-1;
                                        video.type = videoStream::vtMPEG2;
                                        audio.type = audioStream::atMPEG;
+                                       audio.rdsPid = -1;
 
-                                       switch ((*es)->getType())
+                                       switch (streamtype)
                                        {
                                        case 0x1b: // AVC Video Stream (MPEG4 H264)
                                                video.type = videoStream::vtMPEG4_H264;
@@ -285,11 +291,14 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
                                                }
                                        case 0x06: // PES Private
                                        case 0xEA: // TS_PSI_ST_SMPTE_VC1
+                                       {
+                                               int num_descriptors = 0;
                                                for (DescriptorConstIterator desc = (*es)->getDescriptors()->begin();
                                                        desc != (*es)->getDescriptors()->end(); ++desc)
                                                {
                                                        uint8_t tag = (*desc)->getTag();
                                                        /* check descriptors to get the exakt stream type. */
+                                                       ++num_descriptors;
                                                        if (!forced_video && !forced_audio)
                                                        {
                                                                switch (tag)
@@ -458,6 +467,13 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
                                                                break;
                                                        }
                                                }
+                                               if (!num_descriptors && streamtype == 0x06 && prev_audio)
+                                               {
+                                                       prev_audio->rdsPid = (*es)->getPid();
+                                                       eDebug("Rds PID %04x detected ? ! ?", prev_audio->rdsPid);
+                                               }
+                                               prev_audio = 0;
+                                       }
                                        default:
                                                break;
                                        }
@@ -496,6 +512,7 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
                                                        first_ac3 = program.audioStreams.size();
 
                                                program.audioStreams.push_back(audio);
+                                               prev_audio = &program.audioStreams.back();
                                        }
                                        else
                                                continue;
@@ -548,6 +565,7 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
                        audioStream s;
                        s.type = audioStream::atAC3;
                        s.pid = cached_apid_ac3;
+                       s.rdsPid = -1;
                        program.audioStreams.push_back(s);
                        ++cnt;
                }
@@ -556,6 +574,7 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
                        audioStream s;
                        s.type = audioStream::atMPEG;
                        s.pid = cached_apid_mpeg;
+                       s.rdsPid = -1;
                        program.audioStreams.push_back(s);
                        ++cnt;
                }
@@ -681,10 +700,7 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
                        eDVBCIInterfaces::getInstance()->addPMTHandler(this);
        } else if (!simulate) // no simulation of playback services
        {
-               eDVBMetaParser parser;
-
-               int ret=parser.parseFile(ref.path);
-               if (ret || !parser.m_ref.getServiceID().get() /* incorrect sid in meta file or recordings.epl*/ )
+               if (!ref.getServiceID().get() /* incorrect sid in meta file or recordings.epl*/ )
                {
                        eWarning("no .meta file found, trying to find PMT pid");
                        eDVBTSTools tstools;
@@ -700,9 +716,7 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
                                        m_pmt_pid = pmt_pid;
                                }
                        }
-               } else
-                       m_reference = parser.m_ref;
-               
+               }
                eDebug("alloc PVR");
                        /* allocate PVR */
                res = m_resourceManager->allocatePVRChannel(m_pvr_channel);