servicedvb: simplify audio cache selection in selectAudioStream
authorAthanasios Oikonomou <athoik@gmail.com>
Sun, 19 Oct 2014 15:32:47 +0000 (18:32 +0300)
committerlittlesat <littlesat99@yahoo.com>
Sun, 26 Oct 2014 11:51:16 +0000 (12:51 +0100)
Signed-off-by: littlesat <littlesat99@yahoo.com>

lib/service/servicedvb.cpp

index c4be05c..43582b0 100644 (file)
@@ -2203,41 +2203,10 @@ int eDVBServicePlay::selectAudioStream(int i)
                && (m_dvb_service->getCacheEntry(eDVBService::cDDPPID)== -1)
                && (m_dvb_service->getCacheEntry(eDVBService::cAACHEAPID) == -1))))
        {
-               if (apidtype == eDVBAudio::aMPEG)
-               {
-                       m_dvb_service->setCacheEntry(eDVBService::cMPEGAPID, apid);
-                       m_dvb_service->setCacheEntry(eDVBService::cAC3PID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cDDPPID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cAACHEAPID, -1);
-               }
-               else if (apidtype == eDVBAudio::aAC3)
-               {
-                       m_dvb_service->setCacheEntry(eDVBService::cMPEGAPID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cAC3PID, apid);
-                       m_dvb_service->setCacheEntry(eDVBService::cDDPPID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cAACHEAPID, -1);
-               }
-               else if (apidtype == eDVBAudio::aDDP)
-               {
-                       m_dvb_service->setCacheEntry(eDVBService::cMPEGAPID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cAC3PID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cDDPPID, apid);
-                       m_dvb_service->setCacheEntry(eDVBService::cAACHEAPID, -1);
-               }
-               else if (apidtype == eDVBAudio::aAACHE)
-               {
-                       m_dvb_service->setCacheEntry(eDVBService::cMPEGAPID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cAC3PID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cDDPPID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cAACHEAPID, apid);
-               }
-               else
-               {
-                       m_dvb_service->setCacheEntry(eDVBService::cMPEGAPID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cAC3PID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cDDPPID, -1);
-                       m_dvb_service->setCacheEntry(eDVBService::cAACHEAPID, -1);
-               }
+               m_dvb_service->setCacheEntry(eDVBService::cMPEGAPID, apidtype == eDVBAudio::aMPEG ? apid : -1);
+               m_dvb_service->setCacheEntry(eDVBService::cAC3PID, apidtype == eDVBAudio::aAC3 ? apid : -1);
+               m_dvb_service->setCacheEntry(eDVBService::cDDPPID, apidtype == eDVBAudio::aDDP ? apid : -1);
+               m_dvb_service->setCacheEntry(eDVBService::cAACHEAPID, apidtype == eDVBAudio::aAACHE ? apid : -1);
        }
 
        h.resetCachedProgram();