+ apid = program.audioStreams[stream].pid;
+ apidtype = program.audioStreams[stream].type;
+ }
+
+ m_current_audio_pid = apid;
+
+ if (m_decoder->setAudioPID(apid, apidtype))
+ {
+ eDebug("set audio pid failed");
+ return -4;
+ }
+
+ /* 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)
+ {
+ ePtr<iDVBDemux> data_demux;
+ if (!h.getDataDemux(data_demux))
+ {
+ m_rds_decoder = new eDVBRdsDecoder(data_demux);
+ m_rds_decoder->connectEvent(slot(*this, &eDVBServicePlay::rdsDecoderEvent), m_rds_decoder_event_connection);
+ }
+ }
+
+ /* 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,
+ b.) we are not playing back something,
+ c.) we are not selecting the default entry. (we wouldn't change
+ anything in the best case, or destroy the default setting in
+ case the real default is not yet available.)
+ */
+ if (m_dvb_service && !m_is_pvr && ((i != -1)
+ || ((m_dvb_service->getCacheEntry(eDVBService::cAPID) == -1) && (m_dvb_service->getCacheEntry(eDVBService::cAC3PID)==-1))))
+ {
+ if (apidtype == eDVBAudio::aMPEG)