X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/e88b753942b68d5c4abca45abb36bb5563588157..09047544dbeddd0a5df972934c8863bef9e11a99:/lib/service/servicedvb.cpp diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 790ca2f7..6b6e2e68 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -6,7 +6,6 @@ #include #include #include -#include // access to python config #include #include #include @@ -17,6 +16,7 @@ #include #include #include +#include // access to python config /* for subtitles */ #include @@ -1694,6 +1694,8 @@ RESULT eDVBServicePlay::getTrackInfo(struct iAudioTrackInfo &info, unsigned int if (i >= program.audioStreams.size()) return -2; + info.m_pid = program.audioStreams[i].pid; + if (program.audioStreams[i].type == eDVBServicePMTHandler::audioStream::atMPEG) info.m_description = "MPEG"; else if (program.audioStreams[i].type == eDVBServicePMTHandler::audioStream::atAC3) @@ -1730,7 +1732,7 @@ int eDVBServicePlay::selectAudioStream(int i) if (h.getProgramInfo(program)) return -1; - if ((unsigned int)i >= program.audioStreams.size()) + if ((i != -1) && ((unsigned int)i >= program.audioStreams.size())) return -2; if (!m_decoder) @@ -1740,16 +1742,37 @@ int eDVBServicePlay::selectAudioStream(int i) if (stream == -1) stream = program.defaultAudioStream; - m_current_audio_pid = program.audioStreams[stream].pid; + int apid = -1, apidtype = -1; - if (m_decoder->setAudioPID(program.audioStreams[stream].pid, program.audioStreams[stream].type)) + if (((unsigned int)stream) < program.audioStreams.size()) + { + 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 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(program.audioStreams[stream].pid); + 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, @@ -1760,15 +1783,15 @@ int eDVBServicePlay::selectAudioStream(int i) */ if (m_dvb_service && !m_is_pvr && (i != -1)) { - if (program.audioStreams[stream].type == eDVBAudio::aMPEG) + if (apidtype == eDVBAudio::aMPEG) { - m_dvb_service->setCacheEntry(eDVBService::cAPID, program.audioStreams[stream].pid); + m_dvb_service->setCacheEntry(eDVBService::cAPID, apid); m_dvb_service->setCacheEntry(eDVBService::cAC3PID, -1); } else { m_dvb_service->setCacheEntry(eDVBService::cAPID, -1); - m_dvb_service->setCacheEntry(eDVBService::cAC3PID, program.audioStreams[stream].pid); + m_dvb_service->setCacheEntry(eDVBService::cAC3PID, apid); } } @@ -2248,16 +2271,10 @@ void eDVBServicePlay::switchToTimeshift() void eDVBServicePlay::updateDecoder() { - int vpid = -1, vpidtype = -1, apid = -1, apidtype = -1, pcrpid = -1, tpid = -1, achannel = -1, ac3_delay=-1, pcm_delay=-1; + int vpid = -1, vpidtype = -1, pcrpid = -1, tpid = -1, achannel = -1, ac3_delay=-1, pcm_delay=-1; eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler; - bool defaultac3=false; - std::string default_ac3; - - if (!ePythonConfigQuery::getConfigValue("config.av.defaultac3", default_ac3)) - defaultac3 = default_ac3 == "True"; - eDVBServicePMTHandler::program program; if (h.getProgramInfo(program)) eDebug("getting program info failed."); @@ -2290,14 +2307,6 @@ void eDVBServicePlay::updateDecoder() i(program.audioStreams.begin()); i != program.audioStreams.end(); ++i) { - if (apid == -1 || (apidtype == eDVBAudio::aMPEG && defaultac3)) - { - if ( apid == -1 || (i->type != eDVBAudio::aMPEG) ) - { - apid = i->pid; - apidtype = i->type; - } - } if (i != program.audioStreams.begin()) eDebugNoNewLine(", "); eDebugNoNewLine("%04x", i->pid); @@ -2372,19 +2381,7 @@ void eDVBServicePlay::updateDecoder() selectAudioStream(); if (!(m_is_pvr || m_timeshift_active || !m_is_primary)) - { m_decoder->setSyncPCR(pcrpid); - if (apid != -1) - { - ePtr 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); - m_rds_decoder->start(apid); - } - } - } else m_decoder->setSyncPCR(-1); @@ -2411,23 +2408,10 @@ void eDVBServicePlay::updateDecoder() m_decoder->setAudioChannel(achannel); -// how we can do this better? -// update cache pid when the user changed the audio track or video track -// TODO handling of difference audio types.. default audio types.. - /* don't worry about non-existing services, nor pvr services */ if (m_dvb_service && !m_is_pvr) { - if (apidtype == eDVBAudio::aMPEG) - { - m_dvb_service->setCacheEntry(eDVBService::cAPID, apid); - m_dvb_service->setCacheEntry(eDVBService::cAC3PID, -1); - } - else - { - m_dvb_service->setCacheEntry(eDVBService::cAPID, -1); - m_dvb_service->setCacheEntry(eDVBService::cAC3PID, apid); - } + /* (audio pid will be set in selectAudioTrack */ m_dvb_service->setCacheEntry(eDVBService::cVPID, vpid); m_dvb_service->setCacheEntry(eDVBService::cVTYPE, vpidtype == eDVBVideo::MPEG2 ? -1 : vpidtype); m_dvb_service->setCacheEntry(eDVBService::cPCRPID, pcrpid); @@ -2826,26 +2810,26 @@ void eDVBServicePlay::checkSubtitleTiming() int diff = show_time - pos; if (diff < 0) { - eDebug("[late (%d ms)]", -diff / 90); - diff = 0; - } - if (diff > 900000) - { - eDebug("[invalid]"); +// eDebug("[late (%d ms)]", -diff / 90); diff = 0; } +// if (diff > 900000) +// { +// eDebug("[invalid]"); +// diff = 0; +// } if (!diff) { if (type == TELETEXT) { - eDebug("display teletext subtitle page"); +// eDebug("display teletext subtitle page"); m_subtitle_widget->setPage(page); m_subtitle_pages.pop_front(); } else { - eDebug("display dvb subtitle Page"); +// eDebug("display dvb subtitle Page %lld", show_time); m_subtitle_widget->setPage(dvb_page); m_dvb_subtitle_pages.pop_front(); }