add support for DTV tuning api (not tested yet)
[enigma2.git] / lib / service / servicedvb.cpp
index 497911c5dd03e7fe97842efd7f951dac414f9539..06285190e8ddde9235ebc9eb0cfad402bafac456 100644 (file)
@@ -97,50 +97,9 @@ int eStaticServiceDVBInformation::isPlayable(const eServiceReference &ref, const
 }
 
 extern void PutToDict(ePyObject &dict, const char*key, long value);  // defined in dvb/frontend.cpp
-extern void PutToDict(ePyObject &dict, const char*key, ePyObject item); // defined in dvb/frontend.cpp
-extern void PutToDict(ePyObject &dict, const char*key, const char *value); // defined in dvb/frontend.cpp
-
-void PutSatelliteDataToDict(ePyObject &dict, eDVBFrontendParametersSatellite &feparm)
-{
-       PutToDict(dict, "tuner_type", "DVB-S");
-       PutToDict(dict, "frequency", feparm.frequency);
-       PutToDict(dict, "symbol_rate", feparm.symbol_rate);
-       PutToDict(dict, "orbital_position", feparm.orbital_position);
-       PutToDict(dict, "inversion", feparm.inversion);
-       PutToDict(dict, "fec_inner", feparm.fec);
-       PutToDict(dict, "modulation", feparm.modulation);
-       PutToDict(dict, "polarization", feparm.polarisation);
-       if (feparm.system == eDVBFrontendParametersSatellite::System_DVB_S2)
-       {
-               PutToDict(dict, "rolloff", feparm.rolloff);
-               PutToDict(dict, "pilot", feparm.pilot);
-       }
-       PutToDict(dict, "system", feparm.system);
-}
-
-void PutTerrestrialDataToDict(ePyObject &dict, eDVBFrontendParametersTerrestrial &feparm)
-{
-       PutToDict(dict, "tuner_type", "DVB-T");
-       PutToDict(dict, "frequency", feparm.frequency);
-       PutToDict(dict, "bandwidth", feparm.bandwidth);
-       PutToDict(dict, "code_rate_lp", feparm.code_rate_LP);
-       PutToDict(dict, "code_rate_hp", feparm.code_rate_HP);
-       PutToDict(dict, "constellation", feparm.modulation);
-       PutToDict(dict, "transmission_mode", feparm.transmission_mode);
-       PutToDict(dict, "guard_interval", feparm.guard_interval);
-       PutToDict(dict, "hierarchy_information", feparm.hierarchy);
-       PutToDict(dict, "inversion", feparm.inversion);
-}
-
-void PutCableDataToDict(ePyObject &dict, eDVBFrontendParametersCable &feparm)
-{
-       PutToDict(dict, "tuner_type", "DVB-C");
-       PutToDict(dict, "frequency", feparm.frequency);
-       PutToDict(dict, "symbol_rate", feparm.symbol_rate);
-       PutToDict(dict, "modulation", feparm.modulation);
-       PutToDict(dict, "inversion", feparm.inversion);
-       PutToDict(dict, "fec_inner", feparm.fec_inner);
-}
+extern void PutSatelliteDataToDict(ePyObject &dict, eDVBFrontendParametersSatellite &feparm); // defined in dvb/frontend.cpp
+extern void PutTerrestrialDataToDict(ePyObject &dict, eDVBFrontendParametersTerrestrial &feparm); // defined in dvb/frontend.cpp
+extern void PutCableDataToDict(ePyObject &dict, eDVBFrontendParametersCable &feparm); // defined in dvb/frontend.cpp
 
 PyObject *eStaticServiceDVBInformation::getInfoObject(const eServiceReference &r, int what)
 {
@@ -1795,21 +1754,26 @@ int eDVBServicePlay::selectAudioStream(int i)
                return -4;
        }
 
+       int rdsPid = apid;
+
                /* if we are not in PVR mode, timeshift is not active and we are not in pip mode, check if we need to enable the rds reader */
        if (!(m_is_pvr || m_timeshift_active || !m_is_primary))
-               if (!m_rds_decoder)
+       {
+               int different_pid = program.videoStreams.empty() && program.audioStreams.size() == 1 && program.audioStreams[stream].rdsPid != -1;
+               if (different_pid)
+                       rdsPid = program.audioStreams[stream].rdsPid;
+               if (!m_rds_decoder || m_rds_decoder->getPid() != rdsPid)
                {
+                       m_rds_decoder = 0;
                        ePtr<iDVBDemux> data_demux;
                        if (!h.getDataDemux(data_demux))
                        {
-                               m_rds_decoder = new eDVBRdsDecoder(data_demux);
+                               m_rds_decoder = new eDVBRdsDecoder(data_demux, different_pid);
                                m_rds_decoder->connectEvent(slot(*this, &eDVBServicePlay::rdsDecoderEvent), m_rds_decoder_event_connection);
+                               m_rds_decoder->start(rdsPid);
                        }
                }
-
-               /* if we decided that we need one, update the pid */
-       if (m_rds_decoder)
-               m_rds_decoder->start(apid);
+       }
 
                        /* store new pid as default only when:
                                a.) we have an entry in the service db for the current service,